@savvifi/meridian-aion-web 0.1.0 → 0.1.1

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/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @savvifi/meridian-aion-web
2
+
3
+ The **aion/web ↔ meridian-ux render seam**. Lets an SSR host (e.g. `aion/web` on
4
+ Hono + Vite classic SSR) render aion **entity routes** through meridian-ux —
5
+ `ViewDescriptor → muiKit` — instead of the legacy React entity-page path, behind a
6
+ per-entity feature flag so parity can be proven before switching.
7
+
8
+ Meridian owns everything from the composition down (project → render → paginate);
9
+ the host keeps the SSR harness, the app shell, navigation, providers, and the
10
+ session-bound tRPC caller.
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ pnpm add @savvifi/meridian-aion-web
16
+ ```
17
+
18
+ Peers the host provides: `react` `react-dom` (19), `@mui/material` (7),
19
+ `@emotion/react` `@emotion/styled` (11), and `@aion/entity-route-runtime` (the
20
+ composition loader + route parser — the host's version wins).
21
+
22
+ ## Server (SSR)
23
+
24
+ ```ts
25
+ import { renderMeridianEntityView, NotFoundSignal } from "@savvifi/meridian-aion-web/server";
26
+
27
+ const { node, dehydrated } = await renderMeridianEntityView({
28
+ pathname, // "/entities/products" | "/entities/products/id/123"
29
+ caller, // session-bound createCaller -> caller.entities.ops
30
+ graph, // ctx.graph -> composition loader's systemGraphFactory
31
+ mode, // "light" | "dark" (default "light")
32
+ // notFound: "throw" (default) throws NotFoundSignal; "return" -> { node: null }
33
+ });
34
+ // stream `node` as the page content; embed `dehydrated` = { viewJson, initialData }
35
+ // in your boot script for the client.
36
+ ```
37
+
38
+ `renderMeridianEntityView` parses the route, loads the installed composition,
39
+ projects it to a `ViewDescriptor`, **pre-fetches page-0** through the caller (so the
40
+ SSR HTML carries real rows), renders it through `muiKit` + the `savviSkin` theme,
41
+ and returns the node plus the dehydrated payload.
42
+
43
+ ## Client (hydration)
44
+
45
+ ```tsx
46
+ import { MeridianEntityView } from "@savvifi/meridian-aion-web/client";
47
+ import { createEntityOpsInvoker } from "@savvifi/meridian-aion-web";
48
+
49
+ // invoker over the app's browser tRPC client:
50
+ const invoker = createEntityOpsInvoker(client.entities.ops);
51
+
52
+ <MeridianEntityView
53
+ viewJson={dehydrated.viewJson} // a JSON value, not a string
54
+ initialData={dehydrated.initialData}
55
+ invoker={invoker}
56
+ mode={mode}
57
+ />
58
+ ```
59
+
60
+ `usePagedRows` (in `@savvifi/meridian-web-react`) seeds page-0 from `initialData`
61
+ and skips the initial refetch, so hydration matches the server render with no flash.
62
+
63
+ ## Exports
64
+
65
+ - `@savvifi/meridian-aion-web/server` — `renderMeridianEntityView`, `NotFoundSignal`, `isNotFoundSignal`, `savviSkin`
66
+ - `@savvifi/meridian-aion-web/client` — `MeridianEntityView`, `savviSkin`
67
+ - root — all of the above + `createEntityOpsInvoker`
68
+
69
+ ## License
70
+
71
+ UNLICENSED — © savvifi.
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { MeridianEntityView, type MeridianEntityViewProps } from "./render-clien
3
3
  export { savviSkin } from "./savvi-skin.js";
4
4
  export { NotFoundSignal, isNotFoundSignal } from "./not-found.js";
5
5
  export { createEntityOpsInvoker } from "@savvifi/meridian-aion-projection";
6
+ export type { MeridianActionHandler } from "@savvifi/meridian-web-react";
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { RpcInvoker } from "@savvifi/meridian-schemas/uiview";
3
- import { type MeridianInitialData } from "@savvifi/meridian-web-react";
3
+ import { type MeridianActionHandler, type MeridianInitialData } from "@savvifi/meridian-web-react";
4
4
  export interface MeridianEntityViewProps {
5
5
  /** The dehydrated ViewDescriptor JSON value (from the server render). */
6
6
  viewJson: unknown;
@@ -10,5 +10,11 @@ export interface MeridianEntityViewProps {
10
10
  invoker: RpcInvoker;
11
11
  /** Resolved color mode; must match the server render for clean hydration. */
12
12
  mode?: "light" | "dark";
13
+ /**
14
+ * Host handler for no-call actions (view_details / edit / create …). The host
15
+ * wires this to its router — e.g. `(actionId, entityType, entityId) => nav(...)`.
16
+ * Client-only (SSR renders the same markup; onClick handlers aren't serialized).
17
+ */
18
+ onAction?: MeridianActionHandler;
13
19
  }
14
- export declare function MeridianEntityView({ viewJson, initialData, invoker, mode, }: MeridianEntityViewProps): ReactNode;
20
+ export declare function MeridianEntityView({ viewJson, initialData, invoker, mode, onAction, }: MeridianEntityViewProps): ReactNode;
@@ -6,10 +6,10 @@
6
6
  import { createElement } from "react";
7
7
  import { fromJson } from "@bufbuild/protobuf";
8
8
  import { ViewDescriptorSchema } from "@savvifi/meridian-proto-ts/proto/view_pb.js";
9
- import { ViewRenderer } from "@savvifi/meridian-web-react";
9
+ import { ViewRenderer, } from "@savvifi/meridian-web-react";
10
10
  import { MeridianMuiProvider } from "@savvifi/meridian-mui-kit";
11
11
  import { savviSkin } from "./savvi-skin.js";
12
- export function MeridianEntityView({ viewJson, initialData, invoker, mode = "light", }) {
12
+ export function MeridianEntityView({ viewJson, initialData, invoker, mode = "light", onAction, }) {
13
13
  const view = fromJson(ViewDescriptorSchema, viewJson);
14
- return createElement(MeridianMuiProvider, { invoker, theme: savviSkin, mode }, createElement(ViewRenderer, { view, initialData }));
14
+ return createElement(MeridianMuiProvider, { invoker, theme: savviSkin, mode, onAction }, createElement(ViewRenderer, { view, initialData }));
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvifi/meridian-aion-web",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "The aion/web <-> meridian-ux render seam: renderMeridianEntityView (server — parse route, load composition, project to a ViewDescriptor, pre-fetch page-0, render + dehydrate) + MeridianEntityView (client hydration) + savviSkin. Lets an SSR host (e.g. aion/web on Hono+Vite) render entity routes through meridian instead of the legacy React path.",
6
6
  "publishConfig": {
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@savvifi/meridian-aion-projection": "^0.2.2",
40
- "@savvifi/meridian-mui-kit": "^0.1.0",
40
+ "@savvifi/meridian-mui-kit": "^0.1.4",
41
41
  "@savvifi/meridian-proto-ts": "^0.3.0",
42
42
  "@savvifi/meridian-schemas": "^0.3.0",
43
- "@savvifi/meridian-web-react": "^0.3.3",
43
+ "@savvifi/meridian-web-react": "^0.3.5",
44
44
  "@bufbuild/protobuf": "2.12.1"
45
45
  },
46
46
  "peerDependencies": {