@the-portland-company/shell 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-05-12
4
+
5
+ Initial public release.
6
+
7
+ ### Added
8
+ - `ShellProvider`, `useShellAuth`, `useAppRegistry`, `useCurrentApp`
9
+ - `AppLayout` with optional slot props (`headerExtrasSlot`, `modalsSlot`, `notificationsSlot`, `sidebarFooterSlot`, `overlaySlot`)
10
+ - `Header`, `Sidebar`, `Footer` chrome primitives
11
+ - Pure layout components: `Card`, `PageContainer`, `PageHeader`, `BreadcrumbBar`, `HeaderTabBar`, `GlobalUiIdProvider`
12
+ - `politogyTheme` (Chakra theme)
13
+ - `registerShellPrecache()` and bundled service worker (exported at `@the-portland-company/shell/sw`)
14
+ - `buildSpeculationRules()` for cross-app prerendering
15
+ - View transitions CSS at `@the-portland-company/shell/css`
16
+ - Public TypeScript types: `ShellUser`, `ShellAuthStatus`, `AppRegistryEntry`, `ShellSlots`, `ShellProviderProps`, `ShellAuthValue`, `HeaderTabBarItem`
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # @the-portland-company/shell
2
+
3
+ Shared chrome for politogy apps. One install, one wrapper, identical look.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ npm install @the-portland-company/shell @chakra-ui/react @emotion/react @emotion/styled @supabase/supabase-js react react-dom
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```tsx
14
+ import { ShellProvider, AppLayout, registerShellPrecache } from '@the-portland-company/shell'
15
+ import '@the-portland-company/shell/css'
16
+
17
+ registerShellPrecache().catch(() => {})
18
+
19
+ const APPS = [
20
+ { id: 'crm', label: 'CRM', path: '/' },
21
+ { id: 'messaging', label: 'Messaging', path: '/messaging' },
22
+ ]
23
+
24
+ export default function App() {
25
+ return (
26
+ <ShellProvider currentApp="crm" supabaseClient={supabase} appRegistry={APPS}>
27
+ <AppLayout>{/* your routes */}</AppLayout>
28
+ </ShellProvider>
29
+ )
30
+ }
31
+ ```
32
+
33
+ ## Slot props on `<AppLayout>`
34
+
35
+ | Prop | Position | Use for |
36
+ |---|---|---|
37
+ | `headerExtrasSlot` | Right of header, before user menu | App-specific header widgets |
38
+ | `modalsSlot` | Above main content, position absolute | Modal dialogs |
39
+ | `notificationsSlot` | Inside main, top-right | Toasts, badges |
40
+ | `sidebarFooterSlot` | Bottom of sidebar | Org switcher, status |
41
+ | `overlaySlot` | Top of everything | Always-on-top indicators |
42
+
43
+ ## Service worker
44
+
45
+ The package ships a precache SW. Copy it into your `public/` dir during postinstall:
46
+
47
+ ```js
48
+ // scripts/copy-shell-sw.mjs
49
+ import { copyFile } from 'node:fs/promises'
50
+ await copyFile(
51
+ 'node_modules/@the-portland-company/shell/dist/shell-precache.worker.js',
52
+ 'public/sw-shell.js',
53
+ )
54
+ ```
55
+
56
+ Then call `registerShellPrecache()` at the top of your app.
57
+
58
+ ## Speculation Rules
59
+
60
+ Emit cross-app prerendering hints:
61
+
62
+ ```tsx
63
+ import { useAppRegistry, useCurrentApp, buildSpeculationRules } from '@the-portland-company/shell'
64
+
65
+ function SpeculationRules() {
66
+ const registry = useAppRegistry()
67
+ const current = useCurrentApp()
68
+ const json = buildSpeculationRules(current, registry)
69
+ if (!json) return null
70
+ return <script type="speculationrules" dangerouslySetInnerHTML={{ __html: json }} />
71
+ }
72
+ ```