renew module work

This commit is contained in:
Stewart Allen 2025-07-07 13:36:03 -04:00
commit 11552df76f
9 changed files with 116 additions and 73 deletions

View file

@ -18,11 +18,15 @@ import { selection } from './selection.js';
import { stats } from '../kiri/stats.js';
import { widgets } from './widgets.js';
import { updateTool } from '../kiri-mode/cam/tools.js';
import { version } from '../moto/license.js';
import { space as SPACE } from '../moto/space.js';
import { LANG } from './lang.js';
import { LOCAL, SETUP, SECURE } from './main.js';
import { UI } from './ui.js';
import web from '../moto/webui.js';
let UC = UI.prefix('kiri').inputAction(settings.conf.update),
und = undefined,
clone = Object.clone,
@ -80,6 +84,7 @@ let UC = UI.prefix('kiri').inputAction(settings.conf.update),
},
local = {
get: (key) => localGet(key),
getItem: (key) => localGet(key),
getInt: (key) => parseInt(localGet(key)),
getFloat: (key) => parseFloat(localGet(key)),
getBoolean: (key, def = true) => {
@ -89,6 +94,7 @@ let UC = UI.prefix('kiri').inputAction(settings.conf.update),
toggle: (key, val, def) => localSet(key, val ?? !api.local.getBoolean(key, def)),
put: (key, val) => localSet(key, val),
set: (key, val) => localSet(key, val),
setItem: (key, val) => localSet(key, val),
},
tweak = {
line_precision(v) { api.work.config({ base: { clipperClean: v } }) },
@ -152,6 +158,7 @@ export const api = {
settings,
show,
space,
SPACE,
stacks: STACKS,
stats,
tool: {
@ -166,7 +173,9 @@ export const api = {
layer_hi: 0,
layer_max: 0
},
version,
view,
web,
widgets,
work,
};

View file

@ -18,7 +18,7 @@ import { init as initWEDM } from '../kiri-mode/wedm/client.js';
import { init as initWJET } from '../kiri-mode/wjet/client.js';
let { CAM, SLA, FDM, LASER, DRAG, WJET, WEDM } = MODES,
{ client, catalog, platform, selection } = api,
{ client, catalog, platform, selection, stats } = api,
LANG = api.language.current,
WIN = self.window,
DOC = self.document,
@ -1859,8 +1859,9 @@ function init_two() {
// load script extensions
if (SETUP.s) SETUP.s.forEach(function(lib) {
let scr = DOC.createElement('script');
scr.setAttribute('defer',true);
scr.setAttribute('src',`/code/${lib}.js?${version}`);
scr.setAttribute('async', true);
scr.setAttribute('defer', true);
scr.setAttribute('src',`/code/${lib}.js?${version}}`);
DOC.body.appendChild(scr);
stats.add('load_'+lib);
api.event.emit('load.lib', lib);

View file

@ -774,6 +774,7 @@ function showHelpFile(local,then) {
WIN.open("//docs.grid.space/", "_help");
return;
}
const LANG = api.language.current;
$('kiri-version').innerHTML = `${LANG.version} ${version}`;
showModal('help');
api.event.emit('help.show', local);