@kopexa/shared-utils 0.0.0 → 1.0.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.
@@ -0,0 +1,5 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ declare function cn(...inputs: ClassValue[]): string;
4
+
5
+ export { cn };
package/dist/clsx.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { ClassValue } from 'clsx';
2
+
3
+ declare function cn(...inputs: ClassValue[]): string;
4
+
5
+ export { cn };
package/dist/clsx.js ADDED
@@ -0,0 +1,34 @@
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/clsx.ts
21
+ var clsx_exports = {};
22
+ __export(clsx_exports, {
23
+ cn: () => cn
24
+ });
25
+ module.exports = __toCommonJS(clsx_exports);
26
+ var import_clsx = require("clsx");
27
+ var import_tailwind_merge = require("tailwind-merge");
28
+ function cn(...inputs) {
29
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ cn
34
+ });
package/dist/clsx.mjs ADDED
@@ -0,0 +1,9 @@
1
+ // src/clsx.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+ export {
8
+ cn
9
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates a unique identifier using a specified prefix and a random number.
3
+ *
4
+ * @param prefix - The prefix to prepend to the unique identifier.
5
+ * @returns A string that combines the prefix and a random number.
6
+ *
7
+ * @example
8
+ * getUniqueID('btn'); // returns 'btn-123456'
9
+ */
10
+ declare function getUniqueID(prefix: string): string;
11
+
12
+ export { getUniqueID };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates a unique identifier using a specified prefix and a random number.
3
+ *
4
+ * @param prefix - The prefix to prepend to the unique identifier.
5
+ * @returns A string that combines the prefix and a random number.
6
+ *
7
+ * @example
8
+ * getUniqueID('btn'); // returns 'btn-123456'
9
+ */
10
+ declare function getUniqueID(prefix: string): string;
11
+
12
+ export { getUniqueID };
@@ -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/functions.ts
21
+ var functions_exports = {};
22
+ __export(functions_exports, {
23
+ getUniqueID: () => getUniqueID
24
+ });
25
+ module.exports = __toCommonJS(functions_exports);
26
+ function getUniqueID(prefix) {
27
+ return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ getUniqueID
32
+ });
@@ -0,0 +1,7 @@
1
+ // src/functions.ts
2
+ function getUniqueID(prefix) {
3
+ return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
4
+ }
5
+ export {
6
+ getUniqueID
7
+ };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
- declare const index = "";
2
-
3
- export { index };
1
+ export { cn } from './clsx.mjs';
2
+ export { getUniqueID } from './functions.mjs';
3
+ export { clamp } from './numbers.mjs';
4
+ import 'clsx';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- declare const index = "";
2
-
3
- export { index };
1
+ export { cn } from './clsx.js';
2
+ export { getUniqueID } from './functions.js';
3
+ export { clamp } from './numbers.js';
4
+ import 'clsx';
package/dist/index.js CHANGED
@@ -20,11 +20,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- index: () => index
23
+ clamp: () => clamp,
24
+ cn: () => cn,
25
+ getUniqueID: () => getUniqueID
24
26
  });
25
27
  module.exports = __toCommonJS(index_exports);
26
- var index = "";
28
+
29
+ // src/clsx.ts
30
+ var import_clsx = require("clsx");
31
+ var import_tailwind_merge = require("tailwind-merge");
32
+ function cn(...inputs) {
33
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
34
+ }
35
+
36
+ // src/functions.ts
37
+ function getUniqueID(prefix) {
38
+ return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
39
+ }
40
+
41
+ // src/numbers.ts
42
+ function clamp(value, min, max) {
43
+ return Math.min(Math.max(value, min), max);
44
+ }
27
45
  // Annotate the CommonJS export names for ESM import in node:
28
46
  0 && (module.exports = {
29
- index
47
+ clamp,
48
+ cn,
49
+ getUniqueID
30
50
  });
package/dist/index.mjs CHANGED
@@ -1,5 +1,21 @@
1
- // src/index.ts
2
- var index = "";
1
+ // src/clsx.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ // src/functions.ts
9
+ function getUniqueID(prefix) {
10
+ return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
11
+ }
12
+
13
+ // src/numbers.ts
14
+ function clamp(value, min, max) {
15
+ return Math.min(Math.max(value, min), max);
16
+ }
3
17
  export {
4
- index
18
+ clamp,
19
+ cn,
20
+ getUniqueID
5
21
  };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Clamps a value between a minimum and maximum range.
3
+ *
4
+ * @param value - The value to be clamped.
5
+ * @param min - The minimum value of the range.
6
+ * @param max - The maximum value of the range.
7
+ * @returns The clamped value.
8
+ */
9
+ declare function clamp(value: number, min: number, max: number): number;
10
+
11
+ export { clamp };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Clamps a value between a minimum and maximum range.
3
+ *
4
+ * @param value - The value to be clamped.
5
+ * @param min - The minimum value of the range.
6
+ * @param max - The maximum value of the range.
7
+ * @returns The clamped value.
8
+ */
9
+ declare function clamp(value: number, min: number, max: number): number;
10
+
11
+ export { clamp };
@@ -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/numbers.ts
21
+ var numbers_exports = {};
22
+ __export(numbers_exports, {
23
+ clamp: () => clamp
24
+ });
25
+ module.exports = __toCommonJS(numbers_exports);
26
+ function clamp(value, min, max) {
27
+ return Math.min(Math.max(value, min), max);
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ clamp
32
+ });
@@ -0,0 +1,7 @@
1
+ // src/numbers.ts
2
+ function clamp(value, min, max) {
3
+ return Math.min(Math.max(value, min), max);
4
+ }
5
+ export {
6
+ clamp
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopexa/shared-utils",
3
- "version": "0.0.0",
3
+ "version": "1.0.0",
4
4
  "description": "A set of kopexa shared utilities",
5
5
  "keywords": [
6
6
  "system"
@@ -38,6 +38,10 @@
38
38
  "src/demi/react19"
39
39
  ]
40
40
  },
41
+ "dependencies": {
42
+ "clsx": "^2.1.1",
43
+ "tailwind-merge": "3.3.1"
44
+ },
41
45
  "module": "dist/index.mjs",
42
46
  "types": "dist/index.d.ts",
43
47
  "exports": {