@statsbygg/layout 0.0.8 → 0.0.11
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/dist/components/Breadcrumbs.d.mts +10 -0
- package/dist/components/Breadcrumbs.d.ts +10 -0
- package/dist/components/Breadcrumbs.js +5 -0
- package/dist/components/Breadcrumbs.js.map +1 -0
- package/dist/components/Breadcrumbs.mjs +5 -0
- package/dist/components/Breadcrumbs.mjs.map +1 -0
- package/dist/components/GlobalFooter.d.mts +9 -0
- package/dist/components/GlobalFooter.d.ts +9 -0
- package/dist/components/GlobalFooter.js +5 -0
- package/dist/components/GlobalFooter.js.map +1 -0
- package/dist/components/GlobalFooter.mjs +5 -0
- package/dist/components/GlobalFooter.mjs.map +1 -0
- package/dist/components/GlobalHeader.d.mts +10 -0
- package/dist/components/GlobalHeader.d.ts +10 -0
- package/dist/components/GlobalHeader.js +5 -0
- package/dist/components/GlobalHeader.js.map +1 -0
- package/dist/components/GlobalHeader.mjs +5 -0
- package/dist/components/GlobalHeader.mjs.map +1 -0
- package/dist/components/MenuButton.d.mts +9 -0
- package/dist/components/MenuButton.d.ts +9 -0
- package/dist/components/MenuButton.js +5 -0
- package/dist/components/MenuButton.js.map +1 -0
- package/dist/components/MenuButton.mjs +5 -0
- package/dist/components/MenuButton.mjs.map +1 -0
- package/dist/components/RootLayout.d.mts +11 -0
- package/dist/components/RootLayout.d.ts +11 -0
- package/dist/components/RootLayout.js +5 -0
- package/dist/components/RootLayout.js.map +1 -0
- package/dist/components/RootLayout.mjs +5 -0
- package/dist/components/RootLayout.mjs.map +1 -0
- package/dist/index.d.mts +5 -40
- package/dist/index.d.ts +5 -40
- package/dist/index.js +7 -32
- package/dist/index.js.map +1 -1
- package/dist/store/globalState.d.mts +31 -0
- package/dist/store/globalState.d.ts +31 -0
- package/dist/store/globalState.js +30 -0
- package/dist/store/globalState.js.map +1 -0
- package/dist/store/globalState.mjs +30 -0
- package/dist/store/globalState.mjs.map +1 -0
- package/package.json +24 -12
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface BreadcrumbsProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
zone: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare function SbBreadcrumbs({ className, zone }: BreadcrumbsProps): react_jsx_runtime.JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
export { SbBreadcrumbs as Breadcrumbs, type BreadcrumbsProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface BreadcrumbsProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
zone: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare function SbBreadcrumbs({ className, zone }: BreadcrumbsProps): react_jsx_runtime.JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
export { SbBreadcrumbs as Breadcrumbs, type BreadcrumbsProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Breadcrumbs/index.ts","/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/Breadcrumbs.js"],"names":[],"mappings":"AAAA,qHAA6C;ACC7C;AACE;AACF,iDAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/Breadcrumbs.js","sourcesContent":["export { SbBreadcrumbs as Breadcrumbs } from './Breadcrumbs';\nexport type { BreadcrumbsProps } from './Breadcrumbs.types';",null]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Breadcrumbs/index.ts"],"sourcesContent":["export { SbBreadcrumbs as Breadcrumbs } from './Breadcrumbs';\nexport type { BreadcrumbsProps } from './Breadcrumbs.types';"],"mappings":"AAAA,SAA0B,qBAAmB;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface GlobalFooterProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare function GlobalFooter({ className }: GlobalFooterProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { GlobalFooter, type GlobalFooterProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface GlobalFooterProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare function GlobalFooter({ className }: GlobalFooterProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { GlobalFooter, type GlobalFooterProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/GlobalFooter/index.ts","/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/GlobalFooter.js"],"names":[],"mappings":"AAAA,uHAA6B;ACC7B;AACE;AACF,kDAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/GlobalFooter.js","sourcesContent":["export { GlobalFooter } from './GlobalFooter';\nexport type { GlobalFooterProps } from './GlobalFooter.types';",null]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/GlobalFooter/index.ts"],"sourcesContent":["export { GlobalFooter } from './GlobalFooter';\nexport type { GlobalFooterProps } from './GlobalFooter.types';"],"mappings":"AAAA,SAAS,oBAAoB;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface GlobalHeaderProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
zone: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare function GlobalHeader({ className, zone }: GlobalHeaderProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { GlobalHeader, type GlobalHeaderProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface GlobalHeaderProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
zone: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare function GlobalHeader({ className, zone }: GlobalHeaderProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { GlobalHeader, type GlobalHeaderProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/GlobalHeader/index.ts","/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/GlobalHeader.js"],"names":[],"mappings":"AAAA,uHAA6B;ACC7B;AACE;AACF,kDAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/GlobalHeader.js","sourcesContent":["export { GlobalHeader } from './GlobalHeader';\nexport type { GlobalHeaderProps } from './GlobalHeader.types';",null]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/GlobalHeader/index.ts"],"sourcesContent":["export { GlobalHeader } from './GlobalHeader';\nexport type { GlobalHeaderProps } from './GlobalHeader.types';"],"mappings":"AAAA,SAAS,oBAAoB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/MenuButton/index.ts","/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/MenuButton.js"],"names":[],"mappings":"AAAA,mHAA2B;ACC3B;AACE;AACF,4CAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/MenuButton.js","sourcesContent":["export { MenuButton } from './MenuButton';\nexport type { MenuButtonProps } from './MenuButton.types';",null]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/MenuButton/index.ts"],"sourcesContent":["export { MenuButton } from './MenuButton';\nexport type { MenuButtonProps } from './MenuButton.types';"],"mappings":"AAAA,SAAS,kBAAkB;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface RootLayoutProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
zone: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { RootLayout, type RootLayoutProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface RootLayoutProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
zone: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { RootLayout, type RootLayoutProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/RootLayout/index.ts","/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/RootLayout.js"],"names":[],"mappings":"AAAA,mHAA2B;ACC3B;AACE;AACF,4CAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/components/RootLayout.js","sourcesContent":["export { RootLayout } from './RootLayout';\nexport type { RootLayoutProps } from './RootLayout.types';",null]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/RootLayout/index.ts"],"sourcesContent":["export { RootLayout } from './RootLayout';\nexport type { RootLayoutProps } from './RootLayout.types';"],"mappings":"AAAA,SAAS,kBAAkB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
zone: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
|
-
type Theme = 'light' | 'dark' | 'system';
|
|
14
|
-
type GlobalState = {
|
|
15
|
-
user?: {
|
|
16
|
-
id: string;
|
|
17
|
-
name?: string;
|
|
18
|
-
} | null;
|
|
19
|
-
theme: Theme;
|
|
20
|
-
locale: string;
|
|
21
|
-
setUser: (user: GlobalState['user']) => void;
|
|
22
|
-
setTheme: (theme: Theme) => void;
|
|
23
|
-
setLocale: (locale: string) => void;
|
|
24
|
-
initialize: () => void | Promise<void>;
|
|
25
|
-
};
|
|
26
|
-
declare const useGlobalStore: zustand.UseBoundStore<Omit<zustand.StoreApi<GlobalState>, "setState" | "persist"> & {
|
|
27
|
-
setState(partial: GlobalState | Partial<GlobalState> | ((state: GlobalState) => GlobalState | Partial<GlobalState>), replace?: false | undefined): unknown;
|
|
28
|
-
setState(state: GlobalState | ((state: GlobalState) => GlobalState), replace: true): unknown;
|
|
29
|
-
persist: {
|
|
30
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>) => void;
|
|
31
|
-
clearStorage: () => void;
|
|
32
|
-
rehydrate: () => Promise<void> | void;
|
|
33
|
-
hasHydrated: () => boolean;
|
|
34
|
-
onHydrate: (fn: (state: GlobalState) => void) => () => void;
|
|
35
|
-
onFinishHydration: (fn: (state: GlobalState) => void) => () => void;
|
|
36
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>;
|
|
37
|
-
};
|
|
38
|
-
}>;
|
|
39
|
-
|
|
40
|
-
export { type GlobalState, RootLayout, type RootLayoutProps, useGlobalStore };
|
|
1
|
+
export { RootLayout, RootLayoutProps } from './components/RootLayout.mjs';
|
|
2
|
+
export { GlobalState, useGlobalStore } from './store/globalState.mjs';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'zustand/middleware';
|
|
5
|
+
import 'zustand';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
zone: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
declare function RootLayout({ children, zone, className, }: RootLayoutProps): react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
|
-
type Theme = 'light' | 'dark' | 'system';
|
|
14
|
-
type GlobalState = {
|
|
15
|
-
user?: {
|
|
16
|
-
id: string;
|
|
17
|
-
name?: string;
|
|
18
|
-
} | null;
|
|
19
|
-
theme: Theme;
|
|
20
|
-
locale: string;
|
|
21
|
-
setUser: (user: GlobalState['user']) => void;
|
|
22
|
-
setTheme: (theme: Theme) => void;
|
|
23
|
-
setLocale: (locale: string) => void;
|
|
24
|
-
initialize: () => void | Promise<void>;
|
|
25
|
-
};
|
|
26
|
-
declare const useGlobalStore: zustand.UseBoundStore<Omit<zustand.StoreApi<GlobalState>, "setState" | "persist"> & {
|
|
27
|
-
setState(partial: GlobalState | Partial<GlobalState> | ((state: GlobalState) => GlobalState | Partial<GlobalState>), replace?: false | undefined): unknown;
|
|
28
|
-
setState(state: GlobalState | ((state: GlobalState) => GlobalState), replace: true): unknown;
|
|
29
|
-
persist: {
|
|
30
|
-
setOptions: (options: Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>) => void;
|
|
31
|
-
clearStorage: () => void;
|
|
32
|
-
rehydrate: () => Promise<void> | void;
|
|
33
|
-
hasHydrated: () => boolean;
|
|
34
|
-
onHydrate: (fn: (state: GlobalState) => void) => () => void;
|
|
35
|
-
onFinishHydration: (fn: (state: GlobalState) => void) => () => void;
|
|
36
|
-
getOptions: () => Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>;
|
|
37
|
-
};
|
|
38
|
-
}>;
|
|
39
|
-
|
|
40
|
-
export { type GlobalState, RootLayout, type RootLayoutProps, useGlobalStore };
|
|
1
|
+
export { RootLayout, RootLayoutProps } from './components/RootLayout.js';
|
|
2
|
+
export { GlobalState, useGlobalStore } from './store/globalState.js';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'zustand/middleware';
|
|
5
|
+
import 'zustand';
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
RootLayout: () => import_RootLayout.RootLayout,
|
|
23
|
-
useGlobalStore: () => import_globalState.useGlobalStore
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
var import_RootLayout = require("./components/RootLayout");
|
|
27
|
-
var import_globalState = require("./store/globalState");
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
RootLayout,
|
|
31
|
-
useGlobalStore
|
|
32
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
var _RootLayout = require('./components/RootLayout');
|
|
3
|
+
var _globalState = require('./store/globalState');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.RootLayout = _RootLayout.RootLayout; exports.useGlobalStore = _globalState.useGlobalStore;
|
|
33
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["'use client';\n\nexport { RootLayout } from './components/RootLayout';\nexport type { RootLayoutProps } from './components/RootLayout';\n\nexport { useGlobalStore } from './store/globalState';\nexport type { GlobalState } from './store/globalState';\n"]
|
|
1
|
+
{"version":3,"sources":["/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/index.js","../src/index.ts"],"names":[],"mappings":"AAAA,qFAAY;ACEZ,qDAA2B;AAG3B,kDAA+B;ADF/B;AACE;AACA;AACF,kGAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/index.js","sourcesContent":[null,"'use client';\n\nexport { RootLayout } from './components/RootLayout';\nexport type { RootLayoutProps } from './components/RootLayout';\n\nexport { useGlobalStore } from './store/globalState';\nexport type { GlobalState } from './store/globalState';\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as zustand_middleware from 'zustand/middleware';
|
|
2
|
+
import * as zustand from 'zustand';
|
|
3
|
+
|
|
4
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
5
|
+
type GlobalState = {
|
|
6
|
+
user?: {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
} | null;
|
|
10
|
+
theme: Theme;
|
|
11
|
+
locale: string;
|
|
12
|
+
setUser: (user: GlobalState['user']) => void;
|
|
13
|
+
setTheme: (theme: Theme) => void;
|
|
14
|
+
setLocale: (locale: string) => void;
|
|
15
|
+
initialize: () => void | Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
declare const useGlobalStore: zustand.UseBoundStore<Omit<zustand.StoreApi<GlobalState>, "setState" | "persist"> & {
|
|
18
|
+
setState(partial: GlobalState | Partial<GlobalState> | ((state: GlobalState) => GlobalState | Partial<GlobalState>), replace?: false | undefined): unknown;
|
|
19
|
+
setState(state: GlobalState | ((state: GlobalState) => GlobalState), replace: true): unknown;
|
|
20
|
+
persist: {
|
|
21
|
+
setOptions: (options: Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>) => void;
|
|
22
|
+
clearStorage: () => void;
|
|
23
|
+
rehydrate: () => Promise<void> | void;
|
|
24
|
+
hasHydrated: () => boolean;
|
|
25
|
+
onHydrate: (fn: (state: GlobalState) => void) => () => void;
|
|
26
|
+
onFinishHydration: (fn: (state: GlobalState) => void) => () => void;
|
|
27
|
+
getOptions: () => Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
export { type GlobalState, type Theme, useGlobalStore };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as zustand_middleware from 'zustand/middleware';
|
|
2
|
+
import * as zustand from 'zustand';
|
|
3
|
+
|
|
4
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
5
|
+
type GlobalState = {
|
|
6
|
+
user?: {
|
|
7
|
+
id: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
} | null;
|
|
10
|
+
theme: Theme;
|
|
11
|
+
locale: string;
|
|
12
|
+
setUser: (user: GlobalState['user']) => void;
|
|
13
|
+
setTheme: (theme: Theme) => void;
|
|
14
|
+
setLocale: (locale: string) => void;
|
|
15
|
+
initialize: () => void | Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
declare const useGlobalStore: zustand.UseBoundStore<Omit<zustand.StoreApi<GlobalState>, "setState" | "persist"> & {
|
|
18
|
+
setState(partial: GlobalState | Partial<GlobalState> | ((state: GlobalState) => GlobalState | Partial<GlobalState>), replace?: false | undefined): unknown;
|
|
19
|
+
setState(state: GlobalState | ((state: GlobalState) => GlobalState), replace: true): unknown;
|
|
20
|
+
persist: {
|
|
21
|
+
setOptions: (options: Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>) => void;
|
|
22
|
+
clearStorage: () => void;
|
|
23
|
+
rehydrate: () => Promise<void> | void;
|
|
24
|
+
hasHydrated: () => boolean;
|
|
25
|
+
onHydrate: (fn: (state: GlobalState) => void) => () => void;
|
|
26
|
+
onFinishHydration: (fn: (state: GlobalState) => void) => () => void;
|
|
27
|
+
getOptions: () => Partial<zustand_middleware.PersistOptions<GlobalState, unknown, unknown>>;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
export { type GlobalState, type Theme, useGlobalStore };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _zustand = require('zustand');
|
|
2
|
+
var _middleware = require('zustand/middleware');
|
|
3
|
+
const creator = (set, get) => ({
|
|
4
|
+
user: null,
|
|
5
|
+
theme: "light",
|
|
6
|
+
locale: "no",
|
|
7
|
+
setUser: (user) => set({ user }),
|
|
8
|
+
setTheme: (theme) => {
|
|
9
|
+
set({ theme });
|
|
10
|
+
if (typeof document !== "undefined") {
|
|
11
|
+
document.documentElement.setAttribute("data-color-scheme", theme);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setLocale: (locale) => set({ locale }),
|
|
15
|
+
initialize: () => {
|
|
16
|
+
if (typeof document !== "undefined") {
|
|
17
|
+
document.documentElement.setAttribute("data-color-scheme", get().theme);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const useGlobalStore = _zustand.create.call(void 0, )(
|
|
22
|
+
_middleware.persist.call(void 0, creator, {
|
|
23
|
+
name: "statsbygg-global-state",
|
|
24
|
+
storage: _middleware.createJSONStorage.call(void 0, () => localStorage)
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
exports.useGlobalStore = useGlobalStore;
|
|
30
|
+
//# sourceMappingURL=globalState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/globalState.ts","/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/store/globalState.js"],"names":[],"mappings":"AAAA,2GAAqC;AACrC,gDAA2C;AAc3C,MAAM,QAAA,EAAqE,CAAC,GAAA,EAAK,GAAA,EAAA,GAAA,CAAS;AAAA,EACxF,IAAA,EAAM,IAAA;AAAA,EACN,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ,IAAA;AAAA,EACR,OAAA,EAAS,CAAC,IAAA,EAAA,GAAS,GAAA,CAAI,EAAE,KAAK,CAAC,CAAA;AAAA,EAC/B,QAAA,EAAU,CAAC,KAAA,EAAA,GAAU;AACnB,IAAA,GAAA,CAAI,EAAE,MAAM,CAAC,CAAA;AACb,IAAA,GAAA,CAAI,OAAO,SAAA,IAAa,WAAA,EAAa;AACnC,MAAA,QAAA,CAAS,eAAA,CAAgB,YAAA,CAAa,mBAAA,EAAqB,KAAK,CAAA;AAAA,IAClE;AAAA,EACF,CAAA;AAAA,EACA,SAAA,EAAW,CAAC,MAAA,EAAA,GAAW,GAAA,CAAI,EAAE,OAAO,CAAC,CAAA;AAAA,EACrC,UAAA,EAAY,CAAA,EAAA,GAAM;AAChB,IAAA,GAAA,CAAI,OAAO,SAAA,IAAa,WAAA,EAAa;AACnC,MAAA,QAAA,CAAS,eAAA,CAAgB,YAAA,CAAa,mBAAA,EAAqB,GAAA,CAAI,CAAA,CAAE,KAAK,CAAA;AAAA,IACxE;AAAA,EACF;AACF,CAAA,CAAA;AAEO,MAAM,eAAA,EAAiB,6BAAA,CAAoB;AAAA,EAChD,iCAAA,OAAQ,EAAS;AAAA,IACf,IAAA,EAAM,wBAAA;AAAA,IACN,OAAA,EAAS,2CAAA,CAAkB,EAAA,GAAM,YAAY;AAAA,EAC/C,CAAC;AACH,CAAA;ACbA;AACE;AACF,wCAAC","file":"/home/jimmy/dev/work/statsbygg-components/packages/layout/dist/store/globalState.js","sourcesContent":["import { create, StateCreator } from 'zustand';\nimport { persist, createJSONStorage } from 'zustand/middleware';\n\nexport type Theme = 'light' | 'dark' | 'system';\n\nexport type GlobalState = {\n user?: { id: string; name?: string } | null;\n theme: Theme;\n locale: string;\n setUser: (user: GlobalState['user']) => void;\n setTheme: (theme: Theme) => void;\n setLocale: (locale: string) => void;\n initialize: () => void | Promise<void>;\n};\n\nconst creator: StateCreator<GlobalState, [['zustand/persist', unknown]]> = (set, get) => ({\n user: null,\n theme: 'light',\n locale: 'no',\n setUser: (user) => set({ user }),\n setTheme: (theme) => {\n set({ theme });\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-color-scheme', theme);\n }\n },\n setLocale: (locale) => set({ locale }),\n initialize: () => {\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-color-scheme', get().theme);\n }\n },\n});\n\nexport const useGlobalStore = create<GlobalState>()(\n persist(creator, {\n name: 'statsbygg-global-state',\n storage: createJSONStorage(() => localStorage),\n })\n);\n",null]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
import { persist, createJSONStorage } from "zustand/middleware";
|
|
3
|
+
const creator = (set, get) => ({
|
|
4
|
+
user: null,
|
|
5
|
+
theme: "light",
|
|
6
|
+
locale: "no",
|
|
7
|
+
setUser: (user) => set({ user }),
|
|
8
|
+
setTheme: (theme) => {
|
|
9
|
+
set({ theme });
|
|
10
|
+
if (typeof document !== "undefined") {
|
|
11
|
+
document.documentElement.setAttribute("data-color-scheme", theme);
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setLocale: (locale) => set({ locale }),
|
|
15
|
+
initialize: () => {
|
|
16
|
+
if (typeof document !== "undefined") {
|
|
17
|
+
document.documentElement.setAttribute("data-color-scheme", get().theme);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const useGlobalStore = create()(
|
|
22
|
+
persist(creator, {
|
|
23
|
+
name: "statsbygg-global-state",
|
|
24
|
+
storage: createJSONStorage(() => localStorage)
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
useGlobalStore
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=globalState.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/store/globalState.ts"],"sourcesContent":["import { create, StateCreator } from 'zustand';\nimport { persist, createJSONStorage } from 'zustand/middleware';\n\nexport type Theme = 'light' | 'dark' | 'system';\n\nexport type GlobalState = {\n user?: { id: string; name?: string } | null;\n theme: Theme;\n locale: string;\n setUser: (user: GlobalState['user']) => void;\n setTheme: (theme: Theme) => void;\n setLocale: (locale: string) => void;\n initialize: () => void | Promise<void>;\n};\n\nconst creator: StateCreator<GlobalState, [['zustand/persist', unknown]]> = (set, get) => ({\n user: null,\n theme: 'light',\n locale: 'no',\n setUser: (user) => set({ user }),\n setTheme: (theme) => {\n set({ theme });\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-color-scheme', theme);\n }\n },\n setLocale: (locale) => set({ locale }),\n initialize: () => {\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-color-scheme', get().theme);\n }\n },\n});\n\nexport const useGlobalStore = create<GlobalState>()(\n persist(creator, {\n name: 'statsbygg-global-state',\n storage: createJSONStorage(() => localStorage),\n })\n);\n"],"mappings":"AAAA,SAAS,cAA4B;AACrC,SAAS,SAAS,yBAAyB;AAc3C,MAAM,UAAqE,CAAC,KAAK,SAAS;AAAA,EACxF,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS,CAAC,SAAS,IAAI,EAAE,KAAK,CAAC;AAAA,EAC/B,UAAU,CAAC,UAAU;AACnB,QAAI,EAAE,MAAM,CAAC;AACb,QAAI,OAAO,aAAa,aAAa;AACnC,eAAS,gBAAgB,aAAa,qBAAqB,KAAK;AAAA,IAClE;AAAA,EACF;AAAA,EACA,WAAW,CAAC,WAAW,IAAI,EAAE,OAAO,CAAC;AAAA,EACrC,YAAY,MAAM;AAChB,QAAI,OAAO,aAAa,aAAa;AACnC,eAAS,gBAAgB,aAAa,qBAAqB,IAAI,EAAE,KAAK;AAAA,IACxE;AAAA,EACF;AACF;AAEO,MAAM,iBAAiB,OAAoB;AAAA,EAChD,QAAQ,SAAS;AAAA,IACf,MAAM;AAAA,IACN,SAAS,kBAAkB,MAAM,YAAY;AAAA,EAC/C,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsbygg/layout",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"publishConfig": {
|
|
3
|
+
"version": "0.0.11",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
5
7
|
"description": "Shared layout components for Statsbygg microfrontend architecture",
|
|
6
8
|
"main": "./dist/index.js",
|
|
7
9
|
"module": "./dist/index.mjs",
|
|
8
10
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**"
|
|
13
|
+
],
|
|
10
14
|
"exports": {
|
|
11
15
|
".": {
|
|
12
16
|
"import": "./dist/index.mjs",
|
|
13
17
|
"require": "./dist/index.js",
|
|
14
18
|
"types": "./dist/index.d.ts"
|
|
15
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./components/*": "./dist/components/*",
|
|
21
|
+
"./store/*": "./dist/store/*"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"**/*.css"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup && npm run copy:css",
|
|
28
|
+
"copy:css": "node scripts/copy-css.js",
|
|
29
|
+
"dev": "tsup --watch",
|
|
30
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
31
|
+
"type-check": "tsc --noEmit",
|
|
32
|
+
"clean": "rm -rf dist"
|
|
16
33
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup && rsync -a --prune-empty-dirs --include='*/' --include='*.module.css' --exclude='*' src/ dist/",
|
|
19
|
-
"dev": "tsup --watch",
|
|
20
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
21
|
-
"type-check": "tsc --noEmit"
|
|
22
|
-
},
|
|
23
34
|
"peerDependencies": {
|
|
24
35
|
"next": ">=14.0.0",
|
|
25
36
|
"react": ">=18.0.0",
|
|
@@ -36,8 +47,9 @@
|
|
|
36
47
|
"@types/node": "^20.0.0",
|
|
37
48
|
"@types/react": "^18.2.0",
|
|
38
49
|
"@types/react-dom": "^18.2.0",
|
|
50
|
+
"fs-extra": "^11.1.1",
|
|
51
|
+
"glob": "^10.3.10",
|
|
39
52
|
"tsup": "^8.0.0",
|
|
40
53
|
"typescript": "^5.0.0"
|
|
41
|
-
}
|
|
42
|
-
"sideEffects": ["**/*.css"]
|
|
54
|
+
}
|
|
43
55
|
}
|