@leancodepl/utils 10.4.0 → 10.5.1
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/CHANGELOG.md +9 -0
- package/dist/index.js +6 -6
- package/dist/index.umd.cjs +1 -1
- package/dist/lib/valueContext.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [10.5.1](https://github.com/leancodepl/js_corelibrary/compare/v10.4.0...v10.5.1) (2026-07-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @leancodepl/utils
|
|
9
|
+
|
|
10
|
+
# Change Log
|
|
11
|
+
|
|
12
|
+
All notable changes to this project will be documented in this file. See
|
|
13
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
14
|
+
|
|
6
15
|
# [10.4.0](https://github.com/leancodepl/js_corelibrary/compare/v10.3.1...v10.4.0) (2026-06-23)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @leancodepl/utils
|
package/dist/index.js
CHANGED
|
@@ -71,12 +71,12 @@ function O(n, t) {
|
|
|
71
71
|
return C(n, t), n;
|
|
72
72
|
}
|
|
73
73
|
function l(n, t) {
|
|
74
|
-
return n.length === 0 ? "" : t(n
|
|
74
|
+
return n.length === 0 ? "" : t(n.charAt(0)) + n.slice(1);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function h(n) {
|
|
77
77
|
return l(n, (t) => t.toLowerCase());
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function T(n) {
|
|
80
80
|
return l(n, (t) => t.toUpperCase());
|
|
81
81
|
}
|
|
82
82
|
function s(n, t) {
|
|
@@ -84,7 +84,7 @@ function s(n, t) {
|
|
|
84
84
|
if (Array.isArray(n))
|
|
85
85
|
return n.map((e) => s(e, t));
|
|
86
86
|
if (typeof n == "object") {
|
|
87
|
-
const e = t === "capitalize" ?
|
|
87
|
+
const e = t === "capitalize" ? T : h;
|
|
88
88
|
return Object.entries(n).reduce(
|
|
89
89
|
(r, [o, i]) => ({ ...r, [e(o)]: s(i, t) }),
|
|
90
90
|
{}
|
|
@@ -126,8 +126,8 @@ export {
|
|
|
126
126
|
E as ensureNotEmpty,
|
|
127
127
|
O as ensureNotNull,
|
|
128
128
|
V as mkValueContext,
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
h as toLowerFirst,
|
|
130
|
+
T as toUpperFirst,
|
|
131
131
|
P as uncapitalizeDeep,
|
|
132
132
|
I as useBoundRunInTask,
|
|
133
133
|
L as useDialog,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("tiny-invariant"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","tiny-invariant","react/jsx-runtime","react"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t["@leancodepl/utils"]={},t.invariant,t.jsxRuntime,t.react))})(this,(function(t,r,g,o){"use strict";function f(){const[n,e]=o.useState(0),u=o.useCallback(async i=>{e(s=>s+1);try{return await i()}finally{e(s=>s-1)}},[]);return[n>0,u]}function C(n){const[e,u]=f(),i=o.useMemo(()=>n?(...s)=>u(()=>n(...s)):void 0,[n,u]);return[e,i]}function l(n){return[o.useCallback(()=>n(!0),[n]),o.useCallback(()=>n(!1),[n])]}function R(n){const[e,u]=o.useState(!1),[i,s]=l(u),c=o.useCallback(()=>{s(),n&&setTimeout(n)},[s,n]);return{isDialogOpen:e,openDialog:i,closeDialog:c}}function T(n){const e=[];for(const u in n){const i=n[u];(Array.isArray(i)?i.some(s=>s!==null):i!==null)&&e.push(u)}return e}function j(n,e,u){const[i,s]=o.useState(n);(u?!u(n,i):n!==i)&&(s(n),e(n))}function N(n,e){return Object.fromEntries(Object.entries(n).map(([u,i])=>[`${e}${u}`,i]))}function d(n,e){r(n!==void 0,e)}function y(n,e){r(n!=null,e)}function m(n,e){r(n!==null,e)}function k(n,e={}){if(typeof n=="string"){const{name:u}=e,i=document.createElement("a");i.href=n,i.target="_blank",u&&(i.download=u),i.click()}else{const u=URL.createObjectURL(n);k(u,e),URL.revokeObjectURL(u)}}function h(n,e){return d(n,e),n}function b(n,e){return y(n,e),n}function E(n,e){return m(n,e),n}function p(n,e){return n.length===0?"":e(n
|
|
1
|
+
(function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("tiny-invariant"),require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","tiny-invariant","react/jsx-runtime","react"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t["@leancodepl/utils"]={},t.invariant,t.jsxRuntime,t.react))})(this,(function(t,r,g,o){"use strict";function f(){const[n,e]=o.useState(0),u=o.useCallback(async i=>{e(s=>s+1);try{return await i()}finally{e(s=>s-1)}},[]);return[n>0,u]}function C(n){const[e,u]=f(),i=o.useMemo(()=>n?(...s)=>u(()=>n(...s)):void 0,[n,u]);return[e,i]}function l(n){return[o.useCallback(()=>n(!0),[n]),o.useCallback(()=>n(!1),[n])]}function R(n){const[e,u]=o.useState(!1),[i,s]=l(u),c=o.useCallback(()=>{s(),n&&setTimeout(n)},[s,n]);return{isDialogOpen:e,openDialog:i,closeDialog:c}}function T(n){const e=[];for(const u in n){const i=n[u];(Array.isArray(i)?i.some(s=>s!==null):i!==null)&&e.push(u)}return e}function j(n,e,u){const[i,s]=o.useState(n);(u?!u(n,i):n!==i)&&(s(n),e(n))}function N(n,e){return Object.fromEntries(Object.entries(n).map(([u,i])=>[`${e}${u}`,i]))}function d(n,e){r(n!==void 0,e)}function y(n,e){r(n!=null,e)}function m(n,e){r(n!==null,e)}function k(n,e={}){if(typeof n=="string"){const{name:u}=e,i=document.createElement("a");i.href=n,i.target="_blank",u&&(i.download=u),i.click()}else{const u=URL.createObjectURL(n);k(u,e),URL.revokeObjectURL(u)}}function h(n,e){return d(n,e),n}function b(n,e){return y(n,e),n}function E(n,e){return m(n,e),n}function p(n,e){return n.length===0?"":e(n.charAt(0))+n.slice(1)}function D(n){return p(n,e=>e.toLowerCase())}function S(n){return p(n,e=>e.toUpperCase())}function a(n,e){if(n!=null){if(Array.isArray(n))return n.map(u=>a(u,e));if(typeof n=="object"){const u=e==="capitalize"?S:D;return Object.entries(n).reduce((i,[s,c])=>({...i,[u(s)]:a(c,e)}),{})}return n}}function I(n){return a(n,"uncapitalize")}function w(n){return a(n,"capitalize")}function z(){const n=o.createContext([void 0,()=>{}]);function e(){return o.useContext(n)}return e.Provider=function({children:i,initialValue:s}){const c=o.useState(s);return g.jsx(n.Provider,{value:c,children:i})},e.set=function(i){const[,s]=e();o.useEffect(()=>{s(i)},[s,i]),o.useEffect(()=>()=>s(void 0),[s])},e}t.addPrefix=N,t.assertDefined=d,t.assertNotEmpty=y,t.assertNotNull=m,t.capitalizeDeep=w,t.downloadFile=k,t.ensureDefined=h,t.ensureNotEmpty=b,t.ensureNotNull=E,t.mkValueContext=z,t.toLowerFirst=D,t.toUpperFirst=S,t.uncapitalizeDeep=I,t.useBoundRunInTask=C,t.useDialog=R,t.useKeyByRoute=T,t.useRunInTask=f,t.useSetUnset=l,t.useSyncState=j,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -46,7 +46,7 @@ type ProviderProps<T> = {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function mkValueContext<T>(): {
|
|
48
48
|
(): ValueContextData<T>;
|
|
49
|
-
Provider({ children, initialValue }: ProviderProps<T>): import("react
|
|
49
|
+
Provider({ children, initialValue }: ProviderProps<T>): import("react").JSX.Element;
|
|
50
50
|
set(value: T | undefined): void;
|
|
51
51
|
};
|
|
52
52
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/utils",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=22.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leancodepl/api-date": "10.
|
|
25
|
+
"@leancodepl/api-date": "10.5.1",
|
|
26
26
|
"tiny-invariant": ">=1.3.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|