Adding events and better why sectino
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
Sam Russell
|
||||
Captured Sun
|
||||
11.19.25 - Allowing for "auto" values in otherwise numeric styles, adding vmin and vmax units
|
||||
11.17.25.3 - Adding styles() and fixing dynamic function from earlier
|
||||
11.17.25.2 - Fixing onNavigate() and onAppear()
|
||||
11.17.25 - Added dynamic function to have units in style func parameters.
|
||||
@@ -218,6 +219,8 @@ HTMLElement.prototype.rerender = function() {
|
||||
|
||||
/* Styling */
|
||||
|
||||
window.vmin = "vmin"
|
||||
window.vmax = "vmax"
|
||||
window.vh = "vh"
|
||||
window.vw = "vw"
|
||||
window.px = "px"
|
||||
@@ -304,9 +307,13 @@ function extendHTMLElementWithStyleSetters() {
|
||||
switch (type) {
|
||||
case "unit-number":
|
||||
HTMLElement.prototype[prop] = function(value, unit = "px") {
|
||||
if (typeof value !== "number" || isNaN(value)) {
|
||||
if ((typeof value !== "number" || isNaN(value)) && value !== "auto") {
|
||||
throw new Error(`Invalid value for ${prop}: ${value}. Expected a number.`);
|
||||
}
|
||||
if(value === "auto") {
|
||||
this.style[prop] = value
|
||||
return this
|
||||
}
|
||||
this.style[prop] = value + unit;
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
--green: #0857265c;
|
||||
--red: #BC1C02;
|
||||
--brown: #812A18;
|
||||
--darkbrown: #60320c;
|
||||
--darkbrown: #3f0808;
|
||||
--orange: #FE9201;
|
||||
--periwinkle: #655BAF;
|
||||
|
||||
@@ -98,6 +98,10 @@ input {
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
input::placeholder {
|
||||
color: var(--accent)
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: 1px solid var(--red);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user