Skip to content

Commit

Permalink
couple of app fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sidewayss committed Dec 5, 2024
1 parent d996e26 commit 4ce8ae8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion apps/color/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ state-btn:active {
align-self:stretch;
border-radius:2px;
}
color-picker::part(details) {
color-picker::part(details),
color-picker::part(color-space) {
display: none;
}
17 changes: 7 additions & 10 deletions apps/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {MILLI, COUNT, ONE, INPUT, SELECT, BUTTON, DIV, LABEL, dlg, elms, g,
import(_load.js): load, getEasies, initEasies, updateAll, easeFinally,
resizeWindow
*/
let awaitNamed, awaitUpdate, ns, ns_named;
let ns, ns_named;
const RESIZE = "resize";

const awaitFonts = [ // start loading fonts asap
Expand Down Expand Up @@ -90,8 +90,6 @@ function loadCommon() {
is = ns.load(byTag, hasVisited),
// the rest of the async processes:
msg = "Error fetching common.json: presets & tooltips are unavailable";
awaitNamed = Ez.promise(); // these two resolve in loadJSON()
awaitUpdate = Ez.promise();
fetch("../common.json")
.then (rsp => loadJSON(rsp, is, dir, ns, name, hasVisited, byTag, msg))
.catch(err => errorAlert(err, msg));
Expand All @@ -104,6 +102,7 @@ function loadCommon() {
function loadJSON(response, is, dir, ns, name, hasVisited, byTag, msg) {
if (response.ok)
response.json().then(json => {
const awaitNamed = Ez.promise();
g.presets = json.presets; // must precede loadNamed()
loadNamed(is.multi, dir, ns)
.then(namespace => {
Expand All @@ -125,20 +124,18 @@ function loadJSON(response, is, dir, ns, name, hasVisited, byTag, msg) {
}
}
const awaitCustom =
byTag.slice (-4) // the page's custom elements
byTag.slice (-4) // the page's custom elements, by tag
.filter(v => v.length)
.map (v => customElements.whenDefined(v[0].localName));
if (is.promise)
awaitCustom.push(is.promise);
if (is.easings) { // byTag is missing clones
const nums = [...document.getElementsByTagName("input-num")];
if (is.easings) // byTag is missing clones
awaitCustom.push(
...nums.map(num => BaseElement.promises.get(num))
...Array.from(document.getElementsByTagName("input-num"))
.map (inp => BaseElement.promises.get(inp))
);
}

Promise.all([document.fonts.ready, awaitNamed, ...awaitCustom])
.then (() => loadFinally(is, name, hasVisited, id))
.then (() => loadFinally(is, name, hasVisited, id))
.catch(errorAlert);
}).catch(errorAlert);

Expand Down

0 comments on commit 4ce8ae8

Please sign in to comment.