Skip to content

Commit c2eca07

Browse files
committed
Merge branch 'rel-next'
2 parents c6c9846 + 6d5370f commit c2eca07

170 files changed

Lines changed: 36860 additions & 2409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ubuntu-latest, macos-latest, windows-latest]
14+
os: [ubuntu-latest, macos-latest]
1515

1616
steps:
1717
- name: Checkout code
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Docs Fomatting Check'
1+
name: 'Docs Formatting Check'
22
on:
33
push:
44
paths:
@@ -12,12 +12,19 @@ jobs:
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v4
15-
- name: Setup bun
16-
uses: oven-sh/setup-bun@v2
15+
- name: Setup Node
16+
uses: actions/setup-node@v4
1717
with:
18-
bun-version: latest
19-
- name: Install dependencies
20-
run: bun install
21-
- name: check format for docs
22-
run:
23-
bun docs-check
18+
node-version: '20'
19+
- name: Check docs formatting (retry once on transient network failure)
20+
shell: bash
21+
run: |
22+
for attempt in 1 2; do
23+
npx --yes prettier@3.5.3 --config ./conf/prettier.config.js ./docs --check && exit 0
24+
if [ "$attempt" -lt 2 ]; then
25+
echo "Prettier check failed (attempt $attempt). Retrying..."
26+
sleep 5
27+
fi
28+
done
29+
echo "Prettier check failed after retries."
30+
exit 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package-lock.json
1717
src/ext/jszip-esm.js
1818
src/ext/quickjs.js
1919
src/ext/three.js
20+
src/void/solver
2021
tmp
2122
tmp_*/
2223
web/boot/bundle*

app-el.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ const devel = process.argv.slice(2).map(v => v.replaceAll('-', '')).indexOf('dev
1414

1515
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
1616

17+
// Enable GPU/graphics acceleration for Linux (addresses WebGL issues)
18+
// Equivalent to Chrome flags that fixed the rendering in Chrome browser
19+
if (process.platform === 'linux') {
20+
// CRITICAL: Override GPU blocklist - allows hardware acceleration on blocked GPUs
21+
app.commandLine.appendSwitch('ignore-gpu-blocklist');
22+
23+
// Enable WebGL draft extensions (improves WebGL compatibility)
24+
app.commandLine.appendSwitch('enable-webgl-draft-extensions');
25+
26+
// Force GPU acceleration for 2D/3D rendering
27+
app.commandLine.appendSwitch('enable-gpu-rasterization');
28+
29+
// Optional: Try Vulkan if available (Chromium auto-falls back to OpenGL if not)
30+
// Uncomment if you need Vulkan specifically, but most systems work without it:
31+
app.commandLine.appendSwitch('enable-features', 'Vulkan');
32+
}
33+
1734
server({
1835
port: 5309,
1936
apps: basDir,
@@ -61,12 +78,15 @@ function createWindow() {
6178
if (url.endsWith('/mesh') || url.endsWith('/mesh/')) {
6279
return;
6380
}
81+
if (url.endsWith('/void') || url.endsWith('/void/')) {
82+
return;
83+
}
6484
event.preventDefault();
6585
shell.openExternal(url);
6686
});
6787

6888
webContents.on('did-finish-load', () => {
69-
mainWindow.webContents.executeJavaScript(`{ let x = document.getElementById('app-quit'); if (x) { x.onclick = () => window.close() } }; null;`);
89+
// console.log('did finish load');
7090
});
7191

7292
if (devel) {

app.js

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const mods = {};
2626
const load = [];
2727
const api = {};
2828

29+
let lastTouchTime = {};
2930
let forceUseCache = false;
3031
let serviceWorker = true;
3132
let crossOrigin = false;
@@ -134,10 +135,12 @@ function init(mod) {
134135
"/boot" : redir((pre??"") + "/boot/", 301),
135136
"/kiri" : redir((pre??"") + "/kiri/", 301),
136137
"/mesh" : redir((pre??"") + "/mesh/", 301),
137-
"/meta" : redir((pre??"") + "/meta/", 301),
138+
"/void" : redir((pre??"") + "/void/", 301),
139+
"/form" : redir((pre??"") + "/form/", 301),
138140
"/kiri/index.html" : redir((pre??"") + "/kiri/", 301),
139141
"/mesh/index.html" : redir((pre??"") + "/mesh/", 301),
140-
"/meta/index.html" : redir((pre??"") + "/meta/", 301)
142+
"/void/index.html" : redir((pre??"") + "/void/", 301),
143+
"/form/index.html" : redir((pre??"") + "/form/", 301)
141144
}));
142145
mod.add(handleVersion);
143146
mod.add(fixedmap("/api/", api));
@@ -153,12 +156,15 @@ function init(mod) {
153156
mod.static("/lib/", "alt");
154157
mod.static("/lib/", "src");
155158
mod.static("/obj/", "web/obj");
156-
mod.static("/font/", "web/font");
159+
mod.static("/boot/", "web/boot");
157160
mod.static("/fon2/", "web/fon2");
161+
mod.static("/font/", "web/font");
162+
mod.static("/form/", "web/void");
163+
mod.static("/icon/", "web/icon");
164+
mod.static("/kiri/", "web/kiri");
158165
mod.static("/mesh/", "web/mesh");
159166
mod.static("/moto/", "web/moto");
160-
mod.static("/kiri/", "web/kiri");
161-
mod.static("/boot/", "web/boot");
167+
mod.static("/void/", "web/void");
162168

163169
// module loader
164170
function load_modules(root, force) {
@@ -186,10 +192,10 @@ function init(mod) {
186192
});
187193
}
188194

189-
// load development and 3rd party modules
195+
// load development and app modules (onshape, thingiverse)
190196
load_modules('mod');
191197

192-
// load optional local modules
198+
// load optional local modules (bambu)
193199
load_modules('mods');
194200

195201
// run load functions injected by modules
@@ -208,16 +214,34 @@ function init(mod) {
208214
}
209215
}
210216

211-
// create alt artifacts with module extensions
217+
// synthesize new main when applicable
218+
createArtifacts();
219+
}
220+
221+
// create alt artifacts with module extensions
222+
function createArtifacts() {
212223
if (dryrun || !isElectron) {
213-
logger.log('creating artifacts', Object.keys(append));
224+
if (debug) {
225+
setTimeout(createArtifacts, 1000);
226+
}
227+
if (Object.keys(lastTouchTime).length === 0) {
228+
logger.log('creating artifacts', Object.keys(append));
229+
}
214230
for (let [ key, val ] of Object.entries(append)) {
215231
// append mains
216232
let src = `${dir}/src/main/${key}.js`;
217233
if (!fs.existsSync(src)) {
218234
logger.log('missing', src);
219235
continue;
220236
}
237+
let ltt = fs.statSync(src).mtimeMs;
238+
if (lastTouchTime[src] === ltt) {
239+
continue;
240+
} else if (debug) {
241+
logger.log('changed', src);
242+
}
243+
lastTouchTime[src] = ltt;
244+
// console.log({ src, ltt });
221245
fs.mkdirSync(`${dir}/alt/main`, { recursive: true });
222246
let body = fs.readFileSync(src);
223247
fs.writeFileSync(`${dir}/alt/main/${key}.js`, body + val);
@@ -234,7 +258,7 @@ function init(mod) {
234258
} else {
235259
logger.log('skipping artifacts');
236260
}
237-
};
261+
}
238262

239263
// either add module assets to path or require(init.js)
240264
function loadModule(mod, dir) {
@@ -257,7 +281,7 @@ function initModule(mod, file, dir) {
257281
logger.log({ module: file, dir });
258282
require_fresh(file)({
259283
// express functions added here show up at "/api/" url root
260-
api: api,
284+
api,
261285
adm: {
262286
setver(ver) { oversion = ver },
263287
crossOrigin(bool) { crossOrigin = bool }
@@ -329,8 +353,10 @@ function initModule(mod, file, dir) {
329353
const path = mod.dir + '/' + dir + '/' + file;
330354
try {
331355
const body = fs.readFileSync(path);
332-
if (debug && !single) logger.log({ inject: code, file, opt });
333-
if (opt.first) {
356+
if (debug && !single) {
357+
logger.log({ inject: code, file, opt });
358+
}
359+
if (opt.first && append[code]) {
334360
append[code] = body.toString() + '\n' + append[code];
335361
} else {
336362
append[code] += body.toString() + '\n';
@@ -369,8 +395,11 @@ function handleSetup(req, res, next) {
369395
}
370396

371397
const productionMap = {
372-
'/lib/mesh/work.js' : '/lib/pack/mesh-work.js',
398+
'/lib/main/void.js' : '/lib/pack/void-main.js',
399+
'/lib/main/planegcs.wasm' : '/lib/void/solver/planegcs_dist/planegcs.wasm',
400+
'/lib/worker/solids_worker.js' : '/lib/pack/void-work-solid.js',
373401
'/lib/main/mesh.js' : '/lib/pack/mesh-main.js',
402+
'/lib/mesh/work.js' : '/lib/pack/mesh-work.js',
374403
'/lib/main/kiri.js' : '/lib/pack/kiri-main.js',
375404
'/lib/kiri/run/engine.js' : '/lib/pack/kiri-eng.js',
376405
'/lib/kiri/run/minion.js' : '/lib/pack/kiri-pool.js',
@@ -487,7 +516,7 @@ function ifModifiedDate(req) {
487516

488517
function addCorsHeaders(req, res) {
489518
res.setHeader('Access-Control-Allow-Credentials', 'true');
490-
res.setHeader('Access-Control-Allow-Headers', 'X-Moto-Ajax, Content-Type');
519+
res.setHeader('Access-Control-Allow-Headers', 'X-Api-Key, X-Host, X-Moto-Ajax, Content-Type');
491520
res.setHeader('Access-Control-Allow-Origin', req.headers['origin'] || '*');
492521
if (req.headers['access-control-request-private-network'] === 'true') {
493522
res.setHeader('Access-Control-Allow-Private-Network', 'true');

bin/bundle-prod.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
{ "src": "src/pack/kiri-pool.js", "dst": "lib/kiri/run/minion.js" },
1717
{ "src": "src/gpu/raster-worker.js", "dst": "lib/gpu/raster-worker.js" },
1818
{ "src": "src/ext/tween.js", "dst": "lib/ext/tween.js" },
19-
{ "src": "src/moto/license.js", "dst": "lib/moto/license.js" }
19+
{ "src": "src/moto/license.js", "dst": "lib/moto/license.js" },
20+
{ "src": "src/void/solver/planegcs_dist/planegcs.wasm", "dst": "lib/main/planegcs.wasm" }
2021
],
2122
"excludes": [
2223
"src/pack",

bin/esbuild.config.mjs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const isProd = mode === 'prod';
99

1010
console.log(`Building in ${mode} mode...`);
1111

12+
const VOID_OUTFILE = 'src/pack/void-main.js';
13+
const VOID_EXTRAS = [ ];
14+
1215
const MESH_OUTFILE = 'src/pack/mesh-main.js';
1316
const MESH_EXTRAS = [ ];
1417

@@ -29,7 +32,7 @@ async function appendExtraModules(extras, outfile, minify = false) {
2932
const result = await transform(code, {
3033
minify: true,
3134
loader: 'js',
32-
target: 'es2020',
35+
target: 'es2022',
3336
});
3437
return result.code;
3538
})
@@ -92,14 +95,28 @@ const rec = {
9295
minify: isProd, // false for dev, true for prod
9396
platform: 'browser',
9497
sourcemap: false,
95-
target: 'es2020',
98+
target: 'es2022',
9699
};
97100

98101
async function buildApp() {
99102
try {
100103
// Concatenate kiri devices
101104
generateDevices();
102105

106+
// Bundle void main app
107+
await build(Object.assign({}, rec, {
108+
entryPoints: [ 'src/main/void.js' ],
109+
outfile: VOID_OUTFILE,
110+
}));
111+
112+
appendExtraModules(VOID_EXTRAS, VOID_OUTFILE, isProd);
113+
114+
// Bundle void worker
115+
await build(Object.assign({}, rec, {
116+
entryPoints: [ 'src/void/worker/solids_worker.js' ],
117+
outfile: 'src/pack/void-work-solid.js',
118+
}));
119+
103120
// Bundle mesh main app
104121
await build(Object.assign({}, rec, {
105122
entryPoints: [ 'src/main/mesh.js' ],

bin/webpack-three-bundle.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { LineMaterial } from '../node_modules/three/examples/jsm/lines/LineMater
77
import { LineGeometry } from '../node_modules/three/examples/jsm/lines/LineGeometry.js';
88
import { LineSegments2 } from '../node_modules/three/examples/jsm/lines/LineSegments2.js';
99
import { LineSegmentsGeometry } from '../node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js';
10+
import { TrackballControls } from '../node_modules/three/examples/jsm/controls/TrackballControls.js';
1011

1112
import * as MeshBVHLib from '../node_modules/three-mesh-bvh/build/index.module.js';
1213

@@ -19,5 +20,6 @@ export {
1920
LineGeometry,
2021
LineSegments2,
2122
LineSegmentsGeometry,
23+
TrackballControls,
2224
MeshBVHLib
23-
};
25+
};

conf/links.csv

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
src/ext/gerber.js,../../node_modules/@tracespace/parser/umd/parser.js
2-
src/ext/manifold.js,../../node_modules/manifold-3d/manifold.js
3-
src/ext/base64.js,../../node_modules/base64-js/base64js.min.js
4-
src/ext/earcut.js,../../node_modules/earcut/src/earcut.js
5-
src/ext/tween.js,../../node_modules/@tweenjs/tween.js/src/Tween.js
6-
src/ext/jszip.js,../../node_modules/jszip/dist/jszip.js
7-
src/wasm/manifold.wasm,../../node_modules/manifold-3d/manifold.wasm
8-
src/kiri/lang-en.js,../../web/kiri/lang/en.js
9-
web/fon2,../node_modules/bootstrap-icons/font/
10-
web/kiri/lang/pl.js,pl-pl.js
11-
web/kiri/lang/pt-pt.js,pt.js
12-
web/kiri/lang/da-dk.js,da.js
13-
web/kiri/lang/en-us.js,en.js
14-
web/kiri/lang/fr-fr.js,fr.js
15-
web/kiri/lang/de.js,de-de.js
16-
web/kiri/lang/es.js,es-es.js
17-
web/font,../node_modules/@fortawesome/fontawesome-free/
1+
src//gpu/raster.js,../../node_modules/@gridspace/raster-path/build/raster-path.js
2+
src//gpu/raster-worker.js,../../node_modules/@gridspace/raster-path/build/raster-worker.js
3+
src//ext/gerber.js,../../node_modules/@tracespace/parser/umd/parser.js
4+
src//ext/manifold.js,../../node_modules/manifold-3d/manifold.js
5+
src//ext/base64.js,../../node_modules/base64-js/base64js.min.js
6+
src//ext/earcut.js,../../node_modules/earcut/src/earcut.js
7+
src//ext/tween.js,../../node_modules/@tweenjs/tween.js/src/Tween.js
8+
src//ext/jszip.js,../../node_modules/jszip/dist/jszip.js
9+
src//wasm/manifold.wasm,../../node_modules/manifold-3d/manifold.wasm
10+
src//kiri/app/lang-en.js,../../../web/kiri/lang/en.js
11+
web//fon2,../node_modules/bootstrap-icons/font/
12+
web//kiri/lang/pl.js,pl-pl.js
13+
web//kiri/lang/pt-pt.js,pt.js
14+
web//kiri/lang/da-dk.js,da.js
15+
web//kiri/lang/en-us.js,en.js
16+
web//kiri/lang/fr-fr.js,fr.js
17+
web//kiri/lang/de.js,de-de.js
18+
web//kiri/lang/es.js,es-es.js
19+
web//font,../node_modules/@fortawesome/fontawesome-free/

contributing.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)