├── icon.png
├── postcss.config.js
├── .gitignore
├── typings
├── index.d.ts
├── editorManager.d.ts
└── acode.d.ts
├── plugin.json
├── .babelrc
├── src
├── style.scss
└── main.ts
├── tsconfig.json
├── .vscode
├── run-webpack.js
├── server.crt
├── start-dev.js
├── server.key
├── getNet.js
├── pack-zip.js
└── start-server.js
├── readme.md
├── package.json
└── webpack.config.js
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coswat/acode-theme-breeze/HEAD/icon.png
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [
3 | require('autoprefixer')({})
4 | ]
5 | };
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Skipping junk files to repository
2 | node_modules
3 | package-lock.json
4 | yarn.lock
5 | dist.zip
6 | dist
--------------------------------------------------------------------------------
/typings/index.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | declare global {
4 | interface Window {
5 | toast(message: string, duration: number): void;
6 | }
7 | }
8 | export {};
--------------------------------------------------------------------------------
/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "coswat.theme.breeze",
3 | "name": "Theme Breeze",
4 | "main": "dist/main.js",
5 | "version": "1.0.0",
6 | "readme": "readme.md",
7 | "minVersionCode": 289,
8 | "icon": "icon.png",
9 | "files": [],
10 | "author": {
11 | "name": "coderswat",
12 | "email": "abhishek.b4696@gmail.com",
13 | "github": "coswat"
14 | }
15 | }
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-env"
4 | ],
5 | "env": {
6 | "test": {
7 | "presets": [
8 | "@babel/env"
9 | ]
10 | }
11 | },
12 | "plugins": [
13 | "html-tag-js/jsx/jsx-to-tag.js",
14 | "html-tag-js/jsx/syntax-parser.js",
15 | [
16 | "@babel/plugin-transform-runtime"
17 | ]
18 | ],
19 | "compact": true
20 | }
--------------------------------------------------------------------------------
/src/style.scss:
--------------------------------------------------------------------------------
1 | // change the default bg color of one dark pro theme
2 | .ace-one-dark-pro {
3 | background-color: #131313 !important;
4 | }
5 | // change the default bg color of github dark theme
6 | .ace-github-dark {
7 | background-color: #131313 !important;
8 | }
9 | // change the default bg color of ayu mirage theme
10 | .ace-ayu-mirage {
11 | background-color: #131313 !important;
12 | }
13 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2016",
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "resolveJsonModule": true,
7 | "allowJs": true,
8 | "outDir": "./dist",
9 | "removeComments": true,
10 | "esModuleInterop": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "strict": true
13 | },
14 | "exclude": [
15 | "./dist/**/*",
16 | "./postcss.config.js"
17 | ]
18 | }
--------------------------------------------------------------------------------
/typings/editorManager.d.ts:
--------------------------------------------------------------------------------
1 | declare var editorManager: EditorManager;
2 |
3 | type FileEvent = "switch-file" | "rename-file" | "save-file" | "file-loaded" | "file-content-changed" | "add-folder" | "remove-folder" | "new-file" | "init-open-file-list" | "update";
4 |
5 | interface EditorManager {
6 | editor: AjaxAce.Editor | null;
7 | getFile(checkFor: string | number, type: "id" | "name" | "uri"): File;
8 | switchFile(id: string): void;
9 | activeFile(): File;
10 | hasUnsavedFiles(): number | null;
11 | files: Array;
12 | container: HTMLElement;
13 | isScrolling: boolean;
14 | on(event: FileEvent, callback: () => void): void;
15 | off(event: FileEvent, callback: () => void): void;
16 | emit(event: FileEvent, ...args): any;
17 | }
--------------------------------------------------------------------------------
/.vscode/run-webpack.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-console */
2 | const { spawn } = require('child_process');
3 | const path = require('path');
4 |
5 | const webpack = spawn('npx.cmd', ['webpack', '--mode=development', '--watch'], { cwd: path.resolve(__dirname, '../') });
6 |
7 | webpack.on('error', (webpackError) => {
8 | if (webpackError) {
9 | console.error(webpackError);
10 | process.exit(1);
11 | }
12 | });
13 |
14 | webpack.stdout.on('data', (chunk) => {
15 | const stdout = chunk.toString();
16 | console.log(stdout);
17 | process.send(stdout);
18 | });
19 |
20 | webpack.stdout.on('error', (error) => {
21 | console.log(error);
22 | });
23 |
24 | webpack.stderr.on('data', (chunk) => {
25 | const stderr = chunk.toString();
26 | console.log(stderr);
27 | });
28 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Theme Breeze
2 |
3 | Theme Breeze is a app theme plugin for Acode app
4 |
5 |
6 |
7 | Select theme: Start using the theme: `Acode > Settings > Themes > Theme Breeze`.
8 |
9 | ## Note
10 |
11 | This theme is optimized with these editor themes
12 |
13 | - One Dark Pro
14 | - Github Dark
15 | - Ayu Mirage
16 |
17 | Use this app theme with any of these editor theme to get the full experience
18 |
19 | ## Extras
20 |
21 | - theme type - dark
22 | - app theme - true
23 | - ace theme id - .ace-breeze
24 | - plugin id - coswat.theme.breeze
25 |
26 | ### Open source:
27 | Want to see the code? click [here](https://github.com/coswat/acode-theme-breeze)
28 | and don't forget the little star!
29 |
30 | ### Report Bugs:
31 | Found bugs? know how to fix report [here!](https://github.com/coswat/acode-theme-breeze/issues)
32 |
33 | > 👾 Thanks for using our plugin!
--------------------------------------------------------------------------------
/.vscode/server.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIICfjCCAecCFGoKwe9jqvLXZUsAKK8R9rBoxQBVMA0GCSqGSIb3DQEBCwUAMH4x
3 | CzAJBgNVBAYTAklOMRMwEQYDVQQIDApBaml0IEt1bWFyMQwwCgYDVQQHDANCU1Ax
4 | DjAMBgNVBAoMBUZYREJHMQwwCgYDVQQLDANERVYxDTALBgNVBAMMBEFqaXQxHzAd
5 | BgkqhkiG9w0BCQEWEG1lQGFqaXRrdW1hci5kZXYwHhcNMjIwODIxMDc0NjI1WhcN
6 | MjMwODIxMDc0NjI1WjB+MQswCQYDVQQGEwJJTjETMBEGA1UECAwKQWppdCBLdW1h
7 | cjEMMAoGA1UEBwwDQlNQMQ4wDAYDVQQKDAVGWERCRzEMMAoGA1UECwwDREVWMQ0w
8 | CwYDVQQDDARBaml0MR8wHQYJKoZIhvcNAQkBFhBtZUBhaml0a3VtYXIuZGV2MIGf
9 | MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClD9GyID1GNGCdsq8vshf2h/tMUzxW
10 | mWqOoBi8ZSUrQGoZJ4vxSk5+kPkSvaZzj4zs+LnUMqIXPu1KSIXflVRXzAvh5VIE
11 | 7M0ithYYbGPSyviUWpatdLCvLCOPXZPTXc+66mY7RnCVzlBqGKOR2H4goeGWq0zG
12 | Q+V3pAM7gLUJsQIDAQABMA0GCSqGSIb3DQEBCwUAA4GBAHpMjw8nYPtJ20jO2i6M
13 | kJg09Hk91g63HEx4noV8WallM80exNYWJgzNI69UIRdh78QAEknJh43TSF61bVpo
14 | i+mtBHzZLyPv4LHKNN+6eBoMxi58tbWVZXQB4awW6d1AstHY10aSygOmOUKLtGxr
15 | lYt6v4QwWrm3j7oNCDRDwxlj
16 | -----END CERTIFICATE-----
17 |
--------------------------------------------------------------------------------
/.vscode/start-dev.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-console */
2 | const { fork, spawn } = require('child_process');
3 | const path = require('path');
4 |
5 | main();
6 |
7 | async function main() {
8 | let serverStarted = false;
9 | console.log('+--------------+');
10 | console.log('| Starting dev |');
11 | console.log('+--------------+');
12 | const webpack = fork(path.resolve(__dirname, './run-webpack.js'));
13 | webpack.on('message', (chunk) => {
14 | if (!serverStarted && chunk.search(/compiled\ssuccessfully/)) {
15 | startServer();
16 | serverStarted = true;
17 | }
18 | });
19 |
20 | webpack.on('error', (err) => {
21 | console.log('WEBPACK ERROR', err);
22 | webpack.kill(1);
23 | process.exit(1);
24 | });
25 | }
26 |
27 | async function startServer() {
28 | const server = fork(path.resolve(__dirname, './start-server.js'));
29 | server.on('error', (err) => {
30 | console.log('SERVER ERROR', err);
31 | server.kill(1);
32 | process.exit(1);
33 | });
34 | }
35 |
--------------------------------------------------------------------------------
/.vscode/server.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | Proc-Type: 4,ENCRYPTED
3 | DEK-Info: DES-EDE3-CBC,F6E1E7807FC07585
4 |
5 | 1RxeEBdxtQ0+Erd+wmDLuaHy07d81+5uqCBZ1FVkzFOReCwDHFvqT9pyo00soIBJ
6 | ECcUOQyVoV7XyQKZVna+XwQJ8WoiF7R0dVeP7q1E8whFhVD+ybnwvCHSe9Zv1DTo
7 | 8R74rrAqRRKOf0aFEt2DR3sO9vdljOQY0JSTOefFisJs++FSDGSMPzyoUjyGzix+
8 | jOcbA9BjPoossVRNSNta9q7IMZRvYnF+mqbeKrlQ7dDV6BBCICJ15syzp0FFZcry
9 | 7Upmstp+HtFphDr1ABaXlbSzPIzj+lYBro4vV4v/FuyGigwzYhiftTzypz0sVV2u
10 | yOSIGkQkNrg+0iaD35BuLzuZnKvlmjwBeFL0xlN0oh2yUSqveTUwiyGXhJxqjuKe
11 | lK9LEkKFtkj+BB0gwKy0aHNYM7Z3F2FfNGd/FlxxEbZMfORm03W/I3ploJLKk6kO
12 | H69Rkh+5lPsO0q89YBuqptiJH4cgKSup+yWH8LASbz+nuxLEKJTasJZJFEFxO62v
13 | gVHARgwv/V5HYqE4FF860mQs/ZiRVJfTN1HWZ4OpEHjJMuDhWLCyqxHeLMvL8nxd
14 | 5qm9cGoguHWmv7JLe/R238AZhYg6eBybg+WAqOJZ2LdMQjAKFa5+oWezCAk1uLI9
15 | v12C5EBYZFI7znx2C4A+YAN7a3HAf+p6o467c1aL/8CQdb37soSpdnAKApx1uFBp
16 | TBxPrNXBOkND/bdU/w4E1lqMPg5KPFNn3gYe7YTB0fG4YqrBfpA0uswBdNHf4u4E
17 | u2Q99Fw9dIsj/BMkwFxTWM0Mb119VPyZm5nd5L4Y0GZmhND4UyVV0A==
18 | -----END RSA PRIVATE KEY-----
19 |
--------------------------------------------------------------------------------
/.vscode/getNet.js:
--------------------------------------------------------------------------------
1 | const { networkInterfaces } = require('os');
2 |
3 | module.exports = async (mode = 'dev') => {
4 | const { WiFi, Ethernet } = getIp();
5 | const [ip] = WiFi || Ethernet;
6 | const port = '5500';
7 | const src = `https://${ip || '10.0.0'}:${port}`;
8 | console.log('Server starting at: ', src);
9 | return { ip, port };
10 | };
11 |
12 | function getIp() {
13 | const nets = networkInterfaces();
14 | const results = {}; // Or just '{}', an empty object
15 |
16 | Object.keys(nets).forEach((name) => {
17 | nets[name].forEach((net) => {
18 | // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
19 | // 'IPv4' is in Node <= 17, from 18 it's a number 4 or 6
20 | const familyV4Value = typeof net.family === 'string' ? 'IPv4' : 4;
21 | if (net.family === familyV4Value && !net.internal) {
22 | if (!results[name]) {
23 | results[name] = [];
24 | }
25 | results[name].push(net.address);
26 | }
27 | });
28 | });
29 | return results;
30 | }
31 |
--------------------------------------------------------------------------------
/.vscode/pack-zip.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs');
3 | const jszip = require('jszip');
4 |
5 | const iconFile = path.join(__dirname, '../icon.png');
6 | const pluginJSON = path.join(__dirname, '../plugin.json');
7 | const distFolder = path.join(__dirname, '../dist');
8 | let readmeDotMd = path.join(__dirname, '../readme.md');
9 |
10 | if (!fs.existsSync(readmeDotMd)) {
11 | readmeDotMd = path.join(__dirname, '../README.md');
12 | }
13 |
14 | // create zip file of dist folder
15 |
16 | const zip = new jszip();
17 |
18 | zip.file('icon.png', fs.readFileSync(iconFile));
19 | zip.file('plugin.json', fs.readFileSync(pluginJSON));
20 | zip.file('readme.md', fs.readFileSync(readmeDotMd));
21 |
22 | loadFile('', distFolder);
23 |
24 | zip
25 | .generateNodeStream({ type: 'nodebuffer', streamFiles: true })
26 | .pipe(fs.createWriteStream(path.join(__dirname, '../dist.zip')))
27 | .on('finish', () => {
28 | console.log('dist.zip written.');
29 | });
30 |
31 | function loadFile(root, folder) {
32 | const distFiles = fs.readdirSync(folder);
33 | distFiles.forEach((file) => {
34 |
35 | const stat = fs.statSync(path.join(folder, file));
36 |
37 | if (stat.isDirectory()) {
38 | zip.folder(file);
39 | loadFile(path.join(root, file), path.join(folder, file));
40 | return;
41 | }
42 |
43 | if (!/LICENSE.txt/.test(file)) {
44 | zip.file(path.join(root, file), fs.readFileSync(path.join(folder, file)));
45 | }
46 | });
47 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "acode-theme-breeze",
3 | "description": "Breeze theme for Acode app",
4 | "version": "1.0.0",
5 | "license": "MIT",
6 | "author": "Abhishek B | Coderswat",
7 | "keywords": [
8 | "breeze",
9 | "acode",
10 | "theme"
11 | ],
12 | "scripts": {
13 | "build": "webpack",
14 | "build-release": "webpack --mode production",
15 | "start-dev": "node .vscode/start-dev"
16 | },
17 | "dependencies": {
18 | "autoprefixer": "^10.4.14",
19 | "html-tag-js": "^1.1.22"
20 | },
21 | "devDependencies": {
22 | "@babel/cli": "^7.18.10",
23 | "@babel/core": "^7.18.13",
24 | "@babel/plugin-transform-runtime": "^7.19.6",
25 | "@babel/preset-env": "^7.18.10",
26 | "babel-loader": "^9.1.0",
27 | "jszip": "^3.10.1",
28 | "live-server": "^1.2.2",
29 | "postcss": "^8.4.21",
30 | "postcss-loader": "^7.0.2",
31 | "ts-loader": "^9.4.4",
32 | "typescript": "^5.1.6",
33 | "raw-loader": "^4.0.2",
34 | "sass": "^1.57.1",
35 | "sass-loader": "^13.2.0",
36 | "webpack": "^5.76.0",
37 | "webpack-cli": "^5.0.0"
38 | },
39 | "browserslist": [
40 | "> 0.25%, not dead"
41 | ],
42 | "resolutions": {
43 | "terser": ">=5.14.2 ",
44 | "glob-parent": ">=5.1.2"
45 | },
46 | "repository": {
47 | "type": "git",
48 | "url": "https://github.com/coswat/acode-theme-breeze"
49 | },
50 | "bugs": {
51 | "url": "https://github.com/coswat/acode-theme-breeze/issues"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const { exec } = require("child_process");
2 | const path = require("path");
3 |
4 | module.exports = (env, options) => {
5 | const { mode = "development" } = options;
6 | const rules = [
7 | {
8 | test: /\.m?js$/,
9 | use: [
10 | "html-tag-js/jsx/tag-loader.js",
11 | {
12 | loader: "babel-loader",
13 | options: {
14 | presets: ["@babel/preset-env"],
15 | },
16 | },
17 | ],
18 | },
19 | {
20 | test: /\.ts$/,
21 | exclude: /node_modules/,
22 | use: "ts-loader",
23 | },
24 | {
25 | test: /\.(sa|sc|c)ss$/,
26 | use: ["raw-loader", "postcss-loader", "sass-loader"],
27 | },
28 | ];
29 |
30 | const main = {
31 | mode,
32 | entry: {
33 | main: "./src/main.ts",
34 | },
35 | output: {
36 | path: path.resolve(__dirname, "dist"),
37 | filename: "[name].js",
38 | chunkFilename: "[name].js",
39 | },
40 | resolve: {
41 | extensions: [".ts", ".js"],
42 | },
43 | module: {
44 | rules,
45 | },
46 | plugins: [
47 | {
48 | apply: (compiler) => {
49 | compiler.hooks.afterDone.tap("pack-zip", () => {
50 | // run pack-zip.js
51 | exec("node .vscode/pack-zip.js", (err, stdout, stderr) => {
52 | if (err) {
53 | console.error(err);
54 | return;
55 | }
56 | console.log(stdout);
57 | });
58 | });
59 | },
60 | },
61 | ],
62 | };
63 |
64 | return [main];
65 | };
66 |
--------------------------------------------------------------------------------
/.vscode/start-server.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable import/no-extraneous-dependencies */
2 | const fs = require('fs');
3 | const path = require('path');
4 | const liveServer = require('live-server');
5 | const getNet = require('./getNet');
6 |
7 | const serverCrt = path.resolve(__dirname, 'server.crt');
8 | const serverKey = path.resolve(__dirname, 'server.key');
9 |
10 | main();
11 |
12 | async function main() {
13 | const { ip: host, port } = await getNet('dev');
14 | process.cwd = () => __dirname;
15 | liveServer.start({
16 | open: false,
17 | port,
18 | host,
19 | cors: true,
20 | root: '../',
21 | ignore: 'node_modules,platforms,plugins',
22 | file: 'index.html',
23 | https: {
24 | cert: fs.readFileSync(serverCrt),
25 | key: fs.readFileSync(serverKey),
26 | passphrase: '1234',
27 | },
28 | middleware: [(req, res, next) => {
29 | const url = req.originalUrl;
30 | const www = '../platforms/android/app/src/main/assets/www/';
31 |
32 | if (url === '/cordova.js') {
33 | const file = path.resolve(__dirname, www, 'cordova.js');
34 | sendFile(res, file);
35 | return;
36 | }
37 |
38 | if (url === '/cordova_plugins.js') {
39 | const file = path.resolve(__dirname, www, 'cordova_plugins.js');
40 | sendFile(res, file);
41 | return;
42 | }
43 |
44 | next();
45 | }],
46 | });
47 |
48 | process.send('OK');
49 | }
50 |
51 | function sendFile(res, filePath) {
52 | if (fs.existsSync(filePath)) {
53 | const stat = fs.statSync(filePath);
54 |
55 | res.writeHead(200, {
56 | 'Content-Type': 'application/javascript',
57 | 'Content-Length': stat.size,
58 | });
59 |
60 | const readStream = fs.createReadStream(filePath);
61 | readStream.pipe(res);
62 | return;
63 | }
64 |
65 | res.writeHead(404, { 'Content-Type': 'text/plain' });
66 | res.end(`ERROR cannot get ${filePath}`);
67 | }
68 |
--------------------------------------------------------------------------------
/typings/acode.d.ts:
--------------------------------------------------------------------------------
1 | type Strings = string[];
2 | declare var acode: Acode;
3 |
4 |
5 | interface WCPage extends HTMLElement {
6 | on(event: 'hide' | 'show', cb: (this: WCPage) => void): void;
7 | off(event: 'hide' | 'show', cb: (this: WCPage) => void): void;
8 |
9 | settitle(title: string): void;
10 |
11 | id: string,
12 |
13 | hide(): void;
14 | show(): void;
15 |
16 | get body(): HTMLElement | null;
17 | set body($el: HTMLElement | null);
18 |
19 | get innerHTML(): string | undefined;
20 | set innerHTML(html: string);
21 |
22 | get textContent(): string | undefined;
23 | set textContent(text: string);
24 |
25 | get lead(): HTMLElement;
26 | set lead($el: HTMLElement);
27 |
28 | get header(): HTMLElement;
29 | set header($el: HTMLElement);
30 | }
31 |
32 | interface Input {
33 | id: string;
34 | required?: boolean;
35 | type: string;
36 | match?: RegExp;
37 | value?: string;
38 | placeholder?: string;
39 | hints?: string;
40 | name?: string;
41 | disabled?: boolean;
42 | readOnly?: boolean;
43 | autofocus?: boolean;
44 | hidden?: boolean;
45 | onclick?: (event: Event) => void;
46 | onchange?: (event: Event) => void;
47 | }
48 |
49 |
50 | interface Acode {
51 | /**
52 | * Define a module
53 | * @param {string} name
54 | * @param {Object|function} module
55 | */
56 | define(name: string, module: any): void;
57 |
58 | require(module: string): any;
59 |
60 | exec(key: string, val: any): boolean | undefined;
61 |
62 | get exitAppMessage(): string | undefined;
63 |
64 | setLoadingMessage(message: string): void;
65 |
66 | setPluginInit(
67 | id: string,
68 | initFunction: (baseUrl: string, $page: WCPage, options?: any) => Promise,
69 | settings?: any
70 | ): void;
71 |
72 | getPluginSettings(id: string): any;
73 |
74 | setPluginUnmount(id: string, unmountFunction: () => void): void;
75 |
76 | /**
77 | * @param {string} id plugin id
78 | * @param {string} baseUrl local plugin url
79 | * @param {WCPage} $page
80 | */
81 | initPlugin(id: string, baseUrl: string, $page: WCPage, options?: any): Promise;
82 |
83 | unmountPlugin(id: string): void;
84 |
85 | registerFormatter(id: string, extensions: string[], format: () => Promise): void;
86 |
87 | unregisterFormatter(id: string): void;
88 |
89 | format(selectIfNull?: boolean): Promise;
90 |
91 | fsOperation(file: string): any;
92 |
93 | newEditorFile(filename: string, options?: any): void;
94 |
95 | // readonly formatters(): { id: string; name: string; exts: string[] }[];
96 |
97 | /**
98 | * @param {string[]} extensions
99 | * @returns {Array<[id: string, name: string]>} options
100 | */
101 | getFormatterFor(extensions: string[]): [id: string, name: string][];
102 |
103 | alert(title: string, message: string, onhide: ()=>void): void;
104 |
105 | loader(title: string, message: string, cancel: { timeout: number,callback: ()=>void }): void;
106 |
107 | joinUrl(...args: string[]): string;
108 |
109 | addIcon(className: string, src: string): void;
110 |
111 | prompt(
112 | message: string,
113 | defaultValue: string,
114 | type: 'textarea' | 'text' | 'number' | 'tel' | 'search' | 'email' | 'url',
115 | options?: {
116 | match: RegExp,
117 | required: boolean,
118 | placeholder: string,
119 | test: (any)=>boolean
120 | }
121 | ): Promise;
122 |
123 | confirm(title: string, message: string): Promise;
124 |
125 | select(
126 | title: string,
127 | options: [string, string, string, boolean][] | string,
128 | opts?: {
129 | onCancel?: () => void;
130 | onHide?: () => void;
131 | hideOnSelect?: boolean;
132 | textTransform?: boolean;
133 | default?: string;
134 | } | boolean
135 | ): Promise;
136 |
137 | multiPrompt(title: string, inputs: Array, help: string): Promise;
138 |
139 | fileBrowser(mode: 'file' | 'folder' | 'both', info: string, doesOpenLast: boolean): Promise<
140 | | {
141 | name: string;
142 | type: 'file';
143 | url: string;
144 | }
145 | | {
146 | list: {
147 | icon: string;
148 | isDirectory: boolean;
149 | isFile: boolean;
150 | mime: string;
151 | name: string;
152 | type: 'file' | 'folder';
153 | uri: string;
154 | url: string;
155 | }[];
156 | scroll: number;
157 | name: string;
158 | type: 'folder';
159 | url: string;
160 | }
161 | >;
162 |
163 | toInternalUrl(url: string): Promise;
164 | }
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import plugin from "../plugin.json";
2 | import tag from "html-tag-js";
3 | const style = require("./style.scss");
4 | const appSettings = acode.require("settings");
5 | const themes = acode.require("themes");
6 | const ThemeBuilder = acode.require("themeBuilder");
7 | const toast = acode.require("toast");
8 |
9 | interface PromptOption {
10 | required: boolean;
11 | }
12 |
13 | interface SettingsListItem {
14 | key: string;
15 | text: string;
16 | value: string;
17 | info: string;
18 | prompt: string;
19 | promptType: string;
20 | promptOption: PromptOption[];
21 | }
22 |
23 | type SettingsList = {
24 | list: SettingsListItem[];
25 | cb: (key: string, value: string) => void;
26 | };
27 |
28 | class Breeze {
29 | // Base Url
30 | public baseUrl: string | undefined;
31 | // Style Element
32 | private style!: HTMLStyleElement;
33 | // default dodge color
34 | public dodgeColor: string = "#3399ff";
35 |
36 | // apply the default settings
37 | constructor() {
38 | if (!appSettings.value[plugin.id]) {
39 | appSettings.value[plugin.id] = {
40 | dodgeColor: this.dodgeColor,
41 | };
42 | appSettings.update(false);
43 | }
44 | }
45 | // plugin initialization
46 | public async init(): Promise {
47 | // Creating style Element
48 | this.style = tag("style", {
49 | textContent: style.default,
50 | });
51 | // Append the style to the head
52 | document.head.append(this.style);
53 | // add the theme
54 | this.themeBreeze("Theme Breeze");
55 | }
56 |
57 | public async destroy(): Promise {
58 | // clean ups
59 | }
60 |
61 | public async themeBreeze(name: string): Promise {
62 | const breeze: typeof ThemeBuilder = new ThemeBuilder(
63 | name,
64 | "dark",
65 | "free"
66 | );
67 | // core theme properties
68 | breeze.primaryColor = "#151515";
69 | breeze.popupBackgroundColor = "#191919";
70 | breeze.darkenedPrimaryColor = "#131313";
71 | breeze.primaryTextColor = "#ffffff";
72 | breeze.secondaryColor = "#202020";
73 | breeze.secondaryTextColor = "#ffffff";
74 | breeze.activeColor = this.settings.dodgeColor;
75 | breeze.activeIconColor = this.settings.dodgeColor;
76 | breeze.linkTextColor = "#7cbcfb";
77 | breeze.errorTextColor = "#f97583";
78 | breeze.scrollbarColor = "#30363d";
79 | breeze.borderColor = "#30363d";
80 | breeze.popupBorderColor = "#30363d";
81 | breeze.borderRadius = "4px";
82 | breeze.popupBorderRadius = "4px";
83 | breeze.popupIconColor = "#ffffff";
84 | breeze.popupTextColor = "#ffffff";
85 | breeze.popupActiveColor = "gold";
86 | breeze.boxShadowColor = "#00000033";
87 | breeze.buttonActiveColor = this.settings.dodgeColor;
88 | breeze.buttonBackgroundColor = this.settings.dodgeColor;
89 | breeze.buttonTextColor = "#ffffff";
90 |
91 | themes.add(breeze);
92 | themes.apply(name);
93 | }
94 | // get settings list
95 | public get settingsList(): SettingsList {
96 | return {
97 | list: [
98 | {
99 | key: "dodgeColor",
100 | text: "Dodge Color",
101 | value: this.settings.dodgeColor,
102 | info: "The main dodge color",
103 | prompt: "Enter color ( rgb or hex )",
104 | promptType: "text",
105 | promptOption: [
106 | {
107 | required: true,
108 | },
109 | ],
110 | },
111 | ],
112 | cb: (key: string, value: string) => {
113 | this.settings[key] = value;
114 | appSettings.update(false);
115 | appSettings.on("update", () => {
116 | toast("Restart the app", 3000);
117 | });
118 | },
119 | };
120 | }
121 | // get plugin settings value from settings.json
122 | public get settings(): any {
123 | return appSettings.value[plugin.id];
124 | }
125 | }
126 | if (window.acode) {
127 | const _theme = new Breeze();
128 | acode.setPluginInit(
129 | plugin.id,
130 | async (
131 | baseUrl: string,
132 | $page: WCPage,
133 | { cacheFileUrl, cacheFile }: any
134 | ) => {
135 | if (!baseUrl.endsWith("/")) {
136 | baseUrl += "/";
137 | }
138 | _theme.baseUrl = baseUrl;
139 | await _theme.init();
140 | },
141 | _theme.settingsList
142 | );
143 | acode.setPluginUnmount(plugin.id, () => {
144 | _theme.destroy();
145 | });
146 | }
147 |
--------------------------------------------------------------------------------