diff --git a/package-lock.json b/package-lock.json index 788840c..e6bbbc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "@zablab/solar", "version": "0.1.1", "dependencies": { - "@lumencast/runtime": "^0.1.0", + "@lumencast/runtime": "^0.2.0", "@preact/signals-react": "^3.2.1", "framer-motion": "^12.0.0", "react": "^19.0.0", @@ -1133,9 +1133,9 @@ } }, "node_modules/@lumencast/protocol": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@lumencast/protocol/-/protocol-0.1.0.tgz", - "integrity": "sha512-Bex8lI7LeE9UEMCkro/ZvxNgX8j5U/e0/MwzA2LdTBzGoB7DxL6DWfpEqKaTqKjGvHxOauM2Fli/KymADJ4Qog==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@lumencast/protocol/-/protocol-0.2.0.tgz", + "integrity": "sha512-40LNaJiHMoQYv2QMvw2mAea86qhp9X2ZZyszQZfoXxtKFl3b5SPKXKd3KrE9fCG0BnDw0PKjC0wsXB2KTg+f4w==", "license": "Apache-2.0", "dependencies": { "ws": "^8.18.0", @@ -1149,12 +1149,12 @@ } }, "node_modules/@lumencast/runtime": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@lumencast/runtime/-/runtime-0.1.0.tgz", - "integrity": "sha512-EbiW2xqujH6Q/MG9cmf0mDJG9azXLOMEd+4LtPf8tSCT/ix+bKiC3YMj2e83LhWvZXezcMu3YIGWwJOv2JKfGg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@lumencast/runtime/-/runtime-0.2.0.tgz", + "integrity": "sha512-GlXywaabkpR/0UInOFwMVroUGUpP1nh25x3fVVe+Qy46LfpBL6NuMelfWVQoQ+4+7olNAU09Btn9GNNPcoXONA==", "license": "Apache-2.0", "dependencies": { - "@lumencast/protocol": "0.1.0", + "@lumencast/protocol": "0.2.0", "@preact/signals-react": "^3.2.1", "framer-motion": "^12.0.0", "react": "^19.0.0", diff --git a/package.json b/package.json index a31650b..95e3ac2 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "check:bundle": "node scripts/check-bundle-size.mjs" }, "dependencies": { - "@lumencast/runtime": "^0.1.0", + "@lumencast/runtime": "^0.2.0", "@preact/signals-react": "^3.2.1", "framer-motion": "^12.0.0", "react": "^19.0.0", diff --git a/tests/unit/render.test.tsx b/tests/unit/render.test.tsx index b81a410..3bee3de 100644 --- a/tests/unit/render.test.tsx +++ b/tests/unit/render.test.tsx @@ -143,6 +143,42 @@ describe("Solar mount() over @lumencast/runtime", () => { target.remove(); }); + it("renders text fontFamily (resolved.font) and image intrinsic width/height", async () => { + const target = document.createElement("div"); + document.body.appendChild(target); + // Render-vocab bundle (what Orion's lowerRenderProps serves): text.font + + // image.width/height. Proves the runtime fixes — text.tsx applies + // fontFamily, image.tsx honours width/height instead of forcing 100%. + const bundle: RenderBundle = { + scene_version: SCENE_VERSION, + root: { + kind: "stack", + children: [ + { kind: "text", id: "t", props: { value: "FONT", font: "Bebas Neue", size: 48 } }, + { kind: "image", id: "i", props: { src: "http://x/logo.svg", width: 96, height: 64, fit: "contain" } }, + ], + }, + }; + vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify(bundle), { status: 200 }))); + vi.stubGlobal("WebSocket", FakeWebSocket as unknown as typeof WebSocket); + + const handle = mount({ + target, orionUrl: "wss://gate.example/orion/api/v1/show/stream", + token: "t", mode: "broadcast", + }); + await waitFor(() => target.querySelector("img") !== null && target.textContent?.includes("FONT") === true); + + const span = target.querySelector("span"); + const img = target.querySelector("img") as HTMLImageElement | null; + expect(span?.style.fontFamily).toContain("Bebas Neue"); + expect(img?.style.width).toBe("96px"); + expect(img?.style.height).toBe("64px"); + expect(img?.getAttribute("src")).toBe("http://x/logo.svg"); + + handle.disconnect(); + target.remove(); + }); + it("maps orionUrl onto the runtime serverUrl (WS opened against it)", async () => { const target = document.createElement("div"); document.body.appendChild(target);