@kopexa/shared-utils 17.0.46 → 17.0.48

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/dom.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ declare function isHTMLElement(n: unknown): n is HTMLElement;
2
+
3
+ export { isHTMLElement };
package/dist/dom.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare function isHTMLElement(n: unknown): n is HTMLElement;
2
+
3
+ export { isHTMLElement };
package/dist/dom.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/dom.ts
21
+ var dom_exports = {};
22
+ __export(dom_exports, {
23
+ isHTMLElement: () => isHTMLElement
24
+ });
25
+ module.exports = __toCommonJS(dom_exports);
26
+ function isHTMLElement(n) {
27
+ return n instanceof HTMLElement;
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ isHTMLElement
32
+ });
package/dist/dom.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // src/dom.ts
2
+ function isHTMLElement(n) {
3
+ return n instanceof HTMLElement;
4
+ }
5
+ export {
6
+ isHTMLElement
7
+ };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isObject } from './assertion.mjs';
2
2
  export { cn } from './clsx.mjs';
3
+ export { isHTMLElement } from './dom.mjs';
3
4
  export { callAllHandlers, getUniqueID } from './functions.mjs';
4
5
  export { clamp, formatBytes } from './numbers.mjs';
5
- export { compact, mapPropsVariants, objectToDeps } from './object.mjs';
6
+ export { compact, mapPropsVariants, objectToDeps, safeClosest } from './object.mjs';
6
7
  export { chain } from './ra.mjs';
7
8
  export { MAC_SYMBOLS, formatShortcutKey, isMac, parseShortcutKeys } from './system.mjs';
8
9
  export { getInitials, safeText } from './text.mjs';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { ariaAttr, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isObject } from './assertion.js';
2
2
  export { cn } from './clsx.js';
3
+ export { isHTMLElement } from './dom.js';
3
4
  export { callAllHandlers, getUniqueID } from './functions.js';
4
5
  export { clamp, formatBytes } from './numbers.js';
5
- export { compact, mapPropsVariants, objectToDeps } from './object.js';
6
+ export { compact, mapPropsVariants, objectToDeps, safeClosest } from './object.js';
6
7
  export { chain } from './ra.js';
7
8
  export { MAC_SYMBOLS, formatShortcutKey, isMac, parseShortcutKeys } from './system.js';
8
9
  export { getInitials, safeText } from './text.js';
package/dist/index.js CHANGED
@@ -36,11 +36,13 @@ __export(index_exports, {
36
36
  isEmpty: () => isEmpty,
37
37
  isEmptyArray: () => isEmptyArray,
38
38
  isEmptyObject: () => isEmptyObject,
39
+ isHTMLElement: () => isHTMLElement,
39
40
  isMac: () => isMac,
40
41
  isObject: () => isObject,
41
42
  mapPropsVariants: () => mapPropsVariants,
42
43
  objectToDeps: () => objectToDeps,
43
44
  parseShortcutKeys: () => parseShortcutKeys,
45
+ safeClosest: () => safeClosest,
44
46
  safeText: () => safeText
45
47
  });
46
48
  module.exports = __toCommonJS(index_exports);
@@ -75,6 +77,11 @@ function cn(...inputs) {
75
77
  return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
76
78
  }
77
79
 
80
+ // src/dom.ts
81
+ function isHTMLElement(n) {
82
+ return n instanceof HTMLElement;
83
+ }
84
+
78
85
  // src/functions.ts
79
86
  function getUniqueID(prefix) {
80
87
  return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
@@ -137,6 +144,10 @@ function objectToDeps(obj) {
137
144
  return "";
138
145
  }
139
146
  }
147
+ function safeClosest(start, selector) {
148
+ var _a, _b;
149
+ return (_b = (_a = start == null ? void 0 : start.closest) == null ? void 0 : _a.call(start, selector)) != null ? _b : null;
150
+ }
140
151
 
141
152
  // src/ra.ts
142
153
  function chain(...callbacks) {
@@ -220,10 +231,12 @@ var getInitials = (text) => {
220
231
  isEmpty,
221
232
  isEmptyArray,
222
233
  isEmptyObject,
234
+ isHTMLElement,
223
235
  isMac,
224
236
  isObject,
225
237
  mapPropsVariants,
226
238
  objectToDeps,
227
239
  parseShortcutKeys,
240
+ safeClosest,
228
241
  safeText
229
242
  });
package/dist/index.mjs CHANGED
@@ -28,6 +28,11 @@ function cn(...inputs) {
28
28
  return twMerge(clsx(inputs));
29
29
  }
30
30
 
31
+ // src/dom.ts
32
+ function isHTMLElement(n) {
33
+ return n instanceof HTMLElement;
34
+ }
35
+
31
36
  // src/functions.ts
32
37
  function getUniqueID(prefix) {
33
38
  return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
@@ -90,6 +95,10 @@ function objectToDeps(obj) {
90
95
  return "";
91
96
  }
92
97
  }
98
+ function safeClosest(start, selector) {
99
+ var _a, _b;
100
+ return (_b = (_a = start == null ? void 0 : start.closest) == null ? void 0 : _a.call(start, selector)) != null ? _b : null;
101
+ }
93
102
 
94
103
  // src/ra.ts
95
104
  function chain(...callbacks) {
@@ -172,10 +181,12 @@ export {
172
181
  isEmpty,
173
182
  isEmptyArray,
174
183
  isEmptyObject,
184
+ isHTMLElement,
175
185
  isMac,
176
186
  isObject,
177
187
  mapPropsVariants,
178
188
  objectToDeps,
179
189
  parseShortcutKeys,
190
+ safeClosest,
180
191
  safeText
181
192
  };
package/dist/object.d.mts CHANGED
@@ -19,5 +19,6 @@ declare const mapPropsVariants: <T extends Record<string, any>, K extends keyof
19
19
  * objectToDeps(undefined); // returns ""
20
20
  */
21
21
  declare function objectToDeps(obj: Extractable): string;
22
+ declare function safeClosest<T extends Element>(start: Element | null, selector: string): T | null;
22
23
 
23
- export { compact, mapPropsVariants, objectToDeps };
24
+ export { compact, mapPropsVariants, objectToDeps, safeClosest };
package/dist/object.d.ts CHANGED
@@ -19,5 +19,6 @@ declare const mapPropsVariants: <T extends Record<string, any>, K extends keyof
19
19
  * objectToDeps(undefined); // returns ""
20
20
  */
21
21
  declare function objectToDeps(obj: Extractable): string;
22
+ declare function safeClosest<T extends Element>(start: Element | null, selector: string): T | null;
22
23
 
23
- export { compact, mapPropsVariants, objectToDeps };
24
+ export { compact, mapPropsVariants, objectToDeps, safeClosest };
package/dist/object.js CHANGED
@@ -22,7 +22,8 @@ var object_exports = {};
22
22
  __export(object_exports, {
23
23
  compact: () => compact,
24
24
  mapPropsVariants: () => mapPropsVariants,
25
- objectToDeps: () => objectToDeps
25
+ objectToDeps: () => objectToDeps,
26
+ safeClosest: () => safeClosest
26
27
  });
27
28
  module.exports = __toCommonJS(object_exports);
28
29
  function compact(object) {
@@ -60,9 +61,14 @@ function objectToDeps(obj) {
60
61
  return "";
61
62
  }
62
63
  }
64
+ function safeClosest(start, selector) {
65
+ var _a, _b;
66
+ return (_b = (_a = start == null ? void 0 : start.closest) == null ? void 0 : _a.call(start, selector)) != null ? _b : null;
67
+ }
63
68
  // Annotate the CommonJS export names for ESM import in node:
64
69
  0 && (module.exports = {
65
70
  compact,
66
71
  mapPropsVariants,
67
- objectToDeps
72
+ objectToDeps,
73
+ safeClosest
68
74
  });
package/dist/object.mjs CHANGED
@@ -34,8 +34,13 @@ function objectToDeps(obj) {
34
34
  return "";
35
35
  }
36
36
  }
37
+ function safeClosest(start, selector) {
38
+ var _a, _b;
39
+ return (_b = (_a = start == null ? void 0 : start.closest) == null ? void 0 : _a.call(start, selector)) != null ? _b : null;
40
+ }
37
41
  export {
38
42
  compact,
39
43
  mapPropsVariants,
40
- objectToDeps
44
+ objectToDeps,
45
+ safeClosest
41
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopexa/shared-utils",
3
- "version": "17.0.46",
3
+ "version": "17.0.48",
4
4
  "description": "A set of kopexa shared utilities",
5
5
  "keywords": [
6
6
  "system"