Switching to parcel

This commit is contained in:
Fabian Stamm 2020-02-09 17:36:25 +01:00
parent db5a363bff
commit b588693ccf
18 changed files with 5380 additions and 1592 deletions

6088
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,39 +12,43 @@
},
"author": "Fabian Stamm <dev@fabianstamm.de>",
"license": "MIT",
"browserslist": [
"last 2 Chrome versions"
],
"dependencies": {
"@hibas123/secure-file-wrapper": "^2.5.0",
"@hibas123/theme": "^1.0.5",
"@hibas123/utils": "^2.1.0",
"@hibas123/secure-file-wrapper": "^2.5.1",
"@hibas123/theme": "^1.2.14",
"@hibas123/utils": "^2.2.3",
"aes-js": "^3.1.2",
"feather-icons": "^4.22.1",
"feather-icons": "^4.26.0",
"idb": "^4.0.3",
"js-sha256": "^0.9.0",
"lodash.clonedeep": "^4.5.0",
"parcel": "^1.12.4",
"secure-file-wrapper": "git+https://git.stamm.me/OpenServer/OSSecureFileWrapper.git",
"uuid": "^3.3.2"
"uuid": "^3.4.0"
},
"devDependencies": {
"@types/lodash.clonedeep": "^4.5.6",
"@types/uikit": "^2.27.7",
"@types/uuid": "^3.4.5",
"copy-webpack-plugin": "^5.0.3",
"css-loader": "^3.0.0",
"file-loader": "^4.0.0",
"@types/uuid": "^3.4.7",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"file-loader": "^5.0.2",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.7.0",
"node-sass": "^4.12.0",
"preact": "^8.3.1",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.13.1",
"preact": "^10.3.1",
"preact-svg-loader": "^0.2.1",
"raw-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"ts-loader": "^6.0.4",
"typescript": "^3.5.2",
"webpack": "^4.35.2",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.5",
"webpack-dev-server": "^3.7.2",
"raw-loader": "^4.0.0",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"ts-loader": "^6.2.1",
"typescript": "^3.7.5",
"webpack": "^4.41.5",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.3",
"webpack-visualizer-plugin": "^0.1.11",
"worker-loader": "^2.0.0"
}

View File

@ -7,6 +7,8 @@ export default function AddButton({ onClick }: { onClick: () => void }) {
class="fab btn-primary"
onClick={() => onClick()}
>
<Plus width={undefined} height={undefined} />
<img src={Plus} />
</button>
}
// <Plus width={undefined} height={undefined} />

View File

@ -58,7 +58,12 @@ export class Footer extends Component<{}, { synced: boolean, syncing: boolean }>
}
return <footer class="elv-8">
<span>
<span class={extrac} ><a onClick={() => this.onSyncClick()} ><Refresh style="height: 1em; width: 1em;"></Refresh></a></span>
<span class={extrac} >
<a onClick={() => this.onSyncClick()} >
<img src={Refresh} style="height: 1em; width: 1em;" />
{/* <Refresh style="height: 1em; width: 1em;"></Refresh> */}
</a>
</span>
<span style={"margin-left: 8px; color:" + color}>{text}</span>
</span>
<span>

View File

@ -70,7 +70,8 @@ export default abstract class Modal<T> {
<h3>{this.props.modal.title}</h3>
{/* <div> */}
{!this.props.modal.noClose ?
<CloseIcon onClick={() => this.props.modal.result(null)} width={undefined} height={undefined} />
<img src={CloseIcon} onClick={() => this.props.modal.result(null)} />
// <CloseIcon onClick={() => this.props.modal.result(null)} width={undefined} height={undefined} />
: undefined
}
{/* </div> */}

View File

@ -13,7 +13,7 @@ export default class SettingsPage extends Page<{ state: any }, { vault: string }
let active = Theme.active();
return <div>
<header class="header">
<a class="header-icon-button" onClick={() => history.back()}><ArrowLeft height={undefined} width={undefined} /></a>
<a class="header-icon-button" onClick={() => history.back()}><img src={ArrowLeft} height={undefined} width={undefined} /></a>
<h3 style="display:inline" class="header-title" onClick={() => Navigation.setPage("/")}>Settings</h3>
<span></span>
</header>

View File

@ -166,10 +166,10 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
return <div>
<header class="header">
<a class="header-icon-button" onClick={() => this.exitHandler()}><X height={undefined} width={undefined} /></a>
{this.state.changed ? <a class="header-icon-button" style="margin-left: 0.5em;" onClick={() => save_handler()}><Save height={undefined} width={undefined} /></a> : undefined}
<a class="header-icon-button" onClick={() => this.exitHandler()}><img src={X} height={undefined} width={undefined} /></a>
{this.state.changed ? <a class="header-icon-button" style="margin-left: 0.5em;" onClick={() => save_handler()}><img src={Save} height={undefined} width={undefined} /></a> : undefined}
<h3 style="display:inline" class="button header-title">{this.state.title}</h3>
<a class="header-icon-button" onClick={() => delete_handler()}><Trash height={undefined} width={undefined} /></a>
<a class="header-icon-button" onClick={() => delete_handler()}><img src={Trash} height={undefined} width={undefined} /></a>
</header>
<div class="container">
<textarea

View File

@ -266,7 +266,7 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
return <div>
{this.state.context}
<header class="header">
<a class="header-icon-button" onClick={() => history.back()}><ArrowLeft height={undefined} width={undefined} /></a>
<a class="header-icon-button" onClick={() => history.back()}><img src={ArrowLeft} height={undefined} width={undefined} /></a>
<h3 style="display:inline" class="header-title" onClick={() => Navigation.setPage("/")}>{this.vault ? this.vault.name : ""}</h3>
<span></span>
{/* <a class="button header_icon_button"><MoreVertival height={undefined} width={undefined} /></a> */}
@ -276,7 +276,7 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
<div style="display:flex;">
<input class="inp" type="text" style="width: 100%; height: 40px;" onKeyUp={this.searchChanged} ref={elm => this.searchInput = elm} />
<button class="btn btn-primary" style="padding: 5px 10px; margin: 0; height: 40px; width: 40px;">
<Search />
<img src={Search} />
</button>
</div>

View File

@ -206,9 +206,13 @@ export default class VaultsPage extends Page<VaultsProps, { vaults: VaultList, m
}
render() {
// <Unlock height={undefined} width={undefined} />}
// <Lock height={undefined} width={undefined} />
let elms = this.state.vaults.map(vault => {
return <li class="vaults_vault" onClick={() => this.openVault(vault)} onContextMenu={(evt) => this.onContext(evt, vault)}>
{vault.encrypted ? <Lock height={undefined} width={undefined} /> : <Unlock height={undefined} width={undefined} />}
{vault.encrypted ? <img src={Lock} /> : <img src={Unlock} />}
<span>
{vault.name}
</span>
@ -221,7 +225,10 @@ export default class VaultsPage extends Page<VaultsProps, { vaults: VaultList, m
<header class="header">
<span></span>
<h3 style="display:inline" onClick={() => Navigation.setPage("/")}>{this.props.selectVault ? "Select Vault for share" : "Your vaults:"}</h3>
<a class="header-icon-button" onClick={() => Navigation.setPage("/settings")}><Settings height={undefined} width={undefined} /></a>
<a class="header-icon-button" onClick={() => Navigation.setPage("/settings")}>
<img src={Settings} />
{/* <Settings height={undefined} width={undefined} /> */}
</a>
</header>
<AddButton onClick={() => this.addButtonClick()} />
<div class="container">

View File

@ -8,13 +8,6 @@
(function (global) {
'use strict';
// If we're in node require encoding-indexes and attach it to the global.
if (typeof module !== "undefined" && module.exports &&
!global["encoding-indexes"]) {
global["encoding-indexes"] =
require("./encoding-indexes.js")["encoding-indexes"];
}
//
// Utilities
//
@ -1093,7 +1086,8 @@
// BOM seen flag.
if (!this._do_not_flush) {
this._decoder = decoders[this._encoding.name]({
fatal: this._error_mode === 'fatal'});
fatal: this._error_mode === 'fatal'
});
this._BOMseen = false;
}
@ -1277,7 +1271,8 @@
// the input is a USVString so streaming is not necessary.
if (!this._do_not_flush)
this._encoder = encoders[this._encoding.name]({
fatal: this._fatal === 'fatal'});
fatal: this._fatal === 'fatal'
});
this._do_not_flush = Boolean(options['stream']);
// 1. Convert input to a stream.

View File

@ -6,7 +6,7 @@
<meta charset="utf8" />
<meta name="Description" content="Notes app">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="./manifest.json">
<!-- <link rel="shortcut icon" href="/public/icon-72x72.png"> -->
<!-- Add to home screen for Safari on iOS -->
@ -15,9 +15,9 @@
<meta name="apple-mobile-web-app-title" content="Secure Notes">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#1E88E5">
<script src="encoding.js"></script>
<!-- <link rel="apple-touch-icon" sizes="180x180" href="../public/apple-touch-icon.png"> -->
<!-- <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#1E88E5"> -->
<script src="./encoding.js"></script>
<meta name="msapplication-TileColor" content="#1E88E5">
<meta name="theme-color" content="#1E88E5">
</head>
@ -45,7 +45,7 @@
console.warn("Disabling Service Worker in debug mode!")
} else {
// Register the ServiceWorker
navigator.serviceWorker.register('/serviceworker.js', {
navigator.serviceWorker.register('./serviceworker.ts', {
scope: '/'
}).then(function (reg) {
console.log('Service worker has been registered for scope:' + reg.scope);
@ -56,6 +56,7 @@
}
}
</script>
<script src="./index.tsx"></script>
</body>
</html>

View File

@ -9,48 +9,48 @@ body {
// display: flex;
// }
// $header-margin: .5em;
$header-margin: .5em;
// $header-icon-size: calc(1.5rem * 1);
// $header-icon-size: 100%;
// header {
// display: flex;
// justify-content: space-between;
// margin-bottom: $header-margin;
// align-content: center;
// padding: 0.75em;
// border-bottom: solid var(--border-color) 1px;
// background-color: var(--primary);
header {
display: flex;
justify-content: space-between;
margin-bottom: $header-margin;
align-content: center;
padding: 0.75em;
border-bottom: solid var(--border-color) 1px;
background-color: var(--primary);
// >* {
// margin: 0;
// color: white;
// background: var(--primary);
// }
>* {
margin: 0;
color: white;
background: var(--primary);
}
// >.header-title {
// overflow: hidden;
// text-overflow: ellipsis;
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
// flex-grow: 1;
// margin: 0 1em;
// }
>.header-title {
overflow: hidden;
text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
flex-grow: 1;
margin: 0 1em;
}
// .header-icon-button {
// display: block;
// margin-top: auto;
// margin-bottom: auto;
.header-icon-button {
display: block;
margin-top: auto;
margin-bottom: auto;
// min-width: $header-icon-size;
// >svg {
// height: $header-icon-size;
// width: $header-icon-size;
// }
// }
}
// }
}
body {

View File

@ -3,7 +3,7 @@ import { Lock, Observable } from "@hibas123/utils";
import * as aesjs from "aes-js";
import { IDBPTransaction } from "idb";
import { sha256 } from "js-sha256";
import * as uuidv4 from "uuid/v4";
import uuidv4 from "uuid/v4";
import * as config from "../config.json";
import * as b64 from "./helper/base64";
import IDB from "./helper/indexeddb";
@ -39,6 +39,7 @@ export interface ViewNote extends BaseNote {
}
import clonedeep = require("lodash.clonedeep");
import uuid = require("uuid");
const Encoder = new TextEncoder();
const Decoder = new TextDecoder();
@ -81,6 +82,7 @@ export interface IVault {
saveNote(note: ViewNote, date?: Date): Promise<void>;
getNote(id: string): Promise<ViewNote>;
deleteNote(id: string): Promise<void>;
// type: string; //Defines type of plugin, that is required to handle this vault
}
const awaitTimeout = (ms: number) => new Promise<void>(resolve => setTimeout(resolve, ms));
@ -420,6 +422,7 @@ class NotesProvider {
}
public async createVault(name: string, key?: Uint8Array) {
// console.log(uuidv4, uuid);
let vault: DBNote = {
__value: this.encrypt("__BASELINE__", key),
_id: uuidv4(),

View File

@ -1,5 +1,7 @@
const light = require("!!raw-loader!@hibas123/theme/out/light.css").default;
const dark = require("!!raw-loader!@hibas123/theme/out/dark.css").default;
import { readFileSync } from "fs";
const light = readFileSync("./node_modules/@hibas123/theme/out/light.css", "utf8")
const dark = readFileSync("./node_modules/@hibas123/theme/out/dark.css", "utf8")
export enum ThemeStates {
AUTO,

17
src/types.d.ts vendored
View File

@ -1,10 +1,15 @@
// declare module "*.svg" {
// const SVG: (props: {
// width?: number | undefined
// height?: number | undefined
// onClick?: (evt: MouseEvent) => void;
// style?: string;
// }) => JSX.Element;
// export default SVG;
// }
declare module "*.svg" {
const SVG: (props: {
width?: number | undefined
height?: number | undefined
onClick?: (evt: MouseEvent) => void;
style?: string;
}) => JSX.Element;
const SVG: string;
export default SVG;
}

View File

@ -13,7 +13,8 @@
"dom",
"esnext"
],
"resolveJsonModule": true
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": [
"./src/types.d.ts",