fix dialog key override / restore, add named module loading
This commit is contained in:
parent
d48b083cbc
commit
7290103b22
8 changed files with 37 additions and 22 deletions
|
|
@ -1,7 +1,5 @@
|
|||
self.kiri.load(api => {
|
||||
|
||||
console.log('BAMBU MODULE RUNNING');
|
||||
|
||||
const { uc: ui } = api;
|
||||
const { $, h } = api.web;
|
||||
const defams = ";; DEFINE BAMBU-AMS ";
|
||||
|
|
@ -1327,4 +1325,4 @@ self.kiri.load(api => {
|
|||
setInterval(monitor_keepalive, 5000);
|
||||
|
||||
let bblapi = api.bambu = { send, prep_export };
|
||||
});
|
||||
}, 'Bambu');
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ self.kiri.load(api => {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
}, 'Developer');
|
||||
|
|
|
|||
|
|
@ -115,7 +115,15 @@ export const api = {
|
|||
clone: Object.clone,
|
||||
color,
|
||||
conf: settings.conf,
|
||||
const: { LANG, LOCAL, SETUP, SECURE, SPACE, STACKS, ...consts },
|
||||
const: {
|
||||
LANG, LOCAL, SETUP, SECURE, SPACE, STACKS,
|
||||
...consts,
|
||||
URL: {
|
||||
path: LOC.pathname,
|
||||
hash: LOC.hash.substring(1),
|
||||
query: LOC.search.substring(1)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Development/debug utilities
|
||||
*/
|
||||
|
|
@ -151,12 +159,14 @@ export const api = {
|
|||
redo: noop // do.js
|
||||
},
|
||||
event: {
|
||||
on(t,l) { return EVENT.on(t,l) },
|
||||
emit(t,m,o) { return EVENT.publish(t,m,o) },
|
||||
bind(t,m,o) { return EVENT.bind(t,m,o) },
|
||||
alerts(clr) { alerts.update(clr) },
|
||||
bind(t,m,o) { return EVENT.bind(t,m,o) },
|
||||
emit(t,m,o) { return EVENT.publish(t,m,o) },
|
||||
import() { api.ui.load.click() },
|
||||
settings: settingsUI.trigger_event
|
||||
listeners(topic) { return EVENT.targets(topic) },
|
||||
on(t,l) { return EVENT.on(t,l) },
|
||||
settings: settingsUI.trigger_event,
|
||||
topics() { return EVENT.topics() }
|
||||
},
|
||||
electron: navigator.userAgent.includes('Electron'),
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -208,9 +208,11 @@ function confirm(message, buttons, input, opt = {}) {
|
|||
html.appendAll(opt.post);
|
||||
}
|
||||
dialog.innerHTML = html.join('');
|
||||
dialog.onclose = () => {
|
||||
feature.on_key = onkey_save;
|
||||
};
|
||||
function done(value) {
|
||||
dialog.close();
|
||||
feature.on_key = onkey_save;
|
||||
if (value !== undefined) {
|
||||
setTimeout(() => { resolve(value) }, 150);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,15 +253,15 @@ class KeyboardControl {
|
|||
if (handler({key:evt})) return;
|
||||
}
|
||||
|
||||
// Handle Ctrl key combinations
|
||||
// Handle widget grouping (disabled: broken, conflicts with hash settings)
|
||||
if (evt.ctrlKey) {
|
||||
switch (evt.key) {
|
||||
case 'g': return this.#api.group.merge();
|
||||
case 'u': return this.#api.group.split();
|
||||
// case 'g': return this.#api.group.merge();
|
||||
// case 'u': return this.#api.group.split();
|
||||
}
|
||||
}
|
||||
|
||||
switch (evt.charCode) {
|
||||
switch (evt.keyCode) {
|
||||
case this.#cca('`'): this.#api.show.slices(0); break;
|
||||
case this.#cca('0'): {
|
||||
const { max } = this.#slider.getRange();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ class ModalControl {
|
|||
|
||||
// hide all modals before showing another
|
||||
Object.keys(modal.#ui.modals).forEach(name => {
|
||||
console.log({ name, which });
|
||||
modal.#ui.modals[name].style.display = name === which ? 'flex' : '';
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ import { init_sync } from '../kiri/app/init/sync.js';
|
|||
let traceload = location.search.indexOf('traceload') > 0;
|
||||
let load = [];
|
||||
|
||||
function safeExec(fn) {
|
||||
function safeExec(fn, name) {
|
||||
try {
|
||||
if (traceload) {
|
||||
console.log('kiri | exec |', fn);
|
||||
console.log('kiri | exec |', name, fn);
|
||||
} else if (name) {
|
||||
console.log('kiri | load mods |', name);
|
||||
}
|
||||
fn(kiri.api);
|
||||
} catch (error) {
|
||||
|
|
@ -37,8 +39,8 @@ async function checkReady() {
|
|||
await init_input();
|
||||
await init_sync();
|
||||
}
|
||||
for (let fn of load) {
|
||||
safeExec(fn);
|
||||
for (let [fn, name] of load) {
|
||||
safeExec(fn, name);
|
||||
}
|
||||
load = undefined;
|
||||
api.event.emit('load-done', stats);
|
||||
|
|
@ -63,12 +65,12 @@ async function checkReady() {
|
|||
}
|
||||
|
||||
self.kiri = {
|
||||
load(fn) {
|
||||
load(fn, name) {
|
||||
// console.log('KIRI LOAD', [...arguments]);
|
||||
if (load) {
|
||||
load.push(fn);
|
||||
load.push([fn, name]);
|
||||
} else {
|
||||
safeExec(fn);
|
||||
safeExec(fn, name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ class Broker {
|
|||
return Object.keys(this.#topics);
|
||||
}
|
||||
|
||||
targets(topic) {
|
||||
return this.#topics[topic];
|
||||
}
|
||||
|
||||
get send() {
|
||||
return this.#send;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue