@m4l/graphics 7.0.11 → 7.0.12

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.
@@ -10,10 +10,6 @@ declare const DeviceTypeContext: import('react').Context<(Omit<Omit<import('zust
10
10
  }) | null>;
11
11
  /**
12
12
  * Proveedor de contenedor responsivo
13
- * @author Juan Escobar - automatic
14
- * @createdAt 2024-10-06 20:07:18 - automatic
15
- * @updatedAt 2024-10-08 19:03:38 - automatic
16
- * @updatedUser Juan Escobar - automatic
17
13
  */
18
14
  declare const DeviceTypeProvider: (props: DeviceTypePrivderProps) => import("react").JSX.Element;
19
15
  export { DeviceTypeProvider, DeviceTypeContext };
@@ -1,17 +1,18 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { createContext as s, useRef as p, useEffect as u } from "react";
3
- import { c as a } from "./store.js";
4
- import { g as f } from "./helper.js";
5
- import { u as v } from "../../hooks/useUserAgent/index.js";
6
- const m = s(null), l = (r) => {
7
- const { children: c, forcedDeviceType: o } = r, i = v(), e = p(), t = o ?? f(i);
8
- return e.current || (e.current = a({
9
- deviceType: t
10
- })), u(() => {
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { createContext as a, useRef as u, useEffect as v } from "react";
3
+ import { c as f } from "./store.js";
4
+ import { g as m } from "./helper.js";
5
+ import { u as d } from "../../hooks/useUserAgent/index.js";
6
+ const y = a(null), S = (r) => {
7
+ const { children: o, forcedDeviceType: c, storeId: s, storeDevtoolsEnabled: i } = r, n = d(), e = u(), t = c ?? m(n);
8
+ return e.current || (e.current = f({
9
+ deviceType: t,
10
+ storeId: s
11
+ }, i)), v(() => {
11
12
  e.current?.getState().deviceType !== t && e.current?.getState().actions.setDeviceType(t);
12
- }, [t]), /* @__PURE__ */ n(m.Provider, { value: e.current, children: c });
13
+ }, [t]), /* @__PURE__ */ p(y.Provider, { value: e.current, children: o });
13
14
  };
14
15
  export {
15
- m as D,
16
- l as a
16
+ y as D,
17
+ S as a
17
18
  };
@@ -6,7 +6,7 @@ import { InitialDeviceTypeProps, DeviceTypeWithActions } from './types';
6
6
  * @updatedAt 2024-10-06 20:07:18 - automatic
7
7
  * @updatedUser Juan Escobar - automatic
8
8
  */
9
- export declare const createDeviceTypeStore: (initProps: InitialDeviceTypeProps) => Omit<Omit<import('zustand').StoreApi<DeviceTypeWithActions>, "setState"> & {
9
+ export declare const createDeviceTypeStore: (initProps: InitialDeviceTypeProps, storeDevtoolsEnabled?: boolean) => Omit<Omit<import('zustand').StoreApi<DeviceTypeWithActions>, "setState"> & {
10
10
  setState<A extends string | {
11
11
  type: unknown;
12
12
  }>(partial: DeviceTypeWithActions | Partial<DeviceTypeWithActions> | ((state: DeviceTypeWithActions) => DeviceTypeWithActions | Partial<DeviceTypeWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
@@ -1,14 +1,17 @@
1
- import { createStore as i } from "zustand";
2
- import { devtools as m } from "zustand/middleware";
1
+ import { createStore as a } from "zustand";
2
+ import { devtools as n } from "zustand/middleware";
3
3
  import { immer as p } from "zustand/middleware/immer";
4
- const y = (e) => {
5
- const t = {
4
+ const m = (e, t) => {
5
+ const { enabled: o = !1 } = t;
6
+ return o && process.env.NODE_ENV === "development" ? n(e, t) : e;
7
+ }, D = (e, t = !1) => {
8
+ const o = {
6
9
  ...e
7
10
  };
8
- return i(
11
+ return a(
9
12
  m(
10
- p((r, s) => ({
11
- ...t,
13
+ p((r, v) => ({
14
+ ...o,
12
15
  actions: {
13
16
  /**
14
17
  * Establece el punto de interrupción
@@ -17,17 +20,17 @@ const y = (e) => {
17
20
  * @updatedAt 2024-10-06 20:07:18 - automatic
18
21
  * @updatedUser Juan Escobar - automatic
19
22
  */
20
- setDeviceType: (o) => {
23
+ setDeviceType: (s) => {
21
24
  r((c) => {
22
- c.deviceType = o;
25
+ c.deviceType = s;
23
26
  });
24
27
  }
25
28
  }
26
29
  })),
27
- { name: "DeviceType Store" }
30
+ { name: `DeviceTypeStore: ${e.storeId}`, enabled: t }
28
31
  )
29
32
  );
30
33
  };
31
34
  export {
32
- y as c
35
+ D as c
33
36
  };
@@ -1,11 +1,32 @@
1
1
  import { default as React } from 'react';
2
2
  export type DeviceType = 'mobile' | 'desktop';
3
3
  export interface DeviceTypeState {
4
+ /**
5
+ * "storeId" Id del store
6
+ */
7
+ storeId?: string;
8
+ /**
9
+ * "deviceType" Tipo de dispositivo detectado
10
+ */
4
11
  deviceType: DeviceType;
5
12
  }
6
- export type InitialDeviceTypeProps = Pick<DeviceTypeState, 'deviceType'>;
13
+ export type InitialDeviceTypeProps = Pick<DeviceTypeState, 'deviceType' | 'storeId'>;
7
14
  export interface DeviceTypePrivderProps {
15
+ /**
16
+ * "storeId" Id del store
17
+ */
18
+ storeId?: string;
19
+ /**
20
+ * "storeDevtoolsEnabled" Determina si se debe usar devtools para el store
21
+ */
22
+ storeDevtoolsEnabled?: boolean;
23
+ /**
24
+ * "forcedDeviceType" Tipo de dispositivo forzado, para no usar el detectado del userAgent
25
+ */
8
26
  forcedDeviceType?: DeviceType;
27
+ /**
28
+ * "children" Componentes hijos
29
+ */
9
30
  children: React.ReactNode;
10
31
  }
11
32
  export interface DeviceTypeWithActions extends DeviceTypeState {
@@ -10,10 +10,7 @@ declare const ResponsiveContainerContext: import('react').Context<(Omit<Omit<imp
10
10
  }) | null>;
11
11
  /**
12
12
  * Proveedor de contenedor responsivo
13
- * @author Juan Escobar - automatic
14
- * @createdAt 2024-10-06 20:07:18 - automatic
15
- * @updatedAt 2024-10-08 19:03:38 - automatic
16
- * @updatedUser Juan Escobar - automatic
13
+ * @deprecated usar useIsMobile
17
14
  */
18
15
  declare const ResponsiveContainerProvider: (props: ResponsiveContainerProviderProps) => import("react").JSX.Element;
19
16
  export { ResponsiveContainerProvider, ResponsiveContainerContext };
@@ -1,8 +1,5 @@
1
1
  /**
2
2
  * Returns true if the screen size is desktop.
3
- * @author Juan Escobar - automatic
4
- * @createdAt 2024-10-06 20:07:18 - automatic
5
- * @updatedAt 2024-10-06 20:07:18 - automatic
6
- * @updatedUser Juan Escobar - automatic
3
+ * @deprecated usar useIsMobile
7
4
  */
8
5
  export declare function useResponsiveDesktop(): boolean | undefined;
@@ -1,9 +1,6 @@
1
1
  import { ResponsiveContainerStateWithActions } from '../../contexts/ResponsiveContainerContext/types';
2
2
  /**
3
3
  * Hook to use the responsive container store
4
- * @author Juan Escobar - automatic
5
- * @createdAt 2024-10-06 20:07:18 - automatic
6
- * @updatedAt 2024-10-06 20:07:18 - automatic
7
- * @updatedUser Juan Escobar - automatic
4
+ * @deprecated usa use
8
5
  */
9
6
  export declare function useResponsiveContainerStore<T>(selector: (state: ResponsiveContainerStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "7.0.11",
3
+ "version": "7.0.12",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "type": "module",