This commit is contained in:
William Moore 2024-05-12 17:26:00 -05:00
parent 7e8e352989
commit f46b523093
9 changed files with 25 additions and 25 deletions

View File

@ -1,3 +1,3 @@
# Lavender # mosaic
Lavendar is a full-featured widget dashboard that is configurable. Right now, it does not have the capability to share across different browsers and devices the configuration. This is planned! Until then, happily plug in your widgets into Lavender for a wonderful experience. Lavendar is a full-featured widget dashboard that is configurable. Right now, it does not have the capability to share across different browsers and devices the configuration. This is planned! Until then, happily plug in your widgets into mosaic for a wonderful experience.

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "lavender", "name": "mosaic",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "lavender", "name": "mosaic",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {

View File

@ -1,12 +1,12 @@
{ {
"name": "lavender", "name": "mosaic",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "npm run build && npm run deploy", "start": "npm run build && npm run deploy",
"build": "npx tsc && cp -R public dist && npx gulp && npx rollup -c", "build": "npx tsc && cp -R public dist && npx gulp && npx rollup -c",
"deploy": "rm -rf ~/www/html/lavender && cp -R build ~/www/html/lavender", "deploy": "rm -rf ~/www/html/mosaic && cp -R build ~/www/html/mosaic",
"clean": "rm -rf build && rm -rf dist", "clean": "rm -rf build && rm -rf dist",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },

View File

@ -1,5 +1,5 @@
body { body {
background-color: #967BB6; background-color: #DFCF99;
} }
.link-box { .link-box {

View File

@ -6,7 +6,7 @@
</head> </head>
<body> <body>
<lavender-configure></lavender-configure> <mosaic-configure></mosaic-configure>
</body> </body>
</html> </html>

View File

@ -8,10 +8,10 @@
</head> </head>
<body> <body>
<lavender-widgets></lavender-widgets> <mosaic-widgets></mosaic-widgets>
<div class="link-box"> <div class="link-box">
<a href="./edit.html" class="edit-link" alt="Edit Widgets"><i class="fa-solid fa-pen-to-square"></i></a> <a href="./edit.html" class="edit-link" alt="Edit Widgets"><i class="fa-solid fa-pen-to-square"></i></a>
<a href="https://rezrov.xyz/caranmegil/lavender" class="edit-link" target="_blank" alt="Source Code"><i class="fa-brands fa-square-git"></i></a> <a href="https://rezrov.xyz/caranmegil/mosaic" class="edit-link" target="_blank" alt="Source Code"><i class="fa-brands fa-square-git"></i></a>
</div> </div>
<script> <script>
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {

View File

@ -1,6 +1,6 @@
{ {
"short_name": "Lavender", "short_name": "Mosaic",
"name": "Lavender Dashboard", "name": "Mosaic",
"icons": [ "icons": [
{ {
"src": "../images/favicon.png", "src": "../images/favicon.png",

View File

@ -1,10 +1,10 @@
import { LitElement, css, html } from 'lit'; import { LitElement, css, html } from 'lit';
import { customElement } from 'lit/decorators.js'; import { customElement } from 'lit/decorators.js';
const LAVENDER_WIDGETS = 'lavender-widgets'; const mosaic_WIDGETS = 'mosaic-widgets';
@customElement('lavender-configure') @customElement('mosaic-configure')
export default class LavenderConfigure extends LitElement { export default class mosaicConfigure extends LitElement {
text = '[]' text = '[]'
constructor() { constructor() {
@ -91,7 +91,7 @@ export default class LavenderConfigure extends LitElement {
const file = event?.target?.files[0]; const file = event?.target?.files[0];
const reader = new FileReader(); const reader = new FileReader();
reader.onload = () => { reader.onload = () => {
localStorage.setItem(LAVENDER_WIDGETS, reader?.result as string ?? '[]'); localStorage.setItem(mosaic_WIDGETS, reader?.result as string ?? '[]');
window.location.replace('./index.html'); window.location.replace('./index.html');
} }
reader.readAsText(file); reader.readAsText(file);
@ -102,7 +102,7 @@ export default class LavenderConfigure extends LitElement {
const elems = this.shadowRoot?.children ?? null; const elems = this.shadowRoot?.children ?? null;
const widgets = elems ? elems?.item(2)?.children : null; const widgets = elems ? elems?.item(2)?.children : null;
const widgetsLen = widgets ? widgets?.length : 0 const widgetsLen = widgets ? widgets?.length : 0
const lavenderWidgets = []; const mosaicWidgets = [];
for (let widgetI = 0; widgetI < widgetsLen; widgetI++) { for (let widgetI = 0; widgetI < widgetsLen; widgetI++) {
const elem = widgets?.item(widgetI); const elem = widgets?.item(widgetI);
@ -113,7 +113,7 @@ export default class LavenderConfigure extends LitElement {
const url = urlEditElem.value; const url = urlEditElem.value;
const height = heightEditElem.value; const height = heightEditElem.value;
if (title && title.trim() !== '' && url && url.trim() !== '') { if (title && title.trim() !== '' && url && url.trim() !== '') {
lavenderWidgets.push({ mosaicWidgets.push({
title, title,
url, url,
height, height,
@ -121,7 +121,7 @@ export default class LavenderConfigure extends LitElement {
} }
} }
fetch(`CONFIG_STORE_URL?json=${JSON.stringify(lavenderWidgets)}`).then(() => window.location.replace('./index.html')); fetch(`CONFIG_STORE_URL?json=${JSON.stringify(mosaicWidgets)}`).then(() => window.location.replace('./index.html'));
} }
override render() { override render() {
@ -129,7 +129,7 @@ export default class LavenderConfigure extends LitElement {
const widgets = JSON.parse(widgetJSON); const widgets = JSON.parse(widgetJSON);
return html` return html`
<h1 class="centerit">Lavender Widget Editor</h1> <h1 class="centerit">mosaic Widget Editor</h1>
<div class="buttonbar"><button class="button" @click="${async () => await this.save()}">Save</button></div> <div class="buttonbar"><button class="button" @click="${async () => await this.save()}">Save</button></div>
<div class="widgets"> <div class="widgets">
${widgets.map((widget: any) => { ${widgets.map((widget: any) => {
@ -156,6 +156,6 @@ export default class LavenderConfigure extends LitElement {
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
'lavender-configure': LavenderConfigure; 'mosaic-configure': mosaicConfigure;
} }
} }

View File

@ -1,8 +1,8 @@
import { LitElement, css, html } from 'lit'; import { LitElement, css, html } from 'lit';
import { customElement } from 'lit/decorators.js'; import { customElement } from 'lit/decorators.js';
@customElement('lavender-widgets') @customElement('mosaic-widgets')
export class LavenderWidgets extends LitElement { export class mosaicWidgets extends LitElement {
widgets = [] widgets = []
constructor() { constructor() {
@ -75,7 +75,7 @@ export class LavenderWidgets extends LitElement {
override render() { override render() {
return html` return html`
<h1 class="centerit">Lavender</h1> <h1 class="centerit">Mosaic</h1>
<div class="widgets"> <div class="widgets">
${this.widgets.map((widget: any) => { ${this.widgets.map((widget: any) => {
return html`<iframe width="100%" framespacing="0" frameborder="no" style="${widget.height ? `height: ${widget.height}` : ''}" src="${widget.url}" title="${widget.title}">${widget.title}</iframe>`; return html`<iframe width="100%" framespacing="0" frameborder="no" style="${widget.height ? `height: ${widget.height}` : ''}" src="${widget.url}" title="${widget.title}">${widget.title}</iframe>`;
@ -87,6 +87,6 @@ export class LavenderWidgets extends LitElement {
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
'lavender-widgets': LavenderWidgets; 'mosaic-widgets': mosaicWidgets;
} }
} }