@the-portland-company/shell 0.2.0 → 0.2.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
4
|
import { User, Session, SupabaseClient } from '@supabase/supabase-js';
|
|
4
5
|
|
|
@@ -198,6 +199,14 @@ interface ShellSupportValue {
|
|
|
198
199
|
}) => Promise<void>;
|
|
199
200
|
}
|
|
200
201
|
|
|
202
|
+
declare const ShellOrgContext: react.Context<ShellOrganizationValue | null>;
|
|
203
|
+
declare const ShellLinkedAccountsContext: react.Context<ShellLinkedAccountsValue | null>;
|
|
204
|
+
declare const ShellSupportProviderContext: react.Context<ShellSupportValue | null>;
|
|
205
|
+
interface ShellChromeValue$1 {
|
|
206
|
+
devNotesMenu: ReactNode | null;
|
|
207
|
+
myProfileHref: string;
|
|
208
|
+
}
|
|
209
|
+
declare const ShellChromeContext: react.Context<ShellChromeValue$1 | null>;
|
|
201
210
|
declare function ShellProvider({ children, supabaseClient, currentApp, appRegistry, basename, organization, linkedAccounts, support, devNotesMenu, myProfileHref, }: ShellProviderProps): react_jsx_runtime.JSX.Element;
|
|
202
211
|
|
|
203
212
|
declare function useShellAuth(): ShellAuthValue;
|
|
@@ -278,6 +287,33 @@ declare function OrgSelector(): react_jsx_runtime.JSX.Element | null;
|
|
|
278
287
|
*/
|
|
279
288
|
declare function SupportRequestButton(): react_jsx_runtime.JSX.Element | null;
|
|
280
289
|
|
|
290
|
+
interface ShellChromeProps {
|
|
291
|
+
children: ReactNode;
|
|
292
|
+
/** Drives <OrgSelector /> in the header. */
|
|
293
|
+
organization?: ShellOrganizationValue | null;
|
|
294
|
+
/** Drives the UserMenu Switch-account section. */
|
|
295
|
+
linkedAccounts?: ShellLinkedAccountsValue | null;
|
|
296
|
+
/** Drives <SupportRequestButton /> and modal submission. */
|
|
297
|
+
support?: ShellSupportValue | null;
|
|
298
|
+
/** Rendered in the header (typically <DevNotesMenu />). */
|
|
299
|
+
devNotesMenu?: ReactNode;
|
|
300
|
+
/** UserMenu profile link target. Defaults to '/my-profile'. */
|
|
301
|
+
myProfileHref?: string;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Drop-in chrome binding for apps where the org/linked-account/support data
|
|
305
|
+
* lives in React contexts nested BELOW <ShellProvider> (e.g., an
|
|
306
|
+
* <OrganizationProvider> that itself depends on <AuthProvider>).
|
|
307
|
+
*
|
|
308
|
+
* Use this component inside those providers to feed the values into the
|
|
309
|
+
* shell's chrome contexts. Nested <Context.Provider> overrides the empty
|
|
310
|
+
* defaults set by <ShellProvider> at the top of the tree.
|
|
311
|
+
*
|
|
312
|
+
* Apps that have all the data available at the ShellProvider construction
|
|
313
|
+
* site can pass the same props to <ShellProvider> directly instead.
|
|
314
|
+
*/
|
|
315
|
+
declare function ShellChrome({ children, organization, linkedAccounts, support, devNotesMenu, myProfileHref, }: ShellChromeProps): react_jsx_runtime.JSX.Element;
|
|
316
|
+
|
|
281
317
|
interface RegisterShellPrecacheOptions {
|
|
282
318
|
/** Path the host app serves the SW from. Default: '/sw-shell.js'. */
|
|
283
319
|
scriptUrl?: string;
|
|
@@ -304,4 +340,4 @@ declare function registerShellPrecache(opts?: RegisterShellPrecacheOptions): Pro
|
|
|
304
340
|
*/
|
|
305
341
|
declare function buildSpeculationRules(currentApp: string, registry: AppRegistryEntry[]): string | null;
|
|
306
342
|
|
|
307
|
-
export { AppLayout, type AppRegistryEntry, BreadcrumbBar, Card, Footer, GlobalUiIdProvider, Header, HeaderTabBar, type HeaderTabBarItem, OrgSelector, PageContainer, PageHeader, type ShellAuthStatus, type ShellAuthValue, type ShellLinkedAccount, type ShellLinkedAccountsValue, type ShellOrganization, type ShellOrganizationValue, ShellProvider, type ShellProviderProps, type ShellSlots, type ShellSupportContext, type ShellSupportValue, type ShellUser, Sidebar, SupportRequestButton, UserMenu, buildSpeculationRules, politogyTheme, registerShellPrecache, useAppRegistry, useCurrentApp, useShellAuth, useShellChrome, useShellLinkedAccounts, useShellOrganization, useShellSupport };
|
|
343
|
+
export { AppLayout, type AppRegistryEntry, BreadcrumbBar, Card, Footer, GlobalUiIdProvider, Header, HeaderTabBar, type HeaderTabBarItem, OrgSelector, PageContainer, PageHeader, type ShellAuthStatus, type ShellAuthValue, ShellChrome, ShellChromeContext, type ShellChromeProps, type ShellLinkedAccount, ShellLinkedAccountsContext, type ShellLinkedAccountsValue, ShellOrgContext, type ShellOrganization, type ShellOrganizationValue, ShellProvider, type ShellProviderProps, type ShellSlots, type ShellSupportContext, ShellSupportProviderContext, type ShellSupportValue, type ShellUser, Sidebar, SupportRequestButton, UserMenu, buildSpeculationRules, politogyTheme, registerShellPrecache, useAppRegistry, useCurrentApp, useShellAuth, useShellChrome, useShellLinkedAccounts, useShellOrganization, useShellSupport };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode, CSSProperties } from 'react';
|
|
3
4
|
import { User, Session, SupabaseClient } from '@supabase/supabase-js';
|
|
4
5
|
|
|
@@ -198,6 +199,14 @@ interface ShellSupportValue {
|
|
|
198
199
|
}) => Promise<void>;
|
|
199
200
|
}
|
|
200
201
|
|
|
202
|
+
declare const ShellOrgContext: react.Context<ShellOrganizationValue | null>;
|
|
203
|
+
declare const ShellLinkedAccountsContext: react.Context<ShellLinkedAccountsValue | null>;
|
|
204
|
+
declare const ShellSupportProviderContext: react.Context<ShellSupportValue | null>;
|
|
205
|
+
interface ShellChromeValue$1 {
|
|
206
|
+
devNotesMenu: ReactNode | null;
|
|
207
|
+
myProfileHref: string;
|
|
208
|
+
}
|
|
209
|
+
declare const ShellChromeContext: react.Context<ShellChromeValue$1 | null>;
|
|
201
210
|
declare function ShellProvider({ children, supabaseClient, currentApp, appRegistry, basename, organization, linkedAccounts, support, devNotesMenu, myProfileHref, }: ShellProviderProps): react_jsx_runtime.JSX.Element;
|
|
202
211
|
|
|
203
212
|
declare function useShellAuth(): ShellAuthValue;
|
|
@@ -278,6 +287,33 @@ declare function OrgSelector(): react_jsx_runtime.JSX.Element | null;
|
|
|
278
287
|
*/
|
|
279
288
|
declare function SupportRequestButton(): react_jsx_runtime.JSX.Element | null;
|
|
280
289
|
|
|
290
|
+
interface ShellChromeProps {
|
|
291
|
+
children: ReactNode;
|
|
292
|
+
/** Drives <OrgSelector /> in the header. */
|
|
293
|
+
organization?: ShellOrganizationValue | null;
|
|
294
|
+
/** Drives the UserMenu Switch-account section. */
|
|
295
|
+
linkedAccounts?: ShellLinkedAccountsValue | null;
|
|
296
|
+
/** Drives <SupportRequestButton /> and modal submission. */
|
|
297
|
+
support?: ShellSupportValue | null;
|
|
298
|
+
/** Rendered in the header (typically <DevNotesMenu />). */
|
|
299
|
+
devNotesMenu?: ReactNode;
|
|
300
|
+
/** UserMenu profile link target. Defaults to '/my-profile'. */
|
|
301
|
+
myProfileHref?: string;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Drop-in chrome binding for apps where the org/linked-account/support data
|
|
305
|
+
* lives in React contexts nested BELOW <ShellProvider> (e.g., an
|
|
306
|
+
* <OrganizationProvider> that itself depends on <AuthProvider>).
|
|
307
|
+
*
|
|
308
|
+
* Use this component inside those providers to feed the values into the
|
|
309
|
+
* shell's chrome contexts. Nested <Context.Provider> overrides the empty
|
|
310
|
+
* defaults set by <ShellProvider> at the top of the tree.
|
|
311
|
+
*
|
|
312
|
+
* Apps that have all the data available at the ShellProvider construction
|
|
313
|
+
* site can pass the same props to <ShellProvider> directly instead.
|
|
314
|
+
*/
|
|
315
|
+
declare function ShellChrome({ children, organization, linkedAccounts, support, devNotesMenu, myProfileHref, }: ShellChromeProps): react_jsx_runtime.JSX.Element;
|
|
316
|
+
|
|
281
317
|
interface RegisterShellPrecacheOptions {
|
|
282
318
|
/** Path the host app serves the SW from. Default: '/sw-shell.js'. */
|
|
283
319
|
scriptUrl?: string;
|
|
@@ -304,4 +340,4 @@ declare function registerShellPrecache(opts?: RegisterShellPrecacheOptions): Pro
|
|
|
304
340
|
*/
|
|
305
341
|
declare function buildSpeculationRules(currentApp: string, registry: AppRegistryEntry[]): string | null;
|
|
306
342
|
|
|
307
|
-
export { AppLayout, type AppRegistryEntry, BreadcrumbBar, Card, Footer, GlobalUiIdProvider, Header, HeaderTabBar, type HeaderTabBarItem, OrgSelector, PageContainer, PageHeader, type ShellAuthStatus, type ShellAuthValue, type ShellLinkedAccount, type ShellLinkedAccountsValue, type ShellOrganization, type ShellOrganizationValue, ShellProvider, type ShellProviderProps, type ShellSlots, type ShellSupportContext, type ShellSupportValue, type ShellUser, Sidebar, SupportRequestButton, UserMenu, buildSpeculationRules, politogyTheme, registerShellPrecache, useAppRegistry, useCurrentApp, useShellAuth, useShellChrome, useShellLinkedAccounts, useShellOrganization, useShellSupport };
|
|
343
|
+
export { AppLayout, type AppRegistryEntry, BreadcrumbBar, Card, Footer, GlobalUiIdProvider, Header, HeaderTabBar, type HeaderTabBarItem, OrgSelector, PageContainer, PageHeader, type ShellAuthStatus, type ShellAuthValue, ShellChrome, ShellChromeContext, type ShellChromeProps, type ShellLinkedAccount, ShellLinkedAccountsContext, type ShellLinkedAccountsValue, ShellOrgContext, type ShellOrganization, type ShellOrganizationValue, ShellProvider, type ShellProviderProps, type ShellSlots, type ShellSupportContext, ShellSupportProviderContext, type ShellSupportValue, type ShellUser, Sidebar, SupportRequestButton, UserMenu, buildSpeculationRules, politogyTheme, registerShellPrecache, useAppRegistry, useCurrentApp, useShellAuth, useShellChrome, useShellLinkedAccounts, useShellOrganization, useShellSupport };
|
package/dist/index.js
CHANGED
|
@@ -1776,6 +1776,23 @@ function AppLayout({
|
|
|
1776
1776
|
overlaySlot
|
|
1777
1777
|
] });
|
|
1778
1778
|
}
|
|
1779
|
+
function ShellChrome({
|
|
1780
|
+
children,
|
|
1781
|
+
organization,
|
|
1782
|
+
linkedAccounts,
|
|
1783
|
+
support,
|
|
1784
|
+
devNotesMenu,
|
|
1785
|
+
myProfileHref
|
|
1786
|
+
}) {
|
|
1787
|
+
const chrome = useMemo(
|
|
1788
|
+
() => ({
|
|
1789
|
+
devNotesMenu: devNotesMenu ?? null,
|
|
1790
|
+
myProfileHref: myProfileHref ?? "/my-profile"
|
|
1791
|
+
}),
|
|
1792
|
+
[devNotesMenu, myProfileHref]
|
|
1793
|
+
);
|
|
1794
|
+
return /* @__PURE__ */ jsx(ShellOrgContext.Provider, { value: organization ?? null, children: /* @__PURE__ */ jsx(ShellLinkedAccountsContext.Provider, { value: linkedAccounts ?? null, children: /* @__PURE__ */ jsx(ShellSupportProviderContext.Provider, { value: support ?? null, children: /* @__PURE__ */ jsx(ShellChromeContext.Provider, { value: chrome, children }) }) }) });
|
|
1795
|
+
}
|
|
1779
1796
|
|
|
1780
1797
|
// src/sw/registerShellPrecache.ts
|
|
1781
1798
|
async function registerShellPrecache(opts = {}) {
|
|
@@ -1807,6 +1824,6 @@ function buildSpeculationRules(currentApp, registry) {
|
|
|
1807
1824
|
return JSON.stringify(payload);
|
|
1808
1825
|
}
|
|
1809
1826
|
|
|
1810
|
-
export { AppLayout, BreadcrumbBar, Card, Footer, GlobalUiIdProvider, Header, HeaderTabBar, OrgSelector, PageContainer, PageHeader, ShellProvider, Sidebar, SupportRequestButton, UserMenu, buildSpeculationRules, politogyTheme, registerShellPrecache, useAppRegistry, useCurrentApp, useShellAuth, useShellChrome, useShellLinkedAccounts, useShellOrganization, useShellSupport };
|
|
1827
|
+
export { AppLayout, BreadcrumbBar, Card, Footer, GlobalUiIdProvider, Header, HeaderTabBar, OrgSelector, PageContainer, PageHeader, ShellChrome, ShellChromeContext, ShellLinkedAccountsContext, ShellOrgContext, ShellProvider, ShellSupportProviderContext, Sidebar, SupportRequestButton, UserMenu, buildSpeculationRules, politogyTheme, registerShellPrecache, useAppRegistry, useCurrentApp, useShellAuth, useShellChrome, useShellLinkedAccounts, useShellOrganization, useShellSupport };
|
|
1811
1828
|
//# sourceMappingURL=index.js.map
|
|
1812
1829
|
//# sourceMappingURL=index.js.map
|