@effindomv2/create-fui-as-app 0.1.4 → 0.1.6
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/build/templates/hello/README.md +20 -0
- package/build/templates/hello/harness.ts +1 -1
- package/build/templates/hello/package.json +3 -3
- package/build/templates/hello/src/App.ts +3 -3
- package/build/templates/hello/src/HelloWorld.ts +4 -4
- package/build/templates/hello/src/fui/Fui.ts +1 -0
- package/build/templates/hello/src/fui/FuiBrowser.ts +1 -0
- package/build/templates/hello/src/fui/FuiExports.ts +1 -0
- package/build/templates/hello/src/fui/FuiPrimitives.ts +1 -0
- package/build/templates/hello/src/{generated → host/generated}/HostEvents.ts +1 -1
- package/build/templates/hello/src/host/host-events.ts +1 -1
- package/build/templates/hello/src/host/host-services.ts +1 -1
- package/build/templates/mvc/README.md +27 -0
- package/build/templates/mvc/harness.ts +10 -10
- package/build/templates/mvc/index.html +3 -3
- package/build/templates/mvc/package.json +6 -6
- package/build/templates/mvc/route-shell.html +2 -2
- package/build/templates/mvc/scripts/prepare-runtime.ts +4 -4
- package/build/templates/mvc/scripts/smoke.ts +4 -4
- package/build/templates/mvc/src/fui/Fui.ts +1 -0
- package/build/templates/mvc/src/fui/FuiBrowser.ts +1 -0
- package/build/templates/mvc/src/fui/FuiExports.ts +1 -0
- package/build/templates/mvc/src/fui/FuiPrimitives.ts +1 -0
- package/build/templates/mvc/src/{generated → host/generated}/HostEvents.ts +1 -1
- package/build/templates/mvc/src/host/host-events.ts +1 -1
- package/build/templates/mvc/src/host/host-services.ts +1 -1
- package/build/templates/mvc/src/routes/HomeApp.ts +15 -0
- package/build/templates/mvc/src/routes/SettingsApp.ts +15 -0
- package/build/templates/mvc/src/routes/{mvc/pages/home → home}/HomeController.ts +7 -10
- package/build/templates/mvc/src/routes/{mvc/pages/home → home}/HomeView.ts +6 -19
- package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsController.ts +3 -10
- package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsView.ts +6 -19
- package/build/templates/mvc/src/routes/shared/design-system/NavBar.ts +18 -0
- package/build/templates/mvc/src/routes/{mvc/shared/design-system/MvcNavPill.ts → shared/design-system/NavPill.ts} +2 -2
- package/build/templates/mvc/src/routes/{mvc/shared/design-system/MvcPrimaryButton.ts → shared/design-system/PrimaryButton.ts} +2 -2
- package/build/templates/mvc/src/routes/{mvc/shared → shared}/routes.ts +7 -7
- package/dist/scripts/sync-templates.js +32 -30
- package/dist/src/versions.d.ts +1 -1
- package/dist/src/versions.js +1 -1
- package/dist/tests/scaffold.test.js +11 -2
- package/package.json +1 -1
- package/build/templates/hello/src/Fui.ts +0 -1
- package/build/templates/hello/src/FuiBrowser.ts +0 -1
- package/build/templates/hello/src/FuiExports.ts +0 -1
- package/build/templates/hello/src/FuiPrimitives.ts +0 -1
- package/build/templates/mvc/src/Fui.ts +0 -1
- package/build/templates/mvc/src/FuiBrowser.ts +0 -1
- package/build/templates/mvc/src/FuiExports.ts +0 -1
- package/build/templates/mvc/src/FuiPrimitives.ts +0 -1
- package/build/templates/mvc/src/routes/mvc_home.ts +0 -20
- package/build/templates/mvc/src/routes/mvc_settings.ts +0 -20
- /package/build/templates/hello/src/{generated → host/generated}/HostServices.ts +0 -0
- /package/build/templates/mvc/src/{generated → host/generated}/HostServices.ts +0 -0
- /package/build/templates/mvc/src/routes/{mvc/pages/home → home}/HomeModel.ts +0 -0
- /package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsModel.ts +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Hello World scaffold guide
|
|
2
|
+
|
|
3
|
+
This template is the smallest FUI-AS app shape:
|
|
4
|
+
|
|
5
|
+
- `src/App.ts` is the app entrypoint (`__runApp`) and where you compose your root retained UI tree.
|
|
6
|
+
- `src/HelloWorld.ts` is a simple feature module you can replace with your own screens/components.
|
|
7
|
+
- `harness.ts` boots the browser runtime and mounts the wasm app.
|
|
8
|
+
- `src/host/host-services.ts` and `src/host/host-events.ts` define app-owned JS bridge contracts.
|
|
9
|
+
- `src/host/generated/*` is generated from those host definition files.
|
|
10
|
+
|
|
11
|
+
## Typical workflow
|
|
12
|
+
|
|
13
|
+
1. Build UI from `src/App.ts` with controls/nodes from `./fui/Fui`.
|
|
14
|
+
2. Split real features into more files under `src/` and compose them in `App.ts`.
|
|
15
|
+
3. If browser-owned capabilities are needed (for example shell APIs), add definitions in `src/host/*.ts` and run `npm run generate:host`.
|
|
16
|
+
4. Run `npm run dev` while iterating.
|
|
17
|
+
|
|
18
|
+
## Architecture intent
|
|
19
|
+
|
|
20
|
+
Use this template as a single-app baseline: one wasm, one harness, one mounted root tree. Keep UI composition in AssemblyScript and keep browser glue inside `harness.ts` + host bridge definitions.
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"build:assets": "tsx scripts/prepare-runtime.ts",
|
|
10
10
|
"build:wasm": "asc src/App.ts --config asconfig.json --target release",
|
|
11
11
|
"build:harness": "esbuild harness.ts --bundle --format=esm --platform=browser --outfile=public/harness.js",
|
|
12
|
-
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/generated/HostServices.ts
|
|
13
|
-
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/generated/HostEvents.ts
|
|
12
|
+
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/host/generated/HostServices.ts ../../fui/FuiPrimitives",
|
|
13
|
+
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/host/generated/HostEvents.ts ../../fui/FuiPrimitives",
|
|
14
14
|
"generate:host": "npm run generate:host-services && npm run generate:host-events",
|
|
15
|
-
"watch": "chokidar \"src/**/*.ts\" \"harness.ts\" \"index.html\" \"asconfig.json\" -c \"npm run build\"",
|
|
15
|
+
"watch": "chokidar \"src/**/*.ts\" \"harness.ts\" \"index.html\" \"asconfig.json\" --ignore \"src/host/generated/**\" -c \"npm run build\"",
|
|
16
16
|
"serve": "http-server public -p 8080 -c-1",
|
|
17
17
|
"dev": "npm run build && concurrently -k -n watch,serve \"npm run watch\" \"npm run serve\"",
|
|
18
18
|
"test": "npm run build && tsx scripts/smoke.ts"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Application } from "./Fui";
|
|
2
|
-
export * from "./FuiExports";
|
|
3
|
-
export * from "./generated/HostEvents";
|
|
1
|
+
import { Application } from "./fui/Fui";
|
|
2
|
+
export * from "./fui/FuiExports";
|
|
3
|
+
export * from "./host/generated/HostEvents";
|
|
4
4
|
|
|
5
5
|
import { createHelloWorldPage } from "./HelloWorld";
|
|
6
6
|
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
Text,
|
|
9
9
|
TextAlign,
|
|
10
10
|
Unit,
|
|
11
|
-
} from "./Fui";
|
|
12
|
-
import { Callback1 } from "./FuiPrimitives";
|
|
13
|
-
import { onAppClockTick } from "./generated/HostEvents";
|
|
14
|
-
import { appClockNowUnixSeconds } from "./generated/HostServices";
|
|
11
|
+
} from "./fui/Fui";
|
|
12
|
+
import { Callback1 } from "./fui/FuiPrimitives";
|
|
13
|
+
import { onAppClockTick } from "./host/generated/HostEvents";
|
|
14
|
+
import { appClockNowUnixSeconds } from "./host/generated/HostServices";
|
|
15
15
|
|
|
16
16
|
class ClockTickHandler extends Callback1<i32> {
|
|
17
17
|
private readonly owner: HelloWorld;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/src/Fui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/browser/src/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/src/FuiExports";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/src/FuiPrimitives";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# MVC scaffold guide
|
|
2
|
+
|
|
3
|
+
This template scaffolds a multi-route FUI-AS app with explicit page-level MVC.
|
|
4
|
+
|
|
5
|
+
- `src/routes/HomeApp.ts` and `src/routes/SettingsApp.ts` are route app entrypoints.
|
|
6
|
+
- `src/routes/home/*` and `src/routes/settings/*` hold each route's model, view, and controller.
|
|
7
|
+
- `src/routes/shared/*` holds shared route UI primitives (for example nav pills/nav bar) and shared route helpers.
|
|
8
|
+
- `harness.ts` wires routed host boot, route table, and host-services/events registration.
|
|
9
|
+
- `route-shell.html` is the per-route host shell copied for each route path.
|
|
10
|
+
- `src/host/host-services.ts` and `src/host/host-events.ts` are app-owned bridge contracts; `src/host/generated/*` is generated output.
|
|
11
|
+
|
|
12
|
+
## Routing + deployment model
|
|
13
|
+
|
|
14
|
+
Each route builds to its own wasm (`home.wasm`, `settings.wasm`) and is mounted by routed harness config. This is designed for true MFE slices: each route app can evolve and deploy independently while still sharing the same browser host/runtime contract.
|
|
15
|
+
|
|
16
|
+
The routed harness is optimized for fast navigation:
|
|
17
|
+
|
|
18
|
+
- route shells stay stable while route wasm swaps,
|
|
19
|
+
- warm route transitions can avoid full loading overlays,
|
|
20
|
+
- host bridge wiring is reused consistently across route apps.
|
|
21
|
+
|
|
22
|
+
## Typical workflow
|
|
23
|
+
|
|
24
|
+
1. Add/modify page behavior inside `home/` or `settings/` controllers/models/views.
|
|
25
|
+
2. Add new routes by creating another `*App.ts` entrypoint plus a new route folder and route record in `harness.ts`.
|
|
26
|
+
3. Keep shared browser bridge capabilities in `src/host/*.ts`, then regenerate with `npm run generate:host`.
|
|
27
|
+
4. Use `npm run dev` for local routed iteration.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { startRoutedHarness, type HarnessExports, type RoutedHarnessRoute } from './src/FuiBrowser';
|
|
1
|
+
import { startRoutedHarness, type HarnessExports, type RoutedHarnessRoute } from './src/fui/FuiBrowser';
|
|
2
2
|
import { appHostEvents } from './src/host/host-events';
|
|
3
3
|
import { appHostServices } from './src/host/host-services';
|
|
4
4
|
|
|
5
|
-
type
|
|
5
|
+
type RouteExports = HarnessExports & {
|
|
6
6
|
__runApp(): void;
|
|
7
7
|
__disposeApp?(): void;
|
|
8
8
|
};
|
|
@@ -10,19 +10,19 @@ type MvcRouteExports = HarnessExports & {
|
|
|
10
10
|
const routePrefix = window.location.pathname.startsWith('/v2/fui-as/demo-mvc/') ? '/v2/fui-as/demo-mvc' : '';
|
|
11
11
|
const routes: readonly RoutedHarnessRoute[] = [
|
|
12
12
|
{
|
|
13
|
-
routePath: `${routePrefix}/
|
|
14
|
-
wasmPath: `${routePrefix}/
|
|
15
|
-
title: '
|
|
13
|
+
routePath: `${routePrefix}/home/`,
|
|
14
|
+
wasmPath: `${routePrefix}/home.wasm`,
|
|
15
|
+
title: 'Home',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
routePath: `${routePrefix}/
|
|
19
|
-
wasmPath: `${routePrefix}/
|
|
20
|
-
title: '
|
|
18
|
+
routePath: `${routePrefix}/settings/`,
|
|
19
|
+
wasmPath: `${routePrefix}/settings.wasm`,
|
|
20
|
+
title: 'Settings',
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
23
|
|
|
24
|
-
startRoutedHarness<
|
|
25
|
-
shellId: 'fui-
|
|
24
|
+
startRoutedHarness<RouteExports>({
|
|
25
|
+
shellId: 'fui-routes',
|
|
26
26
|
routeBase: routes[0].routePath,
|
|
27
27
|
routes,
|
|
28
28
|
recreateRuntimeOnWarmRouteSwap: true,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
|
-
<meta http-equiv="refresh" content="0; url=/
|
|
6
|
-
<title>FUI-AS
|
|
5
|
+
<meta http-equiv="refresh" content="0; url=/home/" />
|
|
6
|
+
<title>FUI-AS Routed App</title>
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
|
-
<p>Redirecting to <a href="/
|
|
9
|
+
<p>Redirecting to <a href="/home/">/home/</a>…</p>
|
|
10
10
|
</body>
|
|
11
11
|
</html>
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Scaffolded FUI-AS
|
|
6
|
+
"description": "Scaffolded FUI-AS routed app",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "npm run generate:host && npm run build:assets && npm run build:wasm && npm run build:harness",
|
|
9
9
|
"build:assets": "tsx scripts/prepare-runtime.ts",
|
|
10
10
|
"build:wasm": "npm run build:wasm:home && npm run build:wasm:settings",
|
|
11
|
-
"build:wasm:home": "asc src/routes/
|
|
12
|
-
"build:wasm:settings": "asc src/routes/
|
|
11
|
+
"build:wasm:home": "asc src/routes/HomeApp.ts --config asconfig.json --target release --outFile public/home.wasm",
|
|
12
|
+
"build:wasm:settings": "asc src/routes/SettingsApp.ts --config asconfig.json --target release --outFile public/settings.wasm",
|
|
13
13
|
"build:harness": "esbuild harness.ts --bundle --format=esm --platform=browser --outfile=public/harness.js",
|
|
14
|
-
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/generated/HostServices.ts
|
|
15
|
-
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/generated/HostEvents.ts
|
|
14
|
+
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/host/generated/HostServices.ts ../../fui/FuiPrimitives",
|
|
15
|
+
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/host/generated/HostEvents.ts ../../fui/FuiPrimitives",
|
|
16
16
|
"generate:host": "npm run generate:host-services && npm run generate:host-events",
|
|
17
|
-
"watch": "chokidar \"src/**/*.ts\" \"harness.ts\" \"route-shell.html\" \"index.html\" \"asconfig.json\" -c \"npm run build\"",
|
|
17
|
+
"watch": "chokidar \"src/**/*.ts\" \"harness.ts\" \"route-shell.html\" \"index.html\" \"asconfig.json\" --ignore \"src/host/generated/**\" -c \"npm run build\"",
|
|
18
18
|
"serve": "http-server public -p 8080 -c-1",
|
|
19
19
|
"dev": "npm run build && concurrently -k -n watch,serve \"npm run watch\" \"npm run serve\"",
|
|
20
20
|
"test": "npm run build && tsx scripts/smoke.ts"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<base href="../" />
|
|
7
|
-
<title>FUI-AS
|
|
7
|
+
<title>FUI-AS Routed Demo</title>
|
|
8
8
|
<style>
|
|
9
9
|
html, body {
|
|
10
10
|
margin: 0;
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<canvas id="fui-canvas"></canvas>
|
|
48
48
|
</main>
|
|
49
49
|
<div class="effindom-loading-overlay" id="effindom-loading-overlay" data-state="loading">
|
|
50
|
-
<div>Loading
|
|
50
|
+
<div>Loading routed demo…</div>
|
|
51
51
|
</div>
|
|
52
52
|
<script src="./effindom-runtime-config.js"></script>
|
|
53
53
|
<script src="./bridge.js"></script>
|
|
@@ -3,8 +3,8 @@ import { copyFileSync, cpSync, existsSync, mkdirSync, rmSync, writeFileSync } fr
|
|
|
3
3
|
const outputDir = "public";
|
|
4
4
|
rmSync(outputDir, { recursive: true, force: true });
|
|
5
5
|
mkdirSync(`${outputDir}/runtime`, { recursive: true });
|
|
6
|
-
mkdirSync(`${outputDir}/
|
|
7
|
-
mkdirSync(`${outputDir}/
|
|
6
|
+
mkdirSync(`${outputDir}/home`, { recursive: true });
|
|
7
|
+
mkdirSync(`${outputDir}/settings`, { recursive: true });
|
|
8
8
|
|
|
9
9
|
cpSync("node_modules/@effindomv2/runtime/dist", `${outputDir}/runtime/dist`, { recursive: true });
|
|
10
10
|
cpSync("node_modules/@effindomv2/runtime/dist/fonts", `${outputDir}/runtime/fonts`, { recursive: true });
|
|
@@ -18,5 +18,5 @@ writeFileSync(
|
|
|
18
18
|
"utf8",
|
|
19
19
|
);
|
|
20
20
|
copyFileSync("index.html", `${outputDir}/index.html`);
|
|
21
|
-
copyFileSync("route-shell.html", `${outputDir}/
|
|
22
|
-
copyFileSync("route-shell.html", `${outputDir}/
|
|
21
|
+
copyFileSync("route-shell.html", `${outputDir}/home/index.html`);
|
|
22
|
+
copyFileSync("route-shell.html", `${outputDir}/settings/index.html`);
|
|
@@ -3,10 +3,10 @@ import { accessSync } from "node:fs";
|
|
|
3
3
|
const expectedFiles = [
|
|
4
4
|
"public/index.html",
|
|
5
5
|
"public/harness.js",
|
|
6
|
-
"public/
|
|
7
|
-
"public/
|
|
8
|
-
"public/
|
|
9
|
-
"public/
|
|
6
|
+
"public/home/index.html",
|
|
7
|
+
"public/settings/index.html",
|
|
8
|
+
"public/home.wasm",
|
|
9
|
+
"public/settings.wasm",
|
|
10
10
|
"public/bridge.js",
|
|
11
11
|
"public/effindom-runtime-config.js",
|
|
12
12
|
"public/runtime/dist/effindom.v2.manifest.json",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/src/Fui";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/browser/src/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/src/FuiExports";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../node_modules/@effindomv2/fui-as/src/FuiPrimitives";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "../fui/FuiExports";
|
|
2
|
+
export * from "../host/generated/HostEvents";
|
|
3
|
+
|
|
4
|
+
import { createManagedApplication } from "../fui/Fui";
|
|
5
|
+
import { HomeController } from "./home/HomeController";
|
|
6
|
+
|
|
7
|
+
const app = createManagedApplication<HomeController>(() => new HomeController());
|
|
8
|
+
|
|
9
|
+
export function __runApp(): void {
|
|
10
|
+
app.run();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function __disposeApp(): void {
|
|
14
|
+
app.dispose();
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "../fui/FuiExports";
|
|
2
|
+
export * from "../host/generated/HostEvents";
|
|
3
|
+
|
|
4
|
+
import { createManagedApplication } from "../fui/Fui";
|
|
5
|
+
import { SettingsController } from "./settings/SettingsController";
|
|
6
|
+
|
|
7
|
+
const app = createManagedApplication<SettingsController>(() => new SettingsController());
|
|
8
|
+
|
|
9
|
+
export function __runApp(): void {
|
|
10
|
+
app.run();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function __disposeApp(): void {
|
|
14
|
+
app.dispose();
|
|
15
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Callback1 } from "
|
|
3
|
-
import { onAppClockTick } from "
|
|
4
|
-
import { appClockNowUnixSeconds } from "
|
|
1
|
+
import { ManagedApplicationController, Node } from "../../fui/Fui";
|
|
2
|
+
import { Callback1 } from "../../fui/FuiPrimitives";
|
|
3
|
+
import { onAppClockTick } from "../../host/generated/HostEvents";
|
|
4
|
+
import { appClockNowUnixSeconds } from "../../host/generated/HostServices";
|
|
5
5
|
import { HomeModel } from "./HomeModel";
|
|
6
6
|
import { HomeView } from "./HomeView";
|
|
7
7
|
|
|
@@ -19,12 +19,13 @@ class ClockTickHandler extends Callback1<i32> {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export class HomeController {
|
|
22
|
+
export class HomeController extends ManagedApplicationController {
|
|
23
23
|
readonly model: HomeModel = new HomeModel();
|
|
24
24
|
readonly view: HomeView = new HomeView(this.model);
|
|
25
25
|
private readonly clockTickHandler: ClockTickHandler = new ClockTickHandler(this);
|
|
26
26
|
|
|
27
27
|
constructor() {
|
|
28
|
+
super();
|
|
28
29
|
this.view.actionButton.onClickWith(this, (controller) => {
|
|
29
30
|
controller.model.actionCount += 1;
|
|
30
31
|
controller.view.setActionCount(controller.model.actionCount);
|
|
@@ -44,12 +45,8 @@ export class HomeController {
|
|
|
44
45
|
return this.view.getRoot();
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
mount(): void {
|
|
48
|
-
Application.mount(this.view.getRoot());
|
|
49
|
-
}
|
|
50
|
-
|
|
51
48
|
dispose(): void {
|
|
52
49
|
onAppClockTick(null);
|
|
53
|
-
|
|
50
|
+
super.dispose();
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -1,37 +1,24 @@
|
|
|
1
|
-
import { Column, FlexBox,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { mvcHomeRoute, mvcSettingsRoute } from "../../shared/routes";
|
|
1
|
+
import { Column, FlexBox, SelectionArea, Text, Unit, rgb } from "../../fui/Fui";
|
|
2
|
+
import { createNavBar } from "../shared/design-system/NavBar";
|
|
3
|
+
import { PrimaryButton } from "../shared/design-system/PrimaryButton";
|
|
5
4
|
import { HomeModel } from "./HomeModel";
|
|
6
5
|
|
|
7
|
-
function navSpacer(): FlexBox {
|
|
8
|
-
return new FlexBox().width(10.0, Unit.Pixel).height(1.0, Unit.Pixel);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
export class HomeView {
|
|
12
|
-
readonly actionButton:
|
|
7
|
+
readonly actionButton: PrimaryButton;
|
|
13
8
|
private readonly statusText: Text;
|
|
14
9
|
private readonly hostServiceText: Text;
|
|
15
10
|
private readonly hostEventText: Text;
|
|
16
11
|
private readonly root!: SelectionArea;
|
|
17
12
|
|
|
18
13
|
constructor(model: HomeModel) {
|
|
19
|
-
const
|
|
20
|
-
const settingsPill = new MvcNavPill(mvcSettingsRoute(), "Settings").active(false);
|
|
21
|
-
|
|
22
|
-
const navBar = Row()
|
|
23
|
-
.width(100.0, Unit.Percent)
|
|
24
|
-
.justifyContent(JustifyContent.End)
|
|
25
|
-
.child(homePill)
|
|
26
|
-
.child(navSpacer())
|
|
27
|
-
.child(settingsPill);
|
|
14
|
+
const navBar = createNavBar(true);
|
|
28
15
|
|
|
29
16
|
const title = new Text(model.title).fontSize(34.0).textColor(rgb(241, 245, 249)) as Text;
|
|
30
17
|
const subtitle = new Text(model.subtitle).fontSize(16.0).textColor(rgb(148, 163, 184)) as Text;
|
|
31
18
|
this.statusText = new Text("Home counter: 0").fontSize(18.0).textColor(rgb(147, 197, 253)) as Text;
|
|
32
19
|
this.hostServiceText = new Text("Host service time: -").fontSize(15.0).textColor(rgb(191, 219, 254)) as Text;
|
|
33
20
|
this.hostEventText = new Text("Host event tick: -").fontSize(15.0).textColor(rgb(134, 239, 172)) as Text;
|
|
34
|
-
this.actionButton = new
|
|
21
|
+
this.actionButton = new PrimaryButton(model.actionLabel);
|
|
35
22
|
|
|
36
23
|
const content = Column(
|
|
37
24
|
navBar,
|
package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsController.ts
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ManagedApplicationController, Node } from "../../fui/Fui";
|
|
2
2
|
import { SettingsModel } from "./SettingsModel";
|
|
3
3
|
import { SettingsView } from "./SettingsView";
|
|
4
4
|
|
|
5
|
-
export class SettingsController {
|
|
5
|
+
export class SettingsController extends ManagedApplicationController {
|
|
6
6
|
readonly model: SettingsModel = new SettingsModel();
|
|
7
7
|
readonly view: SettingsView = new SettingsView(this.model);
|
|
8
8
|
|
|
9
9
|
constructor() {
|
|
10
|
+
super();
|
|
10
11
|
this.view.actionButton.onClickWith(this, (controller) => {
|
|
11
12
|
controller.model.saveCount += 1;
|
|
12
13
|
controller.view.setSaveCount(controller.model.saveCount);
|
|
@@ -16,12 +17,4 @@ export class SettingsController {
|
|
|
16
17
|
getRoot(): Node {
|
|
17
18
|
return this.view.getRoot();
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
mount(): void {
|
|
21
|
-
Application.mount(this.view.getRoot());
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
dispose(): void {
|
|
25
|
-
Application.unmount();
|
|
26
|
-
}
|
|
27
20
|
}
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import { Column, FlexBox,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { mvcHomeRoute, mvcSettingsRoute } from "../../shared/routes";
|
|
1
|
+
import { Column, FlexBox, SelectionArea, Text, Unit, rgb } from "../../fui/Fui";
|
|
2
|
+
import { createNavBar } from "../shared/design-system/NavBar";
|
|
3
|
+
import { PrimaryButton } from "../shared/design-system/PrimaryButton";
|
|
5
4
|
import { SettingsModel } from "./SettingsModel";
|
|
6
5
|
|
|
7
|
-
function navSpacer(): FlexBox {
|
|
8
|
-
return new FlexBox().width(10.0, Unit.Pixel).height(1.0, Unit.Pixel);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
export class SettingsView {
|
|
12
|
-
readonly actionButton:
|
|
7
|
+
readonly actionButton: PrimaryButton;
|
|
13
8
|
private readonly statusText: Text;
|
|
14
9
|
private readonly root!: SelectionArea;
|
|
15
10
|
|
|
16
11
|
constructor(model: SettingsModel) {
|
|
17
|
-
const
|
|
18
|
-
const settingsPill = new MvcNavPill(mvcSettingsRoute(), "Settings").active(true);
|
|
19
|
-
|
|
20
|
-
const navBar = Row()
|
|
21
|
-
.width(100.0, Unit.Percent)
|
|
22
|
-
.justifyContent(JustifyContent.End)
|
|
23
|
-
.child(homePill)
|
|
24
|
-
.child(navSpacer())
|
|
25
|
-
.child(settingsPill);
|
|
12
|
+
const navBar = createNavBar(false);
|
|
26
13
|
|
|
27
14
|
const title = new Text(model.title).fontSize(34.0).textColor(rgb(241, 245, 249)) as Text;
|
|
28
15
|
const subtitle = new Text(model.subtitle).fontSize(16.0).textColor(rgb(148, 163, 184)) as Text;
|
|
29
16
|
this.statusText = new Text("Settings saved: 0").fontSize(18.0).textColor(rgb(134, 239, 172)) as Text;
|
|
30
|
-
this.actionButton = new
|
|
17
|
+
this.actionButton = new PrimaryButton(model.actionLabel);
|
|
31
18
|
|
|
32
19
|
const content = Column(
|
|
33
20
|
navBar,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FlexBox, JustifyContent, Row, Unit } from "../../../fui/Fui";
|
|
2
|
+
import { NavPill } from "./NavPill";
|
|
3
|
+
import { homeRoute, settingsRoute } from "../routes";
|
|
4
|
+
|
|
5
|
+
function navSpacer(): FlexBox {
|
|
6
|
+
return new FlexBox().width(10.0, Unit.Pixel).height(1.0, Unit.Pixel);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function createNavBar(homeIsActive: bool): FlexBox {
|
|
10
|
+
const homePill = new NavPill(homeRoute(), "Home").active(homeIsActive);
|
|
11
|
+
const settingsPill = new NavPill(settingsRoute(), "Settings").active(!homeIsActive);
|
|
12
|
+
return Row()
|
|
13
|
+
.width(100.0, Unit.Percent)
|
|
14
|
+
.justifyContent(JustifyContent.End)
|
|
15
|
+
.child(homePill)
|
|
16
|
+
.child(navSpacer())
|
|
17
|
+
.child(settingsPill);
|
|
18
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavLink, Text, rgb } from "
|
|
1
|
+
import { NavLink, Text, rgb } from "../../../fui/Fui";
|
|
2
2
|
|
|
3
3
|
const PILL_RADIUS: f32 = 999.0;
|
|
4
4
|
const PILL_PADDING_X: f32 = 16.0;
|
|
@@ -8,7 +8,7 @@ const PILL_ACTIVE_BG: u32 = rgb(34, 197, 94);
|
|
|
8
8
|
const PILL_INACTIVE_TEXT: u32 = rgb(226, 232, 240);
|
|
9
9
|
const PILL_ACTIVE_TEXT: u32 = rgb(12, 16, 24);
|
|
10
10
|
|
|
11
|
-
export class
|
|
11
|
+
export class NavPill extends NavLink {
|
|
12
12
|
private readonly labelNode: Text;
|
|
13
13
|
private activeValue: bool = false;
|
|
14
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, rgb } from "
|
|
1
|
+
import { Button, rgb } from "../../../fui/Fui";
|
|
2
2
|
|
|
3
3
|
const BUTTON_RADIUS: f32 = 12.0;
|
|
4
4
|
const BUTTON_PADDING_X: f32 = 18.0;
|
|
@@ -6,7 +6,7 @@ const BUTTON_PADDING_Y: f32 = 10.0;
|
|
|
6
6
|
const BUTTON_BG: u32 = rgb(59, 130, 246);
|
|
7
7
|
const BUTTON_TEXT: u32 = rgb(241, 245, 249);
|
|
8
8
|
|
|
9
|
-
export class
|
|
9
|
+
export class PrimaryButton extends Button {
|
|
10
10
|
constructor(label: string) {
|
|
11
11
|
super(label);
|
|
12
12
|
this
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { currentRoute } from "
|
|
1
|
+
import { currentRoute } from "../../fui/Fui";
|
|
2
2
|
|
|
3
3
|
const SOURCE_DEMO_BASE: string = "/v2/fui-as/demo-mvc";
|
|
4
|
-
const SOURCE_HOME_ROUTE: string = "/v2/fui-as/demo-mvc/
|
|
5
|
-
const SOURCE_SETTINGS_ROUTE: string = "/v2/fui-as/demo-mvc/
|
|
6
|
-
const PUBLISHED_HOME_ROUTE: string = "/
|
|
7
|
-
const PUBLISHED_SETTINGS_ROUTE: string = "/
|
|
4
|
+
const SOURCE_HOME_ROUTE: string = "/v2/fui-as/demo-mvc/home/";
|
|
5
|
+
const SOURCE_SETTINGS_ROUTE: string = "/v2/fui-as/demo-mvc/settings/";
|
|
6
|
+
const PUBLISHED_HOME_ROUTE: string = "/home/";
|
|
7
|
+
const PUBLISHED_SETTINGS_ROUTE: string = "/settings/";
|
|
8
8
|
|
|
9
9
|
function isSourceDemoRoute(route: string): bool {
|
|
10
10
|
if (route.length == 0) {
|
|
@@ -13,10 +13,10 @@ function isSourceDemoRoute(route: string): bool {
|
|
|
13
13
|
return route.startsWith(SOURCE_DEMO_BASE);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function
|
|
16
|
+
export function homeRoute(): string {
|
|
17
17
|
return isSourceDemoRoute(currentRoute.value) ? SOURCE_HOME_ROUTE : PUBLISHED_HOME_ROUTE;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function settingsRoute(): string {
|
|
21
21
|
return isSourceDemoRoute(currentRoute.value) ? SOURCE_SETTINGS_ROUTE : PUBLISHED_SETTINGS_ROUTE;
|
|
22
22
|
}
|
|
@@ -26,7 +26,7 @@ function rewriteSdkImportsInFile(filePath, templateSrcRoot) {
|
|
|
26
26
|
const original = readFileSync(filePath, "utf8");
|
|
27
27
|
const rewritten = original
|
|
28
28
|
.replace(/(['"])(?:\.\.\/)+src\/(Fui|FuiExports|FuiPrimitives|FuiBrowser)\1/g, (_full, quote, symbolName) => {
|
|
29
|
-
const targetPath = join(templateSrcRoot, `${symbolName}.ts`);
|
|
29
|
+
const targetPath = join(templateSrcRoot, "fui", `${symbolName}.ts`);
|
|
30
30
|
const relativeSpecifier = posixRelativeImport(filePath, targetPath);
|
|
31
31
|
return `${quote}${relativeSpecifier}${quote}`;
|
|
32
32
|
})
|
|
@@ -47,11 +47,11 @@ function walkFiles(root, callback) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
function writeSharedSdkShims(templateRoot) {
|
|
50
|
-
const
|
|
51
|
-
writeTextFile(join(
|
|
52
|
-
writeTextFile(join(
|
|
53
|
-
writeTextFile(join(
|
|
54
|
-
writeTextFile(join(
|
|
50
|
+
const fuiRoot = join(templateRoot, "src", "fui");
|
|
51
|
+
writeTextFile(join(fuiRoot, "Fui.ts"), 'export * from "../../node_modules/@effindomv2/fui-as/src/Fui";\n');
|
|
52
|
+
writeTextFile(join(fuiRoot, "FuiExports.ts"), 'export * from "../../node_modules/@effindomv2/fui-as/src/FuiExports";\n');
|
|
53
|
+
writeTextFile(join(fuiRoot, "FuiPrimitives.ts"), 'export * from "../../node_modules/@effindomv2/fui-as/src/FuiPrimitives";\n');
|
|
54
|
+
writeTextFile(join(fuiRoot, "FuiBrowser.ts"), 'export * from "../../node_modules/@effindomv2/fui-as/browser/src/index";\n');
|
|
55
55
|
}
|
|
56
56
|
function writeAsconfig(templateRoot) {
|
|
57
57
|
writeTextFile(join(templateRoot, "asconfig.json"), JSON.stringify({
|
|
@@ -151,10 +151,10 @@ for (const filePath of expectedFiles) {
|
|
|
151
151
|
"build:assets": "tsx scripts/prepare-runtime.ts",
|
|
152
152
|
"build:wasm": "asc src/App.ts --config asconfig.json --target release",
|
|
153
153
|
"build:harness": "esbuild harness.ts --bundle --format=esm --platform=browser --outfile=public/harness.js",
|
|
154
|
-
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/generated/HostServices.ts
|
|
155
|
-
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/generated/HostEvents.ts
|
|
154
|
+
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/host/generated/HostServices.ts ../../fui/FuiPrimitives",
|
|
155
|
+
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/host/generated/HostEvents.ts ../../fui/FuiPrimitives",
|
|
156
156
|
"generate:host": "npm run generate:host-services && npm run generate:host-events",
|
|
157
|
-
watch: 'chokidar "src/**/*.ts" "harness.ts" "index.html" "asconfig.json" -c "npm run build"',
|
|
157
|
+
watch: 'chokidar "src/**/*.ts" "harness.ts" "index.html" "asconfig.json" --ignore "src/host/generated/**" -c "npm run build"',
|
|
158
158
|
serve: "http-server public -p 8080 -c-1",
|
|
159
159
|
dev: 'npm run build && concurrently -k -n watch,serve "npm run watch" "npm run serve"',
|
|
160
160
|
test: "npm run build && tsx scripts/smoke.ts",
|
|
@@ -165,11 +165,11 @@ function writeMvcSupportFiles(templateRoot) {
|
|
|
165
165
|
<html lang="en">
|
|
166
166
|
<head>
|
|
167
167
|
<meta charset="utf-8" />
|
|
168
|
-
<meta http-equiv="refresh" content="0; url=/
|
|
169
|
-
<title>FUI-AS
|
|
168
|
+
<meta http-equiv="refresh" content="0; url=/home/" />
|
|
169
|
+
<title>FUI-AS Routed App</title>
|
|
170
170
|
</head>
|
|
171
171
|
<body>
|
|
172
|
-
<p>Redirecting to <a href="/
|
|
172
|
+
<p>Redirecting to <a href="/home/">/home/</a>…</p>
|
|
173
173
|
</body>
|
|
174
174
|
</html>
|
|
175
175
|
`);
|
|
@@ -178,8 +178,8 @@ function writeMvcSupportFiles(templateRoot) {
|
|
|
178
178
|
const outputDir = "public";
|
|
179
179
|
rmSync(outputDir, { recursive: true, force: true });
|
|
180
180
|
mkdirSync(\`\${outputDir}/runtime\`, { recursive: true });
|
|
181
|
-
mkdirSync(\`\${outputDir}/
|
|
182
|
-
mkdirSync(\`\${outputDir}/
|
|
181
|
+
mkdirSync(\`\${outputDir}/home\`, { recursive: true });
|
|
182
|
+
mkdirSync(\`\${outputDir}/settings\`, { recursive: true });
|
|
183
183
|
|
|
184
184
|
cpSync("node_modules/@effindomv2/runtime/dist", \`\${outputDir}/runtime/dist\`, { recursive: true });
|
|
185
185
|
cpSync("node_modules/@effindomv2/runtime/dist/fonts", \`\${outputDir}/runtime/fonts\`, { recursive: true });
|
|
@@ -193,18 +193,18 @@ writeFileSync(
|
|
|
193
193
|
"utf8",
|
|
194
194
|
);
|
|
195
195
|
copyFileSync("index.html", \`\${outputDir}/index.html\`);
|
|
196
|
-
copyFileSync("route-shell.html", \`\${outputDir}/
|
|
197
|
-
copyFileSync("route-shell.html", \`\${outputDir}/
|
|
196
|
+
copyFileSync("route-shell.html", \`\${outputDir}/home/index.html\`);
|
|
197
|
+
copyFileSync("route-shell.html", \`\${outputDir}/settings/index.html\`);
|
|
198
198
|
`);
|
|
199
199
|
writeTextFile(join(templateRoot, "scripts", "smoke.ts"), `import { accessSync } from "node:fs";
|
|
200
200
|
|
|
201
201
|
const expectedFiles = [
|
|
202
202
|
"public/index.html",
|
|
203
203
|
"public/harness.js",
|
|
204
|
-
"public/
|
|
205
|
-
"public/
|
|
206
|
-
"public/
|
|
207
|
-
"public/
|
|
204
|
+
"public/home/index.html",
|
|
205
|
+
"public/settings/index.html",
|
|
206
|
+
"public/home.wasm",
|
|
207
|
+
"public/settings.wasm",
|
|
208
208
|
"public/bridge.js",
|
|
209
209
|
"public/effindom-runtime-config.js",
|
|
210
210
|
"public/runtime/dist/effindom.v2.manifest.json",
|
|
@@ -219,17 +219,17 @@ for (const filePath of expectedFiles) {
|
|
|
219
219
|
build: "npm run generate:host && npm run build:assets && npm run build:wasm && npm run build:harness",
|
|
220
220
|
"build:assets": "tsx scripts/prepare-runtime.ts",
|
|
221
221
|
"build:wasm": "npm run build:wasm:home && npm run build:wasm:settings",
|
|
222
|
-
"build:wasm:home": "asc src/routes/
|
|
223
|
-
"build:wasm:settings": "asc src/routes/
|
|
222
|
+
"build:wasm:home": "asc src/routes/HomeApp.ts --config asconfig.json --target release --outFile public/home.wasm",
|
|
223
|
+
"build:wasm:settings": "asc src/routes/SettingsApp.ts --config asconfig.json --target release --outFile public/settings.wasm",
|
|
224
224
|
"build:harness": "esbuild harness.ts --bundle --format=esm --platform=browser --outfile=public/harness.js",
|
|
225
|
-
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/generated/HostServices.ts
|
|
226
|
-
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/generated/HostEvents.ts
|
|
225
|
+
"generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/host/generated/HostServices.ts ../../fui/FuiPrimitives",
|
|
226
|
+
"generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/host/generated/HostEvents.ts ../../fui/FuiPrimitives",
|
|
227
227
|
"generate:host": "npm run generate:host-services && npm run generate:host-events",
|
|
228
|
-
watch: 'chokidar "src/**/*.ts" "harness.ts" "route-shell.html" "index.html" "asconfig.json" -c "npm run build"',
|
|
228
|
+
watch: 'chokidar "src/**/*.ts" "harness.ts" "route-shell.html" "index.html" "asconfig.json" --ignore "src/host/generated/**" -c "npm run build"',
|
|
229
229
|
serve: "http-server public -p 8080 -c-1",
|
|
230
230
|
dev: 'npm run build && concurrently -k -n watch,serve "npm run watch" "npm run serve"',
|
|
231
231
|
test: "npm run build && tsx scripts/smoke.ts",
|
|
232
|
-
}, "Scaffolded FUI-AS
|
|
232
|
+
}, "Scaffolded FUI-AS routed app");
|
|
233
233
|
}
|
|
234
234
|
function rewriteHarnessImports(filePath) {
|
|
235
235
|
const original = readFileSync(filePath, "utf8");
|
|
@@ -256,6 +256,7 @@ function syncHelloTemplate() {
|
|
|
256
256
|
cpSync(join(sourceRoot, "src"), templateSrcRoot, { recursive: true });
|
|
257
257
|
cpSync(join(sourceRoot, "harness.ts"), join(templateRoot, "harness.ts"));
|
|
258
258
|
cpSync(join(sourceRoot, "index.html"), join(templateRoot, "index.html"));
|
|
259
|
+
cpSync(join(sourceRoot, "README.md"), join(templateRoot, "README.md"));
|
|
259
260
|
writeSharedSdkShims(templateRoot);
|
|
260
261
|
writeAsconfig(templateRoot);
|
|
261
262
|
writeTsconfig(templateRoot);
|
|
@@ -266,8 +267,8 @@ function syncHelloTemplate() {
|
|
|
266
267
|
}
|
|
267
268
|
});
|
|
268
269
|
rewriteHarnessImports(join(templateRoot, "harness.ts"));
|
|
269
|
-
normalizeGeneratedHeader(join(templateSrcRoot, "generated", "HostEvents.ts"), "the scaffold host-events definition");
|
|
270
|
-
normalizeGeneratedHeader(join(templateSrcRoot, "generated", "HostServices.ts"), "the scaffold host-services definition");
|
|
270
|
+
normalizeGeneratedHeader(join(templateSrcRoot, "host", "generated", "HostEvents.ts"), "the scaffold host-events definition");
|
|
271
|
+
normalizeGeneratedHeader(join(templateSrcRoot, "host", "generated", "HostServices.ts"), "the scaffold host-services definition");
|
|
271
272
|
}
|
|
272
273
|
function syncMvcTemplate() {
|
|
273
274
|
const templateRoot = join(TEMPLATES_ROOT, "mvc");
|
|
@@ -277,6 +278,7 @@ function syncMvcTemplate() {
|
|
|
277
278
|
cpSync(join(sourceRoot, "src"), templateSrcRoot, { recursive: true });
|
|
278
279
|
cpSync(join(sourceRoot, "harness.ts"), join(templateRoot, "harness.ts"));
|
|
279
280
|
cpSync(join(sourceRoot, "route-shell.html"), join(templateRoot, "route-shell.html"));
|
|
281
|
+
cpSync(join(sourceRoot, "README.md"), join(templateRoot, "README.md"));
|
|
280
282
|
writeSharedSdkShims(templateRoot);
|
|
281
283
|
writeAsconfig(templateRoot);
|
|
282
284
|
writeTsconfig(templateRoot);
|
|
@@ -287,8 +289,8 @@ function syncMvcTemplate() {
|
|
|
287
289
|
}
|
|
288
290
|
});
|
|
289
291
|
rewriteHarnessImports(join(templateRoot, "harness.ts"));
|
|
290
|
-
normalizeGeneratedHeader(join(templateSrcRoot, "generated", "HostEvents.ts"), "the scaffold host-events definition");
|
|
291
|
-
normalizeGeneratedHeader(join(templateSrcRoot, "generated", "HostServices.ts"), "the scaffold host-services definition");
|
|
292
|
+
normalizeGeneratedHeader(join(templateSrcRoot, "host", "generated", "HostEvents.ts"), "the scaffold host-events definition");
|
|
293
|
+
normalizeGeneratedHeader(join(templateSrcRoot, "host", "generated", "HostServices.ts"), "the scaffold host-services definition");
|
|
292
294
|
}
|
|
293
295
|
rmSync(TEMPLATES_ROOT, { recursive: true, force: true });
|
|
294
296
|
rmSync(LEGACY_TEMPLATES_ROOT, { recursive: true, force: true });
|
package/dist/src/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const FUI_AS_VERSION = "0.1.
|
|
1
|
+
export declare const FUI_AS_VERSION = "0.1.4";
|
|
2
2
|
export declare const RUNTIME_VERSION = "0.1.0";
|
package/dist/src/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const FUI_AS_VERSION = "0.1.
|
|
1
|
+
export const FUI_AS_VERSION = "0.1.4";
|
|
2
2
|
export const RUNTIME_VERSION = "0.1.0";
|
|
@@ -21,8 +21,12 @@ test("createProject writes hello-world scaffold including AssemblyScript tsconfi
|
|
|
21
21
|
assert.equal(typeof packageJson.scripts.test, "string");
|
|
22
22
|
assert.equal(typeof packageJson.scripts["generate:host"], "string");
|
|
23
23
|
assert.equal(readFileSync(join(target, "src", "HelloWorld.ts"), "utf8").includes("Hello world"), true);
|
|
24
|
+
assert.equal(readFileSync(join(target, "README.md"), "utf8").includes("Hello World scaffold guide"), true);
|
|
25
|
+
assert.equal(readFileSync(join(target, "src", "fui", "Fui.ts"), "utf8").includes("@effindomv2/fui-as/src/Fui"), true);
|
|
24
26
|
assert.equal(readFileSync(join(target, "src", "host", "host-events.ts"), "utf8").includes("appHostEvents"), true);
|
|
25
27
|
assert.equal(readFileSync(join(target, "src", "host", "host-services.ts"), "utf8").includes("appHostServices"), true);
|
|
28
|
+
assert.equal(readFileSync(join(target, "src", "host", "generated", "HostEvents.ts"), "utf8").includes("onAppClockTick"), true);
|
|
29
|
+
assert.equal(readFileSync(join(target, "src", "host", "generated", "HostServices.ts"), "utf8").includes("appClockNowUnixSeconds"), true);
|
|
26
30
|
}
|
|
27
31
|
finally {
|
|
28
32
|
rmSync(root, { recursive: true, force: true });
|
|
@@ -41,10 +45,15 @@ test("createProject writes mvc scaffold when template is mvc", () => {
|
|
|
41
45
|
assert.equal(typeof packageJson.scripts["build:wasm:home"], "string");
|
|
42
46
|
assert.equal(typeof packageJson.scripts["build:wasm:settings"], "string");
|
|
43
47
|
assert.equal(typeof packageJson.scripts["generate:host"], "string");
|
|
44
|
-
assert.equal(readFileSync(join(target, "src", "routes", "
|
|
48
|
+
assert.equal(readFileSync(join(target, "src", "routes", "home", "HomeController.ts"), "utf8").includes("HomeController"), true);
|
|
49
|
+
assert.equal(readFileSync(join(target, "src", "routes", "HomeApp.ts"), "utf8").includes("createManagedApplication"), true);
|
|
50
|
+
assert.equal(readFileSync(join(target, "README.md"), "utf8").includes("MVC scaffold guide"), true);
|
|
45
51
|
assert.equal(readFileSync(join(target, "src", "host", "host-events.ts"), "utf8").includes("appHostEvents"), true);
|
|
46
52
|
assert.equal(readFileSync(join(target, "src", "host", "host-services.ts"), "utf8").includes("appHostServices"), true);
|
|
47
|
-
assert.equal(readFileSync(join(target, "
|
|
53
|
+
assert.equal(readFileSync(join(target, "src", "fui", "Fui.ts"), "utf8").includes("@effindomv2/fui-as/src/Fui"), true);
|
|
54
|
+
assert.equal(readFileSync(join(target, "src", "host", "generated", "HostEvents.ts"), "utf8").includes("onAppClockTick"), true);
|
|
55
|
+
assert.equal(readFileSync(join(target, "src", "host", "generated", "HostServices.ts"), "utf8").includes("appClockNowUnixSeconds"), true);
|
|
56
|
+
assert.equal(readFileSync(join(target, "route-shell.html"), "utf8").includes("FUI-AS Routed Demo"), true);
|
|
48
57
|
}
|
|
49
58
|
finally {
|
|
50
59
|
rmSync(root, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/src/Fui";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/browser/src/index";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/src/FuiExports";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/src/FuiPrimitives";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/src/Fui";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/browser/src/index";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/src/FuiExports";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../node_modules/@effindomv2/fui-as/src/FuiPrimitives";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from "../FuiExports";
|
|
2
|
-
export * from "../generated/HostEvents";
|
|
3
|
-
|
|
4
|
-
import { Node, createManagedApplication } from "../Fui";
|
|
5
|
-
import { HomeController } from "./mvc/pages/home/HomeController";
|
|
6
|
-
|
|
7
|
-
const app = createManagedApplication<HomeController>(
|
|
8
|
-
() => new HomeController(),
|
|
9
|
-
(controller): Node => controller.getRoot(),
|
|
10
|
-
(controller): void => controller.mount(),
|
|
11
|
-
(controller): void => controller.dispose(),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
export function __runApp(): void {
|
|
15
|
-
app.run();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function __disposeApp(): void {
|
|
19
|
-
app.dispose();
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from "../FuiExports";
|
|
2
|
-
export * from "../generated/HostEvents";
|
|
3
|
-
|
|
4
|
-
import { Node, createManagedApplication } from "../Fui";
|
|
5
|
-
import { SettingsController } from "./mvc/pages/settings/SettingsController";
|
|
6
|
-
|
|
7
|
-
const app = createManagedApplication<SettingsController>(
|
|
8
|
-
() => new SettingsController(),
|
|
9
|
-
(controller): Node => controller.getRoot(),
|
|
10
|
-
(controller): void => controller.mount(),
|
|
11
|
-
(controller): void => controller.dispose(),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
export function __runApp(): void {
|
|
15
|
-
app.run();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function __disposeApp(): void {
|
|
19
|
-
app.dispose();
|
|
20
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|