Adopt Kryon #ui hierarchy syntax

This commit is contained in:
waozi committed 2026-08-23 23:17:20 -03:00
1 parent f4ba954b10
commit a8618c2903
46 files changed
+771 -44

No files matched your search

+2
View File
@@ -63,6 +63,8 @@ local.properties
*.9
*.8
*.a
__pycache__/
*.py[cod]
/pro/
.kotlin/
+5 -1
View File
@@ -501,6 +501,7 @@ KRYON_CANVAS_SRCS := $(filter-out $(KRYON_RAYLIB_WRAPPERS_C),$(KRYON_SRCS))
WEB_DIST_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-web.zip
WEB_SMOKE_BROWSER ?= auto
WEB_SMOKE_TEST := scripts/web-smoke-test.mjs
WEB_SIDE_BY_SIDE_TEST := scripts/web-side-by-side-test.sh
WEB_APP_URL ?= https://inbe.waozi.xyz/
CHROME_WEB_STORE_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-chrome-web-store.zip
CHROME_WEB_STORE_MANIFEST := packaging/chrome-web-store/manifest.json
@@ -536,7 +537,7 @@ MEDITATION_AUDIO_TRACKS := \
include $(KRYON_DIR)/mk/package-freebsd.mk
.PHONY: web-canvas web-canvas-smoke-test web-compare-test all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site site-release-assets-check chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons sync-web-icons
.PHONY: web-canvas web-canvas-smoke-test web-compare-test web-side-by-side-test all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 windows32 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site site-release-assets-check chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons sync-web-icons
.PHONY: no-vendor-edits
.NOTPARALLEL: dist windows windows64 windows32 android-release android-bundle click deb package-deb rpm package-rpm snap package-snap flatpak package-flatpak
@@ -1633,6 +1634,9 @@ web-compare-test:
$(MAKE) web-canvas
$(MAKE) web-canvas-smoke-test
web-side-by-side-test: $(WEB_SIDE_BY_SIDE_TEST)
bash $(WEB_SIDE_BY_SIDE_TEST)
web-smoke-test-firefox: $(WEB_SMOKE_TEST)
WEB_SMOKE_RENDERER=raylib WEB_SMOKE_BROWSER="firefox" node $(WEB_SMOKE_TEST) $(WEB_DIST_DIR)
+11
View File
@@ -7,6 +7,7 @@ Inbe has two web renderer paths:
| `make web` | raylib/WebGL | Shipping web build with liboqs sync support. |
| `make web-canvas` | Kryon Canvas2D | No-WebGL fallback build using Kryon's Canvas backend. The app still uses Emscripten/WASM for C code and support libraries. |
| `make web-compare-test` | both | Builds both renderers and runs the browser smoke suite against each. |
| `make web-side-by-side-test` | both | Builds both renderers, runs both smoke tests, then serves a split-page manual comparison view. |
The shared smoke test is `scripts/web-smoke-test.mjs`. It is renderer-aware:
@@ -18,3 +19,13 @@ The shared smoke test is `scripts/web-smoke-test.mjs`. It is renderer-aware:
Current known gap:
- The shared smoke test verifies account crypto/import parity, rendering, storage, and app settings persistence. It does not yet run a real local sync server transaction for either renderer.
For manual visual comparison, run:
```bash
make web-side-by-side-test
```
The script prints a local URL with raylib/WebGL on the left and Canvas2D on the
right. Use `scripts/web-side-by-side-test.sh --no-serve` for CI-style
build-and-smoke validation without starting the comparison server.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

+1 -1
View File
@@ -22,7 +22,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="1.4.3" date="2026-06-20"/>
<release version="1.9.9" date="2026-08-22"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+2
View File
@@ -5,5 +5,7 @@ Comment=Syncable breathing, meditation, and habit practice app
Exec=inbe
Icon=xyz.waozi.inbe
Categories=Utility;
Keywords=breathing;meditation;habits;wellness;mindfulness;focus;breaks;
Terminal=false
StartupNotify=true
StartupWMClass=xyz.waozi.inbe
+1 -1
View File
@@ -22,7 +22,7 @@
<binary>inbe</binary>
</provides>
<releases>
<release version="1.4.3" date="2026-06-20"/>
<release version="1.9.9" date="2026-08-22"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
+273
View File
@@ -0,0 +1,273 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
BUILD=1
SMOKE=1
SERVE=1
OPEN=0
PORT="${INBE_WEB_SIDE_BY_SIDE_PORT:-0}"
BROWSER="${WEB_SMOKE_BROWSER:-auto}"
STAMP="$(date +%Y%m%d-%H%M%S)"
LOG_DIR="${INBE_WEB_SIDE_BY_SIDE_LOG_DIR:-/tmp/inbe-web-side-by-side-$STAMP}"
WORK_DIR="${INBE_WEB_SIDE_BY_SIDE_WORK_DIR:-/tmp/inbe-web-side-by-side-view-$STAMP}"
export EM_CACHE="${EM_CACHE:-/tmp/inbe-em-cache}"
mkdir -p "$EM_CACHE"
usage() {
cat <<EOF
Usage: $0 [options]
Build and test both web renderers, then serve a side-by-side comparison page.
Options:
--no-build Skip rebuilding build/dist/web and build/dist/web-canvas.
--no-smoke Skip automated smoke tests.
--no-serve Exit after build/smoke checks.
--open Open the side-by-side page with xdg-open after serving starts.
--port PORT Serve on PORT. Default chooses a free local port.
--browser CMD Browser command for smoke tests. Default: WEB_SMOKE_BROWSER or auto.
-h, --help Show this help.
Environment:
WEB_SMOKE_BROWSER Browser for smoke tests.
INBE_WEB_SIDE_BY_SIDE_PORT Default port when --port is omitted.
INBE_WEB_SIDE_BY_SIDE_LOG_DIR Directory for command logs.
INBE_WEB_SIDE_BY_SIDE_WORK_DIR Temporary serving root.
EM_CACHE Emscripten cache. Default: /tmp/inbe-em-cache.
EOF
}
while [ "$#" -gt 0 ]; do
case "$1" in
--no-build)
BUILD=0
;;
--no-smoke)
SMOKE=0
;;
--no-serve)
SERVE=0
;;
--open)
OPEN=1
;;
--port)
shift
if [ "$#" -eq 0 ]; then
echo "Missing value for --port" >&2
exit 2
fi
PORT="$1"
;;
--browser)
shift
if [ "$#" -eq 0 ]; then
echo "Missing value for --browser" >&2
exit 2
fi
BROWSER="$1"
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 2
;;
esac
shift
done
run_step() {
local name="$1"
local label="$2"
shift 2
local log="$LOG_DIR/$name.log"
mkdir -p "$LOG_DIR"
printf '==> %s\n' "$label"
if "$@" >"$log" 2>&1; then
printf ' PASS (%s)\n' "$log"
return 0
fi
printf ' FAIL (%s)\n' "$log" >&2
tail -120 "$log" >&2 || true
exit 1
}
choose_port() {
if [ "$PORT" != "0" ]; then
printf '%s\n' "$PORT"
return 0
fi
python3 - <<'PY'
import socket
sock = socket.socket()
sock.bind(("127.0.0.1", 0))
print(sock.getsockname()[1])
sock.close()
PY
}
write_side_by_side_page() {
mkdir -p "$WORK_DIR"
ln -sfn "$ROOT/build/dist/web" "$WORK_DIR/raylib"
ln -sfn "$ROOT/build/dist/web-canvas" "$WORK_DIR/canvas"
ln -sfn "$ROOT/build/dist/web/site-icons" "$WORK_DIR/site-icons"
ln -sfn "$ROOT/build/dist/web/web-assets" "$WORK_DIR/web-assets"
cat > "$WORK_DIR/index.html" <<'HTML'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Inner Breeze Web Renderer Compare</title>
<style>
html,
body {
height: 100%;
margin: 0;
background: #111;
color: #f7fbf9;
font: 13px/1.4 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.compare {
min-height: 100%;
display: grid;
grid-template-columns: 1fr 1fr;
}
.pane {
min-width: 0;
display: grid;
grid-template-rows: auto 1fr;
border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.pane:first-child {
border-left: 0;
}
.bar {
min-height: 34px;
display: flex;
align-items: center;
gap: 10px;
padding: 0 12px;
background: #20242a;
border-bottom: 1px solid rgba(255, 255, 255, 0.18);
box-sizing: border-box;
}
.label {
font-weight: 700;
}
.path {
color: #aab8b4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
iframe {
width: 100%;
height: 100%;
border: 0;
background: #17172a;
}
@media (max-width: 900px) {
.compare {
grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr;
}
.pane {
border-left: 0;
border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.pane:first-child {
border-top: 0;
}
}
</style>
</head>
<body>
<main class="compare">
<section class="pane">
<div class="bar">
<span class="label">Raylib / WebGL</span>
<span class="path">/raylib/index.html</span>
</div>
<iframe src="/raylib/index.html" title="Inner Breeze Raylib WebGL"></iframe>
</section>
<section class="pane">
<div class="bar">
<span class="label">Canvas2D</span>
<span class="path">/canvas/index.html</span>
</div>
<iframe src="/canvas/index.html" title="Inner Breeze Canvas2D"></iframe>
</section>
</main>
</body>
</html>
HTML
}
cleanup() {
if [ "$SERVE" -eq 0 ]; then
rm -rf "$WORK_DIR"
fi
}
trap cleanup EXIT
if [ "$BUILD" -eq 1 ]; then
run_step build "Build raylib/WebGL and Canvas web outputs" make build/dist/web/index.html
fi
if [ ! -f build/dist/web/index.html ] || [ ! -f build/dist/web/index.js ] || [ ! -f build/dist/web/index.wasm ]; then
echo "Missing raylib/WebGL web build in build/dist/web" >&2
exit 1
fi
if [ ! -f build/dist/web-canvas/index.html ] || [ ! -f build/dist/web-canvas/index.js ] || [ ! -f build/dist/web-canvas/index.wasm ]; then
echo "Missing Canvas web build in build/dist/web-canvas" >&2
exit 1
fi
if [ "$SMOKE" -eq 1 ]; then
run_step smoke-raylib "Smoke test raylib/WebGL renderer" \
env WEB_SMOKE_RENDERER=raylib WEB_SMOKE_BROWSER="$BROWSER" node scripts/web-smoke-test.mjs build/dist/web
run_step smoke-canvas "Smoke test Canvas2D renderer" \
env WEB_SMOKE_RENDERER=canvas WEB_SMOKE_BROWSER="$BROWSER" node scripts/web-smoke-test.mjs build/dist/web-canvas
fi
if [ "$SERVE" -eq 0 ]; then
printf 'Logs: %s\n' "$LOG_DIR"
exit 0
fi
write_side_by_side_page
PORT="$(choose_port)"
URL="http://127.0.0.1:$PORT/"
printf '\nSide-by-side page: %s\n' "$URL"
printf 'Logs: %s\n' "$LOG_DIR"
printf 'Serving root: %s\n' "$WORK_DIR"
printf 'Press Ctrl-C to stop.\n\n'
if [ "$OPEN" -eq 1 ]; then
xdg-open "$URL" >/dev/null 2>&1 || true
fi
exec python3 -m http.server "$PORT" --bind 127.0.0.1 --directory "$WORK_DIR"
+337 -4
View File
@@ -5,6 +5,7 @@ import { createReadStream, mkdtempSync, rmSync, existsSync, accessSync, constant
import { tmpdir } from 'node:os';
import { join, normalize, resolve, sep } from 'node:path';
import { spawn } from 'node:child_process';
import { inflateSync } from 'node:zlib';
if (typeof WebSocket === 'undefined') {
console.error('web smoke: FAIL: this script needs the global WebSocket API. Use Node >= 21, or pass --experimental-websocket on Node 20.');
@@ -304,10 +305,17 @@ function eventText(event) {
return '';
}
function isBenignAsyncifyUnwind(text) {
return /\$(__main_argc_argv|dynCall_[A-Za-z0-9_]+)/.test(text) &&
/\b(callUserCallback|doRewind|MainLoop_runner)\b/.test(text);
}
function fatalEvent(event) {
const text = eventText(event);
if (event.method === 'Runtime.exceptionThrown' && text.includes('transaction.oncomplete'))
return '';
if (event.method === 'Runtime.exceptionThrown' && isBenignAsyncifyUnwind(text))
return '';
if (event.method === 'Runtime.exceptionThrown' || event.method === 'Page.javascriptDialogOpening')
return text;
if (event.method === 'Runtime.consoleAPICalled' && event.params.type === 'error' &&
@@ -334,6 +342,10 @@ function fatalBidiEvent(event) {
return '';
}
function isTransientTargetNavigationError(error) {
return /Inspected target navigated or closed|Execution context was destroyed|Cannot find context with specified id/.test(error?.message || '');
}
async function waitForHealthyPage(client) {
const start = Date.now();
let sawApp = false;
@@ -351,8 +363,10 @@ async function waitForHealthyPage(client) {
sawApp = true;
}
const result = await client.send('Runtime.evaluate', {
expression: `(() => {
let result;
try {
result = await client.send('Runtime.evaluate', {
expression: `(() => {
const renderer = ${JSON.stringify(renderer)};
const canvas = document.querySelector('canvas');
const status = document.querySelector('#status')?.textContent || '';
@@ -394,8 +408,16 @@ async function waitForHealthyPage(client) {
runDependencies: M && (typeof M.monitorRunDependencies === 'function') ? M.totalDependencies : undefined
};
})()`,
returnByValue: true
});
returnByValue: true
});
} catch (error) {
if (!isTransientTargetNavigationError(error))
throw error;
lastState = { ok: false, reason: error.message };
healthySince = 0;
await delay(100);
continue;
}
const value = result.result?.value;
lastState = value;
if ((sawApp || value?.mainStarted) && value?.ok && value?.runtimeReady) {
@@ -768,6 +790,316 @@ async function verifySyncKeyImportBidi(client, context) {
throw new Error(`Firefox web sync key import did not save account settings; code=${state.code}`);
}
async function pageJson(client, expression, awaitPromise = false) {
const result = await client.send('Runtime.evaluate', {
expression,
awaitPromise,
returnByValue: true
});
const value = result.result?.value;
if (typeof value === 'string') {
try {
return JSON.parse(value);
} catch {}
}
return value;
}
function installHabitsLifecycleWatchExpression() {
return `(() => {
window.__inbeSmokeLifecycle = { beforeunload: 0, pagehide: 0, visibilityHidden: 0 };
if (!window.__inbeSmokeLifecycleInstalled) {
window.__inbeSmokeLifecycleInstalled = true;
window.addEventListener('beforeunload', () => { window.__inbeSmokeLifecycle.beforeunload++; });
window.addEventListener('pagehide', () => { window.__inbeSmokeLifecycle.pagehide++; });
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'hidden')
window.__inbeSmokeLifecycle.visibilityHidden++;
});
}
return true;
})()`;
}
function startHabitsFrameProbeExpression(frameCount) {
return `(() => {
const canvas = document.querySelector('canvas');
const frames = ${frameCount};
window.__inbeSmokeFrameProbe = new Promise(resolve => {
const samples = [];
let frame = 0;
function sample() {
const result = { frame, ok: false, bright: 0, total: 0, reason: '' };
try {
if (!canvas) {
result.reason = 'missing canvas';
} else if (canvas.clientWidth <= 0 || canvas.clientHeight <= 0) {
result.reason = 'zero-size canvas';
} else {
const w = 32;
const h = 32;
const copy = document.createElement('canvas');
copy.width = w;
copy.height = h;
const ctx = copy.getContext('2d', { willReadFrequently: true });
ctx.drawImage(canvas, 0, 0, w, h);
const data = ctx.getImageData(0, 0, w, h).data;
let bright = 0;
let alpha = 0;
for (let i = 0; i < data.length; i += 4) {
if (data[i + 3] > 0)
alpha++;
if (data[i + 3] > 0 && data[i] + data[i + 1] + data[i + 2] > 18)
bright++;
}
result.bright = bright;
result.alpha = alpha;
result.total = w * h;
result.ok = bright > result.total * 0.05;
if (!result.ok)
result.reason = 'blank or black canvas frame';
}
} catch (error) {
result.reason = error && error.message ? error.message : String(error);
}
samples.push(result);
frame++;
if (frame >= frames) {
const bad = samples.find(sample => !sample.ok);
resolve({ ok: !bad, bad, samples: samples.slice(0, 3).concat(samples.slice(-3)) });
} else {
requestAnimationFrame(sample);
}
}
requestAnimationFrame(sample);
});
return true;
})()`;
}
async function openHabitsOverview(client) {
const state = await pageJson(client, `(async () => JSON.stringify(await (async () => {
if (typeof Module._app_web_test_save_onboarding_state === 'function')
Module._app_web_test_save_onboarding_state();
if (typeof Module._app_web_extension_open_habits !== 'function')
return { ok: false, reason: 'missing habits launch hook' };
Module._app_web_extension_open_habits();
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
return {
ok: typeof Module._app_web_test_habits_click_x === 'function' &&
typeof Module._app_web_test_habits_click_y === 'function',
reason: 'missing habits click hook'
};
})()))()`, true);
if (!state?.ok)
throw new Error(state?.reason || 'failed to open habits overview');
}
async function habitsClickTarget(client) {
const target = await pageJson(client, `(() => JSON.stringify((() => {
const canvas = Module.canvas || document.querySelector('canvas');
if (!canvas)
return { ok: false, reason: 'missing canvas' };
const rect = canvas.getBoundingClientRect();
const rawX = Module._app_web_test_habits_click_x();
const rawY = Module._app_web_test_habits_click_y();
const basisW = canvas.width || rect.width || 1;
const basisH = canvas.height || rect.height || 1;
const x = rect.left + rawX * rect.width / basisW;
const y = rect.top + rawY * rect.height / basisH;
return {
ok: rawX >= 0 && rawY >= 0 && x >= rect.left && y >= rect.top &&
x <= rect.right && y <= rect.bottom,
reason: 'invalid habits click target',
x,
y,
rawX,
rawY,
rect: { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom, width: rect.width, height: rect.height },
canvas: { width: canvas.width, height: canvas.height }
};
})()))()`);
if (!target?.ok)
throw new Error(`${target?.reason || 'failed to compute habits click target'}; state=${JSON.stringify(target)}`);
return target;
}
function readPngBrightness(base64) {
const png = Buffer.from(base64, 'base64');
const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
if (png.length < signature.length || !png.subarray(0, signature.length).equals(signature))
throw new Error('screenshot is not a PNG');
let offset = signature.length;
let width = 0;
let height = 0;
let colorType = -1;
const idat = [];
while (offset + 8 <= png.length) {
const length = png.readUInt32BE(offset);
const type = png.toString('ascii', offset + 4, offset + 8);
const dataStart = offset + 8;
const dataEnd = dataStart + length;
if (dataEnd + 4 > png.length)
throw new Error('truncated PNG chunk');
if (type === 'IHDR') {
width = png.readUInt32BE(dataStart);
height = png.readUInt32BE(dataStart + 4);
const bitDepth = png[dataStart + 8];
colorType = png[dataStart + 9];
if (bitDepth !== 8 || (colorType !== 2 && colorType !== 6))
throw new Error(`unsupported PNG format bitDepth=${bitDepth} colorType=${colorType}`);
} else if (type === 'IDAT') {
idat.push(png.subarray(dataStart, dataEnd));
} else if (type === 'IEND') {
break;
}
offset = dataEnd + 4;
}
if (width <= 0 || height <= 0 || !idat.length)
throw new Error('PNG is missing IHDR/IDAT data');
const bpp = colorType === 6 ? 4 : 3;
const stride = width * bpp;
const inflated = inflateSync(Buffer.concat(idat));
let input = 0;
let bright = 0;
const total = width * height;
let previous = Buffer.alloc(stride);
let current = Buffer.alloc(stride);
for (let y = 0; y < height; y++) {
const filter = inflated[input++];
for (let x = 0; x < stride; x++) {
const raw = inflated[input++];
const left = x >= bpp ? current[x - bpp] : 0;
const up = previous[x] || 0;
const upLeft = x >= bpp ? previous[x - bpp] : 0;
let value = raw;
if (filter === 1) {
value += left;
} else if (filter === 2) {
value += up;
} else if (filter === 3) {
value += Math.floor((left + up) / 2);
} else if (filter === 4) {
const p = left + up - upLeft;
const pa = Math.abs(p - left);
const pb = Math.abs(p - up);
const pc = Math.abs(p - upLeft);
value += pa <= pb && pa <= pc ? left : (pb <= pc ? up : upLeft);
} else if (filter !== 0) {
throw new Error(`unsupported PNG filter ${filter}`);
}
current[x] = value & 255;
}
for (let x = 0; x < width; x++) {
const pixel = x * bpp;
if (current[pixel] + current[pixel + 1] + current[pixel + 2] > 18)
bright++;
}
const swap = previous;
previous = current;
current = swap;
}
return { bright, total, width, height, ok: bright > total * 0.05 };
}
async function captureScreenshotProbe(client, samples) {
const frames = [];
for (let frame = 0; frame < samples; frame++) {
const screenshot = await client.send('Page.captureScreenshot', {
format: 'png',
fromSurface: true
});
const state = readPngBrightness(screenshot.data);
frames.push({ frame, ...state });
if (!state.ok)
return { ok: false, bad: frames[frames.length - 1], samples: frames.slice(0, 3).concat(frames.slice(-3)) };
await delay(25);
}
return { ok: true, samples: frames.slice(0, 3).concat(frames.slice(-3)) };
}
async function verifyHabitsClickDoesNotReload(client) {
await waitForStorageIdle(client);
await openHabitsOverview(client);
await verifyRenderingLive(client);
await client.send('Page.setLifecycleEventsEnabled', { enabled: true }).catch(() => {});
await pageJson(client, installHabitsLifecycleWatchExpression());
const target = await habitsClickTarget(client);
const marker = `habits-click-${Date.now()}`;
const before = await pageJson(client, `(() => {
window.__inbeSmokeModule = Module;
Module.__inbeSmokeMarker = ${JSON.stringify(marker)};
return {
href: location.href,
ready: !!Module.__inbeRuntimeReady,
loadingClass: document.querySelector('#loading-screen')?.className || '',
lifecycle: window.__inbeSmokeLifecycle
};
})()`);
const firstEvent = client.events.length;
if (renderer === 'canvas')
await pageJson(client, startHabitsFrameProbeExpression(30));
await client.send('Input.dispatchMouseEvent', {
type: 'mouseMoved',
x: target.x,
y: target.y
});
await client.send('Input.dispatchMouseEvent', {
type: 'mousePressed',
x: target.x,
y: target.y,
button: 'left',
clickCount: 1
});
await delay(50);
await client.send('Input.dispatchMouseEvent', {
type: 'mouseReleased',
x: target.x,
y: target.y,
button: 'left',
clickCount: 1
});
const probe = renderer === 'canvas'
? await pageJson(client, 'window.__inbeSmokeFrameProbe.then(value => JSON.stringify(value))', true)
: await captureScreenshotProbe(client, 12);
await delay(250);
const after = await pageJson(client, `(() => ({
href: location.href,
ready: !!Module.__inbeRuntimeReady,
sameModule: window.__inbeSmokeModule === Module,
sameMarker: Module.__inbeSmokeMarker === ${JSON.stringify(marker)},
loadingClass: document.querySelector('#loading-screen')?.className || '',
lifecycle: window.__inbeSmokeLifecycle
}))()`);
const events = client.events.slice(firstEvent);
const navigationEvents = events
.filter(event => event.method === 'Page.frameNavigated' ||
event.method === 'Page.frameStartedNavigating' ||
event.method === 'Page.domContentEventFired' ||
event.method === 'Page.loadEventFired' ||
(event.method === 'Page.lifecycleEvent' && event.params?.name === 'init'))
.map(event => event.method + (event.params?.name ? `:${event.params.name}` : ''));
if (navigationEvents.length)
throw new Error(`habits click triggered page navigation/reload events: ${navigationEvents.join(', ')}`);
if (before.href !== after.href)
throw new Error(`habits click changed location: before=${before.href} after=${after.href}`);
if (!after.ready || !after.sameModule || !after.sameMarker)
throw new Error(`habits click replaced or reset the app runtime: ${JSON.stringify(after)}`);
if ((after.lifecycle?.beforeunload || 0) > 0 || (after.lifecycle?.pagehide || 0) > 0)
throw new Error(`habits click fired unload lifecycle handlers: ${JSON.stringify(after.lifecycle)}`);
if (!/is-hidden/.test(after.loadingClass))
throw new Error(`habits click showed loading overlay: ${JSON.stringify(after.loadingClass)}`);
if (!probe?.ok)
throw new Error(`habits click produced a blank canvas frame: ${JSON.stringify(probe?.bad || probe)}`);
}
let chrome;
let client;
let failure;
@@ -944,6 +1276,7 @@ try {
await verifyReloadPersistence(client);
await verifyAppSettingsReloadPersistence(client);
await verifySyncKeyImport(client);
await verifyHabitsClickDoesNotReload(client);
}
console.log(`web smoke: PASS (${renderer})`);
} catch (error) {
+22
View File
@@ -346,6 +346,28 @@ app_web_test_import_sync_key(void)
web_test_sync_key_import_status = 1;
}
EMSCRIPTEN_KEEPALIVE
int
app_web_test_habits_click_x(void)
{
InbeApp *app = get_global_inbe_app();
int x = 0;
int y = 0;
return habits_overview_test_click_point(app, &x, &y) ? x : -1;
}
EMSCRIPTEN_KEEPALIVE
int
app_web_test_habits_click_y(void)
{
InbeApp *app = get_global_inbe_app();
int x = 0;
int y = 0;
return habits_overview_test_click_point(app, &x, &y) ? y : -1;
}
EMSCRIPTEN_KEEPALIVE
void
app_web_test_enable_extension_breaks(int limit_s)
+3 -2
View File
@@ -7,7 +7,8 @@ route customize_nav {
page customize_nav
}
screen customize_nav {
args InbeApp *app
customize_nav :: (app: InbeApp*) #ui {
Screen root: {
app_draw_customize_nav_page(app)
}
}
+3 -2
View File
@@ -6,7 +6,8 @@ route nav_sidebar {
page nav_sidebar
}
screen nav_sidebar {
args InbeApp *app
nav_sidebar :: (app: InbeApp*) #ui {
Screen root: {
unused app
}
}
@@ -35,7 +35,7 @@ music_icon_for_volume :: (app: InbeApp*) -> Texture2D #private {
return app->icons[UI_ICON_TYPE_MUSIC]
}
start :: (app: InbeApp*, seconds: int) #private {
meditation_start_seconds :: (app: InbeApp*, seconds: int) #private {
if app == nil {
return
}
@@ -91,7 +91,7 @@ meditation_configured_duration_seconds :: (app: const InbeApp*) -> int {
}
meditation_start_configured :: (app: InbeApp*) {
start(app, meditation_configured_duration_seconds(app))
meditation_start_seconds(app, meditation_configured_duration_seconds(app))
}
finish :: (app: InbeApp*) #private {
@@ -393,7 +393,7 @@ meditation_draw_setup_modal :: (app: InbeApp*) {
x := modal_x + side + i * (btn_w + gap)
if draw_duration_button(x, row_y, btn_w, btn_h, labels[i]) {
start(app, duration_presets[i])
meditation_start_seconds(app, duration_presets[i])
}
}
@@ -403,7 +403,7 @@ meditation_draw_setup_modal :: (app: InbeApp*) {
x := modal_x + side + (i - 3) * (two_w + gap)
if draw_duration_button(x, row_y, two_w, btn_h, labels[i]) {
start(app, duration_presets[i])
meditation_start_seconds(app, duration_presets[i])
}
}
@@ -579,7 +579,8 @@ route meditation {
page meditation
}
screen meditation {
args InbeApp *app
meditation :: (app: InbeApp*) #ui {
Screen root: {
meditation_draw_screen(app, view_width / 2, view_height / 2)
}
}
+3 -2
View File
@@ -570,7 +570,8 @@ route patterns {
page patterns
}
screen patterns {
args InbeApp *app
patterns :: (app: InbeApp*) #ui {
Screen root: {
patterns_draw_screen(app, view_width / 2, view_height / 2)
}
}
@@ -493,7 +493,8 @@ route sun_salutation {
page sun_salutation
}
screen sun_salutation {
args InbeApp *app
sun_salutation :: (app: InbeApp*) #ui {
Screen root: {
sun_salutation_draw_screen(app, view_width / 2, view_height / 2)
}
}
+3 -2
View File
@@ -6,7 +6,8 @@ route results {
page results
}
screen results {
args InbeApp *app
results :: (app: InbeApp*) #ui {
Screen root: {
unused app
}
}
+3 -2
View File
@@ -22,11 +22,12 @@ route session {
page session
}
screen session {
args InbeApp *app
session :: (app: InbeApp*) #ui {
Screen root: {
hover: int = 0
practice_draw_active_breathing(app, view_width / 2, view_height / 2)
practice_update_active_breathing(app, view_width / 2, view_height / 2, &hover)
}
}
static whm_background_remainder_ms: int = 0
+3 -2
View File
@@ -810,7 +810,8 @@ route habit_edit {
page habit_edit
}
screen habit_edit {
args InbeApp *app
habit_edit :: (app: InbeApp*) #ui {
Screen root: {
habit_edit_draw(app)
}
}
+3 -2
View File
@@ -651,7 +651,8 @@ route habit_session_edit {
page habit_session_edit
}
screen habit_session_edit {
args InbeApp *app
habit_session_edit :: (app: InbeApp*) #ui {
Screen root: {
habit_session_draw_edit_screen(app)
}
}
+1
View File
@@ -172,6 +172,7 @@ int habit_counter_day_action(InbeApp *app, int habit_index, int day_index,
int allow_left_increment);
int habit_weekly_visible_days(InbeHabits *habits);
int habits_scroll_page_content_height(int content_w, void *user_data);
int habits_overview_test_click_point(InbeApp *app, int *out_x, int *out_y);
void draw_habits_weekly_view(InbeApp *app, InbeHabit *active, int selected,
HabitLinkedContext *linked_ctx,
int content_x, int content_w, int y,
+44 -2
View File
@@ -1669,6 +1669,47 @@ habits_overview_done_today :: (app: InbeApp*) -> int #private {
return done
}
habits_overview_test_click_point :: (app: InbeApp*, out_x: int*,
out_y: int*) -> int {
content_x: int
content_w: int
content_y: int
label_w: int
cell: int
material: int = GetEffectiveThemeStyle() == THEME_STYLE_MATERIAL
cell_gap: int = ScaleUIPx(material ? 6 : 4)
grid_total_w: int
overview_x: int
grid_x: int
grid_y: int
day_columns: int
total_columns: int
if app == nil || out_x == nil || out_y == nil ||
app->inbe.screen != InbeScreenHabits ||
app->habits.screen_mode != HABITS_SCREEN_OVERVIEW ||
app->habits.count <= 0 {
return 0
}
habits_overview_scroll_metrics(app, &content_x, &content_y, &content_w)
label_w = habits_overview_label_width(content_w)
cell = habits_overview_cell_size(content_w)
day_columns = habits_overview_day_columns(content_w)
if day_columns <= 0 || cell <= 0 {
return 0
}
total_columns = day_columns + HABITS_OVERVIEW_DETAIL_COLUMNS
grid_total_w = label_w + cell_gap * total_columns + cell * total_columns
overview_x = content_x + (content_w - grid_total_w) / 2
grid_x = overview_x + label_w
grid_y = content_y + ScaleUIPx(12) + ScaleUIPx(28) + ScaleUIPx(20)
*out_x = grid_x + cell / 2
*out_y = grid_y + cell / 2
return 1
}
habits_overview_cell_clicked :: (app: InbeApp*, x: int, y: int,
w: int, h: int, disabled: int) -> int #private {
mouse: Vector2
@@ -3065,7 +3106,8 @@ route habits {
page habits
}
screen habits {
args InbeApp *app
habits :: (app: InbeApp*) #ui {
Screen root: {
draw_habits_screen(app)
}
}
+3 -2
View File
@@ -61,7 +61,8 @@ route language {
page language
}
screen language {
args InbeApp *app
language :: (app: InbeApp*) #ui {
Screen root: {
language_screen_draw(app)
}
}
+3 -2
View File
@@ -178,7 +178,8 @@ route manual {
page manual
}
screen manual {
args InbeApp *app
manual :: (app: InbeApp*) #ui {
Screen root: {
manual_screen_draw(app)
}
}
+4 -2
View File
@@ -480,7 +480,7 @@ practice_home_content_height :: (content_w: int, user_data: void*) -> int #priva
}
practice_screen_draw_home :: (app: InbeApp*) {
start_kry_draw(app)
start(app)
}
practice_activity_label :: (exercise: int) -> const char* {
@@ -760,7 +760,8 @@ route start {
page start
}
page start(app: InbeApp*) {
start :: (app: InbeApp*) #ui {
Screen root: {
guard app == NULL
practice := (const PracticeDefinition*)NULL
@@ -913,4 +914,5 @@ page start(app: InbeApp*) {
if use_scroll {
EndUIScrollPage(page)
}
}
}
+3 -2
View File
@@ -558,7 +558,8 @@ route profile {
page profile
}
screen profile {
args InbeApp *app
profile :: (app: InbeApp*) #ui {
Screen root: {
unused profile_screen_draw(app)
}
}
+1 -1
View File
@@ -108,7 +108,7 @@ settings_about_draw :: (app: InbeApp*, x: int, w: int, y: int*) {
*y += ScaleUIPx(16)
IconTexture(0, x + (w - logo_size) / 2, *y, logo_size,
app->icons[UI_ICON_TYPE_APP], WHITE)
app->icons[UI_ICON_TYPE_PROJ_INBE], WHITE)
*y += logo_size + ScaleUIPx(12)
text_w = TextWidth(GetLocaleText("app_title"), title_font)
+3 -2
View File
@@ -254,7 +254,8 @@ route settings {
page settings
}
screen settings {
args InbeApp *app
settings :: (app: InbeApp*) #ui {
Screen root: {
unused settings_screen_draw(app)
}
}
+23 -1
View File
@@ -11,6 +11,8 @@ CHANGELOG_DIR="fastlane/metadata/android/en-US/changelogs"
CLICK_MANIFEST_FILE="packaging/click/manifest.json"
CLICK_CONTROL_FILE="packaging/click/control"
CLICK_METAINFO_FILE="packaging/click/inbe.metainfo.xml"
LINUX_APPDATA_FILE="packaging/linux/appimage/inbe.appdata.xml"
SNAP_METAINFO_FILE="packaging/snap/snap/gui/inbe.metainfo.xml"
FIREFOX_ADDONS_MANIFEST_FILE="packaging/firefox-addons/manifest.json"
replace_in_file() {
@@ -34,6 +36,17 @@ fi
# Get latest version for gradle update
LATEST_VERSION=$(echo "$VERSIONS" | head -n 1)
LATEST_DATE=$(awk -v ver="$LATEST_VERSION" '
$0 ~ "^## \\[" ver "\\] - " {
sub("^## \\[" ver "\\] - ", "")
print
exit
}
' "$CHANGELOG_FILE")
if [ -z "$LATEST_DATE" ]; then
LATEST_DATE=$(date +%F)
fi
# Get current gradle values
CURRENT_NAME=$(grep "versionName" "$GRADLE_FILE" | sed 's/.*"\([^"]*\)".*/\1/')
@@ -100,12 +113,21 @@ else
fi
if [ -f "$CLICK_METAINFO_FILE" ]; then
replace_in_file "s/<release version=\"[^\"]*\" date=\"[^\"]*\"/<release version=\"$LATEST_VERSION\" date=\"$(date +%F)\"/" "$CLICK_METAINFO_FILE"
replace_in_file "s/<release version=\"[^\"]*\" date=\"[^\"]*\"/<release version=\"$LATEST_VERSION\" date=\"$LATEST_DATE\"/" "$CLICK_METAINFO_FILE"
echo "✓ Updated $CLICK_METAINFO_FILE"
else
echo "Warning: $CLICK_METAINFO_FILE not found"
fi
for METAINFO_FILE in "$LINUX_APPDATA_FILE" "$SNAP_METAINFO_FILE"; do
if [ -f "$METAINFO_FILE" ]; then
replace_in_file "s/<release version=\"[^\"]*\" date=\"[^\"]*\"/<release version=\"$LATEST_VERSION\" date=\"$LATEST_DATE\"/" "$METAINFO_FILE"
echo "✓ Updated $METAINFO_FILE"
else
echo "Warning: $METAINFO_FILE not found"
fi
done
if [ -f "$FIREFOX_ADDONS_MANIFEST_FILE" ]; then
replace_in_file "s/^\([[:space:]]*\"version\": \)\"[^\"]*\"/\1\"$LATEST_VERSION\"/" "$FIREFOX_ADDONS_MANIFEST_FILE"
echo "✓ Updated $FIREFOX_ADDONS_MANIFEST_FILE"
+1 -1