@mwakidenis/logx-react 0.0.0-stage → 0.1.0
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 +18 -0
- package/LICENSE +23 -0
- package/README.md +151 -3
- package/dist/components/index.d.mts +71 -0
- package/dist/components/index.d.ts +71 -0
- package/dist/components/index.js +268 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +262 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +316 -0
- package/dist/hooks/index.d.ts +316 -0
- package/dist/hooks/index.js +638 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +615 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/storage/index.d.mts +40 -0
- package/dist/hooks/storage/index.d.ts +40 -0
- package/dist/hooks/storage/index.js +119 -0
- package/dist/hooks/storage/index.js.map +1 -0
- package/dist/hooks/storage/index.mjs +116 -0
- package/dist/hooks/storage/index.mjs.map +1 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1066 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +974 -0
- package/dist/index.mjs.map +1 -0
- package/dist/providers/LogxProvider.d.mts +134 -0
- package/dist/providers/LogxProvider.d.ts +134 -0
- package/dist/providers/LogxProvider.js +117 -0
- package/dist/providers/LogxProvider.js.map +1 -0
- package/dist/providers/LogxProvider.mjs +114 -0
- package/dist/providers/LogxProvider.mjs.map +1 -0
- package/dist/types/index.d.mts +87 -0
- package/dist/types/index.d.ts +87 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utilities/index.d.mts +140 -0
- package/dist/utilities/index.d.ts +140 -0
- package/dist/utilities/index.js +167 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/index.mjs +104 -0
- package/dist/utilities/index.mjs.map +1 -0
- package/package.json +127 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/logx.ts","../../src/providers/LogxProvider.tsx"],"names":["addDays","camelCase","capitalize","chunk","clamp","clone","compact","logxDebounce","deepClone","difference","drop","entries","escapeHtml","first","flatten","flattenDeep","get","has","logxHasLocalStorage","logxHasSessionStorage","inRange","intersection","invert","isArray","isBoolean","logxIsBrowser","isEmail","isEmpty","isFunction","isNil","logxIsNode","isNull","isNumber","isObject","isString","isURL","isValidDate","kebabCase","keys","last","logxLocalStorageHelpers","mapKeys","mapValues","merge","omit","partition","pascalCase","percentage","pick","randomInt","retry","round","logxSafeStorage","sample","logxSessionStorageHelpers","set","shuffle","sleep","snakeCase","take","logxThrottle","timeout","trim","truncate","union","unique","values","withTimeout","createContext","jsx","useContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,YAAA,GAAA,EAAA;AAAA,QAAA,CAAA,YAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAAA,YAAA;AAAA,EAAA,SAAA,EAAA,MAAAC,gBAAA;AAAA,EAAA,UAAA,EAAA,MAAAC,iBAAA;AAAA,EAAA,KAAA,EAAA,MAAAC,WAAA;AAAA,EAAA,KAAA,EAAA,MAAAC,YAAA;AAAA,EAAA,KAAA,EAAA,MAAAC,YAAA;AAAA,EAAA,OAAA,EAAA,MAAAC,aAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,QAAA,EAAA,MAAAC,kBAAA;AAAA,EAAA,SAAA,EAAA,MAAAC,gBAAA;AAAA,EAAA,UAAA,EAAA,MAAAC,gBAAA;AAAA,EAAA,IAAA,EAAA,MAAAC,UAAA;AAAA,EAAA,OAAA,EAAA,MAAAC,cAAA;AAAA,EAAA,UAAA,EAAA,MAAAC,iBAAA;AAAA,EAAA,KAAA,EAAA,MAAAC,WAAA;AAAA,EAAA,OAAA,EAAA,MAAAC,aAAA;AAAA,EAAA,WAAA,E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AAAQ,GACnC;AACF;ACzLA,IAAM,WAAA,GAAc6D,oBAAuC,IAAI,CAAA;AAWxD,SAAS,YAAA,CAAa,EAAE,QAAA,EAAS,EAAyC;AAC/E,EAAA,uBACEC,cAAA,CAAC,YAAY,QAAA,EAAZ,EAAqB,OAAO,EAAE,IAAA,EAAA,YAAA,IAC5B,QAAA,EACH,CAAA;AAEJ;AAMO,SAAS,OAAA,GAAmC;AACjD,EAAA,OAAOC,iBAAW,WAAW,CAAA;AAC/B","file":"LogxProvider.js","sourcesContent":["/**\r\n * LOGX integration layer.\r\n *\r\n * This module is the single place where @mwakidenis/logx is imported. Every hook,\r\n * component or utility that needs a LOGX capability imports it from here rather\r\n * than importing @mwakidenis/logx directly. That keeps React-specific behaviour\r\n * separate from core utility behaviour and makes the dependency boundary obvious.\r\n *\r\n * Only confirmed, publicly exported LOGX functions are re-exported. No LOGX\r\n * internals are copied into this project and the parent repository is not modified.\r\n */\r\n\r\nimport {\r\n debounce as logxDebounce,\r\n throttle as logxThrottle,\r\n type Cancelable,\r\n} from \"@mwakidenis/logx/function\";\r\nimport {\r\n isBrowser as logxIsBrowser,\r\n isNode as logxIsNode,\r\n hasLocalStorage as logxHasLocalStorage,\r\n hasSessionStorage as logxHasSessionStorage,\r\n localStorageHelpers as logxLocalStorageHelpers,\r\n sessionStorageHelpers as logxSessionStorageHelpers,\r\n safeStorage as logxSafeStorage,\r\n type StorageHelpers,\r\n} from \"@mwakidenis/logx/browser\";\r\nimport {\r\n isArray,\r\n isBoolean,\r\n isEmail,\r\n isEmpty,\r\n isFunction,\r\n isNil,\r\n isNull,\r\n isNumber,\r\n isObject,\r\n isString,\r\n isURL,\r\n} from \"@mwakidenis/logx/validation\";\r\nimport {\r\n clone,\r\n deepClone,\r\n entries,\r\n get,\r\n has,\r\n invert,\r\n keys,\r\n mapKeys,\r\n mapValues,\r\n merge,\r\n omit,\r\n pick,\r\n set,\r\n values,\r\n} from \"@mwakidenis/logx/object\";\r\nimport {\r\n clamp,\r\n inRange,\r\n percentage,\r\n randomInt,\r\n round,\r\n} from \"@mwakidenis/logx/number\";\r\nimport {\r\n unique,\r\n partition,\r\n compact,\r\n first,\r\n last,\r\n take,\r\n drop,\r\n shuffle,\r\n sample,\r\n chunk,\r\n flatten,\r\n flattenDeep,\r\n difference,\r\n intersection,\r\n union,\r\n} from \"@mwakidenis/logx/array\";\r\nimport { sleep, retry, withTimeout, timeout } from \"@mwakidenis/logx/async\";\r\nimport { addDays, isValidDate } from \"@mwakidenis/logx/date\";\r\nimport {\r\n escapeHtml,\r\n trim,\r\n truncate,\r\n camelCase,\r\n capitalize,\r\n kebabCase,\r\n pascalCase,\r\n snakeCase,\r\n} from \"@mwakidenis/logx/string\";\r\n\r\nexport {\r\n logxDebounce as debounce,\r\n logxThrottle as throttle,\r\n type Cancelable,\r\n logxIsBrowser as isBrowser,\r\n logxIsNode as isNode,\r\n logxHasLocalStorage as hasLocalStorage,\r\n logxHasSessionStorage as hasSessionStorage,\r\n logxLocalStorageHelpers as localStorageHelpers,\r\n logxSessionStorageHelpers as sessionStorageHelpers,\r\n logxSafeStorage as safeStorage,\r\n type StorageHelpers,\r\n isNil,\r\n isString,\r\n isNumber,\r\n isBoolean,\r\n isArray,\r\n isObject,\r\n isEmpty,\r\n isEmail,\r\n isFunction,\r\n isNull,\r\n isURL,\r\n clone,\r\n deepClone,\r\n get,\r\n set,\r\n pick,\r\n omit,\r\n merge,\r\n entries,\r\n keys,\r\n values,\r\n has,\r\n invert,\r\n mapKeys,\r\n mapValues,\r\n clamp,\r\n inRange,\r\n round,\r\n percentage,\r\n randomInt,\r\n unique,\r\n partition,\r\n compact,\r\n first,\r\n last,\r\n take,\r\n drop,\r\n shuffle,\r\n sample,\r\n chunk,\r\n flatten,\r\n flattenDeep,\r\n difference,\r\n intersection,\r\n union,\r\n sleep,\r\n retry,\r\n withTimeout,\r\n timeout,\r\n addDays,\r\n isValidDate,\r\n escapeHtml,\r\n trim,\r\n truncate,\r\n camelCase,\r\n capitalize,\r\n kebabCase,\r\n pascalCase,\r\n snakeCase,\r\n};\r\n\r\n/**\r\n * React-friendly wrapper around LOGX debounce that exposes a stable Cancelable\r\n * and validates the wait argument. Leading edge is not invoked by LOGX debounce\r\n * (trailing edge only); document this in hooks that use it.\r\n */\r\nexport interface LogxDebounceResult<F extends (...args: unknown[]) => unknown> {\r\n fn: F & Cancelable;\r\n cancel: () => void;\r\n flush: () => void;\r\n pending: () => boolean;\r\n}\r\n\r\nexport function createLogxDebounce<F extends (...args: unknown[]) => unknown>(\r\n func: F,\r\n wait: number,\r\n): LogxDebounceResult<F> {\r\n if (!Number.isFinite(wait) || wait < 0) {\r\n throw new RangeError(\"debounce: wait must be a non-negative number\");\r\n }\r\n const debounced = logxDebounce(func, wait);\r\n return {\r\n fn: debounced,\r\n cancel: () => debounced.cancel(),\r\n flush: () => debounced.flush(),\r\n pending: () => debounced.pending(),\r\n };\r\n}\r\n","import { createContext, useContext, ReactNode } from \"react\";\r\nimport * as logx from \"../internal/logx\";\r\n\r\nexport interface LogxContextValue {\r\n logx: typeof logx;\r\n}\r\n\r\nconst LogxContext = createContext<LogxContextValue | null>(null);\r\n\r\n/**\r\n * Provider that exposes the LOGX integration layer via React context.\r\n *\r\n * Wrap your application (or a subtree) so components and hooks can access\r\n * LOGX utilities through context instead of importing @mwakidenis/logx\r\n * directly. This is optional; all hooks and components work standalone.\r\n *\r\n * @param props - Component props\r\n */\r\nexport function LogxProvider({ children }: { children: ReactNode }): JSX.Element {\r\n return (\r\n <LogxContext.Provider value={{ logx }}>\r\n {children}\r\n </LogxContext.Provider>\r\n );\r\n}\r\n\r\n/**\r\n * Consume the LOGX integration layer from context.\r\n * Returns null when used outside a LogxProvider.\r\n */\r\nexport function useLogx(): LogxContextValue | null {\r\n return useContext(LogxContext);\r\n}\r\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import { throttle, debounce } from '@mwakidenis/logx/function';
|
|
3
|
+
import { sessionStorageHelpers, safeStorage, localStorageHelpers, isNode, isBrowser, hasSessionStorage, hasLocalStorage } from '@mwakidenis/logx/browser';
|
|
4
|
+
import { isURL, isString, isObject, isNumber, isNull, isNil, isFunction, isEmpty, isEmail, isBoolean, isArray } from '@mwakidenis/logx/validation';
|
|
5
|
+
import { values, set, pick, omit, merge, mapValues, mapKeys, keys, invert, has, get, entries, deepClone, clone } from '@mwakidenis/logx/object';
|
|
6
|
+
import { round, randomInt, percentage, inRange, clamp } from '@mwakidenis/logx/number';
|
|
7
|
+
import { unique, union, take, shuffle, sample, partition, last, intersection, flattenDeep, flatten, first, drop, difference, compact, chunk } from '@mwakidenis/logx/array';
|
|
8
|
+
import { withTimeout, timeout, sleep, retry } from '@mwakidenis/logx/async';
|
|
9
|
+
import { isValidDate, addDays } from '@mwakidenis/logx/date';
|
|
10
|
+
import { truncate, trim, snakeCase, pascalCase, kebabCase, escapeHtml, capitalize, camelCase } from '@mwakidenis/logx/string';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/internal/logx.ts
|
|
20
|
+
var logx_exports = {};
|
|
21
|
+
__export(logx_exports, {
|
|
22
|
+
addDays: () => addDays,
|
|
23
|
+
camelCase: () => camelCase,
|
|
24
|
+
capitalize: () => capitalize,
|
|
25
|
+
chunk: () => chunk,
|
|
26
|
+
clamp: () => clamp,
|
|
27
|
+
clone: () => clone,
|
|
28
|
+
compact: () => compact,
|
|
29
|
+
createLogxDebounce: () => createLogxDebounce,
|
|
30
|
+
debounce: () => debounce,
|
|
31
|
+
deepClone: () => deepClone,
|
|
32
|
+
difference: () => difference,
|
|
33
|
+
drop: () => drop,
|
|
34
|
+
entries: () => entries,
|
|
35
|
+
escapeHtml: () => escapeHtml,
|
|
36
|
+
first: () => first,
|
|
37
|
+
flatten: () => flatten,
|
|
38
|
+
flattenDeep: () => flattenDeep,
|
|
39
|
+
get: () => get,
|
|
40
|
+
has: () => has,
|
|
41
|
+
hasLocalStorage: () => hasLocalStorage,
|
|
42
|
+
hasSessionStorage: () => hasSessionStorage,
|
|
43
|
+
inRange: () => inRange,
|
|
44
|
+
intersection: () => intersection,
|
|
45
|
+
invert: () => invert,
|
|
46
|
+
isArray: () => isArray,
|
|
47
|
+
isBoolean: () => isBoolean,
|
|
48
|
+
isBrowser: () => isBrowser,
|
|
49
|
+
isEmail: () => isEmail,
|
|
50
|
+
isEmpty: () => isEmpty,
|
|
51
|
+
isFunction: () => isFunction,
|
|
52
|
+
isNil: () => isNil,
|
|
53
|
+
isNode: () => isNode,
|
|
54
|
+
isNull: () => isNull,
|
|
55
|
+
isNumber: () => isNumber,
|
|
56
|
+
isObject: () => isObject,
|
|
57
|
+
isString: () => isString,
|
|
58
|
+
isURL: () => isURL,
|
|
59
|
+
isValidDate: () => isValidDate,
|
|
60
|
+
kebabCase: () => kebabCase,
|
|
61
|
+
keys: () => keys,
|
|
62
|
+
last: () => last,
|
|
63
|
+
localStorageHelpers: () => localStorageHelpers,
|
|
64
|
+
mapKeys: () => mapKeys,
|
|
65
|
+
mapValues: () => mapValues,
|
|
66
|
+
merge: () => merge,
|
|
67
|
+
omit: () => omit,
|
|
68
|
+
partition: () => partition,
|
|
69
|
+
pascalCase: () => pascalCase,
|
|
70
|
+
percentage: () => percentage,
|
|
71
|
+
pick: () => pick,
|
|
72
|
+
randomInt: () => randomInt,
|
|
73
|
+
retry: () => retry,
|
|
74
|
+
round: () => round,
|
|
75
|
+
safeStorage: () => safeStorage,
|
|
76
|
+
sample: () => sample,
|
|
77
|
+
sessionStorageHelpers: () => sessionStorageHelpers,
|
|
78
|
+
set: () => set,
|
|
79
|
+
shuffle: () => shuffle,
|
|
80
|
+
sleep: () => sleep,
|
|
81
|
+
snakeCase: () => snakeCase,
|
|
82
|
+
take: () => take,
|
|
83
|
+
throttle: () => throttle,
|
|
84
|
+
timeout: () => timeout,
|
|
85
|
+
trim: () => trim,
|
|
86
|
+
truncate: () => truncate,
|
|
87
|
+
union: () => union,
|
|
88
|
+
unique: () => unique,
|
|
89
|
+
values: () => values,
|
|
90
|
+
withTimeout: () => withTimeout
|
|
91
|
+
});
|
|
92
|
+
function createLogxDebounce(func, wait) {
|
|
93
|
+
if (!Number.isFinite(wait) || wait < 0) {
|
|
94
|
+
throw new RangeError("debounce: wait must be a non-negative number");
|
|
95
|
+
}
|
|
96
|
+
const debounced = debounce(func, wait);
|
|
97
|
+
return {
|
|
98
|
+
fn: debounced,
|
|
99
|
+
cancel: () => debounced.cancel(),
|
|
100
|
+
flush: () => debounced.flush(),
|
|
101
|
+
pending: () => debounced.pending()
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
var LogxContext = createContext(null);
|
|
105
|
+
function LogxProvider({ children }) {
|
|
106
|
+
return /* @__PURE__ */ jsx(LogxContext.Provider, { value: { logx: logx_exports }, children });
|
|
107
|
+
}
|
|
108
|
+
function useLogx() {
|
|
109
|
+
return useContext(LogxContext);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { LogxProvider, useLogx };
|
|
113
|
+
//# sourceMappingURL=LogxProvider.mjs.map
|
|
114
|
+
//# sourceMappingURL=LogxProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/logx.ts","../../src/providers/LogxProvider.tsx"],"names":["logxDebounce","logxHasLocalStorage","logxHasSessionStorage","logxIsBrowser","logxIsNode","logxLocalStorageHelpers","logxSafeStorage","logxSessionStorageHelpers","logxThrottle"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAA,YAAA,GAAA,EAAA;AAAA,QAAA,CAAA,YAAA,EAAA;AAAA,EAAA,OAAA,EAAA,MAAA,OAAA;AAAA,EAAA,SAAA,EAAA,MAAA,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SAAS,kBAAA,CACd,MACA,IAAA,EACuB;AACvB,EAAA,IAAI,CAAC,MAAA,CAAO,QAAA,CAAS,IAAI,CAAA,IAAK,OAAO,CAAA,EAAG;AACtC,IAAA,MAAM,IAAI,WAAW,8CAA8C,CAAA;AAAA,EACrE;AACA,EAAA,MAAM,SAAA,GAAYR,QAAA,CAAa,IAAA,EAAM,IAAI,CAAA;AACzC,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,SAAA;AAAA,IACJ,MAAA,EAAQ,MAAM,SAAA,CAAU,MAAA,EAAO;AAAA,IAC/B,KAAA,EAAO,MAAM,SAAA,CAAU,KAAA,EAAM;AAAA,IAC7B,OAAA,EAAS,MAAM,SAAA,CAAU,OAAA;AAAQ,GACnC;AACF;ACzLA,IAAM,WAAA,GAAc,cAAuC,IAAI,CAAA;AAWxD,SAAS,YAAA,CAAa,EAAE,QAAA,EAAS,EAAyC;AAC/E,EAAA,uBACE,GAAA,CAAC,YAAY,QAAA,EAAZ,EAAqB,OAAO,EAAE,IAAA,EAAA,YAAA,IAC5B,QAAA,EACH,CAAA;AAEJ;AAMO,SAAS,OAAA,GAAmC;AACjD,EAAA,OAAO,WAAW,WAAW,CAAA;AAC/B","file":"LogxProvider.mjs","sourcesContent":["/**\r\n * LOGX integration layer.\r\n *\r\n * This module is the single place where @mwakidenis/logx is imported. Every hook,\r\n * component or utility that needs a LOGX capability imports it from here rather\r\n * than importing @mwakidenis/logx directly. That keeps React-specific behaviour\r\n * separate from core utility behaviour and makes the dependency boundary obvious.\r\n *\r\n * Only confirmed, publicly exported LOGX functions are re-exported. No LOGX\r\n * internals are copied into this project and the parent repository is not modified.\r\n */\r\n\r\nimport {\r\n debounce as logxDebounce,\r\n throttle as logxThrottle,\r\n type Cancelable,\r\n} from \"@mwakidenis/logx/function\";\r\nimport {\r\n isBrowser as logxIsBrowser,\r\n isNode as logxIsNode,\r\n hasLocalStorage as logxHasLocalStorage,\r\n hasSessionStorage as logxHasSessionStorage,\r\n localStorageHelpers as logxLocalStorageHelpers,\r\n sessionStorageHelpers as logxSessionStorageHelpers,\r\n safeStorage as logxSafeStorage,\r\n type StorageHelpers,\r\n} from \"@mwakidenis/logx/browser\";\r\nimport {\r\n isArray,\r\n isBoolean,\r\n isEmail,\r\n isEmpty,\r\n isFunction,\r\n isNil,\r\n isNull,\r\n isNumber,\r\n isObject,\r\n isString,\r\n isURL,\r\n} from \"@mwakidenis/logx/validation\";\r\nimport {\r\n clone,\r\n deepClone,\r\n entries,\r\n get,\r\n has,\r\n invert,\r\n keys,\r\n mapKeys,\r\n mapValues,\r\n merge,\r\n omit,\r\n pick,\r\n set,\r\n values,\r\n} from \"@mwakidenis/logx/object\";\r\nimport {\r\n clamp,\r\n inRange,\r\n percentage,\r\n randomInt,\r\n round,\r\n} from \"@mwakidenis/logx/number\";\r\nimport {\r\n unique,\r\n partition,\r\n compact,\r\n first,\r\n last,\r\n take,\r\n drop,\r\n shuffle,\r\n sample,\r\n chunk,\r\n flatten,\r\n flattenDeep,\r\n difference,\r\n intersection,\r\n union,\r\n} from \"@mwakidenis/logx/array\";\r\nimport { sleep, retry, withTimeout, timeout } from \"@mwakidenis/logx/async\";\r\nimport { addDays, isValidDate } from \"@mwakidenis/logx/date\";\r\nimport {\r\n escapeHtml,\r\n trim,\r\n truncate,\r\n camelCase,\r\n capitalize,\r\n kebabCase,\r\n pascalCase,\r\n snakeCase,\r\n} from \"@mwakidenis/logx/string\";\r\n\r\nexport {\r\n logxDebounce as debounce,\r\n logxThrottle as throttle,\r\n type Cancelable,\r\n logxIsBrowser as isBrowser,\r\n logxIsNode as isNode,\r\n logxHasLocalStorage as hasLocalStorage,\r\n logxHasSessionStorage as hasSessionStorage,\r\n logxLocalStorageHelpers as localStorageHelpers,\r\n logxSessionStorageHelpers as sessionStorageHelpers,\r\n logxSafeStorage as safeStorage,\r\n type StorageHelpers,\r\n isNil,\r\n isString,\r\n isNumber,\r\n isBoolean,\r\n isArray,\r\n isObject,\r\n isEmpty,\r\n isEmail,\r\n isFunction,\r\n isNull,\r\n isURL,\r\n clone,\r\n deepClone,\r\n get,\r\n set,\r\n pick,\r\n omit,\r\n merge,\r\n entries,\r\n keys,\r\n values,\r\n has,\r\n invert,\r\n mapKeys,\r\n mapValues,\r\n clamp,\r\n inRange,\r\n round,\r\n percentage,\r\n randomInt,\r\n unique,\r\n partition,\r\n compact,\r\n first,\r\n last,\r\n take,\r\n drop,\r\n shuffle,\r\n sample,\r\n chunk,\r\n flatten,\r\n flattenDeep,\r\n difference,\r\n intersection,\r\n union,\r\n sleep,\r\n retry,\r\n withTimeout,\r\n timeout,\r\n addDays,\r\n isValidDate,\r\n escapeHtml,\r\n trim,\r\n truncate,\r\n camelCase,\r\n capitalize,\r\n kebabCase,\r\n pascalCase,\r\n snakeCase,\r\n};\r\n\r\n/**\r\n * React-friendly wrapper around LOGX debounce that exposes a stable Cancelable\r\n * and validates the wait argument. Leading edge is not invoked by LOGX debounce\r\n * (trailing edge only); document this in hooks that use it.\r\n */\r\nexport interface LogxDebounceResult<F extends (...args: unknown[]) => unknown> {\r\n fn: F & Cancelable;\r\n cancel: () => void;\r\n flush: () => void;\r\n pending: () => boolean;\r\n}\r\n\r\nexport function createLogxDebounce<F extends (...args: unknown[]) => unknown>(\r\n func: F,\r\n wait: number,\r\n): LogxDebounceResult<F> {\r\n if (!Number.isFinite(wait) || wait < 0) {\r\n throw new RangeError(\"debounce: wait must be a non-negative number\");\r\n }\r\n const debounced = logxDebounce(func, wait);\r\n return {\r\n fn: debounced,\r\n cancel: () => debounced.cancel(),\r\n flush: () => debounced.flush(),\r\n pending: () => debounced.pending(),\r\n };\r\n}\r\n","import { createContext, useContext, ReactNode } from \"react\";\r\nimport * as logx from \"../internal/logx\";\r\n\r\nexport interface LogxContextValue {\r\n logx: typeof logx;\r\n}\r\n\r\nconst LogxContext = createContext<LogxContextValue | null>(null);\r\n\r\n/**\r\n * Provider that exposes the LOGX integration layer via React context.\r\n *\r\n * Wrap your application (or a subtree) so components and hooks can access\r\n * LOGX utilities through context instead of importing @mwakidenis/logx\r\n * directly. This is optional; all hooks and components work standalone.\r\n *\r\n * @param props - Component props\r\n */\r\nexport function LogxProvider({ children }: { children: ReactNode }): JSX.Element {\r\n return (\r\n <LogxContext.Provider value={{ logx }}>\r\n {children}\r\n </LogxContext.Provider>\r\n );\r\n}\r\n\r\n/**\r\n * Consume the LOGX integration layer from context.\r\n * Returns null when used outside a LogxProvider.\r\n */\r\nexport function useLogx(): LogxContextValue | null {\r\n return useContext(LogxContext);\r\n}\r\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TypeScript types for the LOGX React Toolkit.
|
|
3
|
+
*/
|
|
4
|
+
type Unsubscribe = () => void;
|
|
5
|
+
type SetValue<T> = T | ((prev: T) => T);
|
|
6
|
+
interface AsyncState<T> {
|
|
7
|
+
data: T | null;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isSuccess: boolean;
|
|
11
|
+
isError: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DebouncedValueOptions {
|
|
14
|
+
/** Delay in milliseconds before the debounced value updates. Default: 300 */
|
|
15
|
+
delay?: number;
|
|
16
|
+
/** Invoke immediately on mount/first change (leading edge). Default: false */
|
|
17
|
+
leading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface ThrottleOptions {
|
|
20
|
+
/** Delay in milliseconds between invocations. Default: 300 */
|
|
21
|
+
wait?: number;
|
|
22
|
+
/** Invoke on leading edge. Default: true */
|
|
23
|
+
leading?: boolean;
|
|
24
|
+
/** Invoke on trailing edge. Default: true */
|
|
25
|
+
trailing?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface UseLocalStorageOptions<T> {
|
|
28
|
+
/** Custom serializer. Default: JSON.stringify/JSON.parse */
|
|
29
|
+
serializer?: {
|
|
30
|
+
serialize: (value: T) => string;
|
|
31
|
+
deserialize: (raw: string | null) => T | null;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface CopyButtonProps {
|
|
35
|
+
text: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
copyingLabel?: string;
|
|
38
|
+
successLabel?: string;
|
|
39
|
+
errorLabel?: string;
|
|
40
|
+
className?: string;
|
|
41
|
+
onCopy?: (text: string) => void;
|
|
42
|
+
onError?: (error: unknown) => void;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
}
|
|
45
|
+
interface PasswordInputProps {
|
|
46
|
+
value?: string;
|
|
47
|
+
defaultValue?: string;
|
|
48
|
+
onChange?: (value: string) => void;
|
|
49
|
+
label?: string;
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
required?: boolean;
|
|
53
|
+
name?: string;
|
|
54
|
+
id?: string;
|
|
55
|
+
showToggle?: boolean;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
interface DebouncedInputProps {
|
|
59
|
+
value?: string;
|
|
60
|
+
defaultValue?: string;
|
|
61
|
+
onChange?: (value: string) => void;
|
|
62
|
+
onDebouncedChange?: (value: string) => void;
|
|
63
|
+
delay?: number;
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
name?: string;
|
|
67
|
+
id?: string;
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
interface ResponsiveProps {
|
|
71
|
+
children: (matches: boolean) => React.ReactNode;
|
|
72
|
+
query: string;
|
|
73
|
+
fallback?: React.ReactNode;
|
|
74
|
+
}
|
|
75
|
+
interface ErrorBoundaryProps {
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
fallback?: React.ReactNode | ((error: Error, info: React.ErrorInfo) => React.ReactNode);
|
|
78
|
+
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
79
|
+
resetKeys?: unknown[];
|
|
80
|
+
}
|
|
81
|
+
interface ErrorBoundaryState {
|
|
82
|
+
hasError: boolean;
|
|
83
|
+
error: Error | null;
|
|
84
|
+
info: React.ErrorInfo | null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type { AsyncState, CopyButtonProps, DebouncedInputProps, DebouncedValueOptions, ErrorBoundaryProps, ErrorBoundaryState, PasswordInputProps, ResponsiveProps, SetValue, ThrottleOptions, Unsubscribe, UseLocalStorageOptions };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TypeScript types for the LOGX React Toolkit.
|
|
3
|
+
*/
|
|
4
|
+
type Unsubscribe = () => void;
|
|
5
|
+
type SetValue<T> = T | ((prev: T) => T);
|
|
6
|
+
interface AsyncState<T> {
|
|
7
|
+
data: T | null;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isSuccess: boolean;
|
|
11
|
+
isError: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DebouncedValueOptions {
|
|
14
|
+
/** Delay in milliseconds before the debounced value updates. Default: 300 */
|
|
15
|
+
delay?: number;
|
|
16
|
+
/** Invoke immediately on mount/first change (leading edge). Default: false */
|
|
17
|
+
leading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface ThrottleOptions {
|
|
20
|
+
/** Delay in milliseconds between invocations. Default: 300 */
|
|
21
|
+
wait?: number;
|
|
22
|
+
/** Invoke on leading edge. Default: true */
|
|
23
|
+
leading?: boolean;
|
|
24
|
+
/** Invoke on trailing edge. Default: true */
|
|
25
|
+
trailing?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface UseLocalStorageOptions<T> {
|
|
28
|
+
/** Custom serializer. Default: JSON.stringify/JSON.parse */
|
|
29
|
+
serializer?: {
|
|
30
|
+
serialize: (value: T) => string;
|
|
31
|
+
deserialize: (raw: string | null) => T | null;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface CopyButtonProps {
|
|
35
|
+
text: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
copyingLabel?: string;
|
|
38
|
+
successLabel?: string;
|
|
39
|
+
errorLabel?: string;
|
|
40
|
+
className?: string;
|
|
41
|
+
onCopy?: (text: string) => void;
|
|
42
|
+
onError?: (error: unknown) => void;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
}
|
|
45
|
+
interface PasswordInputProps {
|
|
46
|
+
value?: string;
|
|
47
|
+
defaultValue?: string;
|
|
48
|
+
onChange?: (value: string) => void;
|
|
49
|
+
label?: string;
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
required?: boolean;
|
|
53
|
+
name?: string;
|
|
54
|
+
id?: string;
|
|
55
|
+
showToggle?: boolean;
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
interface DebouncedInputProps {
|
|
59
|
+
value?: string;
|
|
60
|
+
defaultValue?: string;
|
|
61
|
+
onChange?: (value: string) => void;
|
|
62
|
+
onDebouncedChange?: (value: string) => void;
|
|
63
|
+
delay?: number;
|
|
64
|
+
placeholder?: string;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
name?: string;
|
|
67
|
+
id?: string;
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
interface ResponsiveProps {
|
|
71
|
+
children: (matches: boolean) => React.ReactNode;
|
|
72
|
+
query: string;
|
|
73
|
+
fallback?: React.ReactNode;
|
|
74
|
+
}
|
|
75
|
+
interface ErrorBoundaryProps {
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
fallback?: React.ReactNode | ((error: Error, info: React.ErrorInfo) => React.ReactNode);
|
|
78
|
+
onError?: (error: Error, info: React.ErrorInfo) => void;
|
|
79
|
+
resetKeys?: unknown[];
|
|
80
|
+
}
|
|
81
|
+
interface ErrorBoundaryState {
|
|
82
|
+
hasError: boolean;
|
|
83
|
+
error: Error | null;
|
|
84
|
+
info: React.ErrorInfo | null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type { AsyncState, CopyButtonProps, DebouncedInputProps, DebouncedValueOptions, ErrorBoundaryProps, ErrorBoundaryState, PasswordInputProps, ResponsiveProps, SetValue, ThrottleOptions, Unsubscribe, UseLocalStorageOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { chunk as chunk$1, compact as compact$1, difference as difference$1, drop as drop$1, flatten as flatten$1, flattenDeep as flattenDeep$1, intersection as intersection$1, last as last$1, partition as partition$1, sample as sample$1, shuffle as shuffle$1, take as take$1, union as union$1, unique as unique$1 } from '@mwakidenis/logx/array';
|
|
2
|
+
import { clone as clone$1, deepClone as deepClone$1, entries as entries$1, get as get$1, has as has$1, keys as keys$1, mapKeys as mapKeys$1, mapValues as mapValues$1, merge as merge$1, omit as omit$1, pick as pick$1, set as set$1, values as values$1 } from '@mwakidenis/logx/object';
|
|
3
|
+
import { camelCase as camelCase$1, capitalize as capitalize$1, escapeHtml as escapeHtml$1, kebabCase as kebabCase$1, pascalCase as pascalCase$1, snakeCase as snakeCase$1, trim as trim$1, truncate as truncate$1 } from '@mwakidenis/logx/string';
|
|
4
|
+
import { clamp as clamp$1, inRange as inRange$1, percentage as percentage$1, randomInt as randomInt$1, round as round$1 } from '@mwakidenis/logx/number';
|
|
5
|
+
import { isArray as isArray$1, isBoolean as isBoolean$1, isEmail as isEmail$1, isEmpty as isEmpty$1, isFunction as isFunction$1, isNil as isNil$1, isNull as isNull$1, isNumber as isNumber$1, isObject as isObject$1, isString as isString$1, isURL as isURL$1 } from '@mwakidenis/logx/validation';
|
|
6
|
+
import { addDays as addDays$1, isValidDate as isValidDate$1 } from '@mwakidenis/logx/date';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Array utilities.
|
|
10
|
+
*
|
|
11
|
+
* Pure, tree-shakable wrappers around @mwakidenis/logx array functions plus a
|
|
12
|
+
* few React-oriented helpers. LOGX provides the core transformations; this
|
|
13
|
+
* module exposes them with stable, documented signatures.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
declare const chunk: typeof chunk$1;
|
|
17
|
+
declare const compact: typeof compact$1;
|
|
18
|
+
declare const difference: typeof difference$1;
|
|
19
|
+
declare const drop: typeof drop$1;
|
|
20
|
+
declare const flatten: typeof flatten$1;
|
|
21
|
+
declare const flattenDeep: typeof flattenDeep$1;
|
|
22
|
+
declare const intersection: typeof intersection$1;
|
|
23
|
+
declare const last: typeof last$1;
|
|
24
|
+
declare const partition: typeof partition$1;
|
|
25
|
+
declare const sample: typeof sample$1;
|
|
26
|
+
declare const shuffle: typeof shuffle$1;
|
|
27
|
+
declare const take: typeof take$1;
|
|
28
|
+
declare const union: typeof union$1;
|
|
29
|
+
declare const unique: typeof unique$1;
|
|
30
|
+
/**
|
|
31
|
+
* Return the first element of an array, or undefined.
|
|
32
|
+
*/
|
|
33
|
+
declare function first<T>(array: readonly T[]): T | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Remove duplicates from an array using LOGX unique.
|
|
36
|
+
*/
|
|
37
|
+
declare function distinct<T>(array: readonly T[]): T[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Object utilities.
|
|
41
|
+
*
|
|
42
|
+
* Wrappers around @mwakidenis/logx object functions with stable signatures.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
declare const clone: typeof clone$1;
|
|
46
|
+
declare const deepClone: typeof deepClone$1;
|
|
47
|
+
declare const entries: typeof entries$1;
|
|
48
|
+
declare const get: typeof get$1;
|
|
49
|
+
declare const has: typeof has$1;
|
|
50
|
+
declare const keys: typeof keys$1;
|
|
51
|
+
declare const mapKeys: typeof mapKeys$1;
|
|
52
|
+
declare const mapValues: typeof mapValues$1;
|
|
53
|
+
declare const merge: typeof merge$1;
|
|
54
|
+
declare const omit: typeof omit$1;
|
|
55
|
+
declare const pick: typeof pick$1;
|
|
56
|
+
declare const set: typeof set$1;
|
|
57
|
+
declare const values: typeof values$1;
|
|
58
|
+
/**
|
|
59
|
+
* Safely get a nested value, returning undefined when the path is missing.
|
|
60
|
+
*/
|
|
61
|
+
declare function safeGet<T>(object: unknown, path: string | Array<string | number>): T | undefined;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* String utilities.
|
|
65
|
+
*
|
|
66
|
+
* Wrappers around @mwakidenis/logx string functions plus a React-oriented
|
|
67
|
+
* HTML escaper for safe rendering.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
declare const camelCase: typeof camelCase$1;
|
|
71
|
+
declare const capitalize: typeof capitalize$1;
|
|
72
|
+
declare const escapeHtml: typeof escapeHtml$1;
|
|
73
|
+
declare const kebabCase: typeof kebabCase$1;
|
|
74
|
+
declare const pascalCase: typeof pascalCase$1;
|
|
75
|
+
declare const snakeCase: typeof snakeCase$1;
|
|
76
|
+
declare const trim: typeof trim$1;
|
|
77
|
+
declare const truncate: typeof truncate$1;
|
|
78
|
+
/**
|
|
79
|
+
* Escape HTML special characters so a string can be interpolated safely.
|
|
80
|
+
* Delegates to @mwakidenis/logx escapeHtml.
|
|
81
|
+
*/
|
|
82
|
+
declare function htmlEscape(input: string): string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Number utilities.
|
|
86
|
+
*
|
|
87
|
+
* Wrappers around @mwakidenis/logx number functions.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
declare const clamp: typeof clamp$1;
|
|
91
|
+
declare const inRange: typeof inRange$1;
|
|
92
|
+
declare const round: typeof round$1;
|
|
93
|
+
declare const percentage: typeof percentage$1;
|
|
94
|
+
declare const randomInt: typeof randomInt$1;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Validation utilities.
|
|
98
|
+
*
|
|
99
|
+
* Wrappers around @mwakidenis/logx validation functions with type-guard
|
|
100
|
+
* signatures preserved, plus React-oriented helpers.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
declare const isArray: typeof isArray$1;
|
|
104
|
+
declare const isBoolean: typeof isBoolean$1;
|
|
105
|
+
declare const isEmail: typeof isEmail$1;
|
|
106
|
+
declare const isEmpty: typeof isEmpty$1;
|
|
107
|
+
declare const isFunction: typeof isFunction$1;
|
|
108
|
+
declare const isNil: typeof isNil$1;
|
|
109
|
+
declare const isNull: typeof isNull$1;
|
|
110
|
+
declare const isNumber: typeof isNumber$1;
|
|
111
|
+
declare const isObject: typeof isObject$1;
|
|
112
|
+
declare const isString: typeof isString$1;
|
|
113
|
+
declare const isURL: typeof isURL$1;
|
|
114
|
+
/**
|
|
115
|
+
* Required-field validator: returns an error message when the value is nil or
|
|
116
|
+
* an empty string, otherwise null.
|
|
117
|
+
*/
|
|
118
|
+
declare function required(value: unknown, fieldName?: string): string | null;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Date utilities.
|
|
122
|
+
*
|
|
123
|
+
* Wrappers around @mwakidenis/logx date functions.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
declare const addDays: typeof addDays$1;
|
|
127
|
+
declare const isValidDate: typeof isValidDate$1;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Browser environment utilities.
|
|
131
|
+
*
|
|
132
|
+
* Re-exports @mwakidenis/logx browser detection helpers so consumers can
|
|
133
|
+
* write SSR-safe code without importing @mwakidenis/logx directly.
|
|
134
|
+
*/
|
|
135
|
+
declare const hasLocalStorage: boolean;
|
|
136
|
+
declare const hasSessionStorage: boolean;
|
|
137
|
+
declare const isBrowser: boolean;
|
|
138
|
+
declare const isNode: boolean;
|
|
139
|
+
|
|
140
|
+
export { addDays, camelCase, capitalize, chunk, clamp, clone, compact, deepClone, difference, distinct, drop, entries, escapeHtml, first, flatten, flattenDeep, get, has, hasLocalStorage, hasSessionStorage, htmlEscape, inRange, intersection, isArray, isBoolean, isBrowser, isEmail, isEmpty, isFunction, isNil, isNode, isNull, isNumber, isObject, isString, isURL, isValidDate, kebabCase, keys, last, mapKeys, mapValues, merge, omit, partition, pascalCase, percentage, pick, randomInt, required, round, safeGet, sample, set, shuffle, snakeCase, take, trim, truncate, union, unique, values };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { chunk as chunk$1, compact as compact$1, difference as difference$1, drop as drop$1, flatten as flatten$1, flattenDeep as flattenDeep$1, intersection as intersection$1, last as last$1, partition as partition$1, sample as sample$1, shuffle as shuffle$1, take as take$1, union as union$1, unique as unique$1 } from '@mwakidenis/logx/array';
|
|
2
|
+
import { clone as clone$1, deepClone as deepClone$1, entries as entries$1, get as get$1, has as has$1, keys as keys$1, mapKeys as mapKeys$1, mapValues as mapValues$1, merge as merge$1, omit as omit$1, pick as pick$1, set as set$1, values as values$1 } from '@mwakidenis/logx/object';
|
|
3
|
+
import { camelCase as camelCase$1, capitalize as capitalize$1, escapeHtml as escapeHtml$1, kebabCase as kebabCase$1, pascalCase as pascalCase$1, snakeCase as snakeCase$1, trim as trim$1, truncate as truncate$1 } from '@mwakidenis/logx/string';
|
|
4
|
+
import { clamp as clamp$1, inRange as inRange$1, percentage as percentage$1, randomInt as randomInt$1, round as round$1 } from '@mwakidenis/logx/number';
|
|
5
|
+
import { isArray as isArray$1, isBoolean as isBoolean$1, isEmail as isEmail$1, isEmpty as isEmpty$1, isFunction as isFunction$1, isNil as isNil$1, isNull as isNull$1, isNumber as isNumber$1, isObject as isObject$1, isString as isString$1, isURL as isURL$1 } from '@mwakidenis/logx/validation';
|
|
6
|
+
import { addDays as addDays$1, isValidDate as isValidDate$1 } from '@mwakidenis/logx/date';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Array utilities.
|
|
10
|
+
*
|
|
11
|
+
* Pure, tree-shakable wrappers around @mwakidenis/logx array functions plus a
|
|
12
|
+
* few React-oriented helpers. LOGX provides the core transformations; this
|
|
13
|
+
* module exposes them with stable, documented signatures.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
declare const chunk: typeof chunk$1;
|
|
17
|
+
declare const compact: typeof compact$1;
|
|
18
|
+
declare const difference: typeof difference$1;
|
|
19
|
+
declare const drop: typeof drop$1;
|
|
20
|
+
declare const flatten: typeof flatten$1;
|
|
21
|
+
declare const flattenDeep: typeof flattenDeep$1;
|
|
22
|
+
declare const intersection: typeof intersection$1;
|
|
23
|
+
declare const last: typeof last$1;
|
|
24
|
+
declare const partition: typeof partition$1;
|
|
25
|
+
declare const sample: typeof sample$1;
|
|
26
|
+
declare const shuffle: typeof shuffle$1;
|
|
27
|
+
declare const take: typeof take$1;
|
|
28
|
+
declare const union: typeof union$1;
|
|
29
|
+
declare const unique: typeof unique$1;
|
|
30
|
+
/**
|
|
31
|
+
* Return the first element of an array, or undefined.
|
|
32
|
+
*/
|
|
33
|
+
declare function first<T>(array: readonly T[]): T | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Remove duplicates from an array using LOGX unique.
|
|
36
|
+
*/
|
|
37
|
+
declare function distinct<T>(array: readonly T[]): T[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Object utilities.
|
|
41
|
+
*
|
|
42
|
+
* Wrappers around @mwakidenis/logx object functions with stable signatures.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
declare const clone: typeof clone$1;
|
|
46
|
+
declare const deepClone: typeof deepClone$1;
|
|
47
|
+
declare const entries: typeof entries$1;
|
|
48
|
+
declare const get: typeof get$1;
|
|
49
|
+
declare const has: typeof has$1;
|
|
50
|
+
declare const keys: typeof keys$1;
|
|
51
|
+
declare const mapKeys: typeof mapKeys$1;
|
|
52
|
+
declare const mapValues: typeof mapValues$1;
|
|
53
|
+
declare const merge: typeof merge$1;
|
|
54
|
+
declare const omit: typeof omit$1;
|
|
55
|
+
declare const pick: typeof pick$1;
|
|
56
|
+
declare const set: typeof set$1;
|
|
57
|
+
declare const values: typeof values$1;
|
|
58
|
+
/**
|
|
59
|
+
* Safely get a nested value, returning undefined when the path is missing.
|
|
60
|
+
*/
|
|
61
|
+
declare function safeGet<T>(object: unknown, path: string | Array<string | number>): T | undefined;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* String utilities.
|
|
65
|
+
*
|
|
66
|
+
* Wrappers around @mwakidenis/logx string functions plus a React-oriented
|
|
67
|
+
* HTML escaper for safe rendering.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
declare const camelCase: typeof camelCase$1;
|
|
71
|
+
declare const capitalize: typeof capitalize$1;
|
|
72
|
+
declare const escapeHtml: typeof escapeHtml$1;
|
|
73
|
+
declare const kebabCase: typeof kebabCase$1;
|
|
74
|
+
declare const pascalCase: typeof pascalCase$1;
|
|
75
|
+
declare const snakeCase: typeof snakeCase$1;
|
|
76
|
+
declare const trim: typeof trim$1;
|
|
77
|
+
declare const truncate: typeof truncate$1;
|
|
78
|
+
/**
|
|
79
|
+
* Escape HTML special characters so a string can be interpolated safely.
|
|
80
|
+
* Delegates to @mwakidenis/logx escapeHtml.
|
|
81
|
+
*/
|
|
82
|
+
declare function htmlEscape(input: string): string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Number utilities.
|
|
86
|
+
*
|
|
87
|
+
* Wrappers around @mwakidenis/logx number functions.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
declare const clamp: typeof clamp$1;
|
|
91
|
+
declare const inRange: typeof inRange$1;
|
|
92
|
+
declare const round: typeof round$1;
|
|
93
|
+
declare const percentage: typeof percentage$1;
|
|
94
|
+
declare const randomInt: typeof randomInt$1;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Validation utilities.
|
|
98
|
+
*
|
|
99
|
+
* Wrappers around @mwakidenis/logx validation functions with type-guard
|
|
100
|
+
* signatures preserved, plus React-oriented helpers.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
declare const isArray: typeof isArray$1;
|
|
104
|
+
declare const isBoolean: typeof isBoolean$1;
|
|
105
|
+
declare const isEmail: typeof isEmail$1;
|
|
106
|
+
declare const isEmpty: typeof isEmpty$1;
|
|
107
|
+
declare const isFunction: typeof isFunction$1;
|
|
108
|
+
declare const isNil: typeof isNil$1;
|
|
109
|
+
declare const isNull: typeof isNull$1;
|
|
110
|
+
declare const isNumber: typeof isNumber$1;
|
|
111
|
+
declare const isObject: typeof isObject$1;
|
|
112
|
+
declare const isString: typeof isString$1;
|
|
113
|
+
declare const isURL: typeof isURL$1;
|
|
114
|
+
/**
|
|
115
|
+
* Required-field validator: returns an error message when the value is nil or
|
|
116
|
+
* an empty string, otherwise null.
|
|
117
|
+
*/
|
|
118
|
+
declare function required(value: unknown, fieldName?: string): string | null;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Date utilities.
|
|
122
|
+
*
|
|
123
|
+
* Wrappers around @mwakidenis/logx date functions.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
declare const addDays: typeof addDays$1;
|
|
127
|
+
declare const isValidDate: typeof isValidDate$1;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Browser environment utilities.
|
|
131
|
+
*
|
|
132
|
+
* Re-exports @mwakidenis/logx browser detection helpers so consumers can
|
|
133
|
+
* write SSR-safe code without importing @mwakidenis/logx directly.
|
|
134
|
+
*/
|
|
135
|
+
declare const hasLocalStorage: boolean;
|
|
136
|
+
declare const hasSessionStorage: boolean;
|
|
137
|
+
declare const isBrowser: boolean;
|
|
138
|
+
declare const isNode: boolean;
|
|
139
|
+
|
|
140
|
+
export { addDays, camelCase, capitalize, chunk, clamp, clone, compact, deepClone, difference, distinct, drop, entries, escapeHtml, first, flatten, flattenDeep, get, has, hasLocalStorage, hasSessionStorage, htmlEscape, inRange, intersection, isArray, isBoolean, isBrowser, isEmail, isEmpty, isFunction, isNil, isNode, isNull, isNumber, isObject, isString, isURL, isValidDate, kebabCase, keys, last, mapKeys, mapValues, merge, omit, partition, pascalCase, percentage, pick, randomInt, required, round, safeGet, sample, set, shuffle, snakeCase, take, trim, truncate, union, unique, values };
|