diff --git a/public/Makefile b/public/Makefile new file mode 100644 index 00000000..a2d90da1 --- /dev/null +++ b/public/Makefile @@ -0,0 +1,14 @@ +all: + find . -type f -name '*.html' | xargs brotli -f -k + find . -type f -name '*.html' | xargs gzip -f -k + find . -type f -name '*.js' | xargs brotli -f -k + find . -type f -name '*.js' | xargs gzip -f -k --best + find . -type f -name '*.css' | xargs brotli -f -k + find . -type f -name '*.css' | xargs gzip -f -k + +clean: + find . -name '*.gz' -exec rm {} \; + find . -name '*.br' -exec rm {} \; + +serve: + go run server.go diff --git a/public/components/modal.css b/public/components/modal.css new file mode 100644 index 00000000..29fceebc --- /dev/null +++ b/public/components/modal.css @@ -0,0 +1,56 @@ +.component_modal{ + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: #f2f3f5f0; + z-index: 1000; +} +.component_modal > div{ + box-shadow: 1px 2px 20px rgba(0, 0, 0, 0.1); + background: white; + width: 80%; + max-width: 310px; + padding: 20px 20px 0 20px; + border-radius: 2px; +} + +.dark-mode .component_modal{ + background: var(--bg-color); +} + +.component_popup .popup--content { + font-size: 1.1em; + margin: 0; +} +.component_popup .popup--content p { + margin: 0; +} +.component_popup .popup--content .modal-error-message { + font-size: 15px; +} +.component_popup .buttons { + margin: 15px -20px 0 -20px; + display: flex; +} +.component_popup .buttons > div { + display: flex; + width: 100%; +} +.component_popup .buttons [type="submit"] { + border-radius: 10px 0 0; +} +.component_popup .buttons > button { + width: 50%; + margin-left: auto; +} +.component_popup .buttons button { + text-transform: uppercase; +} +.component_popup .modal-error-message { + color: var(--error); +} +.component_popup .center { + text-align: center; +} diff --git a/public/components/modal.js b/public/components/modal.js index 05e2fbd5..408d1b14 100644 --- a/public/components/modal.js +++ b/public/components/modal.js @@ -1,13 +1,114 @@ -import { createElement } from "../common/skeleton/index.js"; +import { createElement } from "../lib/skeleton/index.js"; +import rxjs, { applyMutation } from "../lib/rxjs/index.js"; +import { animate } from "../lib/animate/index.js"; +import { qs } from "../lib/dom/index.js"; -export function prompt(label, okFn, errFn) { - const $node = createElement(` - `); - document.body.appendChild($node); - okFn("OK") +import CSSLoader from "../../helpers/css.js"; +// http://127.0.0.1:8000/admin/setup + +const _observables = []; +const effect = (obs) => _observables.push(obs.subscribe()); +const free = () => { + for (let i=0; i<_observables.length; i++) { + _observables[i].unsubscribe(); + } + _observables = []; } + +class Modal extends HTMLElement { + constructor() { + super(); + } + + trigger($node, opts = {}) { + const { onQuit, leftButton, rightButton } = opts; + const $modal = createElement(` +