@m4l/core 0.0.39 → 0.0.40

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.
@@ -3,6 +3,7 @@ import { u as useEnvironment } from "../../hooks/useEnvironment/index.js";
3
3
  import { u as useFlags } from "../../hooks/useFlags/index.js";
4
4
  import { u as useHostTools } from "../../hooks/useHostTools/index.js";
5
5
  import "../ModulePrivilegesContext/index.js";
6
+ import "../ModuleSkeletonContext/index.js";
6
7
  import { u as useNetwork } from "../../hooks/useNetwork/index.js";
7
8
  import { jsx } from "react/jsx-runtime";
8
9
  const initialState = {
@@ -3,6 +3,7 @@ import "../EnvironmentContext/index.js";
3
3
  import { u as useFlags } from "../../hooks/useFlags/index.js";
4
4
  import { u as useHostTools } from "../../hooks/useHostTools/index.js";
5
5
  import "../ModuleDictionaryContext/index.js";
6
+ import "../ModuleSkeletonContext/index.js";
6
7
  import { u as useNetwork } from "../../hooks/useNetwork/index.js";
7
8
  import { jsx } from "react/jsx-runtime";
8
9
  const initialState = {
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ModuleSkeletonContextProps, ModuleSkeletonProviderProps } from './types';
3
+ declare const ModuleSkeletonContext: import("react").Context<ModuleSkeletonContextProps>;
4
+ declare function ModuleSkeletonProvider(props: ModuleSkeletonProviderProps): JSX.Element;
5
+ export { ModuleSkeletonProvider, ModuleSkeletonContext };
@@ -0,0 +1,26 @@
1
+ import { createContext } from "react";
2
+ import "../EnvironmentContext/index.js";
3
+ import { a as useFlagsPresent } from "../../hooks/useFlags/index.js";
4
+ import "../HostToolsContext/index.js";
5
+ import "../ModuleDictionaryContext/index.js";
6
+ import "../ModulePrivilegesContext/index.js";
7
+ import "../NetworkContext/index.js";
8
+ import { jsx } from "react/jsx-runtime";
9
+ const initialState = {
10
+ isSkeleton: false
11
+ };
12
+ const ModuleSkeletonContext = createContext(initialState);
13
+ function ModuleSkeletonProvider(props) {
14
+ const {
15
+ children,
16
+ flags
17
+ } = props;
18
+ const isSkeleton = !useFlagsPresent(flags);
19
+ return /* @__PURE__ */ jsx(ModuleSkeletonContext.Provider, {
20
+ value: {
21
+ isSkeleton
22
+ },
23
+ children
24
+ });
25
+ }
26
+ export { ModuleSkeletonContext as M, ModuleSkeletonProvider as a };
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ModuleSkeletonProviderProps {
3
+ flags: string[];
4
+ children: ReactNode;
5
+ }
6
+ export interface ModuleSkeletonContextProps {
7
+ isSkeleton: boolean;
8
+ }
@@ -4,3 +4,4 @@ export { NetworkContext, NetworkProvider } from './NetworkContext';
4
4
  export { FlagsContext, FlagsProvider } from './FlagsContext';
5
5
  export { ModuleDictionaryContext, ModuleDictionaryProvider } from './ModuleDictionaryContext';
6
6
  export { ModulePrivilegesContext, ModulePrivilegesProvider } from './ModulePrivilegesContext';
7
+ export { ModuleSkeletonContext, ModuleSkeletonProvider } from './ModuleSkeletonContext';
@@ -4,6 +4,7 @@ export { useHostTools } from './useHostTools';
4
4
  export { useLocalStorage } from './useLocalStorage';
5
5
  export { useModuleDictionary } from './useModuleDictionary';
6
6
  export { useModulePrivileges } from './useModulePrivileges';
7
+ export { useModuleSkeleton } from './useModuleSkeleton';
7
8
  export { useNetwork } from './useNetwork';
8
9
  export { usePaginate } from './usePaginate';
9
10
  export type { PagerState } from './usePaginate/types';
@@ -0,0 +1 @@
1
+ export declare const useModuleSkeleton: () => boolean;
@@ -0,0 +1,9 @@
1
+ import { useContext } from "react";
2
+ import { M as ModuleSkeletonContext } from "../../contexts/ModuleSkeletonContext/index.js";
3
+ const useModuleSkeleton = () => {
4
+ const context = useContext(ModuleSkeletonContext);
5
+ if (!context)
6
+ throw new Error("useModuleSkeleton context must be use inside ModuleSkeletonContext");
7
+ return context.isSkeleton;
8
+ };
9
+ export { useModuleSkeleton as u };
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { F as FlagsContext, a as FlagsProvider } from "./contexts/FlagsContext/i
4
4
  export { H as HostToolsContext, a as HostToolsProvider } from "./contexts/HostToolsContext/index.js";
5
5
  export { M as ModuleDictionaryContext, a as ModuleDictionaryProvider } from "./contexts/ModuleDictionaryContext/index.js";
6
6
  export { M as ModulePrivilegesContext, a as ModulePrivilegesProvider } from "./contexts/ModulePrivilegesContext/index.js";
7
+ export { M as ModuleSkeletonContext, a as ModuleSkeletonProvider } from "./contexts/ModuleSkeletonContext/index.js";
7
8
  export { N as NetworkContext, a as NetworkProvider } from "./contexts/NetworkContext/index.js";
8
9
  export { u as useEnvironment } from "./hooks/useEnvironment/index.js";
9
10
  export { u as useFlags, a as useFlagsPresent } from "./hooks/useFlags/index.js";
@@ -11,6 +12,7 @@ export { u as useHostTools } from "./hooks/useHostTools/index.js";
11
12
  export { u as useLocalStorage } from "./hooks/useLocalStorage/index.js";
12
13
  export { u as useModuleDictionary } from "./hooks/useModuleDictionary/index.js";
13
14
  export { u as useModulePrivileges } from "./hooks/useModulePrivileges/index.js";
15
+ export { u as useModuleSkeleton } from "./hooks/useModuleSkeleton/index.js";
14
16
  export { u as useNetwork } from "./hooks/useNetwork/index.js";
15
17
  export { i as initialPagerState, u as usePaginate } from "./hooks/usePaginate/index.js";
16
18
  export { E as EmitEvents } from "./types/index.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
3
  "private": false,
4
- "version": "0.0.39",
4
+ "version": "0.0.40",
5
5
  "license": "UNLICENSED",
6
6
  "author": "M4L Team",
7
7
  "scripts": {