mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-11 07:55:34 +03:00
chore: add .prettierrc
in repo root (#2145)
This commit is contained in:
parent
e0a8e09cab
commit
66916b739f
@ -217,41 +217,29 @@
|
|||||||
"tauri-runtime": {
|
"tauri-runtime": {
|
||||||
"path": "./core/tauri-runtime",
|
"path": "./core/tauri-runtime",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": [
|
"dependencies": ["tauri-utils"],
|
||||||
"tauri-utils"
|
|
||||||
],
|
|
||||||
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||||
},
|
},
|
||||||
"tauri-runtime-wry": {
|
"tauri-runtime-wry": {
|
||||||
"path": "./core/tauri-runtime-wry",
|
"path": "./core/tauri-runtime-wry",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": [
|
"dependencies": ["tauri-utils", "tauri-runtime"],
|
||||||
"tauri-utils",
|
|
||||||
"tauri-runtime"
|
|
||||||
],
|
|
||||||
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||||
},
|
},
|
||||||
"tauri-codegen": {
|
"tauri-codegen": {
|
||||||
"path": "./core/tauri-codegen",
|
"path": "./core/tauri-codegen",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": [
|
"dependencies": ["tauri-utils"]
|
||||||
"tauri-utils"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"tauri-macros": {
|
"tauri-macros": {
|
||||||
"path": "./core/tauri-macros",
|
"path": "./core/tauri-macros",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": [
|
"dependencies": ["tauri-codegen"]
|
||||||
"tauri-codegen"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"tauri-build": {
|
"tauri-build": {
|
||||||
"path": "./core/tauri-build",
|
"path": "./core/tauri-build",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": [
|
"dependencies": ["tauri-codegen", "tauri-utils"],
|
||||||
"tauri-codegen",
|
|
||||||
"tauri-utils"
|
|
||||||
],
|
|
||||||
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
@ -268,9 +256,7 @@
|
|||||||
"cli.js": {
|
"cli.js": {
|
||||||
"path": "./tooling/cli.js",
|
"path": "./tooling/cli.js",
|
||||||
"manager": "javascript",
|
"manager": "javascript",
|
||||||
"dependencies": [
|
"dependencies": ["cli.rs"],
|
||||||
"cli.rs"
|
|
||||||
],
|
|
||||||
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
@ -282,9 +268,7 @@
|
|||||||
"cli.rs": {
|
"cli.rs": {
|
||||||
"path": "./tooling/cli.rs",
|
"path": "./tooling/cli.rs",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": [
|
"dependencies": ["tauri-bundler"],
|
||||||
"tauri-bundler"
|
|
||||||
],
|
|
||||||
"postversion": "cargo check"
|
"postversion": "cargo check"
|
||||||
},
|
},
|
||||||
"create-tauri-app": {
|
"create-tauri-app": {
|
||||||
@ -292,4 +276,4 @@
|
|||||||
"manager": "javascript"
|
"manager": "javascript"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
.prettierrc.js
Normal file
5
.prettierrc.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
singleQuote: true,
|
||||||
|
semi: false,
|
||||||
|
trailingComma: 'none'
|
||||||
|
}
|
@ -10,36 +10,36 @@ we should look to find a more "rusty way" to import / "pin" a version value in o
|
|||||||
rust binaries.
|
rust binaries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { readFileSync, writeFileSync } = require("fs");
|
const { readFileSync, writeFileSync } = require('fs')
|
||||||
|
|
||||||
const filePath = `../../tooling/cli.rs/metadata.json`;
|
const filePath = `../../tooling/cli.rs/metadata.json`
|
||||||
const packageNickname = process.argv[2];
|
const packageNickname = process.argv[2]
|
||||||
const bump = process.argv[3];
|
const bump = process.argv[3]
|
||||||
if (bump !== "prerelease") {
|
if (bump !== 'prerelease') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`We don't handle anything except prerelease right now. Exiting.`
|
`We don't handle anything except prerelease right now. Exiting.`
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const inc = (version) => {
|
const inc = (version) => {
|
||||||
const v = version.split("");
|
const v = version.split('')
|
||||||
const n = v.pop();
|
const n = v.pop()
|
||||||
return [...v, String(Number(n) + 1)].join("");
|
return [...v, String(Number(n) + 1)].join('')
|
||||||
};
|
|
||||||
|
|
||||||
// read file into js object
|
|
||||||
const metadata = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
||||||
|
|
||||||
// set field version
|
|
||||||
let version;
|
|
||||||
if (packageNickname === "cli.js") {
|
|
||||||
version = inc(metadata[packageNickname].version);
|
|
||||||
metadata[packageNickname].version = version;
|
|
||||||
} else {
|
|
||||||
version = inc(metadata[packageNickname]);
|
|
||||||
metadata[packageNickname] = version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeFileSync(filePath, JSON.stringify(metadata, null, 2) + "\n");
|
// read file into js object
|
||||||
console.log(`wrote ${version} for ${packageNickname} into metadata.json`);
|
const metadata = JSON.parse(readFileSync(filePath, 'utf-8'))
|
||||||
console.dir(metadata);
|
|
||||||
|
// set field version
|
||||||
|
let version
|
||||||
|
if (packageNickname === 'cli.js') {
|
||||||
|
version = inc(metadata[packageNickname].version)
|
||||||
|
metadata[packageNickname].version = version
|
||||||
|
} else {
|
||||||
|
version = inc(metadata[packageNickname])
|
||||||
|
metadata[packageNickname] = version
|
||||||
|
}
|
||||||
|
|
||||||
|
writeFileSync(filePath, JSON.stringify(metadata, null, 2) + '\n')
|
||||||
|
console.log(`wrote ${version} for ${packageNickname} into metadata.json`)
|
||||||
|
console.dir(metadata)
|
||||||
|
@ -8,7 +8,7 @@ This script is solely intended to be run as part of the `covector version` step
|
|||||||
keep the `tauri-runtime`, `tauri-runtime-wry` and `tauri-driver` crates version without the `beta` or `beta-rc` suffix.
|
keep the `tauri-runtime`, `tauri-runtime-wry` and `tauri-driver` crates version without the `beta` or `beta-rc` suffix.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { readFileSync, writeFileSync } = require("fs")
|
const { readFileSync, writeFileSync } = require('fs')
|
||||||
|
|
||||||
const packageNickname = process.argv[2]
|
const packageNickname = process.argv[2]
|
||||||
const bump = process.argv[3]
|
const bump = process.argv[3]
|
||||||
@ -19,7 +19,10 @@ let changelogPath
|
|||||||
|
|
||||||
if (packageNickname === 'tauri-runtime') {
|
if (packageNickname === 'tauri-runtime') {
|
||||||
manifestPath = '../../core/tauri-runtime/Cargo.toml'
|
manifestPath = '../../core/tauri-runtime/Cargo.toml'
|
||||||
dependencyManifestPaths = ['../../core/tauri/Cargo.toml', '../../core/tauri-runtime-wry/Cargo.toml']
|
dependencyManifestPaths = [
|
||||||
|
'../../core/tauri/Cargo.toml',
|
||||||
|
'../../core/tauri-runtime-wry/Cargo.toml'
|
||||||
|
]
|
||||||
changelogPath = '../../core/tauri-runtime/CHANGELOG.md'
|
changelogPath = '../../core/tauri-runtime/CHANGELOG.md'
|
||||||
} else if (packageNickname === 'tauri-runtime-wry') {
|
} else if (packageNickname === 'tauri-runtime-wry') {
|
||||||
manifestPath = '../../core/tauri-runtime-wry/Cargo.toml'
|
manifestPath = '../../core/tauri-runtime-wry/Cargo.toml'
|
||||||
@ -33,16 +36,24 @@ if (packageNickname === 'tauri-runtime') {
|
|||||||
throw new Error(`Unexpected package ${packageNickname}`)
|
throw new Error(`Unexpected package ${packageNickname}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
let manifest = readFileSync(manifestPath, "utf-8")
|
let manifest = readFileSync(manifestPath, 'utf-8')
|
||||||
manifest = manifest.replace(/version = "(\d+\.\d+\.\d+)-[^0-9\.]+\.0"/, 'version = "$1"')
|
manifest = manifest.replace(
|
||||||
|
/version = "(\d+\.\d+\.\d+)-[^0-9\.]+\.0"/,
|
||||||
|
'version = "$1"'
|
||||||
|
)
|
||||||
writeFileSync(manifestPath, manifest)
|
writeFileSync(manifestPath, manifest)
|
||||||
|
|
||||||
let changelog = readFileSync(changelogPath, "utf-8")
|
let changelog = readFileSync(changelogPath, 'utf-8')
|
||||||
changelog = changelog.replace(/(\d+\.\d+\.\d+)-[^0-9\.]+\.0/, '$1')
|
changelog = changelog.replace(/(\d+\.\d+\.\d+)-[^0-9\.]+\.0/, '$1')
|
||||||
writeFileSync(changelogPath, changelog)
|
writeFileSync(changelogPath, changelog)
|
||||||
|
|
||||||
for (const dependencyManifestPath of dependencyManifestPaths) {
|
for (const dependencyManifestPath of dependencyManifestPaths) {
|
||||||
let dependencyManifest = readFileSync(dependencyManifestPath, "utf-8")
|
let dependencyManifest = readFileSync(dependencyManifestPath, 'utf-8')
|
||||||
dependencyManifest = dependencyManifest.replace(new RegExp(packageNickname + ' = { version = "(\\d+\\.\\d+\.\\d+)-[^0-9\.]+\.0"'), `${packageNickname} = { version = "$1"`)
|
dependencyManifest = dependencyManifest.replace(
|
||||||
|
new RegExp(
|
||||||
|
packageNickname + ' = { version = "(\\d+\\.\\d+.\\d+)-[^0-9.]+.0"'
|
||||||
|
),
|
||||||
|
`${packageNickname} = { version = "$1"`
|
||||||
|
)
|
||||||
writeFileSync(dependencyManifestPath, dependencyManifest)
|
writeFileSync(dependencyManifestPath, dependencyManifest)
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
// polyfills
|
// polyfills
|
||||||
if (!String.prototype.startsWith) {
|
if (!String.prototype.startsWith) {
|
||||||
String.prototype.startsWith = function (searchString, position) {
|
String.prototype.startsWith = function (searchString, position) {
|
||||||
position = position || 0;
|
position = position || 0
|
||||||
return this.substr(position, searchString.length) === searchString;
|
return this.substr(position, searchString.length) === searchString
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
;(function () {
|
||||||
function uid() {
|
function uid() {
|
||||||
const length = new Int8Array(1)
|
const length = new Int8Array(1)
|
||||||
window.crypto.getRandomValues(length)
|
window.crypto.getRandomValues(length)
|
||||||
@ -20,41 +20,41 @@ if (!String.prototype.startsWith) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ownKeys(object, enumerableOnly) {
|
function ownKeys(object, enumerableOnly) {
|
||||||
var keys = Object.keys(object);
|
var keys = Object.keys(object)
|
||||||
if (Object.getOwnPropertySymbols) {
|
if (Object.getOwnPropertySymbols) {
|
||||||
var symbols = Object.getOwnPropertySymbols(object);
|
var symbols = Object.getOwnPropertySymbols(object)
|
||||||
if (enumerableOnly)
|
if (enumerableOnly)
|
||||||
symbols = symbols.filter(function (sym) {
|
symbols = symbols.filter(function (sym) {
|
||||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable
|
||||||
});
|
})
|
||||||
keys.push.apply(keys, symbols);
|
keys.push.apply(keys, symbols)
|
||||||
}
|
}
|
||||||
return keys;
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
function _objectSpread(target) {
|
function _objectSpread(target) {
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
var source = arguments[i] != null ? arguments[i] : {};
|
var source = arguments[i] != null ? arguments[i] : {}
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
ownKeys(source, true).forEach(function (key) {
|
ownKeys(source, true).forEach(function (key) {
|
||||||
_defineProperty(target, key, source[key]);
|
_defineProperty(target, key, source[key])
|
||||||
});
|
})
|
||||||
} else if (Object.getOwnPropertyDescriptors) {
|
} else if (Object.getOwnPropertyDescriptors) {
|
||||||
Object.defineProperties(
|
Object.defineProperties(
|
||||||
target,
|
target,
|
||||||
Object.getOwnPropertyDescriptors(source)
|
Object.getOwnPropertyDescriptors(source)
|
||||||
);
|
)
|
||||||
} else {
|
} else {
|
||||||
ownKeys(source).forEach(function (key) {
|
ownKeys(source).forEach(function (key) {
|
||||||
Object.defineProperty(
|
Object.defineProperty(
|
||||||
target,
|
target,
|
||||||
key,
|
key,
|
||||||
Object.getOwnPropertyDescriptor(source, key)
|
Object.getOwnPropertyDescriptor(source, key)
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return target;
|
return target
|
||||||
}
|
}
|
||||||
|
|
||||||
function _defineProperty(obj, key, value) {
|
function _defineProperty(obj, key, value) {
|
||||||
@ -63,52 +63,52 @@ if (!String.prototype.startsWith) {
|
|||||||
value: value,
|
value: value,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
writable: true,
|
writable: true
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
obj[key] = value;
|
obj[key] = value
|
||||||
}
|
}
|
||||||
return obj;
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window.__TAURI__) {
|
if (!window.__TAURI__) {
|
||||||
window.__TAURI__ = {};
|
window.__TAURI__ = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.__TAURI__.transformCallback = function transformCallback(
|
window.__TAURI__.transformCallback = function transformCallback(
|
||||||
callback,
|
callback,
|
||||||
once
|
once
|
||||||
) {
|
) {
|
||||||
var identifier = uid();
|
var identifier = uid()
|
||||||
|
|
||||||
window[identifier] = function (result) {
|
window[identifier] = function (result) {
|
||||||
if (once) {
|
if (once) {
|
||||||
delete window[identifier];
|
delete window[identifier]
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback && callback(result);
|
return callback && callback(result)
|
||||||
};
|
}
|
||||||
|
|
||||||
return identifier;
|
return identifier
|
||||||
};
|
}
|
||||||
|
|
||||||
window.__TAURI__._invoke = function invoke(cmd, args = {}, key = null) {
|
window.__TAURI__._invoke = function invoke(cmd, args = {}, key = null) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var callback = window.__TAURI__.transformCallback(function (r) {
|
var callback = window.__TAURI__.transformCallback(function (r) {
|
||||||
resolve(r);
|
resolve(r)
|
||||||
delete window[error];
|
delete window[error]
|
||||||
}, true);
|
}, true)
|
||||||
var error = window.__TAURI__.transformCallback(function (e) {
|
var error = window.__TAURI__.transformCallback(function (e) {
|
||||||
reject(e);
|
reject(e)
|
||||||
delete window[callback];
|
delete window[callback]
|
||||||
}, true);
|
}, true)
|
||||||
|
|
||||||
if (typeof cmd === "string") {
|
if (typeof cmd === 'string') {
|
||||||
args.cmd = cmd;
|
args.cmd = cmd
|
||||||
} else if (typeof cmd === "object") {
|
} else if (typeof cmd === 'object') {
|
||||||
args = cmd;
|
args = cmd
|
||||||
} else {
|
} else {
|
||||||
return reject(new Error("Invalid argument type."));
|
return reject(new Error('Invalid argument type.'))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.rpc) {
|
if (window.rpc) {
|
||||||
@ -118,238 +118,259 @@ if (!String.prototype.startsWith) {
|
|||||||
{
|
{
|
||||||
callback: callback,
|
callback: callback,
|
||||||
error: error,
|
error: error,
|
||||||
__invokeKey: key || __TAURI_INVOKE_KEY__,
|
__invokeKey: key || __TAURI_INVOKE_KEY__
|
||||||
},
|
},
|
||||||
args
|
args
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
} else {
|
} else {
|
||||||
window.addEventListener("DOMContentLoaded", function () {
|
window.addEventListener('DOMContentLoaded', function () {
|
||||||
window.rpc.notify(
|
window.rpc.notify(
|
||||||
cmd,
|
cmd,
|
||||||
_objectSpread(
|
_objectSpread(
|
||||||
{
|
{
|
||||||
callback: callback,
|
callback: callback,
|
||||||
error: error,
|
error: error,
|
||||||
__invokeKey: key || __TAURI_INVOKE_KEY__,
|
__invokeKey: key || __TAURI_INVOKE_KEY__
|
||||||
},
|
},
|
||||||
args
|
args
|
||||||
)
|
)
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// open <a href="..."> links with the Tauri API
|
// open <a href="..."> links with the Tauri API
|
||||||
function __openLinks() {
|
function __openLinks() {
|
||||||
document.querySelector("body").addEventListener(
|
document.querySelector('body').addEventListener(
|
||||||
"click",
|
'click',
|
||||||
function (e) {
|
function (e) {
|
||||||
var target = e.target;
|
var target = e.target
|
||||||
while (target != null) {
|
while (target != null) {
|
||||||
if (
|
if (
|
||||||
target.matches ? target.matches("a") : target.msMatchesSelector("a")
|
target.matches ? target.matches('a') : target.msMatchesSelector('a')
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
target.href &&
|
target.href &&
|
||||||
target.href.startsWith("http") &&
|
target.href.startsWith('http') &&
|
||||||
target.target === "_blank"
|
target.target === '_blank'
|
||||||
) {
|
) {
|
||||||
window.__TAURI__._invoke('tauri', {
|
window.__TAURI__._invoke(
|
||||||
__tauriModule: "Shell",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "open",
|
__tauriModule: 'Shell',
|
||||||
path: target.href,
|
message: {
|
||||||
|
cmd: 'open',
|
||||||
|
path: target.href
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
e.preventDefault();
|
)
|
||||||
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
target = target.parentElement;
|
target = target.parentElement
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
document.readyState === "complete" ||
|
document.readyState === 'complete' ||
|
||||||
document.readyState === "interactive"
|
document.readyState === 'interactive'
|
||||||
) {
|
) {
|
||||||
__openLinks();
|
__openLinks()
|
||||||
} else {
|
} else {
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
"DOMContentLoaded",
|
'DOMContentLoaded',
|
||||||
function () {
|
function () {
|
||||||
__openLinks();
|
__openLinks()
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// drag region
|
// drag region
|
||||||
document.addEventListener('mousedown', (e) => {
|
document.addEventListener('mousedown', (e) => {
|
||||||
if (e.target.hasAttribute("data-tauri-drag-region") && e.buttons === 1) {
|
if (e.target.hasAttribute('data-tauri-drag-region') && e.buttons === 1) {
|
||||||
// start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
|
// start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
|
||||||
e.detail === 2
|
window.__TAURI__._invoke(
|
||||||
? window.__TAURI__._invoke(
|
'tauri',
|
||||||
"tauri",
|
|
||||||
{
|
{
|
||||||
__tauriModule: "Window",
|
__tauriModule: 'Window',
|
||||||
message: {
|
message: {
|
||||||
cmd: "toggleMaximize",
|
cmd: e.detail === 2 ? 'toggleMaximize' : 'startDragging'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
_KEY_VALUE_
|
_KEY_VALUE_
|
||||||
)
|
)
|
||||||
: window.__TAURI__._invoke(
|
|
||||||
"tauri",
|
|
||||||
{
|
|
||||||
__tauriModule: "Window",
|
|
||||||
message: {
|
|
||||||
cmd: "startDragging",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
_KEY_VALUE_
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
window.__TAURI__._invoke('tauri', {
|
window.__TAURI__._invoke(
|
||||||
__tauriModule: "Event",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "listen",
|
__tauriModule: 'Event',
|
||||||
event: "tauri://window-created",
|
message: {
|
||||||
handler: window.__TAURI__.transformCallback(function (event) {
|
cmd: 'listen',
|
||||||
if (event.payload) {
|
event: 'tauri://window-created',
|
||||||
var windowLabel = event.payload.label;
|
handler: window.__TAURI__.transformCallback(function (event) {
|
||||||
window.__TAURI__.__windows.push({ label: windowLabel });
|
if (event.payload) {
|
||||||
}
|
var windowLabel = event.payload.label
|
||||||
}),
|
window.__TAURI__.__windows.push({ label: windowLabel })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
|
)
|
||||||
|
|
||||||
let permissionSettable = false;
|
let permissionSettable = false
|
||||||
let permissionValue = "default";
|
let permissionValue = 'default'
|
||||||
|
|
||||||
function isPermissionGranted() {
|
function isPermissionGranted() {
|
||||||
if (window.Notification.permission !== "default") {
|
if (window.Notification.permission !== 'default') {
|
||||||
return Promise.resolve(window.Notification.permission === "granted");
|
return Promise.resolve(window.Notification.permission === 'granted')
|
||||||
}
|
}
|
||||||
return window.__TAURI__._invoke('tauri', {
|
return window.__TAURI__._invoke(
|
||||||
__tauriModule: "Notification",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "isNotificationPermissionGranted",
|
__tauriModule: 'Notification',
|
||||||
|
message: {
|
||||||
|
cmd: 'isNotificationPermissionGranted'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNotificationPermission(value) {
|
function setNotificationPermission(value) {
|
||||||
permissionSettable = true;
|
permissionSettable = true
|
||||||
window.Notification.permission = value;
|
window.Notification.permission = value
|
||||||
permissionSettable = false;
|
permissionSettable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestPermission() {
|
function requestPermission() {
|
||||||
return window.__TAURI__
|
return window.__TAURI__
|
||||||
.invoke('tauri', {
|
.invoke(
|
||||||
__tauriModule: "Notification",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "requestNotificationPermission",
|
__tauriModule: 'Notification',
|
||||||
|
message: {
|
||||||
|
cmd: 'requestNotificationPermission'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_)
|
_KEY_VALUE_
|
||||||
|
)
|
||||||
.then(function (permission) {
|
.then(function (permission) {
|
||||||
setNotificationPermission(permission);
|
setNotificationPermission(permission)
|
||||||
return permission;
|
return permission
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendNotification(options) {
|
function sendNotification(options) {
|
||||||
if (typeof options === "object") {
|
if (typeof options === 'object') {
|
||||||
Object.freeze(options);
|
Object.freeze(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
isPermissionGranted().then(function (permission) {
|
isPermissionGranted().then(function (permission) {
|
||||||
if (permission) {
|
if (permission) {
|
||||||
return window.__TAURI__._invoke('tauri', {
|
return window.__TAURI__._invoke(
|
||||||
__tauriModule: "Notification",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "notification",
|
__tauriModule: 'Notification',
|
||||||
options:
|
message: {
|
||||||
typeof options === "string"
|
cmd: 'notification',
|
||||||
? {
|
options:
|
||||||
title: options,
|
typeof options === 'string'
|
||||||
}
|
? {
|
||||||
: options,
|
title: options
|
||||||
|
}
|
||||||
|
: options
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
|
)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Notification = function (title, options) {
|
window.Notification = function (title, options) {
|
||||||
var opts = options || {};
|
var opts = options || {}
|
||||||
sendNotification(
|
sendNotification(
|
||||||
Object.assign(opts, {
|
Object.assign(opts, {
|
||||||
title: title,
|
title: title
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
window.Notification.requestPermission = requestPermission;
|
window.Notification.requestPermission = requestPermission
|
||||||
|
|
||||||
Object.defineProperty(window.Notification, "permission", {
|
Object.defineProperty(window.Notification, 'permission', {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () {
|
get: function () {
|
||||||
return permissionValue;
|
return permissionValue
|
||||||
},
|
},
|
||||||
set: function (v) {
|
set: function (v) {
|
||||||
if (!permissionSettable) {
|
if (!permissionSettable) {
|
||||||
throw new Error("Readonly property");
|
throw new Error('Readonly property')
|
||||||
}
|
}
|
||||||
permissionValue = v;
|
permissionValue = v
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
isPermissionGranted().then(function (response) {
|
isPermissionGranted().then(function (response) {
|
||||||
if (response === null) {
|
if (response === null) {
|
||||||
setNotificationPermission("default");
|
setNotificationPermission('default')
|
||||||
} else {
|
} else {
|
||||||
setNotificationPermission(response ? "granted" : "denied");
|
setNotificationPermission(response ? 'granted' : 'denied')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
window.alert = function (message) {
|
window.alert = function (message) {
|
||||||
window.__TAURI__._invoke('tauri', {
|
window.__TAURI__._invoke(
|
||||||
__tauriModule: "Dialog",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "messageDialog",
|
__tauriModule: 'Dialog',
|
||||||
message: message,
|
message: {
|
||||||
|
cmd: 'messageDialog',
|
||||||
|
message: message
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
};
|
)
|
||||||
|
}
|
||||||
|
|
||||||
window.confirm = function (message) {
|
window.confirm = function (message) {
|
||||||
return window.__TAURI__._invoke('tauri', {
|
return window.__TAURI__._invoke(
|
||||||
__tauriModule: "Dialog",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "askDialog",
|
__tauriModule: 'Dialog',
|
||||||
message: message,
|
message: {
|
||||||
|
cmd: 'askDialog',
|
||||||
|
message: message
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
};
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// window.print works on Linux/Windows; need to use the API on macOS
|
// window.print works on Linux/Windows; need to use the API on macOS
|
||||||
if (navigator.userAgent.includes('Mac')) {
|
if (navigator.userAgent.includes('Mac')) {
|
||||||
window.print = function () {
|
window.print = function () {
|
||||||
return window.__TAURI__._invoke('tauri', {
|
return window.__TAURI__._invoke(
|
||||||
__tauriModule: "Window",
|
'tauri',
|
||||||
message: {
|
{
|
||||||
cmd: "print"
|
__tauriModule: 'Window',
|
||||||
|
message: {
|
||||||
|
cmd: 'print'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}, _KEY_VALUE_);
|
_KEY_VALUE_
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})()
|
||||||
|
@ -75,10 +75,7 @@
|
|||||||
{
|
{
|
||||||
"label": "CI/CD",
|
"label": "CI/CD",
|
||||||
"type": "category",
|
"type": "category",
|
||||||
"items": [
|
"items": ["usage/ci-cd/workflow", "usage/ci-cd/cross-platform"]
|
||||||
"usage/ci-cd/workflow",
|
|
||||||
"usage/ci-cd/cross-platform"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"usage/contributor-guide"
|
"usage/contributor-guide"
|
||||||
]
|
]
|
||||||
|
File diff suppressed because one or more lines are too long
@ -41,7 +41,7 @@ body {
|
|||||||
color: #f0f4f5;
|
color: #f0f4f5;
|
||||||
border: solid 1px rgba(255, 255, 255, 0.055);
|
border: solid 1px rgba(255, 255, 255, 0.055);
|
||||||
box-shadow: 0 1px 5px 0 rgb(0 0 0 / 20%);
|
box-shadow: 0 1px 5px 0 rgb(0 0 0 / 20%);
|
||||||
font-family: "Courier New", Courier, monospace;
|
font-family: 'Courier New', Courier, monospace;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
padding: 0px 15px;
|
padding: 0px 15px;
|
||||||
@ -80,7 +80,7 @@ button:active {
|
|||||||
.button {
|
.button {
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
background: #67D6ED;
|
background: #67d6ed;
|
||||||
color: rgb(0, 0, 0);
|
color: rgb(0, 0, 0);
|
||||||
font-family: system-ui, sans-serif;
|
font-family: system-ui, sans-serif;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
@ -120,9 +120,9 @@ button:active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nv_selected {
|
.nv_selected {
|
||||||
color: #67D6ED;
|
color: #67d6ed;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
border-left: solid 5px #67D6ED;
|
border-left: solid 5px #67d6ed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@ -138,14 +138,14 @@ main {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[type="radio"]:checked~label {
|
[type='radio']:checked ~ label {
|
||||||
background: rgb(36, 37, 38);
|
background: rgb(36, 37, 38);
|
||||||
color: #67D6ED;
|
color: #67d6ed;
|
||||||
border-bottom: 1px solid transparent;
|
border-bottom: 1px solid transparent;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
[type="radio"]:checked~label~.content {
|
[type='radio']:checked ~ label ~ .content {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
import svelte from "rollup-plugin-svelte";
|
import svelte from 'rollup-plugin-svelte'
|
||||||
import resolve from "@rollup/plugin-node-resolve";
|
import resolve from '@rollup/plugin-node-resolve'
|
||||||
import commonjs from "@rollup/plugin-commonjs";
|
import commonjs from '@rollup/plugin-commonjs'
|
||||||
import livereload from "rollup-plugin-livereload";
|
import livereload from 'rollup-plugin-livereload'
|
||||||
import { terser } from "rollup-plugin-terser";
|
import { terser } from 'rollup-plugin-terser'
|
||||||
|
|
||||||
const production = !process.env.ROLLUP_WATCH;
|
const production = !process.env.ROLLUP_WATCH
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: "src/main.js",
|
input: 'src/main.js',
|
||||||
output: {
|
output: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
format: "iife",
|
format: 'iife',
|
||||||
name: "app",
|
name: 'app',
|
||||||
file: "public/build/bundle.js",
|
file: 'public/build/bundle.js'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
svelte({
|
svelte({
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
// enable run-time checks when not in production
|
// enable run-time checks when not in production
|
||||||
dev: !production,
|
dev: !production
|
||||||
},
|
},
|
||||||
emitCss: false,
|
emitCss: false
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// If you have external dependencies installed from
|
// If you have external dependencies installed from
|
||||||
@ -30,7 +30,7 @@ export default {
|
|||||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
||||||
resolve({
|
resolve({
|
||||||
browser: true,
|
browser: true,
|
||||||
dedupe: ["svelte"],
|
dedupe: ['svelte']
|
||||||
}),
|
}),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
|
|
||||||
@ -40,38 +40,38 @@ export default {
|
|||||||
|
|
||||||
// Watch the `public` directory and refresh the
|
// Watch the `public` directory and refresh the
|
||||||
// browser on changes when not in production
|
// browser on changes when not in production
|
||||||
!production && livereload("public"),
|
!production && livereload('public'),
|
||||||
|
|
||||||
// If we're building for production (npm run build
|
// If we're building for production (npm run build
|
||||||
// instead of npm run dev), minify
|
// instead of npm run dev), minify
|
||||||
production && terser(),
|
production && terser()
|
||||||
],
|
],
|
||||||
watch: {
|
watch: {
|
||||||
clearScreen: false,
|
clearScreen: false
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function serve() {
|
function serve() {
|
||||||
let server;
|
let server
|
||||||
|
|
||||||
function toExit() {
|
function toExit() {
|
||||||
if (server) server.kill(0);
|
if (server) server.kill(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
writeBundle() {
|
writeBundle() {
|
||||||
if (server) return;
|
if (server) return
|
||||||
server = require("child_process").spawn(
|
server = require('child_process').spawn(
|
||||||
"npm",
|
'npm',
|
||||||
["run", "start", "--", "--dev"],
|
['run', 'start', '--', '--dev'],
|
||||||
{
|
{
|
||||||
stdio: ["ignore", "inherit", "inherit"],
|
stdio: ['ignore', 'inherit', 'inherit'],
|
||||||
shell: true,
|
shell: true
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
|
||||||
process.on("SIGTERM", toExit);
|
process.on('SIGTERM', toExit)
|
||||||
process.on("exit", toExit);
|
process.on('exit', toExit)
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,7 @@
|
|||||||
"name": "theme",
|
"name": "theme",
|
||||||
"takesValue": true,
|
"takesValue": true,
|
||||||
"description": "App theme",
|
"description": "App theme",
|
||||||
"possibleValues": [
|
"possibleValues": ["light", "dark", "system"]
|
||||||
"light",
|
|
||||||
"dark",
|
|
||||||
"system"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"short": "v",
|
"short": "v",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import App from "./App.svelte";
|
import App from './App.svelte'
|
||||||
|
|
||||||
const app = new App({
|
const app = new App({
|
||||||
target: document.body,
|
target: document.body
|
||||||
});
|
})
|
||||||
|
|
||||||
export default app;
|
export default app
|
||||||
|
@ -1,62 +1,68 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<h1>Tauri Commands</h1>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<div>Response: <span id="response"></span></div>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<div>Without Args: <span id="response-optional"></span></div>
|
||||||
<title>Tauri</title>
|
<div id="container"></div>
|
||||||
</head>
|
<script>
|
||||||
|
function runCommand(commandName, args, optional) {
|
||||||
|
const id = optional ? '#response-optional' : '#response'
|
||||||
|
const result = document.querySelector(id)
|
||||||
|
window.__TAURI__
|
||||||
|
.invoke(commandName, args)
|
||||||
|
.then((response) => {
|
||||||
|
result.innerText = `Ok(${response})`
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
result.innerText = `Err(${error})`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
<body>
|
const container = document.querySelector('#container')
|
||||||
<h1>Tauri Commands</h1>
|
const commands = [
|
||||||
<div>Response: <span id="response"></span></div>
|
{ name: 'borrow_cmd' },
|
||||||
<div >Without Args: <span id="response-optional"></span></div>
|
{ name: 'window_label' },
|
||||||
<div id="container"></div>
|
{ name: 'simple_command' },
|
||||||
<script>
|
{ name: 'stateful_command' },
|
||||||
function runCommand(commandName, args, optional) {
|
{ name: 'async_simple_command' },
|
||||||
const id = optional ? "#response-optional" : "#response";
|
{ name: 'future_simple_command' },
|
||||||
const result = document.querySelector(id)
|
{ name: 'async_stateful_command' },
|
||||||
window.__TAURI__.invoke(commandName, args).then(response => {
|
{ name: 'simple_command_with_result' },
|
||||||
result.innerText = `Ok(${response})`
|
{ name: 'stateful_command_with_result' },
|
||||||
}).catch(error => {
|
{ name: 'async_simple_command_with_result' },
|
||||||
result.innerText = `Err(${error})`
|
{ name: 'future_simple_command_with_return' },
|
||||||
})
|
{ name: 'future_simple_command_with_result' },
|
||||||
}
|
{ name: 'async_stateful_command_with_result' },
|
||||||
|
{ name: 'command_arguments_wild' },
|
||||||
const container = document.querySelector('#container')
|
{
|
||||||
const commands = [
|
name: 'command_arguments_struct',
|
||||||
{ name: 'borrow_cmd' },
|
args: { Person: { name: 'ferris', age: 6 } }
|
||||||
{ name: 'window_label' },
|
},
|
||||||
{ name: 'simple_command' },
|
{
|
||||||
{ name: 'stateful_command' },
|
name: 'command_arguments_tuple_struct',
|
||||||
{ name: 'async_simple_command' },
|
args: { InlinePerson: ['ferris', 6] }
|
||||||
{ name: 'future_simple_command'},
|
}
|
||||||
{ name: 'async_stateful_command' },
|
]
|
||||||
{ name: 'simple_command_with_result' },
|
|
||||||
{ name: 'stateful_command_with_result' },
|
|
||||||
{ name: 'async_simple_command_with_result' },
|
|
||||||
{ name: 'future_simple_command_with_return' },
|
|
||||||
{ name: 'future_simple_command_with_result' },
|
|
||||||
{ name: 'async_stateful_command_with_result' },
|
|
||||||
{ name: 'command_arguments_wild' },
|
|
||||||
{ name: 'command_arguments_struct', args: { "Person": { "name": "ferris", age: 6 } } },
|
|
||||||
{ name: 'command_arguments_tuple_struct', args: { "InlinePerson": [ "ferris", 6 ] } },
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const command of commands) {
|
|
||||||
const { name } = command
|
|
||||||
const args = command.args ?? { argument: 'value' }
|
|
||||||
const button = document.createElement('button')
|
|
||||||
button.innerHTML = `Run ${name}`;
|
|
||||||
button.addEventListener("click", function () {
|
|
||||||
runCommand(name, args, false)
|
|
||||||
runCommand(name, Object.create(null), true)
|
|
||||||
});
|
|
||||||
container.appendChild(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
for (const command of commands) {
|
||||||
|
const { name } = command
|
||||||
|
const args = command.args ?? { argument: 'value' }
|
||||||
|
const button = document.createElement('button')
|
||||||
|
button.innerHTML = `Run ${name}`
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
runCommand(name, args, false)
|
||||||
|
runCommand(name, Object.create(null), true)
|
||||||
|
})
|
||||||
|
container.appendChild(button)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "",
|
"beforeDevCommand": "",
|
||||||
"beforeBuildCommand": "",
|
"beforeBuildCommand": "",
|
||||||
"withGlobalTauri": true
|
"withGlobalTauri": true
|
||||||
@ -58,4 +54,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "",
|
"beforeDevCommand": "",
|
||||||
"beforeBuildCommand": ""
|
"beforeBuildCommand": ""
|
||||||
},
|
},
|
||||||
|
@ -1,75 +1,74 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<body>
|
||||||
|
<div id="window-label"></div>
|
||||||
|
<div id="container"></div>
|
||||||
|
<div id="response"></div>
|
||||||
|
|
||||||
<body>
|
<script>
|
||||||
<div id="window-label"></div>
|
var WebviewWindow = window.__TAURI__.window.WebviewWindow
|
||||||
<div id="container"></div>
|
var thisTauriWindow = window.__TAURI__.window.getCurrent()
|
||||||
<div id="response"></div>
|
var windowLabel = thisTauriWindow.label
|
||||||
|
var windowLabelContainer = document.getElementById('window-label')
|
||||||
|
windowLabelContainer.innerHTML = 'This is the ' + windowLabel + ' window.'
|
||||||
|
|
||||||
<script>
|
var container = document.getElementById('container')
|
||||||
var WebviewWindow = window.__TAURI__.window.WebviewWindow
|
|
||||||
var thisTauriWindow = window.__TAURI__.window.getCurrent();
|
|
||||||
var windowLabel = thisTauriWindow.label;
|
|
||||||
var windowLabelContainer = document.getElementById("window-label");
|
|
||||||
windowLabelContainer.innerHTML =
|
|
||||||
"This is the " + windowLabel + " window.";
|
|
||||||
|
|
||||||
var container = document.getElementById("container");
|
function createWindowMessageBtn(label) {
|
||||||
|
var tauriWindow = WebviewWindow.getByLabel(label)
|
||||||
function createWindowMessageBtn(label) {
|
var button = document.createElement('button')
|
||||||
var tauriWindow = WebviewWindow.getByLabel(label)
|
button.innerHTML = 'Send message to ' + label
|
||||||
var button = document.createElement("button");
|
button.addEventListener('click', function () {
|
||||||
button.innerHTML = "Send message to " + label;
|
tauriWindow.emit('clicked', 'message from ' + windowLabel)
|
||||||
button.addEventListener("click", function () {
|
})
|
||||||
tauriWindow.emit("clicked", "message from " + windowLabel);
|
container.appendChild(button)
|
||||||
});
|
|
||||||
container.appendChild(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
// global listener
|
|
||||||
window.__TAURI__.event.listen("clicked", function (event) {
|
|
||||||
responseContainer.innerHTML += "Got " + JSON.stringify(event) + " on global listener<br><br>";
|
|
||||||
})
|
|
||||||
window.__TAURI__.event.listen('tauri://window-created', function (event) {
|
|
||||||
createWindowMessageBtn(event.payload.label)
|
|
||||||
})
|
|
||||||
|
|
||||||
var responseContainer = document.getElementById("response");
|
|
||||||
// listener tied to this window
|
|
||||||
thisTauriWindow.listen("clicked", function (event) {
|
|
||||||
responseContainer.innerHTML += "Got " + JSON.stringify(event) + " on window listener<br><br>";
|
|
||||||
});
|
|
||||||
|
|
||||||
var createWindowButton = document.createElement("button");
|
|
||||||
createWindowButton.innerHTML = "Create window";
|
|
||||||
createWindowButton.addEventListener("click", function () {
|
|
||||||
var webviewWindow = new WebviewWindow(Math.random().toString());
|
|
||||||
webviewWindow.once('tauri://created', function () {
|
|
||||||
responseContainer.innerHTML += "Created new webview"
|
|
||||||
})
|
|
||||||
webviewWindow.once('tauri://error', function () {
|
|
||||||
responseContainer.innerHTML += "Error creating new webview"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
container.appendChild(createWindowButton);
|
|
||||||
|
|
||||||
var globalMessageButton = document.createElement("button");
|
|
||||||
globalMessageButton.innerHTML = "Send global message";
|
|
||||||
globalMessageButton.addEventListener("click", function () {
|
|
||||||
// emit to all windows
|
|
||||||
window.__TAURI__.event.emit("clicked", "message from " + windowLabel);
|
|
||||||
});
|
|
||||||
container.appendChild(globalMessageButton);
|
|
||||||
|
|
||||||
var allWindows = window.__TAURI__.window.getAll()
|
|
||||||
for (var index in allWindows) {
|
|
||||||
var label = allWindows[index].label;
|
|
||||||
if (label === windowLabel) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
createWindowMessageBtn(label)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
// global listener
|
||||||
|
window.__TAURI__.event.listen('clicked', function (event) {
|
||||||
|
responseContainer.innerHTML +=
|
||||||
|
'Got ' + JSON.stringify(event) + ' on global listener<br><br>'
|
||||||
|
})
|
||||||
|
window.__TAURI__.event.listen('tauri://window-created', function (event) {
|
||||||
|
createWindowMessageBtn(event.payload.label)
|
||||||
|
})
|
||||||
|
|
||||||
|
var responseContainer = document.getElementById('response')
|
||||||
|
// listener tied to this window
|
||||||
|
thisTauriWindow.listen('clicked', function (event) {
|
||||||
|
responseContainer.innerHTML +=
|
||||||
|
'Got ' + JSON.stringify(event) + ' on window listener<br><br>'
|
||||||
|
})
|
||||||
|
|
||||||
|
var createWindowButton = document.createElement('button')
|
||||||
|
createWindowButton.innerHTML = 'Create window'
|
||||||
|
createWindowButton.addEventListener('click', function () {
|
||||||
|
var webviewWindow = new WebviewWindow(Math.random().toString())
|
||||||
|
webviewWindow.once('tauri://created', function () {
|
||||||
|
responseContainer.innerHTML += 'Created new webview'
|
||||||
|
})
|
||||||
|
webviewWindow.once('tauri://error', function () {
|
||||||
|
responseContainer.innerHTML += 'Error creating new webview'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
container.appendChild(createWindowButton)
|
||||||
|
|
||||||
|
var globalMessageButton = document.createElement('button')
|
||||||
|
globalMessageButton.innerHTML = 'Send global message'
|
||||||
|
globalMessageButton.addEventListener('click', function () {
|
||||||
|
// emit to all windows
|
||||||
|
window.__TAURI__.event.emit('clicked', 'message from ' + windowLabel)
|
||||||
|
})
|
||||||
|
container.appendChild(globalMessageButton)
|
||||||
|
|
||||||
|
var allWindows = window.__TAURI__.window.getAll()
|
||||||
|
for (var index in allWindows) {
|
||||||
|
var label = allWindows[index].label
|
||||||
|
if (label === windowLabel) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
createWindowMessageBtn(label)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,4 +8,4 @@
|
|||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"withGlobalTauri": true
|
"withGlobalTauri": true
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
@ -49,4 +45,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,22 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<h1>index.html</h1>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<select id="route">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<option value="secondary.html">secondary.html</option>
|
||||||
<title>Tauri</title>
|
<option value="nested/index.html">nested/index.html</option>
|
||||||
</head>
|
<option value="nested/secondary.html">nested/secondary.html</option>
|
||||||
|
</select>
|
||||||
<body>
|
<button id="open-window">New window</button>
|
||||||
<h1>index.html</h1>
|
<button id="go">Go</button>
|
||||||
<select id="route">
|
<a id="link" href="secondary.html">Go</a>
|
||||||
<option value="secondary.html">secondary.html</option>
|
<script src="index.js"></script>
|
||||||
<option value="nested/index.html">nested/index.html</option>
|
</body>
|
||||||
<option value="nested/secondary.html">nested/secondary.html</option>
|
|
||||||
</select>
|
|
||||||
<button id="open-window">New window</button>
|
|
||||||
<button id="go">Go</button>
|
|
||||||
<a id="link" href="secondary.html">Go</a>
|
|
||||||
<script src="index.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,7 +8,7 @@ routeSelect.addEventListener('change', (event) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
document.querySelector('#go').addEventListener('click', () => {
|
document.querySelector('#go').addEventListener('click', () => {
|
||||||
window.location.href = (window.location.origin + '/' + routeSelect.value)
|
window.location.href = window.location.origin + '/' + routeSelect.value
|
||||||
})
|
})
|
||||||
|
|
||||||
document.querySelector('#open-window').addEventListener('click', () => {
|
document.querySelector('#open-window').addEventListener('click', () => {
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<h1></h1>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<button onclick="window.history.back()">Back</button>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<script src="index.js"></script>
|
||||||
<title>Tauri</title>
|
</body>
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1></h1>
|
|
||||||
<button onclick="window.history.back()">Back</button>
|
|
||||||
<script src="index.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<h1></h1>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<button onclick="window.history.back()">Back</button>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<script src="secondary.js"></script>
|
||||||
<title>Tauri</title>
|
</body>
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1></h1>
|
|
||||||
<button onclick="window.history.back()">Back</button>
|
|
||||||
<script src="secondary.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<h1></h1>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<button onclick="window.history.back()">Back</button>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<script src="secondary.js"></script>
|
||||||
<title>Tauri</title>
|
</body>
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1></h1>
|
|
||||||
<button onclick="window.history.back()">Back</button>
|
|
||||||
<script src="secondary.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -54,4 +54,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Params</title>
|
<title>Params</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Simple custom `Params` types check.</h1>
|
<h1>Simple custom `Params` types check.</h1>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "",
|
"beforeDevCommand": "",
|
||||||
"beforeBuildCommand": ""
|
"beforeBuildCommand": ""
|
||||||
},
|
},
|
||||||
@ -57,4 +53,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Sidecar</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<div></div>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
const div = document.querySelector('div')
|
||||||
<title>Sidecar</title>
|
window.__TAURI__.event.listen('message', (event) => {
|
||||||
</head>
|
const p = document.createElement('p')
|
||||||
|
p.innerHTML = event.payload
|
||||||
<body>
|
div.appendChild(p)
|
||||||
<div></div>
|
})
|
||||||
<script>
|
</script>
|
||||||
const div = document.querySelector('div')
|
</body>
|
||||||
window.__TAURI__.event.listen('message', event => {
|
|
||||||
const p = document.createElement('p')
|
|
||||||
p.innerHTML = event.payload
|
|
||||||
div.appendChild(p)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
console.log(`[${new Date().toLocaleTimeString()}] new message`)
|
console.log(`[${new Date().toLocaleTimeString()}] new message`)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "",
|
"beforeDevCommand": "",
|
||||||
"beforeBuildCommand": "",
|
"beforeBuildCommand": "",
|
||||||
"withGlobalTauri": true
|
"withGlobalTauri": true
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Sidecar</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<div></div>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<script>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
const div = document.querySelector('div')
|
||||||
<title>Sidecar</title>
|
window.__TAURI__.event.listen('message', (event) => {
|
||||||
</head>
|
const p = document.createElement('p')
|
||||||
|
p.innerHTML = event.payload
|
||||||
<body>
|
div.appendChild(p)
|
||||||
<div></div>
|
})
|
||||||
<script>
|
</script>
|
||||||
const div = document.querySelector('div')
|
</body>
|
||||||
window.__TAURI__.event.listen('message', event => {
|
|
||||||
const p = document.createElement('p')
|
|
||||||
p.innerHTML = event.payload
|
|
||||||
div.appendChild(p)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "yarn package",
|
"beforeDevCommand": "yarn package",
|
||||||
"beforeBuildCommand": "yarn package",
|
"beforeBuildCommand": "yarn package",
|
||||||
"withGlobalTauri": true
|
"withGlobalTauri": true
|
||||||
|
@ -8,7 +8,7 @@ module.exports = {
|
|||||||
terminal: false
|
terminal: false
|
||||||
})
|
})
|
||||||
|
|
||||||
rl.on('line', function(line){
|
rl.on('line', function (line) {
|
||||||
cb(line)
|
cb(line)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
const { write, onMessage } = require('./communication')
|
const { write, onMessage } = require('./communication')
|
||||||
|
|
||||||
onMessage(line => {
|
onMessage((line) => {
|
||||||
write(`read ${line}`)
|
write(`read ${line}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
write(`[${new Date().toLocaleTimeString()}] new message`)
|
write(`[${new Date().toLocaleTimeString()}] new message`)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
24
examples/splashscreen/dist/index.html
vendored
24
examples/splashscreen/dist/index.html
vendored
@ -1,16 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<body>
|
||||||
<body>
|
<h1>This is the main window!</h1>
|
||||||
<h1>This is the main window!</h1>
|
<script>
|
||||||
<script>
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
// we delay here just so we can see the splashscreen for a while
|
||||||
// we delay here just so we can see the splashscreen for a while
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
window.__TAURI__.invoke('close_splashscreen')
|
||||||
window.__TAURI__.invoke('close_splashscreen')
|
}, 2000)
|
||||||
}, 2000)
|
})
|
||||||
})
|
</script>
|
||||||
</script>
|
</body>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
46
examples/splashscreen/dist/splashscreen.html
vendored
46
examples/splashscreen/dist/splashscreen.html
vendored
@ -1,28 +1,26 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Splashscreen</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
<head>
|
.splashscreen-image {
|
||||||
<title>Splashscreen</title>
|
background-color: #444;
|
||||||
<style>
|
background-image: url('icon.png');
|
||||||
body {
|
background-position: center;
|
||||||
margin: 0;
|
background-repeat: no-repeat;
|
||||||
}
|
background-size: 50%;
|
||||||
|
width: 100vw !important;
|
||||||
|
height: 100vh !important;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
.splashscreen-image {
|
<body>
|
||||||
background-color: #444;
|
<div class="splashscreen-image" />
|
||||||
background-image: url('icon.png');
|
</body>
|
||||||
background-position: center;
|
</html>
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 50%;
|
|
||||||
width: 100vw !important;
|
|
||||||
height: 100vh !important;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="splashscreen-image" />
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
@ -48,4 +48,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,57 +1,65 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<h3>Counter</h3>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<div>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<button id="increment-btn">Increment counter</button>
|
||||||
<title>Tauri</title>
|
</div>
|
||||||
</head>
|
<h3>Database</h3>
|
||||||
|
<div>
|
||||||
|
<input id="store-input" placeholder="The value to store" />
|
||||||
|
<button id="store-btn">Store</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button id="read-btn">Read</button>
|
||||||
|
</div>
|
||||||
|
<div id="response"></div>
|
||||||
|
|
||||||
<body>
|
<script>
|
||||||
<h3>Counter</h3>
|
const KEY = 'db-key'
|
||||||
<div>
|
const storeBtn = document.querySelector('#store-btn')
|
||||||
<button id="increment-btn">Increment counter</button>
|
const readBtn = document.querySelector('#read-btn')
|
||||||
</div>
|
const incrementBtn = document.querySelector('#increment-btn')
|
||||||
<h3>Database</h3>
|
const storeInput = document.querySelector('#store-input')
|
||||||
<div>
|
const responseContainer = document.querySelector('#response')
|
||||||
<input id="store-input" placeholder="The value to store">
|
|
||||||
<button id="store-btn">Store</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button id="read-btn">Read</button>
|
|
||||||
</div>
|
|
||||||
<div id="response"></div>
|
|
||||||
|
|
||||||
<script>
|
function updateResponse(response) {
|
||||||
const KEY = 'db-key'
|
responseContainer.innerHTML =
|
||||||
const storeBtn = document.querySelector('#store-btn')
|
typeof response === 'string' ? response : JSON.stringify(response)
|
||||||
const readBtn = document.querySelector('#read-btn')
|
}
|
||||||
const incrementBtn = document.querySelector('#increment-btn')
|
|
||||||
const storeInput = document.querySelector('#store-input')
|
|
||||||
const responseContainer = document.querySelector('#response')
|
|
||||||
|
|
||||||
function updateResponse(response) {
|
incrementBtn.addEventListener('click', () => {
|
||||||
responseContainer.innerHTML = typeof response === "string" ? response : JSON.stringify(response)
|
window.__TAURI__
|
||||||
}
|
.invoke('increment_counter')
|
||||||
|
.then(updateResponse)
|
||||||
|
.catch(updateResponse)
|
||||||
|
})
|
||||||
|
|
||||||
incrementBtn.addEventListener('click', () => {
|
storeBtn.addEventListener('click', () => {
|
||||||
window.__TAURI__.invoke('increment_counter').then(updateResponse).catch(updateResponse)
|
window.__TAURI__
|
||||||
})
|
.invoke('db_insert', {
|
||||||
|
key: KEY,
|
||||||
storeBtn.addEventListener('click', () => {
|
value: storeInput.value
|
||||||
window.__TAURI__.invoke('db_insert', {
|
})
|
||||||
key: KEY,
|
.then(updateResponse)
|
||||||
value: storeInput.value
|
.catch(updateResponse)
|
||||||
}).then(updateResponse).catch(updateResponse)
|
})
|
||||||
})
|
|
||||||
|
|
||||||
readBtn.addEventListener('click', () => {
|
|
||||||
window.__TAURI__.invoke('db_read', {
|
|
||||||
key: KEY
|
|
||||||
}).then(updateResponse).catch(updateResponse)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
readBtn.addEventListener('click', () => {
|
||||||
|
window.__TAURI__
|
||||||
|
.invoke('db_read', {
|
||||||
|
key: KEY
|
||||||
|
})
|
||||||
|
.then(updateResponse)
|
||||||
|
.catch(updateResponse)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "",
|
"beforeDevCommand": "",
|
||||||
"beforeBuildCommand": "",
|
"beforeBuildCommand": "",
|
||||||
"withGlobalTauri": true
|
"withGlobalTauri": true
|
||||||
@ -58,4 +54,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": [
|
"distDir": ["../index.html"],
|
||||||
"../index.html"
|
"devPath": ["../index.html"],
|
||||||
],
|
|
||||||
"devPath": [
|
|
||||||
"../index.html"
|
|
||||||
],
|
|
||||||
"beforeDevCommand": "",
|
"beforeDevCommand": "",
|
||||||
"beforeBuildCommand": ""
|
"beforeBuildCommand": ""
|
||||||
},
|
},
|
||||||
@ -62,4 +58,4 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"directory": "tooling/cli.js"
|
"directory": "tooling/cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||||
"postinstall": "husky install"
|
"postinstall": "husky install"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,31 +1,20 @@
|
|||||||
{
|
{
|
||||||
"extends": [
|
"extends": ["config:base"],
|
||||||
"config:base"
|
|
||||||
],
|
|
||||||
"schedule": "after 3am on Wednesday",
|
"schedule": "after 3am on Wednesday",
|
||||||
"ignorePaths": [],
|
"ignorePaths": [],
|
||||||
"labels": [
|
"labels": ["chore"],
|
||||||
"chore"
|
"enabledManagers": ["cargo", "npm"],
|
||||||
],
|
|
||||||
"enabledManagers": [
|
|
||||||
"cargo",
|
|
||||||
"npm"
|
|
||||||
],
|
|
||||||
"cargo": {
|
"cargo": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"packagePatterns": [
|
"packagePatterns": ["*"],
|
||||||
"*"
|
|
||||||
],
|
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["core/tauri/**"],
|
||||||
"core/tauri/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri Core",
|
"groupName": "Tauri Core",
|
||||||
"groupSlug": "allTauriCore",
|
"groupSlug": "allTauriCore",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -36,9 +25,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["core/tauri-build/**"],
|
||||||
"core/tauri-build/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri Build",
|
"groupName": "Tauri Build",
|
||||||
"groupSlug": "allTauriBuild",
|
"groupSlug": "allTauriBuild",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -49,9 +36,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["core/tauri-codegen/**"],
|
||||||
"core/tauri-codegen/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri Codegen",
|
"groupName": "Tauri Codegen",
|
||||||
"groupSlug": "allTauriCodegen",
|
"groupSlug": "allTauriCodegen",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -62,9 +47,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["core/tauri-macros/**"],
|
||||||
"core/tauri-macros/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri Macros",
|
"groupName": "Tauri Macros",
|
||||||
"groupSlug": "allTauriMacros",
|
"groupSlug": "allTauriMacros",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -75,9 +58,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["core/tauri-utils/**"],
|
||||||
"core/tauri-utils/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri Utils",
|
"groupName": "Tauri Utils",
|
||||||
"groupSlug": "allTauriUtils",
|
"groupSlug": "allTauriUtils",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -88,9 +69,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["tooling/cli.rs/**"],
|
||||||
"tooling/cli.rs/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri CLI",
|
"groupName": "Tauri CLI",
|
||||||
"groupSlug": "allTauriCLI",
|
"groupSlug": "allTauriCLI",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -101,9 +80,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["tooling/bundler/**"],
|
||||||
"tooling/bundler/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri Bundler",
|
"groupName": "Tauri Bundler",
|
||||||
"groupSlug": "allTauriBundler",
|
"groupSlug": "allTauriBundler",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -114,9 +91,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["tooling/cli.js/**"],
|
||||||
"tooling/cli.js/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri JS CLI",
|
"groupName": "Tauri JS CLI",
|
||||||
"groupSlug": "allTauriJSCLI",
|
"groupSlug": "allTauriJSCLI",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -127,9 +102,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["tooling/api/**"],
|
||||||
"tooling/api/**"
|
|
||||||
],
|
|
||||||
"groupName": "Tauri API Definitions",
|
"groupName": "Tauri API Definitions",
|
||||||
"groupSlug": "allTauriAPIDefinitions",
|
"groupSlug": "allTauriAPIDefinitions",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
@ -140,9 +113,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": [
|
"paths": ["tooling/create-tauri-app/**"],
|
||||||
"tooling/create-tauri-app/**"
|
|
||||||
],
|
|
||||||
"groupName": "create-tauri-app",
|
"groupName": "create-tauri-app",
|
||||||
"groupSlug": "allCTA",
|
"groupSlug": "allCTA",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
||||||
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
||||||
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
||||||
"format": "prettier --write --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||||
"format:check": "prettier --check --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore"
|
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -41,9 +41,7 @@ writeFileSync('dist/package.json', JSON.stringify(outputPkg, undefined, 2))
|
|||||||
/**
|
/**
|
||||||
* copy necessary files like `CHANGELOG.md` and Licenses to `./dist`
|
* copy necessary files like `CHANGELOG.md` and Licenses to `./dist`
|
||||||
*/
|
*/
|
||||||
const files = readdirSync('.').filter(
|
const files = readdirSync('.').filter((f) => f.startsWith('LICENSE'))
|
||||||
(f) => f.startsWith('LICENSE')
|
|
||||||
)
|
|
||||||
files.forEach((f) => copyFileSync(f, `dist/${f}`))
|
files.forEach((f) => copyFileSync(f, `dist/${f}`))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
|
||||||
Arial, sans-serif;
|
Arial, sans-serif;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
max-width: 38rem;
|
max-width: 38rem;
|
||||||
|
@ -1,59 +1,59 @@
|
|||||||
// Create web worker
|
// Create web worker
|
||||||
const THRESHOLD = 10000000;
|
const THRESHOLD = 10000000
|
||||||
const worker = new Worker("worker.js");
|
const worker = new Worker('worker.js')
|
||||||
/** @type {HTMLButtonElement} */
|
/** @type {HTMLButtonElement} */
|
||||||
const start = document.getElementById("start");
|
const start = document.getElementById('start')
|
||||||
/** @type {HTMLParagraphElement} */
|
/** @type {HTMLParagraphElement} */
|
||||||
const status = document.getElementById("status");
|
const status = document.getElementById('status')
|
||||||
const results = document.getElementById("results");
|
const results = document.getElementById('results')
|
||||||
|
|
||||||
const ITERATIONS = 1;
|
const ITERATIONS = 1
|
||||||
|
|
||||||
let resolver;
|
let resolver
|
||||||
|
|
||||||
const onMessage = (message) => {
|
const onMessage = (message) => {
|
||||||
// Update the UI
|
// Update the UI
|
||||||
let prefix = "[Calculating]";
|
let prefix = '[Calculating]'
|
||||||
|
|
||||||
if (message.data.status === "done") {
|
if (message.data.status === 'done') {
|
||||||
// tell tauri that we are done
|
// tell tauri that we are done
|
||||||
window.__TAURI__.invoke("tauri", {
|
window.__TAURI__.invoke('tauri', {
|
||||||
__tauriModule: "Process",
|
__tauriModule: 'Process',
|
||||||
message: {
|
message: {
|
||||||
cmd: "exit",
|
cmd: 'exit',
|
||||||
exitCode: 0,
|
exitCode: 0
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
status.innerHTML = `${prefix} Found <code>${message.data.count}</code> prime numbers in <code>${message.data.time}ms</code>`;
|
status.innerHTML = `${prefix} Found <code>${message.data.count}</code> prime numbers in <code>${message.data.time}ms</code>`
|
||||||
|
|
||||||
if (message.data.status === "done") {
|
if (message.data.status === 'done') {
|
||||||
resolver(message.data.time);
|
resolver(message.data.time)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
worker.addEventListener("message", onMessage);
|
worker.addEventListener('message', onMessage)
|
||||||
|
|
||||||
const benchmark = () => {
|
const benchmark = () => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now()
|
||||||
resolver = resolve;
|
resolver = resolve
|
||||||
worker.postMessage({ value: THRESHOLD, startTime });
|
worker.postMessage({ value: THRESHOLD, startTime })
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
const calculate = async () => {
|
const calculate = async () => {
|
||||||
let total = 0;
|
let total = 0
|
||||||
|
|
||||||
for (let i = 0; i < ITERATIONS; i++) {
|
for (let i = 0; i < ITERATIONS; i++) {
|
||||||
const result = await benchmark();
|
const result = await benchmark()
|
||||||
total += result;
|
total += result
|
||||||
}
|
}
|
||||||
|
|
||||||
const average = total / ITERATIONS;
|
const average = total / ITERATIONS
|
||||||
|
|
||||||
results.innerText = `Average time: ${average}ms`;
|
results.innerText = `Average time: ${average}ms`
|
||||||
};
|
}
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", calculate);
|
window.addEventListener('DOMContentLoaded', calculate)
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
const isPrime = (number) => {
|
const isPrime = (number) => {
|
||||||
if (number % 2 === 0 && number > 2) {
|
if (number % 2 === 0 && number > 2) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
let start = 2;
|
let start = 2
|
||||||
const limit = Math.sqrt(number);
|
const limit = Math.sqrt(number)
|
||||||
while (start <= limit) {
|
while (start <= limit) {
|
||||||
if (number % start++ < 1) {
|
if (number % start++ < 1) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return number > 1;
|
return number > 1
|
||||||
};
|
}
|
||||||
|
|
||||||
addEventListener("message", (e) => {
|
addEventListener('message', (e) => {
|
||||||
const { startTime } = e.data;
|
const { startTime } = e.data
|
||||||
|
|
||||||
let n = 0;
|
let n = 0
|
||||||
let total = 0;
|
let total = 0
|
||||||
const THRESHOLD = e.data.value;
|
const THRESHOLD = e.data.value
|
||||||
const primes = [];
|
const primes = []
|
||||||
|
|
||||||
let previous = startTime;
|
let previous = startTime
|
||||||
|
|
||||||
while (++n <= THRESHOLD) {
|
while (++n <= THRESHOLD) {
|
||||||
if (isPrime(n)) {
|
if (isPrime(n)) {
|
||||||
primes.push(n);
|
primes.push(n)
|
||||||
total++;
|
total++
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now()
|
||||||
|
|
||||||
if (now - previous > 250) {
|
if (now - previous > 250) {
|
||||||
previous = now;
|
previous = now
|
||||||
postMessage({
|
postMessage({
|
||||||
status: "calculating",
|
status: 'calculating',
|
||||||
count: total,
|
count: total,
|
||||||
time: Date.now() - startTime,
|
time: Date.now() - startTime
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postMessage({ status: "done", count: total, time: Date.now() - startTime });
|
postMessage({ status: 'done', count: total, time: Date.now() - startTime })
|
||||||
});
|
})
|
||||||
|
@ -54,4 +54,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,39 +10,39 @@
|
|||||||
<h1>Welcome to Tauri!</h1>
|
<h1>Welcome to Tauri!</h1>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("DOMContentLoaded", (event) => {
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
window.__TAURI__
|
window.__TAURI__
|
||||||
.invoke("tauri", {
|
.invoke('tauri', {
|
||||||
__tauriModule: "Fs",
|
__tauriModule: 'Fs',
|
||||||
message: {
|
message: {
|
||||||
cmd: "readBinaryFile",
|
cmd: 'readBinaryFile',
|
||||||
path: ".tauri_3mb.json",
|
path: '.tauri_3mb.json',
|
||||||
options: {
|
options: {
|
||||||
// home folder
|
// home folder
|
||||||
dir: 11,
|
dir: 11
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
.then((_data) => {
|
.then((_data) => {
|
||||||
window.__TAURI__.invoke("tauri", {
|
window.__TAURI__.invoke('tauri', {
|
||||||
__tauriModule: "Process",
|
__tauriModule: 'Process',
|
||||||
message: {
|
message: {
|
||||||
cmd: "exit",
|
cmd: 'exit',
|
||||||
exitCode: 0,
|
exitCode: 0
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch((_error) => {
|
.catch((_error) => {
|
||||||
// error
|
// error
|
||||||
window.__TAURI__.invoke("tauri", {
|
window.__TAURI__.invoke('tauri', {
|
||||||
__tauriModule: "Process",
|
__tauriModule: 'Process',
|
||||||
message: {
|
message: {
|
||||||
cmd: "exit",
|
cmd: 'exit',
|
||||||
exitCode: 1,
|
exitCode: 1
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -57,4 +57,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,15 +10,15 @@
|
|||||||
<h1>Welcome to Tauri!</h1>
|
<h1>Welcome to Tauri!</h1>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("DOMContentLoaded", (event) => {
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
window.__TAURI__.invoke("tauri", {
|
window.__TAURI__.invoke('tauri', {
|
||||||
__tauriModule: "Process",
|
__tauriModule: 'Process',
|
||||||
message: {
|
message: {
|
||||||
cmd: "exit",
|
cmd: 'exit',
|
||||||
exitCode: 0,
|
exitCode: 0
|
||||||
},
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -54,4 +54,4 @@
|
|||||||
"active": false
|
"active": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
||||||
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
||||||
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
||||||
"format": "prettier --write --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||||
"format:check": "prettier --check --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore"
|
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -228,17 +228,11 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"beforeBuildCommand": {
|
"beforeBuildCommand": {
|
||||||
"description": "a shell command to run before `tauri build` kicks in",
|
"description": "a shell command to run before `tauri build` kicks in",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"beforeDevCommand": {
|
"beforeDevCommand": {
|
||||||
"description": "a shell command to run before `tauri dev` kicks in",
|
"description": "a shell command to run before `tauri dev` kicks in",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"devPath": {
|
"devPath": {
|
||||||
"description": "The path or URL to use on development.",
|
"description": "The path or URL to use on development.",
|
||||||
@ -260,20 +254,14 @@
|
|||||||
},
|
},
|
||||||
"features": {
|
"features": {
|
||||||
"description": "features passed to `cargo` commands",
|
"description": "features passed to `cargo` commands",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runner": {
|
"runner": {
|
||||||
"description": "The binary used to build and run the application.",
|
"description": "The binary used to build and run the application.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"withGlobalTauri": {
|
"withGlobalTauri": {
|
||||||
"description": "Whether we should inject the Tauri API on `window.__TAURI__` or not.",
|
"description": "Whether we should inject the Tauri API on `window.__TAURI__` or not.",
|
||||||
@ -292,16 +280,10 @@
|
|||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"category": {
|
"category": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"copyright": {
|
"copyright": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"deb": {
|
"deb": {
|
||||||
"default": {
|
"default": {
|
||||||
@ -315,36 +297,24 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"externalBin": {
|
"externalBin": {
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"icon": {
|
"icon": {
|
||||||
"description": "The app's icons",
|
"description": "The app's icons",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"identifier": {
|
"identifier": {
|
||||||
"description": "The app's identifier",
|
"description": "The app's identifier",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"longDescription": {
|
"longDescription": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"macOS": {
|
"macOS": {
|
||||||
"default": {
|
"default": {
|
||||||
@ -358,19 +328,13 @@
|
|||||||
},
|
},
|
||||||
"resources": {
|
"resources": {
|
||||||
"description": "App resources to bundle. Each resource is a path to a file or directory. Glob patterns are supported.",
|
"description": "App resources to bundle. Each resource is a path to a file or directory. Glob patterns are supported.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"targets": {
|
"targets": {
|
||||||
"description": "The bundle targets, currently supports [\"deb\", \"app\", \"msi\", \"appimage\", \"dmg\"] or \"all\"",
|
"description": "The bundle targets, currently supports [\"deb\", \"app\", \"msi\", \"appimage\", \"dmg\"] or \"all\"",
|
||||||
@ -415,197 +379,129 @@
|
|||||||
"CliArg": {
|
"CliArg": {
|
||||||
"description": "A CLI argument definition",
|
"description": "A CLI argument definition",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": ["name"],
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"conflictsWith": {
|
"conflictsWith": {
|
||||||
"description": "Sets a conflicting argument by name i.e. when using this argument, the following argument can't be present and vice versa.",
|
"description": "Sets a conflicting argument by name i.e. when using this argument, the following argument can't be present and vice versa.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"conflictsWithAll": {
|
"conflictsWithAll": {
|
||||||
"description": "The same as conflictsWith but allows specifying multiple two-way conflicts per argument.",
|
"description": "The same as conflictsWith but allows specifying multiple two-way conflicts per argument.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"description": "The argument description which will be shown on the help information. Typically, this is a short (one line) description of the arg.",
|
"description": "The argument description which will be shown on the help information. Typically, this is a short (one line) description of the arg.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"index": {
|
"index": {
|
||||||
"description": "The positional argument index, starting at 1.\n\nThe index refers to position according to other positional argument. It does not define position in the argument list as a whole. When utilized with multiple=true, only the last positional argument may be defined as multiple (i.e. the one with the highest index).",
|
"description": "The positional argument index, starting at 1.\n\nThe index refers to position according to other positional argument. It does not define position in the argument list as a whole. When utilized with multiple=true, only the last positional argument may be defined as multiple (i.e. the one with the highest index).",
|
||||||
"type": [
|
"type": ["integer", "null"],
|
||||||
"integer",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "uint64",
|
"format": "uint64",
|
||||||
"minimum": 0.0
|
"minimum": 0.0
|
||||||
},
|
},
|
||||||
"longDescription": {
|
"longDescription": {
|
||||||
"description": "The argument long description which will be shown on the help information. Typically this a more detailed (multi-line) message that describes the argument.",
|
"description": "The argument long description which will be shown on the help information. Typically this a more detailed (multi-line) message that describes the argument.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"maxValues": {
|
"maxValues": {
|
||||||
"description": "Specifies the maximum number of values are for this argument. For example, if you had a -f <file> argument where you wanted up to 3 'files', you would set .max_values(3), and this argument would be satisfied if the user provided, 1, 2, or 3 values.",
|
"description": "Specifies the maximum number of values are for this argument. For example, if you had a -f <file> argument where you wanted up to 3 'files', you would set .max_values(3), and this argument would be satisfied if the user provided, 1, 2, or 3 values.",
|
||||||
"type": [
|
"type": ["integer", "null"],
|
||||||
"integer",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "uint64",
|
"format": "uint64",
|
||||||
"minimum": 0.0
|
"minimum": 0.0
|
||||||
},
|
},
|
||||||
"minValues": {
|
"minValues": {
|
||||||
"description": "Specifies the minimum number of values for this argument. For example, if you had a -f <file> argument where you wanted at least 2 'files', you would set `minValues: 2`, and this argument would be satisfied if the user provided, 2 or more values.",
|
"description": "Specifies the minimum number of values for this argument. For example, if you had a -f <file> argument where you wanted at least 2 'files', you would set `minValues: 2`, and this argument would be satisfied if the user provided, 2 or more values.",
|
||||||
"type": [
|
"type": ["integer", "null"],
|
||||||
"integer",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "uint64",
|
"format": "uint64",
|
||||||
"minimum": 0.0
|
"minimum": 0.0
|
||||||
},
|
},
|
||||||
"multiple": {
|
"multiple": {
|
||||||
"description": "Specifies that the argument may appear more than once.\n\n- For flags, this results in the number of occurrences of the flag being recorded. For example -ddd or -d -d -d would count as three occurrences. - For options there is a distinct difference in multiple occurrences vs multiple values. For example, --opt val1 val2 is one occurrence, but two values. Whereas --opt val1 --opt val2 is two occurrences.",
|
"description": "Specifies that the argument may appear more than once.\n\n- For flags, this results in the number of occurrences of the flag being recorded. For example -ddd or -d -d -d would count as three occurrences. - For options there is a distinct difference in multiple occurrences vs multiple values. For example, --opt val1 val2 is one occurrence, but two values. Whereas --opt val1 --opt val2 is two occurrences.",
|
||||||
"type": [
|
"type": ["boolean", "null"]
|
||||||
"boolean",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"multipleOccurrences": {
|
"multipleOccurrences": {
|
||||||
"description": "specifies that the argument may appear more than once.",
|
"description": "specifies that the argument may appear more than once.",
|
||||||
"type": [
|
"type": ["boolean", "null"]
|
||||||
"boolean",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"description": "The unique argument name",
|
"description": "The unique argument name",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"numberOfValues": {
|
"numberOfValues": {
|
||||||
"type": [
|
"type": ["integer", "null"],
|
||||||
"integer",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "uint64",
|
"format": "uint64",
|
||||||
"minimum": 0.0
|
"minimum": 0.0
|
||||||
},
|
},
|
||||||
"possibleValues": {
|
"possibleValues": {
|
||||||
"description": "Specifies a list of possible values for this argument. At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.",
|
"description": "Specifies a list of possible values for this argument. At runtime, the CLI verifies that only one of the specified values was used, or fails with an error message.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requireEquals": {
|
"requireEquals": {
|
||||||
"description": "Requires that options use the --option=val syntax i.e. an equals between the option and associated value.",
|
"description": "Requires that options use the --option=val syntax i.e. an equals between the option and associated value.",
|
||||||
"type": [
|
"type": ["boolean", "null"]
|
||||||
"boolean",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"required": {
|
"required": {
|
||||||
"description": "Sets whether or not the argument is required by default.\n\n- Required by default means it is required, when no other conflicting rules have been evaluated - Conflicting rules take precedence over being required.",
|
"description": "Sets whether or not the argument is required by default.\n\n- Required by default means it is required, when no other conflicting rules have been evaluated - Conflicting rules take precedence over being required.",
|
||||||
"type": [
|
"type": ["boolean", "null"]
|
||||||
"boolean",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"requiredIfEq": {
|
"requiredIfEq": {
|
||||||
"description": "Allows specifying that an argument is required conditionally with the signature [arg, value] the requirement will only become valid if the `arg`'s value equals `${value}`.",
|
"description": "Allows specifying that an argument is required conditionally with the signature [arg, value] the requirement will only become valid if the `arg`'s value equals `${value}`.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiredUnlessPresent": {
|
"requiredUnlessPresent": {
|
||||||
"description": "Sets an arg that override this arg's required setting i.e. this arg will be required unless this other argument is present.",
|
"description": "Sets an arg that override this arg's required setting i.e. this arg will be required unless this other argument is present.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"requiredUnlessPresentAll": {
|
"requiredUnlessPresentAll": {
|
||||||
"description": "Sets args that override this arg's required setting i.e. this arg will be required unless all these other arguments are present.",
|
"description": "Sets args that override this arg's required setting i.e. this arg will be required unless all these other arguments are present.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiredUnlessPresentAny": {
|
"requiredUnlessPresentAny": {
|
||||||
"description": "Sets args that override this arg's required setting i.e. this arg will be required unless at least one of these other arguments are present.",
|
"description": "Sets args that override this arg's required setting i.e. this arg will be required unless at least one of these other arguments are present.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requires": {
|
"requires": {
|
||||||
"description": "Tets an argument by name that is required when this one is present i.e. when using this argument, the following argument must be present.",
|
"description": "Tets an argument by name that is required when this one is present i.e. when using this argument, the following argument must be present.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"requiresAll": {
|
"requiresAll": {
|
||||||
"description": "Sts multiple arguments by names that are required when this one is present i.e. when using this argument, the following arguments must be present.",
|
"description": "Sts multiple arguments by names that are required when this one is present i.e. when using this argument, the following arguments must be present.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiresIf": {
|
"requiresIf": {
|
||||||
"description": "Allows a conditional requirement with the signature [arg, value] the requirement will only become valid if `arg`'s value equals `${value}`.",
|
"description": "Allows a conditional requirement with the signature [arg, value] the requirement will only become valid if `arg`'s value equals `${value}`.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"short": {
|
"short": {
|
||||||
"description": "The short version of the argument, without the preceding -.\n\nNOTE: Any leading - characters will be stripped, and only the first non - character will be used as the short version.",
|
"description": "The short version of the argument, without the preceding -.\n\nNOTE: Any leading - characters will be stripped, and only the first non - character will be used as the short version.",
|
||||||
"type": [
|
"type": ["string", "null"],
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"maxLength": 1,
|
"maxLength": 1,
|
||||||
"minLength": 1
|
"minLength": 1
|
||||||
},
|
},
|
||||||
"takesValue": {
|
"takesValue": {
|
||||||
"description": "Specifies that the argument takes a value at run time.\n\nNOTE: values for arguments may be specified in any of the following methods - Using a space such as -o value or --option value - Using an equals and no space such as -o=value or --option=value - Use a short and no space such as -ovalue",
|
"description": "Specifies that the argument takes a value at run time.\n\nNOTE: values for arguments may be specified in any of the following methods - Using a space such as -o value or --option value - Using an equals and no space such as -o=value or --option=value - Use a short and no space such as -ovalue",
|
||||||
"type": [
|
"type": ["boolean", "null"]
|
||||||
"boolean",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@ -616,48 +512,30 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"afterHelp": {
|
"afterHelp": {
|
||||||
"description": "adds additional help information to be displayed in addition to auto-generated help this information is displayed after the auto-generated help information this is often used to describe how to use the arguments, or caveats to be noted.",
|
"description": "adds additional help information to be displayed in addition to auto-generated help this information is displayed after the auto-generated help information this is often used to describe how to use the arguments, or caveats to be noted.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"args": {
|
"args": {
|
||||||
"description": "list of args for the command",
|
"description": "list of args for the command",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/CliArg"
|
"$ref": "#/definitions/CliArg"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"beforeHelp": {
|
"beforeHelp": {
|
||||||
"description": "adds additional help information to be displayed in addition to auto-generated help this information is displayed before the auto-generated help information. this is often used for header information",
|
"description": "adds additional help information to be displayed in addition to auto-generated help this information is displayed before the auto-generated help information. this is often used for header information",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"description": "command description which will be shown on the help information",
|
"description": "command description which will be shown on the help information",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"longDescription": {
|
"longDescription": {
|
||||||
"description": "command long description which will be shown on the help information",
|
"description": "command long description which will be shown on the help information",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"subcommands": {
|
"subcommands": {
|
||||||
"description": "list of subcommands of this command.\n\nsubcommands are effectively sub-apps, because they can contain their own arguments, subcommands, usage, etc. they also function just like the app command, in that they get their own auto generated help and usage",
|
"description": "list of subcommands of this command.\n\nsubcommands are effectively sub-apps, because they can contain their own arguments, subcommands, usage, etc. they also function just like the app command, in that they get their own auto generated help and usage",
|
||||||
"type": [
|
"type": ["object", "null"],
|
||||||
"object",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"$ref": "#/definitions/CliConfig"
|
"$ref": "#/definitions/CliConfig"
|
||||||
}
|
}
|
||||||
@ -669,10 +547,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"depends": {
|
"depends": {
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@ -791,43 +666,25 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"entitlements": {
|
"entitlements": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"exceptionDomain": {
|
"exceptionDomain": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"minimumSystemVersion": {
|
"minimumSystemVersion": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"signingIdentity": {
|
"signingIdentity": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"useBootstrapper": {
|
"useBootstrapper": {
|
||||||
"default": false,
|
"default": false,
|
||||||
@ -851,17 +708,11 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"productName": {
|
"productName": {
|
||||||
"description": "App name. Automatically converted to kebab-case on Linux.",
|
"description": "App name. Automatically converted to kebab-case on Linux.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"description": "App version.",
|
"description": "App version.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@ -870,10 +721,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"csp": {
|
"csp": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@ -898,9 +746,7 @@
|
|||||||
},
|
},
|
||||||
"SystemTrayConfig": {
|
"SystemTrayConfig": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": ["iconPath"],
|
||||||
"iconPath"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"iconPath": {
|
"iconPath": {
|
||||||
"description": "Path to the icon to use on the system tray.\n\nIt is forced to be a `.png` file on Linux and macOS, and a `.ico` file on Windows.",
|
"description": "Path to the icon to use on the system tray.\n\nIt is forced to be a `.png` file on Linux and macOS, and a `.ico` file on Windows.",
|
||||||
@ -1051,27 +897,18 @@
|
|||||||
"dialog": {
|
"dialog": {
|
||||||
"description": "Display built-in dialog or use event system if disabled.",
|
"description": "Display built-in dialog or use event system if disabled.",
|
||||||
"default": true,
|
"default": true,
|
||||||
"type": [
|
"type": ["boolean", "null"]
|
||||||
"boolean",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"endpoints": {
|
"endpoints": {
|
||||||
"description": "The updater endpoints.",
|
"description": "The updater endpoints.",
|
||||||
"type": [
|
"type": ["array", "null"],
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pubkey": {
|
"pubkey": {
|
||||||
"description": "Optional pubkey.",
|
"description": "Optional pubkey.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@ -1116,33 +953,21 @@
|
|||||||
},
|
},
|
||||||
"height": {
|
"height": {
|
||||||
"description": "The window height.",
|
"description": "The window height.",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"label": {
|
"label": {
|
||||||
"description": "The window identifier.",
|
"description": "The window identifier.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"maxHeight": {
|
"maxHeight": {
|
||||||
"description": "The max window height.",
|
"description": "The max window height.",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"maxWidth": {
|
"maxWidth": {
|
||||||
"description": "The max window width.",
|
"description": "The max window width.",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"maximized": {
|
"maximized": {
|
||||||
@ -1152,18 +977,12 @@
|
|||||||
},
|
},
|
||||||
"minHeight": {
|
"minHeight": {
|
||||||
"description": "The min window height.",
|
"description": "The min window height.",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"minWidth": {
|
"minWidth": {
|
||||||
"description": "The min window width.",
|
"description": "The min window width.",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"resizable": {
|
"resizable": {
|
||||||
@ -1173,10 +992,7 @@
|
|||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"description": "The window title.",
|
"description": "The window title.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"transparent": {
|
"transparent": {
|
||||||
"description": "Whether the window is transparent or not.",
|
"description": "Whether the window is transparent or not.",
|
||||||
@ -1185,10 +1001,7 @@
|
|||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"description": "The window webview URL.",
|
"description": "The window webview URL.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"visible": {
|
"visible": {
|
||||||
"description": "Whether the window is visible or not.",
|
"description": "Whether the window is visible or not.",
|
||||||
@ -1197,26 +1010,17 @@
|
|||||||
},
|
},
|
||||||
"width": {
|
"width": {
|
||||||
"description": "The window width.",
|
"description": "The window width.",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"x": {
|
"x": {
|
||||||
"description": "The horizontal position of the window's top left corner",
|
"description": "The horizontal position of the window's top left corner",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
"y": {
|
"y": {
|
||||||
"description": "The vertical position of the window's top left corner",
|
"description": "The vertical position of the window's top left corner",
|
||||||
"type": [
|
"type": ["number", "null"],
|
||||||
"number",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"format": "double"
|
"format": "double"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1226,22 +1030,13 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"certificateThumbprint": {
|
"certificateThumbprint": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"digestAlgorithm": {
|
"digestAlgorithm": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"timestampUrl": {
|
"timestampUrl": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"wix": {
|
"wix": {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
@ -1301,10 +1096,7 @@
|
|||||||
},
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"description": "Path to the license file.",
|
"description": "Path to the license file.",
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"mergeRefs": {
|
"mergeRefs": {
|
||||||
"default": [],
|
"default": [],
|
||||||
@ -1318,13 +1110,10 @@
|
|||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"template": {
|
"template": {
|
||||||
"type": [
|
"type": ["string", "null"]
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
||||||
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
||||||
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
||||||
"format": "prettier --write --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||||
"format:check": "prettier --check --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||||
"test": "jest --runInBand"
|
"test": "jest --runInBand"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user