@zydon/common 2.5.41 → 2.5.43
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/chunk-IB2EDGUN.js +13 -0
- package/dist/chunk-JAHXVWFM.js +6 -0
- package/dist/chunk-SO64ZYQB.js +3 -0
- package/dist/components/Common/index.js +2 -1
- package/dist/hooks/useDeepCompareEffect.js +3 -3
- package/dist/theme/theme-provider.js +2 -1
- package/dist/utils/compare.d.ts +25 -2
- package/dist/utils/compare.js +1 -1
- package/dist/utils/execution.d.ts +120 -0
- package/dist/utils/execution.js +3 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/object.js +1 -0
- package/package.json +2 -3
- package/dist/chunk-VVMQMROT.js +0 -5
- package/dist/chunk-XI2QTFJA.js +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { a as a$1 } from './chunk-SO64ZYQB.js';
|
|
2
|
+
import { a } from './chunk-GUFT6XPG.js';
|
|
3
|
+
import { a as a$2, e } from './chunk-BH5YHBAI.js';
|
|
4
|
+
import { a as a$4, b as b$1 } from './chunk-OSDHZZEM.js';
|
|
5
|
+
import { q, s, a as a$3 } from './chunk-FDP5MHVS.js';
|
|
6
|
+
import { c } from './chunk-D27ND54J.js';
|
|
7
|
+
import A from '@mui/material/CssBaseline';
|
|
8
|
+
import { Experimental_CssVarsProvider, experimental_extendTheme, lighten, darken } from '@mui/material/styles';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
var g={modeStorageKey:"theme-mode",defaultMode:"light"};var C={};var b=e=>({lighter:lighten(e,.815),light:lighten(e,.225),main:e,dark:darken(e,.15),darker:darken(e,.35),contrastText:"#000"});function S(e$1,t,m=""){let o=b(t.primaryColor);a$1(q,"dark.palette.primary",o),a$1(q,"light.palette.primary",o);let i={colorSchemes:q,shadows:a$2(t.colorScheme),customShadows:s(t.colorScheme,o.main),shape:{borderRadius:8},components:a$3,typography:{...e,fontFamily:c(t.fontFamily)},cssVarPrefix:m,shouldSkipGeneratingVar:k},r=a$4(i,t);return experimental_extendTheme(r,e$1,b$1(t),C)}function k(e,t){let m=["mixins","overlays","direction","breakpoints","cssVarPrefix","unstable_sxConfig","typography"],o={global:["tonalOffset","dividerChannel","contrastThreshold"],grey:["A100","A200","A400","A700"],text:["icon"]};if(e[0]==="palette"){let r=e[1],n=o[r]||o.global;return e.some(x=>n?.includes(x))}return e.some(r=>m?.includes(r))}var V=({primaryColor:e,children:t,colorScheme:m="light",contrast:o="default",cssVarPrefix:i})=>{let r=S(a[1].systemValue,{primaryColor:e,colorScheme:m,contrast:o,navLayout:"vertical",navColor:"integrate",compactLayout:!0,fontFamily:"Public Sans"},i);return jsxs(Experimental_CssVarsProvider,{theme:r,defaultMode:"light",defaultColorScheme:"light",modeStorageKey:g.modeStorageKey,children:[jsx(A,{}),t]})},H=V;
|
|
12
|
+
|
|
13
|
+
export { H as a };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b } from '../chunk-JAHXVWFM.js';
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var o=t=>{let e=useRef();return b(t,e.current)||(e.current=t),e.current},p=(t,e)=>{useEffect(t,e.map(o));},u=p;
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { u as default };
|
package/dist/utils/compare.d.ts
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as isEqual } from 'react-fast-compare';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Realiza comparação profunda entre dois valores com tratamento especial para Sets.
|
|
5
|
+
*
|
|
6
|
+
* Esta função utiliza react-fast-compare como base, mas adiciona lógica especial
|
|
7
|
+
* para Sets que contêm objetos, já que react-fast-compare pode não comparar
|
|
8
|
+
* corretamente Sets com objetos complexos em algumas situações.
|
|
9
|
+
*
|
|
10
|
+
* @param a - Primeiro valor a ser comparado
|
|
11
|
+
* @param b - Segundo valor a ser comparado
|
|
12
|
+
* @returns true se os valores são profundamente iguais, false caso contrário
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const set1 = new Set([{id: 1}, {id: 2}]);
|
|
17
|
+
* const set2 = new Set([{id: 1}, {id: 2}]);
|
|
18
|
+
* deepCompareWithSets(set1, set2); // true
|
|
19
|
+
*
|
|
20
|
+
* deepCompareWithSets([1, 2, 3], [1, 2, 3]); // true
|
|
21
|
+
* deepCompareWithSets({a: 1}, {a: 1}); // true
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const deepCompareWithSets: (a: unknown, b: unknown) => boolean;
|
|
25
|
+
|
|
26
|
+
export { deepCompareWithSets };
|
package/dist/utils/compare.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as isEqual } from '../chunk-
|
|
1
|
+
export { b as deepCompareWithSets, a as isEqual } from '../chunk-JAHXVWFM.js';
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executa imediatamente uma função e retorna seu resultado.
|
|
3
|
+
*
|
|
4
|
+
* Esta função utilitária é usada para avaliar expressões de forma "eager" (ansiosa),
|
|
5
|
+
* executando a função fornecida imediatamente e retornando seu valor. É útil em
|
|
6
|
+
* situações onde você quer forçar a execução imediata de uma função que poderia
|
|
7
|
+
* ser avaliada de forma lazy (preguiçosa).
|
|
8
|
+
*
|
|
9
|
+
* @template T - O tipo do valor retornado pela função
|
|
10
|
+
* @param fn - A função a ser executada imediatamente
|
|
11
|
+
* @returns O resultado da execução da função
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Execução imediata de uma computação
|
|
16
|
+
* const result = eager(() => {
|
|
17
|
+
* console.log('Executando agora!');
|
|
18
|
+
* return 42;
|
|
19
|
+
* }); // result = 42, e o console.log é executado imediatamente
|
|
20
|
+
*
|
|
21
|
+
* // Útil para inicialização de valores
|
|
22
|
+
* const config = eager(() => ({
|
|
23
|
+
* apiUrl: process.env.API_URL || 'http://localhost:3000',
|
|
24
|
+
* timeout: 5000
|
|
25
|
+
* }));
|
|
26
|
+
*
|
|
27
|
+
* // Forçar execução de side effects
|
|
28
|
+
* eager(() => {
|
|
29
|
+
* localStorage.setItem('initialized', 'true');
|
|
30
|
+
* return null;
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare const eager: <T>(fn: () => T) => T;
|
|
35
|
+
/**
|
|
36
|
+
* Adia a execução de uma função para o próximo ciclo do event loop.
|
|
37
|
+
*
|
|
38
|
+
* Esta função utiliza setTimeout com delay 0 para agendar a execução da função
|
|
39
|
+
* fornecida para o próximo tick do event loop. É útil para quebrar operações
|
|
40
|
+
* síncronas longas ou para garantir que o DOM seja atualizado antes da execução.
|
|
41
|
+
*
|
|
42
|
+
* @template T - O tipo do valor retornado pela função
|
|
43
|
+
* @param fn - A função a ser executada de forma adiada
|
|
44
|
+
* @returns Uma Promise que resolve com o resultado da função
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Adiar execução para permitir atualização do DOM
|
|
49
|
+
* const updateUI = async () => {
|
|
50
|
+
* setLoading(true);
|
|
51
|
+
*
|
|
52
|
+
* const result = await defer(() => {
|
|
53
|
+
* return processLargeDataset(data);
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* setLoading(false);
|
|
57
|
+
* return result;
|
|
58
|
+
* };
|
|
59
|
+
*
|
|
60
|
+
* // Quebrar operação síncrona longa
|
|
61
|
+
* const processInChunks = async (items: any[]) => {
|
|
62
|
+
* for (let i = 0; i < items.length; i += 100) {
|
|
63
|
+
* const chunk = items.slice(i, i + 100);
|
|
64
|
+
* processChunk(chunk);
|
|
65
|
+
*
|
|
66
|
+
* // Permite que outras tarefas sejam executadas
|
|
67
|
+
* await defer(() => {});
|
|
68
|
+
* }
|
|
69
|
+
* };
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare const defer: <T>(fn: () => T) => Promise<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Cria uma versão debounced de uma função que atrasa sua execução até que
|
|
75
|
+
* tenha passado um determinado tempo desde a última vez que foi invocada.
|
|
76
|
+
*
|
|
77
|
+
* Esta função é útil para limitar a frequência de execução de funções caras
|
|
78
|
+
* computacionalmente, como chamadas de API, validações ou atualizações de UI
|
|
79
|
+
* em resposta a eventos frequentes como digitação ou scroll.
|
|
80
|
+
*
|
|
81
|
+
* @template T - O tipo dos argumentos da função
|
|
82
|
+
* @template R - O tipo do valor retornado pela função
|
|
83
|
+
* @param fn - A função a ser debounced
|
|
84
|
+
* @param delay - O tempo em milissegundos para aguardar antes da execução
|
|
85
|
+
* @returns Uma versão debounced da função original
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* // Debounce para busca em tempo real
|
|
90
|
+
* const searchAPI = debounce(async (query: string) => {
|
|
91
|
+
* const results = await fetch(`/api/search?q=${query}`);
|
|
92
|
+
* return results.json();
|
|
93
|
+
* }, 300);
|
|
94
|
+
*
|
|
95
|
+
* // Uso em input de busca
|
|
96
|
+
* const handleSearchInput = (event: ChangeEvent<HTMLInputElement>) => {
|
|
97
|
+
* searchAPI(event.target.value);
|
|
98
|
+
* };
|
|
99
|
+
*
|
|
100
|
+
* // Debounce para redimensionamento de janela
|
|
101
|
+
* const handleResize = debounce(() => {
|
|
102
|
+
* console.log('Janela redimensionada:', window.innerWidth);
|
|
103
|
+
* updateLayout();
|
|
104
|
+
* }, 250);
|
|
105
|
+
*
|
|
106
|
+
* window.addEventListener('resize', handleResize);
|
|
107
|
+
*
|
|
108
|
+
* // Debounce para validação de formulário
|
|
109
|
+
* const validateField = debounce((value: string) => {
|
|
110
|
+
* if (value.length < 3) {
|
|
111
|
+
* setError('Mínimo 3 caracteres');
|
|
112
|
+
* } else {
|
|
113
|
+
* setError('');
|
|
114
|
+
* }
|
|
115
|
+
* }, 500);
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare const debounce: <T extends unknown[], R>(fn: (...args: T) => R, delay: number) => (...args: T) => void;
|
|
119
|
+
|
|
120
|
+
export { debounce, defer, eager };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define uma propriedade aninhada em um objeto usando notação de ponto
|
|
3
|
+
* @param obj - O objeto onde definir a propriedade
|
|
4
|
+
* @param path - O caminho da propriedade usando notação de ponto (ex: 'a.b.c')
|
|
5
|
+
* @param value - O valor a ser definido
|
|
6
|
+
*/
|
|
7
|
+
declare const setNestedProperty: (obj: Record<string, unknown>, path: string, value: unknown) => void;
|
|
8
|
+
|
|
9
|
+
export { setNestedProperty };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as setNestedProperty } from '../chunk-SO64ZYQB.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zydon/common",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.43",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -91,7 +91,6 @@
|
|
|
91
91
|
"@testing-library/user-event": "14.5.2",
|
|
92
92
|
"@types/color": "^3.0.6",
|
|
93
93
|
"@types/jest": "^30.0.0",
|
|
94
|
-
"@types/lodash": "^4.17.7",
|
|
95
94
|
"@types/node": "^20.0.0",
|
|
96
95
|
"@types/react": "^18.3.4",
|
|
97
96
|
"@types/react-color": "^3.0.13",
|
|
@@ -135,11 +134,11 @@
|
|
|
135
134
|
"embla-carousel-react": "^8.2.0",
|
|
136
135
|
"framer-motion": "^11.3.30",
|
|
137
136
|
"hugeicons-react": "^0.3.0",
|
|
138
|
-
"lodash": "^4.17.21",
|
|
139
137
|
"react-color": "^2.19.3",
|
|
140
138
|
"react-cropper": "^2.3.3",
|
|
141
139
|
"react-dropzone": "^14.2.3",
|
|
142
140
|
"react-easy-crop": "^5.5.0",
|
|
141
|
+
"react-fast-compare": "^3.2.2",
|
|
143
142
|
"react-imask": "^7.6.1",
|
|
144
143
|
"react-number-format": "^5.4.0",
|
|
145
144
|
"react-window": "^1.8.10",
|
package/dist/chunk-VVMQMROT.js
DELETED
package/dist/chunk-XI2QTFJA.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-GUFT6XPG.js';
|
|
2
|
-
import { a as a$1, e } from './chunk-BH5YHBAI.js';
|
|
3
|
-
import { a as a$3, b as b$1 } from './chunk-OSDHZZEM.js';
|
|
4
|
-
import { q, s, a as a$2 } from './chunk-FDP5MHVS.js';
|
|
5
|
-
import { c } from './chunk-D27ND54J.js';
|
|
6
|
-
import A from '@mui/material/CssBaseline';
|
|
7
|
-
import { Experimental_CssVarsProvider, experimental_extendTheme, lighten, darken } from '@mui/material/styles';
|
|
8
|
-
import S from 'lodash/set';
|
|
9
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
var y={modeStorageKey:"theme-mode",defaultMode:"light"};var g={};var b=e=>({lighter:lighten(e,.815),light:lighten(e,.225),main:e,dark:darken(e,.15),darker:darken(e,.35),contrastText:"#000"});function P(e$1,t,m=""){let o=b(t.primaryColor);S(q,"dark.palette.primary",o),S(q,"light.palette.primary",o);let i={colorSchemes:q,shadows:a$1(t.colorScheme),customShadows:s(t.colorScheme,o.main),shape:{borderRadius:8},components:a$2,typography:{...e,fontFamily:c(t.fontFamily)},cssVarPrefix:m,shouldSkipGeneratingVar:k},r=a$3(i,t);return experimental_extendTheme(r,e$1,b$1(t),g)}function k(e,t){let m=["mixins","overlays","direction","breakpoints","cssVarPrefix","unstable_sxConfig","typography"],o={global:["tonalOffset","dividerChannel","contrastThreshold"],grey:["A100","A200","A400","A700"],text:["icon"]};if(e[0]==="palette"){let r=e[1],s=o[r]||o.global;return e.some(x=>s?.includes(x))}return e.some(r=>m?.includes(r))}var V=({primaryColor:e,children:t,colorScheme:m="light",contrast:o="default",cssVarPrefix:i})=>{let r=P(a[1].systemValue,{primaryColor:e,colorScheme:m,contrast:o,navLayout:"vertical",navColor:"integrate",compactLayout:!0,fontFamily:"Public Sans"},i);return jsxs(Experimental_CssVarsProvider,{theme:r,defaultMode:"light",defaultColorScheme:"light",modeStorageKey:y.modeStorageKey,children:[jsx(A,{}),t]})},I=V;
|
|
12
|
-
|
|
13
|
-
export { I as a };
|