diff --git a/CLAUDE.md b/CLAUDE.md index 3e6cb5f7..a6e381a5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -124,7 +124,7 @@ Rules if you find yourself adding a third: - `shinyreact.set_react_page(path=None)` — Express helper; with no args serves `www/index.html` when present, else discovers `www/ui.js` / `www/ui.css` and emits no body HTML. Auto-discovers `HTMLDependency` objects from traditional Shiny renderers and injects the shinyreact dep. `page_opts()` options reach the page (`page_auto()` splats them into our `page_fn`): the no-HTML-file mode honors `title` / `lang` / `theme`; anything else, and any option at all in HTML-file mode, raises a `TypeError` naming it - `shinyreact.page_react(*args, src_dir=None, js_file="ui.js", css_file="ui.css", title=None, lang="en", **kwargs)` — Core-mode zero-config page: discovers `www/ui.js` / `www/ui.css` next to the calling module, serves them as an mtime-versioned dependency (cache-busted), title defaults to the app folder name; the client appends its own mount container to `` - `shinyreact.ReactApp(server, *, ui=None, static_assets=MISSING, bookmark_store="disable", **kwargs)` — `shiny.App` for the ui.tsx pattern with the UI discovered next to the calling module: `www/index.html` present → `page_react_html()`, else → `page_react()`. The discovered UI is a per-request function, so bookmark restore works with no wiring (`ReactApp(server, bookmark_store="url")`); `ui=page_react_html(...)` + a bookmark store raises, since one already-built document can't restore. The React asset dir is mounted at `/`, and a passed `static_assets` mapping is **merged with** that mount rather than replacing it — the author wins only on collision (`"/"` key, a bare path, or `None` for nothing). `static_assets` defaults to `MISSING`, not `None`, so `None` can mean "mount nothing". `ui=` overrides discovery (a `page_react_html()` document still gets its dir mounted); discovery reads the *immediate* calling frame, so helpers wrapping `ReactApp(...)` must pass `ui=` -- `shinyreact.page_react_html(path="www/index.html")` — Core-mode helper for apps that own a complete HTML document containing `` (py-shiny's `ui.page_html()` default `deps_replace_pattern=`); Shiny's and shinyreact's tags render in its place. Rarely called directly — `ReactApp` discovers it (plain `shiny.App` works too via `ui.page_html()`, consumed as a git dep on py-shiny `main` until py-shiny#2475 releases — issue #216). Does not auto-discover renderer dependencies +- `shinyreact.page_react_html(path="www/index.html")` — Core-mode helper for apps that own a complete HTML document containing `` (py-shiny's `ui.page_html()` default `deps_replace_pattern=`); Shiny's and shinyreact's tags render in its place. Rarely called directly — `ReactApp` discovers it (plain `shiny.App` works too via `ui.page_html()`, which needs `shiny>=1.8.0`). Does not auto-discover renderer dependencies - `shinyreact.page_bare(*args, title=None, lang="en", **kwargs)` / `shinyreact.page_react_dep(*, src_dir=None, js_file="ui.js", css_file="ui.css", name=None)` — escape-hatch page builder and app-bundle `HTMLDependency` helper. Neither takes `theme=` or `version=`: styling belongs to the React client, not Bootstrap, and a package needing a fixed version builds its own `HTMLDependency`. `**kwargs` / R's `...` still reach `page_bootstrap()` / `bootstrapPage()`. With no `theme`, `page_bare()` (and so `page_react()`) attaches **no Bootstrap** — jQuery, Shiny's own JS/CSS, and a viewport meta tag, nothing else (#285). Passing a theme restores the plain passthrough - Bookmark restore + protocol handshake: page entry points emit a `