Compare commits

...

4 Commits

Author SHA1 Message Date
a306f0732c Removed /db from getImageURL 2026-04-03 19:23:07 -04:00
027ae4d130 Added CSS var and /@server on viite config 2026-04-03 13:56:17 -04:00
metacryst
2592137fa3 quill updates, signup comment 2026-03-31 07:08:07 -05:00
metacryst
8279a81dc9 updating quill 2026-03-28 02:24:04 -05:00
5 changed files with 140 additions and 44 deletions

View File

@@ -103,7 +103,6 @@ class Signup extends Shadow {
e.preventDefault(); e.preventDefault();
const data = new FormData(e.target); const data = new FormData(e.target);
if (this.verifyInput(data)) { if (this.verifyInput(data)) {
this.errorMessage = "";
await this.requestSignup(data); await this.requestSignup(data);
} else { } else {
console.log(this.errorMessage) console.log(this.errorMessage)
@@ -111,6 +110,11 @@ class Signup extends Shadow {
}) })
} }
/*
*******************************************************************************
NO LONGER WORKS - SEE AUTH ENDPOINT IN SERVER
*******************************************************************************
*/
async requestSignup(data) { async requestSignup(data) {
const networkId = this.attr("networkid"); const networkId = this.attr("networkid");
const res = await fetch(`${util.HOST}/auth/signup`, { const res = await fetch(`${util.HOST}/auth/signup`, {

View File

@@ -15,6 +15,7 @@
--sidebar: #698b6f; --sidebar: #698b6f;
--divider: #523636; --divider: #523636;
--lightDivider: #52363681;
--darkbrown: #3f0808; --darkbrown: #3f0808;
--darkgrey: #5c4646; --darkgrey: #5c4646;
@@ -55,6 +56,7 @@
--sidebar: #240609; --sidebar: #240609;
--divider: #523636; --divider: #523636;
--lightDivider: #52363680;
--darktext: #62473E; --darktext: #62473E;
--headertext: #ffd8bb; --headertext: #ffd8bb;
--darkred: #6b2c1d; --darkred: #6b2c1d;

View File

@@ -7,7 +7,7 @@ class AppMenu extends Shadow {
darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
getImageURL(appName) { getImageURL(appName) {
let imgUrl = `${util.HOST}/db/apps/${appName}/icons/${appName}` let imgUrl = `${util.HOST}/apps/${appName}/icons/${appName}`
if(this.darkMode) { if(this.darkMode) {
imgUrl += "light" imgUrl += "light"
} }

View File

@@ -1,10 +1,14 @@
/* /*
Sam Russell Sam Russell
Captured Sun Captured Sun
2.24.26 - Allowing state() to watch other elements 3.28.26 - Stopping state() from duplicating on rerender()
2.21.26 - Making state() be called on initial definition, fixing fontSize so it works with clamp(), other strings 3.27.26 - Adding quill router, removing dynamicText(), removing horizontal and verticalAlign() checks
2.20.26 - Adding state() 3.24.26 - Allowing state() to watch other elements
2.19.26 - Adding dynamicText() 3.21.26 - Making state() be called on initial definition, fixing fontSize so it works with clamp(), other strings
3.20.26 - Adding state()
3.19.26 - Adding dynamicText()
3.4.26 - Making horizontalAlign() and verticalAlign() methods of checking for stacks more robust
2.27.26 - Adding parentShadow() function
2.16.26 - Adding event objects to the onTouch callbacks 2.16.26 - Adding event objects to the onTouch callbacks
1.16.26 - Moving nav event dispatch out of pushState, adding null feature to attr() 1.16.26 - Moving nav event dispatch out of pushState, adding null feature to attr()
1.5.26 - Switching verticalAlign and horizontalAlign names, adding borderVertical and Horizontal 1.5.26 - Switching verticalAlign and horizontalAlign names, adding borderVertical and Horizontal
@@ -182,6 +186,63 @@ Object.defineProperty(Array.prototype, 'last', {
window.quill = { window.quill = {
rendering: [], rendering: [],
lastState: null, lastState: null,
router: null,
storedState: new WeakMap(),
router: class {
routes = []
route(route, cb) {
this.routes.push({route: route, cb: cb})
}
async findMatch() {
let matched;
for (const route of this.routes) {
const [match, params] = this.matchPath(route.route, window.location.pathname)
if (match) {
await route.cb(params)
return;
}
}
if(!matched) throw new Error("Quill: couldn't match route!")
return null
}
matchPath(pattern, pathname) {
const patternParts = pattern.split('/').filter(Boolean)
const pathParts = pathname.split('/').filter(Boolean)
if (patternParts.length !== pathParts.length) return [false]
const params = []
for (let i = 0; i < patternParts.length; i++) {
if (patternParts[i].startsWith(':')) {
params.push(pathParts[i])
} else if (patternParts[i] !== pathParts[i]) {
return [false]
}
}
return [true, params]
}
},
init: async (home, router) => {
if(router) {
quill.router = router
window.addEventListener("navigate", () => {
if(quill.router) {
router.findMatch()
}
})
if(quill.router) {
await router.findMatch()
}
}
home()
},
render: (el) => { render: (el) => {
if(el instanceof Shadow) { if(el instanceof Shadow) {
@@ -202,7 +263,19 @@ window.quill = {
quill.rendering.pop(el) quill.rendering.pop(el)
}, },
removeState: (el) => {
let state = quill.storedState.get(el)
if(state) {
state.forEach(observer => {
observer.disconnect()
})
}
quill.storedState.delete(el)
},
rerender: (el) => { rerender: (el) => {
quill.removeState(el)
Array.from(el.attributes).forEach(attr => el.removeAttribute(attr.name)); Array.from(el.attributes).forEach(attr => el.removeAttribute(attr.name));
el.innerHTML = "" el.innerHTML = ""
el.removeAllListeners() el.removeAllListeners()
@@ -315,6 +388,17 @@ HTMLElement.prototype.rerender = function() {
quill.rerender(this) quill.rerender(this)
} }
HTMLElement.prototype.parentShadow = function(selector) {
let el = this
while(el !== document.body) {
el = el.parentElement
if(el instanceof Shadow) {
return el
}
}
return null
}
/* Styling */ /* Styling */
window.pct = "%" window.pct = "%"
@@ -672,10 +756,6 @@ HTMLElement.prototype.centerY = function () {
HTMLElement.prototype.verticalAlign = function (value) { HTMLElement.prototype.verticalAlign = function (value) {
const direction = getComputedStyle(this).flexDirection; const direction = getComputedStyle(this).flexDirection;
if(!direction) {
throw new Error("verticalAlign can be only be used on HStacks or VStacks!")
}
if (direction === "column" || direction === "column-reverse") { if (direction === "column" || direction === "column-reverse") {
this.style.justifyContent = value; this.style.justifyContent = value;
} else { } else {
@@ -686,10 +766,6 @@ HTMLElement.prototype.verticalAlign = function (value) {
HTMLElement.prototype.horizontalAlign = function (value) { HTMLElement.prototype.horizontalAlign = function (value) {
const direction = getComputedStyle(this).flexDirection; const direction = getComputedStyle(this).flexDirection;
if(!direction) {
throw new Error("horizontalAlign can be only be used on HStacks or VStacks!")
}
if (direction === "column" || direction === "column-reverse") { if (direction === "column" || direction === "column-reverse") {
this.style.alignItems = value; this.style.alignItems = value;
} else { } else {
@@ -701,54 +777,64 @@ HTMLElement.prototype.horizontalAlign = function (value) {
/* Elements */ /* Elements */
HTMLElement.prototype.state = function(arg1, arg2, arg3) { /*
STATE RULES:
reset on rerender()
elements not connected to the dom have their state listeners removed
*/
HTMLElement.prototype.state = function(arg1, arg2, arg3, arg4) {
let el; let el;
let attr; let attr;
let cb; let cb;
let runImmediately;
if(arg3) { // element, attr, callback
el = arg1 // element, attr, callback, bool
attr = arg2 // attr, callback
cb = arg3 // attr, callback, bool
if(arg1 instanceof Element) {
if(typeof arg4 === 'boolean') {
el = arg1; attr = arg2; cb = arg3; runImmediately = arg4;
} else { } else {
el = this el = arg1; attr = arg2; cb = arg3; runImmediately = true;
attr = arg1 }
cb = arg2 } else {
if(typeof arg3 === 'boolean') {
el = this; attr = arg1; cb = arg2; runImmediately = arg3
} else {
el = this; attr = arg1; cb = arg2; runImmediately = true
}
} }
if (attr !== attr.toLowerCase()) { if (attr !== attr.toLowerCase()) {
throw new Error(`quill: dynamicText() attr "${attr}" must be lowercase`); throw new Error(`quill: state() attr "${attr}" must be lowercase`);
} }
let handler = () => { let handler = () => {
const value = el.getAttribute(attr); const value = el.getAttribute(attr);
if(!this.isConnected) {
quill.removeState(this)
} else {
cb.call(this, value) cb.call(this, value)
} }
}
new MutationObserver(handler) let observer = new MutationObserver(handler)
.observe(el, { attributes: true, attributeFilter: [attr] }); observer.observe(el, { attributes: true, attributeFilter: [attr] })
if(!quill.storedState.get(this)) {
quill.storedState.set(this, [])
}
quill.storedState.get(this).push(observer)
if(runImmediately) {
handler() handler()
}
return this return this
} }
HTMLElement.prototype.dynamicText = function(attr, template) {
// Set initial text if attr already has a value
if (attr !== attr.toLowerCase()) {
throw new Error(`quill: dynamicText() attr "${attr}" must be lowercase`);
}
if (this.getAttribute(attr)) {
this.innerText = template.replace('{{}}', this.getAttribute(attr));
}
new MutationObserver(() => {
const value = this.getAttribute(attr);
this.innerText = template.replace('{{}}', value ?? '');
}).observe(this, { attributes: true, attributeFilter: [attr] });
return this
};
quill.setChildren = function(el, innerContent) { quill.setChildren = function(el, innerContent) {
if(typeof innerContent === "string") { if(typeof innerContent === "string") {
el.innerText = innerContent el.innerText = innerContent

View File

@@ -35,6 +35,10 @@ export default defineConfig({
"/auth": { "/auth": {
target: "http://localhost:10002", target: "http://localhost:10002",
changeOrigin: true changeOrigin: true
},
"/@server": {
target: "http://localhost:10002",
changeOrigin: true
} }
}, },
host: true, host: true,