complete api mapping

This commit is contained in:
Stewart Allen 2024-09-17 10:40:42 -04:00
commit 683c117bcd
5 changed files with 25 additions and 26 deletions

View file

@ -18,9 +18,10 @@ gapp.register("kiri-mode.cam.tools", (root, exports) => {
api.show.tools = showTools; api.show.tools = showTools;
api.tool = { // extend API
Object.assign(api.tool, {
update: updateTool update: updateTool
}; });
function settings() { function settings() {
return api.conf.get(); return api.conf.get();

View file

@ -67,10 +67,11 @@ function update(clear) {
} }
} }
api.alerts = { // extend API
Object.assign(api.alerts, {
hide, hide,
show, show,
update update
}; });
}); });

View file

@ -74,6 +74,7 @@ let { data, kiri, moto, noop } = root,
und = undefined, und = undefined,
api = exports({ api = exports({
ajax, // via utils ajax, // via utils
alerts: {}, // alerts.js
busy: {}, // main.js busy: {}, // main.js
catalog: und, // main.js catalog: und, // main.js
clip, // <-- clip, // <--
@ -81,12 +82,13 @@ let { data, kiri, moto, noop } = root,
color: und, // main.js color: und, // main.js
conf: {}, // settings.js conf: {}, // settings.js
const: {}, // main.js const: {}, // main.js
devel, // <--
device: {}, // devices.js
devices: {}, // devices.js
dialog: {}, // main.js dialog: {}, // main.js
doit, // <-- doit, // <--
devel, // <--
event: {}, // main.js event: {}, // main.js
feature, // <-- feature, // <--
focus: noop,
function: {}, // function.js function: {}, // function.js
group: {}, // main.js group: {}, // main.js
help: {}, // main.js help: {}, // main.js
@ -94,8 +96,8 @@ let { data, kiri, moto, noop } = root,
image: {}, // main.js image: {}, // main.js
js2o, // via utils js2o, // via utils
language: und, // main.js language: und, // main.js
local, // <--
lists, // <-- lists, // <--
local, // <--
modal: {}, // main.js modal: {}, // main.js
mode: {}, // main.js mode: {}, // main.js
o2js, // via utils o2js, // via utils
@ -107,6 +109,8 @@ let { data, kiri, moto, noop } = root,
settings: {}, // settings.js settings: {}, // settings.js
show: {}, // main.js show: {}, // main.js
space: {}, // main.js space: {}, // main.js
tool: {}, // kiri-mode/cam/tools.js
tweak, // <--
uc: {}, // main.js uc: {}, // main.js
ui: {}, // main.js ui: {}, // main.js
util: {}, // main.js util: {}, // main.js
@ -116,7 +120,6 @@ let { data, kiri, moto, noop } = root,
layer_max: 0 layer_max: 0
}, },
view: {}, // main.js view: {}, // main.js
tweak,
widgets: {}, // widgets.js widgets: {}, // widgets.js
work: und, // main.js work: und, // main.js
}); });

View file

@ -9,21 +9,25 @@ gapp.register("kiri.devices", (root, exports) => {
let { kiri } = root, let { kiri } = root,
{ api, conf } = kiri; { api, conf } = kiri;
api.show.devices = showDevices; // extend API
Object.assign(api.show, {
showDevices
});
api.device = { Object.assign(api.device, {
clone: cloneDevice, clone: cloneDevice,
code: currentDeviceCode, code: currentDeviceCode,
get: currentDeviceName, get: currentDeviceName,
set: selectDevice, set: selectDevice,
isBelt isBelt
}; });
api.devices = { Object.assign(api.devices, {
show: showDevices, show: showDevices,
select: selectDevice, select: selectDevice,
refresh: updateDeviceList refresh: updateDeviceList,
}; update_laser_state: updateLaserState
});
function isBelt() { function isBelt() {
return api.conf.get().device.bedBelt; return api.conf.get().device.bedBelt;

View file

@ -214,16 +214,6 @@ gapp.register("kiri.init", (root, exports) => {
}, 100); }, 100);
} }
function parentWithClass(el, classname) {
while (el) {
if (el.classList.contains(classname)) {
return el;
}
el = el.parentNode;
}
return el;
}
function onBooleanClick(el) { function onBooleanClick(el) {
// copy some ui elements to target settings // copy some ui elements to target settings
let settings = api.conf.get(); let settings = api.conf.get();
@ -236,7 +226,7 @@ gapp.register("kiri.init", (root, exports) => {
api.conf.update(); api.conf.update();
DOC.activeElement.blur(); DOC.activeElement.blur();
api.event.emit("boolean.click"); api.event.emit("boolean.click");
updateLaserState(); api.devices.update_laser_state();
if (el === ui.camStockIndexed) { if (el === ui.camStockIndexed) {
api.space.set_focus(); api.space.set_focus();
} }
@ -763,7 +753,7 @@ gapp.register("kiri.init", (root, exports) => {
} }
function isBelt() { function isBelt() {
return api.device.isBelt; return api.device.isBelt();
} }
function isNotBelt() { function isNotBelt() {