This commit is contained in:
metacryst
2026-01-25 06:27:57 -06:00
parent fd27ac9c69
commit 7f3f266d52
24 changed files with 1298 additions and 210 deletions

View File

@@ -1,6 +1,7 @@
/*
Sam Russell
Captured Sun
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
12.26.25 - State for arrays, nested objects. State for stacks (Shadow-only)
12.17.25 - [Hyperia] - adding width, height functions. adding "e" to onClick. adding the non-window $$ funcs.
@@ -27,7 +28,6 @@ let oldPushState = history.pushState;
history.pushState = function pushState() {
let ret = oldPushState.apply(this, arguments);
window.dispatchEvent(new Event('pushstate'));
window.dispatchEvent(new Event('navigate'));
return ret;
};
@@ -53,8 +53,8 @@ window.setQuery = function(key, value) {
};
window.navigateTo = function(url) {
window.dispatchEvent(new Event('navigate'));
window.history.pushState({}, '', url);
window.dispatchEvent(new Event('navigate'));
}
window.setLocation = function(url) {
@@ -1084,7 +1084,7 @@ HTMLElement.prototype.onTap = function(cb) {
- We can't just put a listener on the element, because a window "navigate" event won't trigger it
- We can't just put a listener on the window, because the "this" variable will only refer to the window
- And, if we try to re-add that scope using bind(), it makes the return value of .toString() unreadable, which means we cannot detect duplicate listeners.
- Therefore, we attach a global navigate event to the window, and each navigate event in this array, and manually trigger each event when the global one fires.
- Therefore, we attach a global navigate event to the window, and store each navigate event in this navigateListeners array, and manually trigger each event on the elements when the global one fires.
*/
navigateListeners = []
window.addEventListener("navigate", () => {
@@ -1197,7 +1197,11 @@ HTMLElement.prototype.attr = function(attributes) {
}
for (const [key, value] of Object.entries(attributes)) {
this.setAttribute(key, value);
if(value === null) {
this.removeAttribute(key)
} else {
this.setAttribute(key, value);
}
}
return this;
};

View File

@@ -1,5 +1,5 @@
:root {
--main: #AEBDFF;
--main: #FFE9C8;
--accent: #60320c;
--text: #340000;
--yellow: #f1f3c3;