@jpmorganchase/mosaic-store 0.1.0-beta.8 → 0.1.0-beta.81
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 +4 -2
- package/dist/chunk-2LDP6ZYH.js +1 -0
- package/dist/chunk-2NGTHKWE.js +1 -0
- package/dist/chunk-D3E7HZ32.js +1 -0
- package/dist/chunk-EDMM5TSL.js +1 -0
- package/dist/chunk-EOCK5YS5.js +1 -0
- package/dist/chunk-GNWK3KEN.js +1 -0
- package/dist/chunk-IS7TJ54I.js +0 -0
- package/dist/chunk-JDX7D2AR.js +1 -0
- package/dist/chunk-KAG3ZTOY.js +1 -0
- package/dist/chunk-LAADEEXW.js +0 -0
- package/dist/chunk-SHXJLVWX.js +1 -0
- package/dist/chunk-UWY445ZF.js +1 -0
- package/dist/chunk-X5BH4J65.js +1 -0
- package/dist/chunk-YOBGV3ZW.js +1 -0
- package/dist/chunk-ZIZ7BMWA.js +1 -0
- package/dist/chunk-ZMWHBFUG.js +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/store.d.ts +33 -4
- package/dist/store.js +1 -1
- package/dist/types/appHeader.d.ts +8 -1
- package/dist/types/appHeader.js +1 -1
- package/dist/types/breadcrumbs.js +1 -1
- package/dist/types/colorMode.d.ts +3 -0
- package/dist/types/colorMode.js +1 -0
- package/dist/types/footer.js +1 -1
- package/dist/types/helpLinks.js +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -1
- package/dist/types/layout.js +1 -1
- package/dist/types/meta.js +1 -1
- package/dist/types/navigation.d.ts +23 -0
- package/dist/types/navigation.js +1 -0
- package/dist/types/route.js +1 -1
- package/dist/types/searchIndex.d.ts +22 -0
- package/dist/types/searchIndex.js +1 -0
- package/dist/types/sharedConfig.d.ts +2 -3
- package/dist/types/sharedConfig.js +1 -1
- package/dist/types/sidebar.d.ts +17 -2
- package/dist/types/sidebar.js +1 -1
- package/dist/types/tableOfContents.js +1 -1
- package/dist/useAppHeader.d.ts +1 -4
- package/dist/useAppHeader.js +1 -1
- package/dist/useBreadcrumbs.js +1 -1
- package/dist/useColorMode.d.ts +2 -0
- package/dist/useColorMode.js +1 -0
- package/dist/useFooter.js +1 -1
- package/dist/useLayout.js +1 -1
- package/dist/useMeta.js +1 -1
- package/dist/useNavigation.d.ts +2 -0
- package/dist/useNavigation.js +1 -0
- package/dist/useRoute.js +1 -1
- package/dist/useSearchIndex.d.ts +6 -0
- package/dist/useSearchIndex.js +1 -0
- package/dist/useSidebar.d.ts +2 -2
- package/dist/useSidebar.js +1 -1
- package/dist/useStoreActions.d.ts +3 -0
- package/dist/useStoreActions.js +1 -0
- package/dist/useTableOfContents.d.ts +0 -1
- package/dist/useTableOfContents.js +1 -1
- package/package.json +27 -12
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -7
- package/dist/chunk-5TAZCOCH.js +0 -1
- package/dist/chunk-AA7IK7Y5.js +0 -1
- package/dist/chunk-C62PIKZ5.js +0 -1
- package/dist/chunk-DGGPN6YK.js +0 -1
- package/dist/chunk-HUM6DWGV.js +0 -1
- package/dist/chunk-LYZGAQ5N.js +0 -1
- package/dist/chunk-OHN6TEOW.js +0 -1
- package/dist/chunk-PN7DOU52.js +0 -1
- package/dist/chunk-SD2G45FB.js +0 -1
- package/dist/chunk-TEDOG7PC.js +0 -1
- package/dist/chunk-UMYWSM5J.js +0 -1
- package/dist/useNextPrev.d.ts +0 -4
- package/dist/useNextPrev.js +0 -1
- package/src/__tests__/store.test.ts +0 -126
- package/src/__tests__/test-utils/utils.tsx +0 -25
- package/src/__tests__/useAppHeader.test.ts +0 -182
- package/src/__tests__/useBreadcrumbs.test.ts +0 -42
- package/src/__tests__/useFooter.test.ts +0 -64
- package/src/__tests__/useLayout.test.ts +0 -24
- package/src/__tests__/useMeta.test.ts +0 -35
- package/src/__tests__/useRoute.test.ts +0 -24
- package/src/__tests__/useTableOfContents.test.ts +0 -31
- package/src/index.ts +0 -13
- package/src/store.ts +0 -105
- package/src/types/appHeader.ts +0 -72
- package/src/types/breadcrumbs.ts +0 -21
- package/src/types/footer.ts +0 -17
- package/src/types/helpLinks.ts +0 -13
- package/src/types/index.ts +0 -10
- package/src/types/layout.ts +0 -7
- package/src/types/meta.ts +0 -13
- package/src/types/route.ts +0 -7
- package/src/types/sharedConfig.ts +0 -16
- package/src/types/sidebar.ts +0 -22
- package/src/types/tableOfContents.ts +0 -19
- package/src/useAppHeader.ts +0 -64
- package/src/useBreadcrumbs.ts +0 -11
- package/src/useFooter.ts +0 -10
- package/src/useLayout.ts +0 -9
- package/src/useMeta.ts +0 -17
- package/src/useNextPrev.ts +0 -43
- package/src/useRoute.ts +0 -9
- package/src/useSidebar.ts +0 -16
- package/src/useTableOfContents.ts +0 -10
- package/tsconfig.json +0 -9
- /package/dist/{chunk-ASPK4M5R.js → chunk-BHW7CEID.js} +0 -0
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# Mosaic Site Store
|
|
2
2
|
|
|
3
|
-
`@
|
|
3
|
+
`@jpmorganchase/mosaic-store` an extendable API for accessing Mosaic state and props.
|
|
4
4
|
|
|
5
5
|
The Mosaic store is based on [Zustand](https://zustand-demo.pmnd.rs/).
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
`yarn add @
|
|
9
|
+
`yarn add @jpmorganchase/mosaic-store`
|
|
10
|
+
|
|
11
|
+
The Redux DevTools chrome extension can be used to view the contents of the store if required.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as o}from"./chunk-UWY445ZF.js";function d(){return o(r=>r.colorMode)}export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e}from"./chunk-UWY445ZF.js";function u(){return{route:e(t=>t.route)}}export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as c}from"./chunk-UWY445ZF.js";function t(){let e=c(r=>r.searchIndex),o=c(r=>r.searchConfig),n=o!==void 0&&e!==void 0&&e.length>0;return{searchEnabled:n,searchIndex:n?e:[],searchConfig:n?o:{}}}export{t as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-UWY445ZF.js";function s(){return{tableOfContents:t(e=>e.tableOfContents)||[]}}export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as o}from"./chunk-UWY445ZF.js";function f(){return o(e=>e.sharedConfig?.footer)}export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e}from"./chunk-UWY445ZF.js";function m(t=1){let r=e(b=>b.breadcrumbs);return{breadcrumbs:r||[],enabled:r?.length>t}}export{m as a};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-UWY445ZF.js";function r(){let{next:o,prev:i}=t(n=>n.navigation)||{};return{next:o,prev:i}}export{r as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-UWY445ZF.js";function e(){return{layout:t(o=>o.layout)}}export{e as a};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-UWY445ZF.js";function u(e){return e.links!==void 0}function d(e){return e.link!==void 0}function M(){let e=t(n=>n.sharedConfig?.header);if(!e)return;let i=e.menu.reduce((n,p)=>{if(u(p)){let r={...p,type:"menu"};return[...n,r]}if(d(p)){let r={...p,type:"link"};return[...n,r]}return console.error("Unknown menu type passed to useAppHeader, ignoring",p),n},[]);return{...e,menu:i}}export{M as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useLayoutEffect as l,createContext as f,useContext as p}from"react";import{createStore as u,useStore as m}from"zustand";import{devtools as y,persist as C}from"zustand/middleware";var r;function n(){return{breadcrumbs:[],sidebarData:[],tableOfContents:[],navigation:{},searchIndex:[],searchConfig:{},sharedConfig:{},description:void 0,layout:void 0,route:void 0,title:void 0,colorMode:"light"}}var s=f(void 0),P=s.Provider,g=e=>y(C(e,{name:"mosaic-theme-pref",partialize:t=>({colorMode:t.colorMode})})),a=(e={})=>u(g(o=>({...n(),...e,actions:{setColorMode:i=>o({colorMode:i})}})));function T(e,t=!1){if(typeof window>"u"||t)return()=>a(e);let o=Boolean(r);return r=r??a(e),l(()=>{if(e&&o){let i={...n(),...e},{colorMode:S,actions:d,...c}=r.getState();r.setState({...c,...i,colorMode:S,actions:d},!0)}}),()=>r}function v(e,t){let o=p(s);if(!o)throw new Error("Missing StoreProvider in the tree");return m(o,e,t)}export{P as a,a as b,T as c,v as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as o}from"./chunk-UWY445ZF.js";var r=()=>o(t=>t.actions);export{r as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"./chunk-2NGTHKWE.js";import{a as u}from"./chunk-GNWK3KEN.js";import{d as s}from"./chunk-UWY445ZF.js";function p(){let e=s(o=>o.sidebarData)||[],{route:r}=c(),{breadcrumbs:t}=u();return{menu:e,selectedNodeId:r,selectedGroupIds:d(t)}}function d(e){let r=e.reduce((t,{id:o})=>[...t,o.replace(/\/[^\/]*$/,"")],[]);return new Set(r)}export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./chunk-UWY445ZF.js";function o(){return{meta:t(e=>({description:e.description,breadcrumbs:e.breadcrumbs,title:e.title}))}}export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=(e=>(e.MENU="menu",e.LINK="link",e))(t||{});export{t as a};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export * from './store';
|
|
2
2
|
export * from './useAppHeader';
|
|
3
3
|
export * from './useBreadcrumbs';
|
|
4
|
+
export * from './useColorMode';
|
|
4
5
|
export * from './useLayout';
|
|
5
6
|
export * from './useMeta';
|
|
6
|
-
export * from './
|
|
7
|
+
export * from './useNavigation';
|
|
7
8
|
export * from './useRoute';
|
|
9
|
+
export * from './useSearchIndex';
|
|
8
10
|
export * from './useSidebar';
|
|
9
11
|
export * from './useTableOfContents';
|
|
10
12
|
export * from './useFooter';
|
|
13
|
+
export * from './useStoreActions';
|
|
11
14
|
export * from './types';
|
|
12
|
-
export { MenuItemType } from './types';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as c}from"./chunk-JDX7D2AR.js";import{a as g}from"./chunk-D3E7HZ32.js";import{a as h}from"./chunk-YOBGV3ZW.js";import{a as d}from"./chunk-2NGTHKWE.js";import{a as k}from"./chunk-X5BH4J65.js";import{a as i}from"./chunk-EDMM5TSL.js";import{a as p}from"./chunk-SHXJLVWX.js";import"./chunk-BHW7CEID.js";import"./chunk-IS7TJ54I.js";import"./chunk-5L7EI47O.js";import"./chunk-MBLLQB7A.js";import"./chunk-ZJYDN5YH.js";import"./chunk-UK5NIPTI.js";import"./chunk-ZYJGHEAC.js";import"./chunk-BZYGOU7Y.js";import"./chunk-UGD4MMRB.js";import"./chunk-LAADEEXW.js";import"./chunk-BHMVW2ZZ.js";import{a as m}from"./chunk-ZMWHBFUG.js";import"./chunk-VXYECVIB.js";import{a as t}from"./chunk-GNWK3KEN.js";import{a as x}from"./chunk-2LDP6ZYH.js";import{a as j}from"./chunk-EOCK5YS5.js";import{a}from"./chunk-KAG3ZTOY.js";import{a as b}from"./chunk-ZIZ7BMWA.js";import{a as o,b as r,c as e,d as f}from"./chunk-UWY445ZF.js";export{m as MenuItemType,o as StoreProvider,r as initializeStore,p as useAppHeader,t as useBreadcrumbs,x as useColorMode,e as useCreateStore,j as useFooter,a as useLayout,b as useMeta,c as useNavigation,d as useRoute,g as useSearchIndex,h as useSidebar,f as useStore,k as useStoreActions,i as useTableOfContents};
|
package/dist/store.d.ts
CHANGED
|
@@ -1,28 +1,57 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { StoreApi } from 'zustand';
|
|
2
3
|
import type { BreadcrumbsSlice } from './types/breadcrumbs';
|
|
4
|
+
import type { SearchIndexSlice } from './types/searchIndex';
|
|
3
5
|
import type { SharedConfigSlice } from './types/sharedConfig';
|
|
4
6
|
import type { LayoutSlice } from './types/layout';
|
|
7
|
+
import type { NavigationSlice } from './types/navigation';
|
|
5
8
|
import type { SidebarSlice } from './types/sidebar';
|
|
6
9
|
import type { TableOfContentsSlice } from './types/tableOfContents';
|
|
7
|
-
|
|
10
|
+
import type { ColorMode } from './types/colorMode';
|
|
11
|
+
export declare type SiteState = BreadcrumbsSlice & LayoutSlice & SidebarSlice & TableOfContentsSlice & NavigationSlice & SearchIndexSlice & SharedConfigSlice & {
|
|
8
12
|
/** Page metadata description, used by search */
|
|
9
13
|
description?: string;
|
|
10
14
|
/** Page route */
|
|
11
15
|
route?: string;
|
|
12
16
|
/** Page title */
|
|
13
17
|
title?: string;
|
|
18
|
+
colorMode: ColorMode;
|
|
19
|
+
actions: {
|
|
20
|
+
setColorMode: (colorMode: ColorMode) => void;
|
|
21
|
+
};
|
|
14
22
|
};
|
|
23
|
+
declare type PeristedStoreState = Pick<SiteState, 'colorMode'>;
|
|
15
24
|
declare const StoreProvider: import("react").Provider<StoreApi<SiteState> | undefined>;
|
|
16
|
-
declare const initializeStore: (preloadedState?: Partial<SiteState>) => Omit<StoreApi<SiteState>, "setState"> & {
|
|
25
|
+
declare const initializeStore: (preloadedState?: Partial<SiteState>) => Omit<Omit<StoreApi<SiteState>, "setState"> & {
|
|
17
26
|
setState<A extends string | {
|
|
18
27
|
type: unknown;
|
|
19
28
|
}>(partial: SiteState | Partial<SiteState> | ((state: SiteState) => SiteState | Partial<SiteState>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
29
|
+
}, "persist"> & {
|
|
30
|
+
persist: {
|
|
31
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SiteState, PeristedStoreState>>) => void;
|
|
32
|
+
clearStorage: () => void;
|
|
33
|
+
rehydrate: () => void | Promise<void>;
|
|
34
|
+
hasHydrated: () => boolean;
|
|
35
|
+
onHydrate: (fn: (state: SiteState) => void) => () => void;
|
|
36
|
+
onFinishHydration: (fn: (state: SiteState) => void) => () => void;
|
|
37
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SiteState, PeristedStoreState>>;
|
|
38
|
+
};
|
|
20
39
|
};
|
|
21
|
-
declare function useCreateStore(serverInitialState: Partial<SiteState>, isSSR?: boolean): () => Omit<StoreApi<SiteState>, "setState"> & {
|
|
40
|
+
declare function useCreateStore(serverInitialState: Partial<SiteState>, isSSR?: boolean): (() => Omit<Omit<StoreApi<SiteState>, "setState"> & {
|
|
22
41
|
setState<A extends string | {
|
|
23
42
|
type: unknown;
|
|
24
43
|
}>(partial: SiteState | Partial<SiteState> | ((state: SiteState) => SiteState | Partial<SiteState>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
25
|
-
}
|
|
44
|
+
}, "persist"> & {
|
|
45
|
+
persist: {
|
|
46
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<SiteState, PeristedStoreState>>) => void;
|
|
47
|
+
clearStorage: () => void;
|
|
48
|
+
rehydrate: () => void | Promise<void>;
|
|
49
|
+
hasHydrated: () => boolean;
|
|
50
|
+
onHydrate: (fn: (state: SiteState) => void) => () => void;
|
|
51
|
+
onFinishHydration: (fn: (state: SiteState) => void) => () => void;
|
|
52
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<SiteState, PeristedStoreState>>;
|
|
53
|
+
};
|
|
54
|
+
}) | (() => StoreApi<SiteState>);
|
|
26
55
|
/**
|
|
27
56
|
* Hook providing access to state stored in the site store
|
|
28
57
|
*/
|
package/dist/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-UWY445ZF.js";export{a as StoreProvider,b as initializeStore,c as useCreateStore,d as useStore};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SearchIndexSlice } from './searchIndex';
|
|
1
2
|
/**
|
|
2
3
|
* [[`MenuItemType`]] defines the type of App header Menu items
|
|
3
4
|
*/
|
|
@@ -15,8 +16,10 @@ export declare type Menu = MenuLinksItem | MenuLinkItem;
|
|
|
15
16
|
export interface MenuLinksItem {
|
|
16
17
|
/** Collection of link options */
|
|
17
18
|
links: MenuLinkItem[];
|
|
18
|
-
/** Title of
|
|
19
|
+
/** Title of MenuLinksItem */
|
|
19
20
|
title: string;
|
|
21
|
+
/** Type of MenuLinksItem */
|
|
22
|
+
type: MenuItemType.MENU;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
25
|
* [[`MenuLinksItem`]] defines a menu of links and includes a type
|
|
@@ -37,6 +40,8 @@ export interface MenuLinkItem {
|
|
|
37
40
|
link: string;
|
|
38
41
|
/** Title of Tab */
|
|
39
42
|
title?: string;
|
|
43
|
+
/** Type of MenuLinkItem */
|
|
44
|
+
type: MenuItemType.LINK;
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
47
|
* [[`MenuLinkItem`]] define a menu link and include a type
|
|
@@ -63,4 +68,6 @@ export declare type AppHeaderSlice = {
|
|
|
63
68
|
menu: Menu[];
|
|
64
69
|
/** Search namespace, suffix used on env variable `process.env.SEARCH_ENDPOINT` to filter search results to a specific namespace. */
|
|
65
70
|
searchNamespace?: string;
|
|
71
|
+
/** Search index, created by SearchIndexPlugin */
|
|
72
|
+
searchIndex?: SearchIndexSlice;
|
|
66
73
|
};
|
package/dist/types/appHeader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-ZMWHBFUG.js";export{a as MenuItemType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-VXYECVIB.js";
|
|
1
|
+
import"../chunk-VXYECVIB.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o="light",e="dark";export{e as darkMode,o as lightMode};
|
package/dist/types/footer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-UK5NIPTI.js";
|
|
1
|
+
import"../chunk-UK5NIPTI.js";
|
package/dist/types/helpLinks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-ZYJGHEAC.js";
|
|
1
|
+
import"../chunk-ZYJGHEAC.js";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export * from './footer';
|
|
|
4
4
|
export * from './helpLinks';
|
|
5
5
|
export * from './layout';
|
|
6
6
|
export * from './meta';
|
|
7
|
+
export * from './navigation';
|
|
7
8
|
export * from './route';
|
|
9
|
+
export * from './searchIndex';
|
|
8
10
|
export * from './sharedConfig';
|
|
9
11
|
export * from './sidebar';
|
|
10
12
|
export * from './tableOfContents';
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-
|
|
1
|
+
import"../chunk-BHW7CEID.js";import"../chunk-IS7TJ54I.js";import"../chunk-5L7EI47O.js";import"../chunk-MBLLQB7A.js";import"../chunk-ZJYDN5YH.js";import"../chunk-UK5NIPTI.js";import"../chunk-ZYJGHEAC.js";import"../chunk-BZYGOU7Y.js";import"../chunk-UGD4MMRB.js";import"../chunk-LAADEEXW.js";import"../chunk-BHMVW2ZZ.js";import{a}from"../chunk-ZMWHBFUG.js";import"../chunk-VXYECVIB.js";export{a as MenuItemType};
|
package/dist/types/layout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-BZYGOU7Y.js";
|
|
1
|
+
import"../chunk-BZYGOU7Y.js";
|
package/dist/types/meta.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-UGD4MMRB.js";
|
|
1
|
+
import"../chunk-UGD4MMRB.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page within a sequence
|
|
3
|
+
*/
|
|
4
|
+
export declare type NavigationLink = {
|
|
5
|
+
/** page title */
|
|
6
|
+
title: string;
|
|
7
|
+
/** page route */
|
|
8
|
+
route: string;
|
|
9
|
+
/** parent group */
|
|
10
|
+
group?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* [[`Navigation`]] specifies page navigation such as next or previous pages
|
|
14
|
+
*/
|
|
15
|
+
export declare type Navigation = {
|
|
16
|
+
/** next page in sequence */
|
|
17
|
+
next?: NavigationLink;
|
|
18
|
+
/** previous page in sequence */
|
|
19
|
+
prev?: NavigationLink;
|
|
20
|
+
};
|
|
21
|
+
export declare type NavigationSlice = {
|
|
22
|
+
navigation?: Navigation;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunk-LAADEEXW.js";
|
package/dist/types/route.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-BHMVW2ZZ.js";
|
|
1
|
+
import"../chunk-BHMVW2ZZ.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare type SearchDataPage = {
|
|
2
|
+
title: string;
|
|
3
|
+
content: string[];
|
|
4
|
+
route: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type SearchIndex = SearchDataPage[];
|
|
7
|
+
export declare type SearchConfig = {
|
|
8
|
+
includeScore?: boolean;
|
|
9
|
+
includeMatches?: boolean;
|
|
10
|
+
maxPatternLength?: number;
|
|
11
|
+
ignoreLocation?: boolean;
|
|
12
|
+
threshold?: number;
|
|
13
|
+
keys?: string[] | {
|
|
14
|
+
name: string;
|
|
15
|
+
weight: number;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
export declare type SearchIndexSlice = {
|
|
19
|
+
searchIndex?: SearchIndex;
|
|
20
|
+
searchConfig?: SearchConfig;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunk-IS7TJ54I.js";
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { AppHeaderSlice } from './appHeader';
|
|
2
2
|
import type { FooterSlice } from './footer';
|
|
3
|
-
import type { SidebarSlice } from './sidebar';
|
|
4
3
|
export declare type SharedConfig = {
|
|
5
4
|
/** Footer props */
|
|
6
5
|
footer?: FooterSlice;
|
|
7
6
|
/** Header props */
|
|
8
7
|
header?: AppHeaderSlice;
|
|
9
8
|
/** Sidebar props */
|
|
10
|
-
sidebar?:
|
|
9
|
+
sidebar?: Pick<FooterSlice, 'helpLinks'>;
|
|
11
10
|
};
|
|
12
11
|
export declare type SharedConfigSlice = {
|
|
13
|
-
sharedConfig
|
|
12
|
+
sharedConfig?: SharedConfig;
|
|
14
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-5L7EI47O.js";
|
|
1
|
+
import"../chunk-5L7EI47O.js";
|
package/dist/types/sidebar.d.ts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface SidebarNode {
|
|
2
2
|
/** The id of the item */
|
|
3
3
|
id: string;
|
|
4
|
+
/** Node kind */
|
|
5
|
+
kind: 'data';
|
|
4
6
|
/** The name of the item */
|
|
5
7
|
name: string;
|
|
6
8
|
/** Sidebar data */
|
|
7
9
|
data: {
|
|
10
|
+
/** The level of the menu item from the sidebar root */
|
|
11
|
+
level: number;
|
|
8
12
|
/** The link of the item */
|
|
9
13
|
link: string;
|
|
10
14
|
};
|
|
15
|
+
/** Whether the item is hidden */
|
|
16
|
+
hidden: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SidebarGroup {
|
|
19
|
+
/** The id of the item */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Node kind */
|
|
22
|
+
kind: 'group';
|
|
11
23
|
/** Child nodes */
|
|
12
24
|
childNodes: SidebarItem[];
|
|
25
|
+
/** The name of the item */
|
|
26
|
+
name: string;
|
|
13
27
|
/** Whether the item is hidden */
|
|
14
28
|
hidden: boolean;
|
|
15
|
-
}
|
|
29
|
+
}
|
|
30
|
+
export declare type SidebarItem = SidebarNode | SidebarGroup;
|
|
16
31
|
/**
|
|
17
32
|
* [[`SidebarSlice`]] specifies sidebar content
|
|
18
33
|
*/
|
package/dist/types/sidebar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-MBLLQB7A.js";
|
|
1
|
+
import"../chunk-MBLLQB7A.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-ZJYDN5YH.js";
|
|
1
|
+
import"../chunk-ZJYDN5YH.js";
|
package/dist/useAppHeader.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { AppHeaderSlice, AppHeaderMenuLinkItem, AppHeaderMenuLinksItem } from './types';
|
|
2
2
|
export declare type AppHeaderMenu = Array<AppHeaderMenuLinksItem | AppHeaderMenuLinkItem>;
|
|
3
|
-
export interface AppHeader extends Omit<AppHeaderSlice, '
|
|
4
|
-
HeaderControlsProps?: {
|
|
5
|
-
searchEndpoint: string;
|
|
6
|
-
};
|
|
3
|
+
export interface AppHeader extends Omit<AppHeaderSlice, 'menu'> {
|
|
7
4
|
menu: AppHeaderMenu;
|
|
8
5
|
}
|
|
9
6
|
export declare function useAppHeader(): AppHeader | undefined;
|
package/dist/useAppHeader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-SHXJLVWX.js";import"./chunk-BHW7CEID.js";import"./chunk-IS7TJ54I.js";import"./chunk-5L7EI47O.js";import"./chunk-MBLLQB7A.js";import"./chunk-ZJYDN5YH.js";import"./chunk-UK5NIPTI.js";import"./chunk-ZYJGHEAC.js";import"./chunk-BZYGOU7Y.js";import"./chunk-UGD4MMRB.js";import"./chunk-LAADEEXW.js";import"./chunk-BHMVW2ZZ.js";import"./chunk-ZMWHBFUG.js";import"./chunk-VXYECVIB.js";import"./chunk-UWY445ZF.js";export{a as useAppHeader};
|
package/dist/useBreadcrumbs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-GNWK3KEN.js";import"./chunk-UWY445ZF.js";export{a as useBreadcrumbs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-2LDP6ZYH.js";import"./chunk-UWY445ZF.js";export{a as useColorMode};
|
package/dist/useFooter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-EOCK5YS5.js";import"./chunk-UWY445ZF.js";export{a as useFooter};
|
package/dist/useLayout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-KAG3ZTOY.js";import"./chunk-UWY445ZF.js";export{a as useLayout};
|
package/dist/useMeta.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-ZIZ7BMWA.js";import"./chunk-UWY445ZF.js";export{a as useMeta};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-JDX7D2AR.js";import"./chunk-UWY445ZF.js";export{a as useNavigation};
|
package/dist/useRoute.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-2NGTHKWE.js";import"./chunk-UWY445ZF.js";export{a as useRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-D3E7HZ32.js";import"./chunk-UWY445ZF.js";export{a as useSearchIndex};
|
package/dist/useSidebar.d.ts
CHANGED
package/dist/useSidebar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"./chunk-YOBGV3ZW.js";import"./chunk-2NGTHKWE.js";import"./chunk-GNWK3KEN.js";import"./chunk-UWY445ZF.js";export{a as useSidebar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-X5BH4J65.js";import"./chunk-UWY445ZF.js";export{a as useStoreActions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-EDMM5TSL.js";import"./chunk-UWY445ZF.js";export{a as useTableOfContents};
|
package/package.json
CHANGED
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpmorganchase/mosaic-store",
|
|
3
3
|
"description": "Mosaic - Store for site configuration",
|
|
4
|
-
"version": "0.1.0-beta.
|
|
4
|
+
"version": "0.1.0-beta.81",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git@github.com:jpmorganchase/mosaic.git",
|
|
10
|
+
"directory": "packages/store"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
5
13
|
"main": "./dist/index.js",
|
|
6
14
|
"types": "./dist/index.d.ts",
|
|
7
|
-
"
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"node": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
8
26
|
"scripts": {
|
|
9
27
|
"build": "npm-run-all --parallel build:*",
|
|
10
28
|
"build:bundle": "node ../../scripts/bundle.js",
|
|
11
29
|
"build:types": "tsc",
|
|
12
|
-
"clean": "del-cli 'dist/**' && find . -type d -empty -delete",
|
|
30
|
+
"clean": "npx del-cli 'dist/**' && find . -type d -empty -delete",
|
|
31
|
+
"lint": "eslint --ignore-pattern \"**/__tests__/**\"",
|
|
13
32
|
"dev": "node ../../scripts/bundle.js watch"
|
|
14
33
|
},
|
|
15
34
|
"devDependencies": {
|
|
35
|
+
"@testing-library/react": "^13.4.0",
|
|
16
36
|
"del-cli": "^4.0.1",
|
|
17
37
|
"typescript": "^4.8.3"
|
|
18
38
|
},
|
|
19
39
|
"dependencies": {
|
|
20
|
-
"@testing-library/react": "^12.1.5",
|
|
21
|
-
"@testing-library/react-hooks": "8.0.1",
|
|
22
|
-
"react-test-renderer": "^16.9.0",
|
|
23
40
|
"zustand": "^4.1.1"
|
|
24
41
|
},
|
|
25
42
|
"peerDependencies": {
|
|
26
|
-
"@types/react": "^
|
|
27
|
-
"react": "^
|
|
28
|
-
"react-dom": "^
|
|
29
|
-
}
|
|
30
|
-
"author": "",
|
|
31
|
-
"license": "ISC"
|
|
43
|
+
"@types/react": "^18.0.26",
|
|
44
|
+
"react": "^18.2.0",
|
|
45
|
+
"react-dom": "^18.2.0"
|
|
46
|
+
}
|
|
32
47
|
}
|
package/.turbo/turbo-build.log
DELETED
package/CHANGELOG.md
DELETED
package/dist/chunk-5TAZCOCH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty,g=Object.defineProperties;var h=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var i=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var e=(c,a,b)=>a in c?f(c,a,{enumerable:!0,configurable:!0,writable:!0,value:b}):c[a]=b,k=(c,a)=>{for(var b in a||(a={}))i.call(a,b)&&e(c,b,a[b]);if(d)for(var b of d(a))j.call(a,b)&&e(c,b,a[b]);return c},l=(c,a)=>g(c,h(a));export{k as a,l as b};
|
package/dist/chunk-AA7IK7Y5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-SD2G45FB.js";import{d}from"./chunk-TEDOG7PC.js";import{a as t,b as p}from"./chunk-5TAZCOCH.js";function a(e){return e.links!==void 0}function m(e){return e.link!==void 0}var M=e=>e?process.env[`SEARCH_ENDPOINT_${e}`]||"":process.env.SEARCH_ENDPOINT;function I(){let e=d(r=>{var n;return(n=r.sharedConfig)==null?void 0:n.header});if(!e)return;let i={};e.searchNamespace&&(i={HeaderControlsProps:{searchEndpoint:M(e.searchNamespace)}});let o=e.menu.reduce((r,n)=>{if(a(n)){let s=p(t({},n),{type:u.MENU});return[...r,s]}if(m(n)){let s=p(t({},n),{type:u.LINK});return[...r,s]}return console.error("Unknown menu type passed to useAppHeader, ignoring",n),r},[]);return p(t(t({},i),e),{menu:o})}export{I as a};
|
package/dist/chunk-C62PIKZ5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as t}from"./chunk-TEDOG7PC.js";function i(){return{meta:t(e=>({description:e.description,breadcrumbs:e.breadcrumbs,title:e.title}))}}export{i as a};
|
package/dist/chunk-DGGPN6YK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as r}from"./chunk-TEDOG7PC.js";function u(t=1){let e=r(o=>o.breadcrumbs);return{breadcrumbs:e||[],enabled:(e==null?void 0:e.length)>t}}export{u as a};
|
package/dist/chunk-HUM6DWGV.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./chunk-TEDOG7PC.js";function u(){return{route:e(t=>t.route)}}export{u as a};
|
package/dist/chunk-LYZGAQ5N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as t}from"./chunk-TEDOG7PC.js";function y(){return{layout:t(o=>o.layout)}}export{y as a};
|
package/dist/chunk-OHN6TEOW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e}from"./chunk-TEDOG7PC.js";function i(){return e(t=>{var o;return(o=t.sharedConfig)==null?void 0:o.footer})}export{i as a};
|
package/dist/chunk-PN7DOU52.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as t}from"./chunk-TEDOG7PC.js";function s(){return{tableOfContents:t(e=>e.tableOfContents)||[]}}export{s as a};
|
package/dist/chunk-SD2G45FB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t;(function(e){e.MENU="menu",e.LINK="link"})(t||(t={}));export{t as a};
|
package/dist/chunk-TEDOG7PC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-5TAZCOCH.js";import{useLayoutEffect as s,createContext as S,useContext as d}from"react";import{createStore as u,useStore as f}from"zustand";import{devtools as c}from"zustand/middleware";var t;function l(){return{breadcrumbs:[],sidebarData:[],tableOfContents:[],sharedConfig:{},description:void 0,layout:void 0,route:void 0,title:void 0}}var n=S(void 0),g=n.Provider,a=(e={})=>u(c(()=>r(r({},l()),e)));function C(e,i=!1){if(typeof window=="undefined"||i)return()=>a(e);let o=Boolean(t);return t=t!=null?t:a(e),s(()=>{e&&o&&t.setState(r(r({},t.getState()),e),!0)}),()=>t}function h(e,i){let o=d(n);if(!o)throw new Error("Missing StoreProvider in the tree");return f(o,e,i)}export{g as a,a as b,C as c,h as d};
|
package/dist/chunk-UMYWSM5J.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-HUM6DWGV.js";import{a}from"./chunk-DGGPN6YK.js";import{d as s}from"./chunk-TEDOG7PC.js";function v(){let e=s(o=>o.sidebarData)||[],{route:t}=n(),{breadcrumbs:r}=a();return{sidebarData:e,selectedNodeId:t,expandedNodeIds:x(r)}}function x(e){return new Set(e.map(({id:t})=>t.substr(0,t.lastIndexOf("."))))}function C(){let e=s(u=>u.sidebarData)||[],{route:t}=n(),{next:r,prev:o}=c(e,t);return{next:r,prev:o}}var c=(e,t)=>{let r=p(e);return i(r,t)},p=e=>{let t=[];return e.forEach(r=>{t.push({link:r.data.link,text:r.name}),r.childNodes&&(t=t.concat(p(r.childNodes)))}),t},i=(e,t)=>{let r=e.map(m=>m.link).indexOf(t),{length:o}=e,u=d(r,o)?e[r+1]:null,f=l(r,o)?e[r-1]:null;return{next:u,prev:f}},d=(e,t)=>e>=0&&e<t-1,l=(e,t)=>e>0&&e<t;export{C as a,v as b};
|
package/dist/useNextPrev.d.ts
DELETED
package/dist/useNextPrev.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-UMYWSM5J.js";import"./chunk-HUM6DWGV.js";import"./chunk-PN7DOU52.js";import"./chunk-AA7IK7Y5.js";import"./chunk-ASPK4M5R.js";import"./chunk-BZYGOU7Y.js";import"./chunk-UGD4MMRB.js";import"./chunk-BHMVW2ZZ.js";import"./chunk-5L7EI47O.js";import"./chunk-MBLLQB7A.js";import"./chunk-ZJYDN5YH.js";import"./chunk-SD2G45FB.js";import"./chunk-VXYECVIB.js";import"./chunk-UK5NIPTI.js";import"./chunk-ZYJGHEAC.js";import"./chunk-DGGPN6YK.js";import"./chunk-OHN6TEOW.js";import"./chunk-LYZGAQ5N.js";import"./chunk-C62PIKZ5.js";import"./chunk-TEDOG7PC.js";import"./chunk-5TAZCOCH.js";export{a as useNextPrev};
|