@effindomv2/fui-as 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/src/common-harness/host-imports.ts +21 -4
- package/package.json +8 -7
- package/scripts/build-demo-as.sh +2 -20
- package/scripts/build.sh +1 -57
- package/scripts/check-runtime-dependency.sh +48 -0
- package/src/Fui.ts +7 -1
- package/src/core/Application.ts +28 -4
- package/src/nodes/ScrollBox.ts +1 -1
- package/src/nodes/ScrollView.ts +1 -1
|
@@ -45,6 +45,15 @@ export interface HostImportDeps {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function createHostImportModule(deps: HostImportDeps) {
|
|
48
|
+
function safeNotify(label: string, notify: () => void): void {
|
|
49
|
+
try {
|
|
50
|
+
notify();
|
|
51
|
+
} catch (error: unknown) {
|
|
52
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
53
|
+
console.error(`[fui_host] ${label}: ${message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
return {
|
|
49
58
|
request_render(): void {
|
|
50
59
|
const runtime = deps.getRuntime();
|
|
@@ -229,14 +238,18 @@ export function createHostImportModule(deps: HostImportDeps) {
|
|
|
229
238
|
if (deps.getCurrentSessionOrNull() !== session) {
|
|
230
239
|
return;
|
|
231
240
|
}
|
|
232
|
-
|
|
241
|
+
safeNotify(`failed to deliver SVG ${String(svgId)} success callback`, () => {
|
|
242
|
+
deps.notifySvgLoaded(session, svgId, result.width, result.height);
|
|
243
|
+
});
|
|
233
244
|
}).catch((error: unknown) => {
|
|
234
245
|
const message = error instanceof Error ? error.message : String(error);
|
|
235
246
|
console.error(`[fui_host] SVG ${String(svgId)} failed to load from ${url}: ${message}`);
|
|
236
247
|
if (deps.getCurrentSessionOrNull() !== session) {
|
|
237
248
|
return;
|
|
238
249
|
}
|
|
239
|
-
|
|
250
|
+
safeNotify(`failed to deliver SVG ${String(svgId)} failure callback`, () => {
|
|
251
|
+
deps.notifySvgFailed(session, svgId, message);
|
|
252
|
+
});
|
|
240
253
|
});
|
|
241
254
|
},
|
|
242
255
|
fui_load_texture(textureId: number, ptr: number, len: number): void {
|
|
@@ -247,14 +260,18 @@ export function createHostImportModule(deps: HostImportDeps) {
|
|
|
247
260
|
if (deps.getCurrentSessionOrNull() !== session) {
|
|
248
261
|
return;
|
|
249
262
|
}
|
|
250
|
-
|
|
263
|
+
safeNotify(`failed to deliver texture ${String(textureId)} success callback`, () => {
|
|
264
|
+
deps.notifyTextureLoaded(session, textureId, result.width, result.height);
|
|
265
|
+
});
|
|
251
266
|
}).catch((error: unknown) => {
|
|
252
267
|
const message = error instanceof Error ? error.message : String(error);
|
|
253
268
|
console.error(`[fui_host] texture ${String(textureId)} failed to load from ${url}: ${message}`);
|
|
254
269
|
if (deps.getCurrentSessionOrNull() !== session) {
|
|
255
270
|
return;
|
|
256
271
|
}
|
|
257
|
-
|
|
272
|
+
safeNotify(`failed to deliver texture ${String(textureId)} failure callback`, () => {
|
|
273
|
+
deps.notifyTextureFailed(session, textureId, message);
|
|
274
|
+
});
|
|
258
275
|
});
|
|
259
276
|
},
|
|
260
277
|
fui_release_svg(svgId: number): void {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effindomv2/fui-as",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-EffinDom-Commercial",
|
|
6
6
|
"description": "EffinDom v2 AssemblyScript frontend framework SDK and browser harness",
|
|
@@ -67,17 +67,18 @@
|
|
|
67
67
|
"LICENSES"
|
|
68
68
|
],
|
|
69
69
|
"scripts": {
|
|
70
|
-
"
|
|
71
|
-
"build:
|
|
72
|
-
"build:
|
|
70
|
+
"guard:runtime-dependency": "bash scripts/check-runtime-dependency.sh",
|
|
71
|
+
"build": "npm run guard:runtime-dependency && bash scripts/build.sh",
|
|
72
|
+
"build:only": "npm run guard:runtime-dependency && bash scripts/build.sh",
|
|
73
|
+
"build:full": "npm run guard:runtime-dependency && bash scripts/build.sh",
|
|
73
74
|
"build:demo:as": "bash scripts/build-demo-as.sh",
|
|
74
|
-
"test:unit": "asp --verbose -c as-pect.config.mjs -a as-pect.asconfig.json",
|
|
75
|
+
"test:unit": "npm run guard:runtime-dependency && asp --verbose -c as-pect.config.mjs -a as-pect.asconfig.json",
|
|
75
76
|
"test:integration": "npm run build:full && playwright test -c playwright.config.ts",
|
|
76
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
77
|
+
"typecheck": "npm run guard:runtime-dependency && tsc -p tsconfig.json --noEmit"
|
|
77
78
|
},
|
|
78
79
|
"dependencies": {
|
|
79
80
|
"@assemblyscript/loader": "^0.28.17",
|
|
80
|
-
"@effindomv2/runtime": "0.1.
|
|
81
|
+
"@effindomv2/runtime": "0.1.1"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@as-pect/assembly": "8.1.0",
|
package/scripts/build-demo-as.sh
CHANGED
|
@@ -5,13 +5,11 @@ set -euo pipefail
|
|
|
5
5
|
PACKAGE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
6
6
|
REPO_ROOT="$(cd "${PACKAGE_DIR}/../.." && pwd)"
|
|
7
7
|
DEMO_OUT_DIR="${REPO_ROOT}/public/v2/fui-as/demo"
|
|
8
|
-
MVC_OUT_DIR="${REPO_ROOT}/public/v2/fui-as/demo-mvc"
|
|
9
|
-
HELLO_OUT_DIR="${REPO_ROOT}/public/v2/fui-as/demo-hello-world"
|
|
10
8
|
HOST_SERVICE_GENERATOR_BUILD="${PACKAGE_DIR}/build/generate-host-services.mjs"
|
|
11
9
|
HOST_EVENT_GENERATOR_BUILD="${PACKAGE_DIR}/build/generate-host-events.mjs"
|
|
12
10
|
BUILD_TARGET="${1:-all}"
|
|
13
11
|
|
|
14
|
-
mkdir -p "${PACKAGE_DIR}/build" "${DEMO_OUT_DIR}"
|
|
12
|
+
mkdir -p "${PACKAGE_DIR}/build" "${DEMO_OUT_DIR}"
|
|
15
13
|
cd "${PACKAGE_DIR}"
|
|
16
14
|
|
|
17
15
|
build_demo_app() {
|
|
@@ -77,10 +75,6 @@ generate_host_services "demo/src/host-services.ts" "demoHostServices" "demo/src/
|
|
|
77
75
|
generate_host_events "demo/src/host-events.ts" "demoHostEvents" "demo/src/generated/HostEvents.ts"
|
|
78
76
|
generate_host_services "demo/src/worker-host-services.ts" "demoWorkerHostServices" "demo/src/generated/WorkerHostServices.ts"
|
|
79
77
|
generate_host_services "scripts/framework-host-services.ts" "frameworkHostServices" "src/core/generated/FrameworkHostServices.ts" "" "fui_host"
|
|
80
|
-
generate_host_services "templates/demo-hello-world/src/host/host-services.ts" "appHostServices" "templates/demo-hello-world/src/host/generated/HostServices.ts" "../../fui/FuiPrimitives"
|
|
81
|
-
generate_host_events "templates/demo-hello-world/src/host/host-events.ts" "appHostEvents" "templates/demo-hello-world/src/host/generated/HostEvents.ts" "../../fui/FuiPrimitives"
|
|
82
|
-
generate_host_services "templates/demo-mvc/src/host/host-services.ts" "appHostServices" "templates/demo-mvc/src/host/generated/HostServices.ts" "../../fui/FuiPrimitives"
|
|
83
|
-
generate_host_events "templates/demo-mvc/src/host/host-events.ts" "appHostEvents" "templates/demo-mvc/src/host/generated/HostEvents.ts" "../../fui/FuiPrimitives"
|
|
84
78
|
|
|
85
79
|
case "${BUILD_TARGET}" in
|
|
86
80
|
all)
|
|
@@ -88,9 +82,6 @@ case "${BUILD_TARGET}" in
|
|
|
88
82
|
build_demo_app "demo/src/routes/demo_home.ts" "${DEMO_OUT_DIR}/home.wasm"
|
|
89
83
|
build_demo_app "demo/src/routes/demo_advanced_controls.ts" "${DEMO_OUT_DIR}/advanced-controls.wasm"
|
|
90
84
|
build_demo_app "demo/src/routes/templated-controls.ts" "${DEMO_OUT_DIR}/templated-controls.wasm"
|
|
91
|
-
build_demo_app "templates/demo-mvc/src/routes/mvc_home.ts" "${MVC_OUT_DIR}/mvc-home.wasm"
|
|
92
|
-
build_demo_app "templates/demo-mvc/src/routes/mvc_settings.ts" "${MVC_OUT_DIR}/mvc-settings.wasm"
|
|
93
|
-
build_demo_app "templates/demo-hello-world/src/App.ts" "${HELLO_OUT_DIR}/app.wasm"
|
|
94
85
|
;;
|
|
95
86
|
dashboard)
|
|
96
87
|
build_demo_app "demo/src/dashboard.ts" "${DEMO_OUT_DIR}/demo.wasm"
|
|
@@ -104,18 +95,9 @@ case "${BUILD_TARGET}" in
|
|
|
104
95
|
templated-controls|templated)
|
|
105
96
|
build_demo_app "demo/src/routes/templated-controls.ts" "${DEMO_OUT_DIR}/templated-controls.wasm"
|
|
106
97
|
;;
|
|
107
|
-
mvc-home|mvc-home-page)
|
|
108
|
-
build_demo_app "templates/demo-mvc/src/routes/mvc_home.ts" "${MVC_OUT_DIR}/mvc-home.wasm"
|
|
109
|
-
;;
|
|
110
|
-
mvc-settings|mvc-settings-page)
|
|
111
|
-
build_demo_app "templates/demo-mvc/src/routes/mvc_settings.ts" "${MVC_OUT_DIR}/mvc-settings.wasm"
|
|
112
|
-
;;
|
|
113
|
-
hello-world|hello)
|
|
114
|
-
build_demo_app "templates/demo-hello-world/src/App.ts" "${HELLO_OUT_DIR}/app.wasm"
|
|
115
|
-
;;
|
|
116
98
|
*)
|
|
117
99
|
echo "Unknown build target: ${BUILD_TARGET}" >&2
|
|
118
|
-
echo "Usage: bash scripts/build-demo-as.sh [all|dashboard|home|advanced-controls|templated-controls
|
|
100
|
+
echo "Usage: bash scripts/build-demo-as.sh [all|dashboard|home|advanced-controls|templated-controls]" >&2
|
|
119
101
|
exit 1
|
|
120
102
|
;;
|
|
121
103
|
esac
|
package/scripts/build.sh
CHANGED
|
@@ -8,8 +8,6 @@ BROWSER_SRC_DIR="${PACKAGE_DIR}/browser/src"
|
|
|
8
8
|
SMOKE_FIXTURE_DIR="${PACKAGE_DIR}/tests/fixtures/smoke"
|
|
9
9
|
OUT_DIR="${REPO_ROOT}/public/v2/fui-as"
|
|
10
10
|
DEMO_OUT_DIR="${OUT_DIR}/demo"
|
|
11
|
-
MVC_OUT_DIR="${OUT_DIR}/demo-mvc"
|
|
12
|
-
HELLO_OUT_DIR="${OUT_DIR}/demo-hello-world"
|
|
13
11
|
WORKER_BUILD_DIR="${PACKAGE_DIR}/build/workers"
|
|
14
12
|
WORKER_BOOTSTRAP_BUILD="${PACKAGE_DIR}/build/worker-bootstrap.js"
|
|
15
13
|
WORKER_BOOTSTRAP_MAP_BUILD="${PACKAGE_DIR}/build/worker-bootstrap.js.map"
|
|
@@ -24,7 +22,7 @@ RUNTIME_CONFIG_FILE="effindom-runtime-config.js"
|
|
|
24
22
|
DEFAULT_MANIFEST_PATH="./runtime/dist/effindom.v2.manifest.json"
|
|
25
23
|
|
|
26
24
|
rm -rf "${OUT_DIR}"
|
|
27
|
-
mkdir -p "${PACKAGE_DIR}/build" "${OUT_DIR}" "${DEMO_OUT_DIR}" "${
|
|
25
|
+
mkdir -p "${PACKAGE_DIR}/build" "${OUT_DIR}" "${DEMO_OUT_DIR}" "${WORKER_BUILD_DIR}"
|
|
28
26
|
|
|
29
27
|
cd "${PACKAGE_DIR}"
|
|
30
28
|
|
|
@@ -253,19 +251,12 @@ generate_host_services "demo/src/host-services.ts" "demoHostServices" "demo/src/
|
|
|
253
251
|
generate_host_events "demo/src/host-events.ts" "demoHostEvents" "demo/src/generated/HostEvents.ts"
|
|
254
252
|
generate_host_services "demo/src/worker-host-services.ts" "demoWorkerHostServices" "demo/src/generated/WorkerHostServices.ts"
|
|
255
253
|
generate_host_services "scripts/framework-host-services.ts" "frameworkHostServices" "src/core/generated/FrameworkHostServices.ts" "" "fui_host"
|
|
256
|
-
generate_host_services "templates/demo-hello-world/src/host/host-services.ts" "appHostServices" "templates/demo-hello-world/src/host/generated/HostServices.ts" "../../fui/FuiPrimitives"
|
|
257
|
-
generate_host_events "templates/demo-hello-world/src/host/host-events.ts" "appHostEvents" "templates/demo-hello-world/src/host/generated/HostEvents.ts" "../../fui/FuiPrimitives"
|
|
258
|
-
generate_host_services "templates/demo-mvc/src/host/host-services.ts" "appHostServices" "templates/demo-mvc/src/host/generated/HostServices.ts" "../../fui/FuiPrimitives"
|
|
259
|
-
generate_host_events "templates/demo-mvc/src/host/host-events.ts" "appHostEvents" "templates/demo-mvc/src/host/generated/HostEvents.ts" "../../fui/FuiPrimitives"
|
|
260
254
|
|
|
261
255
|
build_app "tests/fixtures/smoke/app.ts" "${OUT_DIR}/app.wasm"
|
|
262
256
|
build_app "demo/src/dashboard.ts" "${DEMO_OUT_DIR}/demo.wasm"
|
|
263
257
|
build_app "demo/src/routes/demo_home.ts" "${DEMO_OUT_DIR}/home.wasm"
|
|
264
258
|
build_app "demo/src/routes/demo_advanced_controls.ts" "${DEMO_OUT_DIR}/advanced-controls.wasm"
|
|
265
259
|
build_app "demo/src/routes/templated-controls.ts" "${DEMO_OUT_DIR}/templated-controls.wasm"
|
|
266
|
-
build_app "templates/demo-mvc/src/routes/mvc_home.ts" "${MVC_OUT_DIR}/mvc-home.wasm"
|
|
267
|
-
build_app "templates/demo-mvc/src/routes/mvc_settings.ts" "${MVC_OUT_DIR}/mvc-settings.wasm"
|
|
268
|
-
build_app "templates/demo-hello-world/src/App.ts" "${HELLO_OUT_DIR}/app.wasm"
|
|
269
260
|
build_workers
|
|
270
261
|
write_worker_manifest
|
|
271
262
|
|
|
@@ -287,24 +278,6 @@ npx esbuild "${PACKAGE_DIR}/demo/harness.ts" \
|
|
|
287
278
|
--outfile="${DEMO_OUT_DIR}/harness.js" \
|
|
288
279
|
--sourcemap
|
|
289
280
|
|
|
290
|
-
npx esbuild "${PACKAGE_DIR}/templates/demo-mvc/harness.ts" \
|
|
291
|
-
--bundle \
|
|
292
|
-
--format=esm \
|
|
293
|
-
--platform=browser \
|
|
294
|
-
--target=es2020 \
|
|
295
|
-
--minify \
|
|
296
|
-
--outfile="${MVC_OUT_DIR}/harness.js" \
|
|
297
|
-
--sourcemap
|
|
298
|
-
|
|
299
|
-
npx esbuild "${PACKAGE_DIR}/templates/demo-hello-world/harness.ts" \
|
|
300
|
-
--bundle \
|
|
301
|
-
--format=esm \
|
|
302
|
-
--platform=browser \
|
|
303
|
-
--target=es2020 \
|
|
304
|
-
--minify \
|
|
305
|
-
--outfile="${HELLO_OUT_DIR}/harness.js" \
|
|
306
|
-
--sourcemap
|
|
307
|
-
|
|
308
281
|
npx esbuild "${BROWSER_SRC_DIR}/file-processing-worker.ts" \
|
|
309
282
|
--bundle \
|
|
310
283
|
--format=iife \
|
|
@@ -318,10 +291,6 @@ cp "${FILE_PROCESSING_WORKER_BUILD}" "${OUT_DIR}/file-processing-worker.js"
|
|
|
318
291
|
cp "${FILE_PROCESSING_WORKER_MAP_BUILD}" "${OUT_DIR}/file-processing-worker.js.map"
|
|
319
292
|
cp "${FILE_PROCESSING_WORKER_BUILD}" "${DEMO_OUT_DIR}/file-processing-worker.js"
|
|
320
293
|
cp "${FILE_PROCESSING_WORKER_MAP_BUILD}" "${DEMO_OUT_DIR}/file-processing-worker.js.map"
|
|
321
|
-
cp "${FILE_PROCESSING_WORKER_BUILD}" "${MVC_OUT_DIR}/file-processing-worker.js"
|
|
322
|
-
cp "${FILE_PROCESSING_WORKER_MAP_BUILD}" "${MVC_OUT_DIR}/file-processing-worker.js.map"
|
|
323
|
-
cp "${FILE_PROCESSING_WORKER_BUILD}" "${HELLO_OUT_DIR}/file-processing-worker.js"
|
|
324
|
-
cp "${FILE_PROCESSING_WORKER_MAP_BUILD}" "${HELLO_OUT_DIR}/file-processing-worker.js.map"
|
|
325
294
|
|
|
326
295
|
npx esbuild "${BROWSER_SRC_DIR}/worker-bootstrap.ts" \
|
|
327
296
|
--bundle \
|
|
@@ -343,43 +312,18 @@ npx esbuild "${PACKAGE_DIR}/demo/worker-host-services.ts" \
|
|
|
343
312
|
|
|
344
313
|
cp "${SMOKE_FIXTURE_DIR}/index.html" "${OUT_DIR}/index.html"
|
|
345
314
|
cp "${PACKAGE_DIR}/demo/index.html" "${DEMO_OUT_DIR}/index.html"
|
|
346
|
-
cp "${PACKAGE_DIR}/templates/demo-hello-world/index.html" "${HELLO_OUT_DIR}/index.html"
|
|
347
315
|
cp "${PACKAGE_DIR}/demo/demo-texture.png" "${DEMO_OUT_DIR}/demo-texture.png"
|
|
348
316
|
cp "${PACKAGE_DIR}/demo/demo-secondary-texture.png" "${DEMO_OUT_DIR}/demo-secondary-texture.png"
|
|
349
317
|
|
|
350
318
|
mkdir -p "${DEMO_OUT_DIR}/advanced-controls" "${DEMO_OUT_DIR}/templated-controls"
|
|
351
319
|
cp "${PACKAGE_DIR}/demo/route-shell.html" "${DEMO_OUT_DIR}/advanced-controls/index.html"
|
|
352
320
|
cp "${PACKAGE_DIR}/demo/route-shell.html" "${DEMO_OUT_DIR}/templated-controls/index.html"
|
|
353
|
-
mkdir -p "${MVC_OUT_DIR}/mvc-home" "${MVC_OUT_DIR}/mvc-settings"
|
|
354
|
-
cp "${PACKAGE_DIR}/templates/demo-mvc/route-shell.html" "${MVC_OUT_DIR}/mvc-home/index.html"
|
|
355
|
-
cp "${PACKAGE_DIR}/templates/demo-mvc/route-shell.html" "${MVC_OUT_DIR}/mvc-settings/index.html"
|
|
356
|
-
cat > "${MVC_OUT_DIR}/index.html" <<'EOF'
|
|
357
|
-
<!doctype html>
|
|
358
|
-
<html lang="en">
|
|
359
|
-
<head>
|
|
360
|
-
<meta charset="utf-8" />
|
|
361
|
-
<meta http-equiv="refresh" content="0; url=./mvc-home/" />
|
|
362
|
-
<title>FUI-AS MVC Demo</title>
|
|
363
|
-
</head>
|
|
364
|
-
<body>
|
|
365
|
-
<p>Redirecting to <a href="./mvc-home/">MVC Home</a>…</p>
|
|
366
|
-
</body>
|
|
367
|
-
</html>
|
|
368
|
-
EOF
|
|
369
321
|
|
|
370
322
|
copy_runtime_assets "${OUT_DIR}"
|
|
371
323
|
copy_runtime_assets "${DEMO_OUT_DIR}"
|
|
372
|
-
copy_runtime_assets "${MVC_OUT_DIR}"
|
|
373
|
-
copy_runtime_assets "${HELLO_OUT_DIR}"
|
|
374
324
|
copy_worker_assets "${OUT_DIR}"
|
|
375
325
|
copy_worker_assets "${DEMO_OUT_DIR}"
|
|
376
|
-
copy_worker_assets "${MVC_OUT_DIR}"
|
|
377
|
-
copy_worker_assets "${HELLO_OUT_DIR}"
|
|
378
326
|
write_runtime_config "${OUT_DIR}" "${DEFAULT_MANIFEST_PATH}"
|
|
379
327
|
write_runtime_config "${DEMO_OUT_DIR}" "${DEFAULT_MANIFEST_PATH}"
|
|
380
|
-
write_runtime_config "${MVC_OUT_DIR}" "${DEFAULT_MANIFEST_PATH}"
|
|
381
|
-
write_runtime_config "${HELLO_OUT_DIR}" "${DEFAULT_MANIFEST_PATH}"
|
|
382
328
|
write_runtime_config "${DEMO_OUT_DIR}/advanced-controls" "../runtime/dist/effindom.v2.manifest.json"
|
|
383
329
|
write_runtime_config "${DEMO_OUT_DIR}/templated-controls" "../runtime/dist/effindom.v2.manifest.json"
|
|
384
|
-
write_runtime_config "${MVC_OUT_DIR}/mvc-home" "../runtime/dist/effindom.v2.manifest.json"
|
|
385
|
-
write_runtime_config "${MVC_OUT_DIR}/mvc-settings" "../runtime/dist/effindom.v2.manifest.json"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
PACKAGE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
6
|
+
REPO_ROOT="$(cd "${PACKAGE_DIR}/../.." && pwd)"
|
|
7
|
+
PACKAGE_JSON="${PACKAGE_DIR}/package.json"
|
|
8
|
+
RUNTIME_PACKAGE_JSON="${REPO_ROOT}/v2/browser-bridge/package.json"
|
|
9
|
+
|
|
10
|
+
if [ ! -f "${PACKAGE_JSON}" ]; then
|
|
11
|
+
echo "Missing package.json at ${PACKAGE_JSON}" >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
runtime_spec="$(
|
|
16
|
+
node -e '
|
|
17
|
+
const fs = require("node:fs");
|
|
18
|
+
const pkg = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
19
|
+
process.stdout.write(String(pkg.dependencies?.["@effindomv2/runtime"] ?? ""));
|
|
20
|
+
' "${PACKAGE_JSON}"
|
|
21
|
+
)"
|
|
22
|
+
|
|
23
|
+
if [ -z "${runtime_spec}" ]; then
|
|
24
|
+
echo "@effindomv2/runtime must be declared in dependencies." >&2
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if ! printf '%s' "${runtime_spec}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?$'; then
|
|
29
|
+
echo "@effindomv2/runtime must be pinned to an exact version, found: ${runtime_spec}" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
if [ -f "${RUNTIME_PACKAGE_JSON}" ]; then
|
|
34
|
+
runtime_version="$(
|
|
35
|
+
node -e '
|
|
36
|
+
const fs = require("node:fs");
|
|
37
|
+
const pkg = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
38
|
+
process.stdout.write(String(pkg.version ?? ""));
|
|
39
|
+
' "${RUNTIME_PACKAGE_JSON}"
|
|
40
|
+
)"
|
|
41
|
+
|
|
42
|
+
if [ -n "${runtime_version}" ] && [ "${runtime_spec}" != "${runtime_version}" ]; then
|
|
43
|
+
echo "@effindomv2/fui-as depends on @effindomv2/runtime@${runtime_spec}, but monorepo runtime is ${runtime_version}." >&2
|
|
44
|
+
echo "Update v2/fui-as/package.json to match v2/browser-bridge/package.json." >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
fi
|
|
48
|
+
|
package/src/Fui.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
Application,
|
|
3
|
+
ApplicationRegistration,
|
|
4
|
+
ManagedApplicationController,
|
|
5
|
+
createApplication,
|
|
6
|
+
createManagedApplication,
|
|
7
|
+
} from "./core/Application";
|
|
2
8
|
export { Action, CallbackAction, HandlerAction, NodeAction, SignalHandler } from "./core/Action";
|
|
3
9
|
export { ObjectDisposedError } from "./core/Errors";
|
|
4
10
|
export {
|
package/src/core/Application.ts
CHANGED
|
@@ -271,6 +271,20 @@ export class Application<TPage> {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
export class ManagedApplicationController {
|
|
275
|
+
getRoot(): Node {
|
|
276
|
+
throw new Error("ManagedApplicationController.getRoot() must be overridden.");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
mount(): void {
|
|
280
|
+
Application.mount(this.getRoot());
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
dispose(): void {
|
|
284
|
+
Application.unmount();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
274
288
|
function getNodeRoot(page: Node): Node {
|
|
275
289
|
return page;
|
|
276
290
|
}
|
|
@@ -283,11 +297,21 @@ export function createApplication(buildPage: () => Node): Application<Node> {
|
|
|
283
297
|
|
|
284
298
|
export function createManagedApplication<TPage>(
|
|
285
299
|
buildPage: () => TPage,
|
|
286
|
-
getRoot: (page: TPage) => Node,
|
|
287
|
-
mountPage: ((page: TPage) => void) | null,
|
|
288
|
-
disposePage: ((page: TPage) => void) | null,
|
|
300
|
+
getRoot: ((page: TPage) => Node) | null = null,
|
|
301
|
+
mountPage: ((page: TPage) => void) | null = null,
|
|
302
|
+
disposePage: ((page: TPage) => void) | null = null,
|
|
289
303
|
): Application<TPage> {
|
|
290
|
-
|
|
304
|
+
let managedGetRootFn: (page: TPage) => Node;
|
|
305
|
+
let managedMountPageFn = mountPage;
|
|
306
|
+
let managedDisposePageFn = disposePage;
|
|
307
|
+
if (getRoot === null) {
|
|
308
|
+
managedGetRootFn = (page: TPage): Node => changetype<ManagedApplicationController>(page).getRoot();
|
|
309
|
+
managedMountPageFn = (page: TPage): void => changetype<ManagedApplicationController>(page).mount();
|
|
310
|
+
managedDisposePageFn = (page: TPage): void => changetype<ManagedApplicationController>(page).dispose();
|
|
311
|
+
} else {
|
|
312
|
+
managedGetRootFn = getRoot;
|
|
313
|
+
}
|
|
314
|
+
const app = new Application<TPage>(buildPage, managedGetRootFn, managedMountPageFn, managedDisposePageFn);
|
|
291
315
|
exportedApplication = changetype<Application<Node>>(app);
|
|
292
316
|
return app;
|
|
293
317
|
}
|
package/src/nodes/ScrollBox.ts
CHANGED
|
@@ -39,7 +39,7 @@ export class ScrollBox extends FlexBox {
|
|
|
39
39
|
private scrollbarGutterValue: f32 = DEFAULT_SCROLLBAR_GUTTER;
|
|
40
40
|
private verticalChromeVisibleValue: bool = false;
|
|
41
41
|
private horizontalChromeVisibleValue: bool = false;
|
|
42
|
-
private persistScrollValue: bool =
|
|
42
|
+
private persistScrollValue: bool = true;
|
|
43
43
|
private persistedScrollRestorePending: bool = false;
|
|
44
44
|
|
|
45
45
|
constructor(scrollState: ScrollState = new ScrollState(), viewportOverride: ScrollView | null = null) {
|
package/src/nodes/ScrollView.ts
CHANGED
|
@@ -60,7 +60,7 @@ export class ScrollView extends Node {
|
|
|
60
60
|
private pendingProgrammaticOffsetY: f32 = 0.0;
|
|
61
61
|
private hasFriction: bool = false;
|
|
62
62
|
private _scrollState: ScrollState = new ScrollState();
|
|
63
|
-
private persistScrollValue: bool =
|
|
63
|
+
private persistScrollValue: bool = true;
|
|
64
64
|
private persistedScrollRestorePending: bool = false;
|
|
65
65
|
private transitionsValue: NodeTransitions | null = null;
|
|
66
66
|
private scrollOffsetTransitionAnimation: Animation | null = null;
|