@pi-outpost/embed 0.8.0 → 0.9.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 CHANGED
@@ -38,6 +38,17 @@ widget.unmount(); // tear down the React tree
38
38
 
39
39
  `mount(container, options?)` returns `{ unmount(), setTheme(theme) }`. The container itself stays in the DOM after `unmount()`, with an empty shadow root.
40
40
 
41
+ ### Which theme wins
42
+
43
+ Strongest first:
44
+
45
+ 1. `setTheme()`, a `{ type: "pi-outpost:set-theme", theme }` message, or the reader using the widget's own toggle — whatever was chosen while it was on screen;
46
+ 2. the `theme` you pass to `mount()`. Naming it means you get it: a reader who once used the toggle on this origin does not overrule the page that embeds the widget;
47
+ 3. a theme this browser remembered from an earlier visit;
48
+ 4. the server's `branding.defaultTheme`, itself falling back to `"system"`.
49
+
50
+ So pass `theme` when your page has a look the widget has to match, and leave it out when the deployment's own `branding.defaultTheme` should decide.
51
+
41
52
  ## Server-rendered apps
42
53
 
43
54
  Importing the package is safe anywhere, but `mount()` needs a real DOM: it attaches a shadow root to the element you give it. In Next.js, Remix or Astro, call it from an effect (client-side only):