|
1 | | -// Federation-exposed mount. Same pattern as prompt-template-manager — |
2 | | -// theme.css first (so :root tokens exist before app.css's var() refs |
3 | | -// resolve), then app.css, then mount the App component. |
| 1 | +// Federation-exposed mount. The shared body lives in @augment-it/federation, |
| 2 | +// which also carries the theme.css import — see that module for why the |
| 3 | +// ordering below (federation first, ./app.css second) is load-bearing. |
4 | 4 | // |
5 | | -// The chat connects to the workspace WebSocket on mount and disconnects |
6 | | -// on unmount. In federation mode the workspace singleton is per-remote |
7 | | -// (the shell's no-`shared` discipline), so the chat owns its own |
8 | | -// workspace connection and exchanges state with the rest of the stack |
9 | | -// via the same broadcast subjects everyone else sees. |
| 5 | +// The chat connects to the workspace WebSocket on mount and disconnects on |
| 6 | +// unmount. In federation mode the workspace singleton is per-remote (the |
| 7 | +// shell's no-`shared` discipline), so the chat owns its own workspace |
| 8 | +// connection and exchanges state with the rest of the stack via the same |
| 9 | +// broadcast subjects everyone else sees. |
10 | 10 |
|
11 | | -import '@augment-it/theme/theme.css'; |
| 11 | +import { makeMount } from '@augment-it/federation'; |
12 | 12 | import './app.css'; |
13 | | -import { mount, unmount, type Component } from 'svelte'; |
| 13 | +import type { Component } from 'svelte'; |
14 | 14 | import App from './App.svelte'; |
15 | 15 |
|
16 | | -export type MountResult = { |
17 | | - destroy: () => void; |
18 | | -}; |
| 16 | +export type { MountResult } from '@augment-it/federation'; |
19 | 17 |
|
20 | | -export function mountChat(target: HTMLElement): MountResult { |
21 | | - const component = mount(App as Component, { target }); |
22 | | - return { |
23 | | - destroy: () => { |
24 | | - unmount(component); |
25 | | - }, |
26 | | - }; |
27 | | -} |
| 18 | +export const mountChat = makeMount(App as Component); |
0 commit comments