@nightstem/utils 0.0.1-alpha.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,4 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare const cn: (...inputs: ClassValue[]) => string;
3
+ export default cn;
4
+ //# sourceMappingURL=classnames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classnames.d.ts","sourceRoot":"","sources":["../../src/classnames/classnames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,eAAO,MAAM,EAAE,GAAI,GAAG,QAAQ,UAAU,EAAE,WAA0B,CAAC;AAErE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as cn } from './classnames';
2
+ export { default } from './classnames';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/classnames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const hashIndex: (seed: string, max: number) => number;
2
+ export default hashIndex;
3
+ //# sourceMappingURL=hashIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hashIndex.d.ts","sourceRoot":"","sources":["../../src/hashIndex/hashIndex.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,WAMlD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './hashIndex';
2
+ export { default } from './hashIndex';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hashIndex/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './classnames';
2
+ export * from './hashIndex';
3
+ export * from './randomInt';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import { clsx as e } from "clsx";
2
+ import { twMerge as t } from "tailwind-merge";
3
+ //#region src/classnames/classnames.ts
4
+ var n = (...n) => t(e(n)), r = (e, t) => {
5
+ if (!e || t <= 1) return 0;
6
+ let n = 5381;
7
+ for (let t = 0; t < e.length; t += 1) n = n * 33 ^ e.charCodeAt(t);
8
+ return Math.abs(n) % t;
9
+ }, i = (e) => {
10
+ if (e <= 1) return 0;
11
+ let t = new Uint32Array(1);
12
+ return crypto.getRandomValues(t), Math.floor(t[0] / 2 ** 32 * e);
13
+ };
14
+ //#endregion
15
+ export { n as cn, r as hashIndex, i as randomInt };
16
+
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/classnames/classnames.ts","../src/hashIndex/hashIndex.ts","../src/randomInt/randomInt.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));\n\nexport default cn;\n","export const hashIndex = (seed: string, max: number) => {\n if (!seed || max <= 1) return 0;\n\n let h = 5381;\n for (let i = 0; i < seed.length; i += 1) h = (h * 33) ^ seed.charCodeAt(i);\n return Math.abs(h) % max;\n};\n\nexport default hashIndex;\n","export const randomInt = (max: number) => {\n if (max <= 1) return 0;\n const buf = new Uint32Array(1);\n crypto.getRandomValues(buf);\n return Math.floor((buf[0] / 2 ** 32) * max);\n};\n\nexport default randomInt;\n"],"mappings":";;;AAGA,IAAa,KAAM,GAAG,MAAyB,EAAQ,EAAK,EAAO,CAAC,ECHvD,KAAa,GAAc,MAAgB;AACtD,KAAI,CAAC,KAAQ,KAAO,EAAG,QAAO;CAE9B,IAAI,IAAI;AACR,MAAK,IAAI,IAAI,GAAG,IAAI,EAAK,QAAQ,KAAK,EAAG,KAAK,IAAI,KAAM,EAAK,WAAW,EAAE;AAC1E,QAAO,KAAK,IAAI,EAAE,GAAG;GCLV,KAAa,MAAgB;AACxC,KAAI,KAAO,EAAG,QAAO;CACrB,IAAM,IAAM,IAAI,YAAY,EAAE;AAE9B,QADA,OAAO,gBAAgB,EAAI,EACpB,KAAK,MAAO,EAAI,KAAK,KAAK,KAAM,EAAI"}
@@ -0,0 +1,3 @@
1
+ export * from './randomInt';
2
+ export { default } from './randomInt';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/randomInt/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const randomInt: (max: number) => number;
2
+ export default randomInt;
3
+ //# sourceMappingURL=randomInt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomInt.d.ts","sourceRoot":"","sources":["../../src/randomInt/randomInt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,WAKpC,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@nightstem/utils",
3
+ "version": "0.0.1-alpha.0",
4
+ "description": "Framework-agnostic utilities for the Nightstem design system",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/nightstem/design-system.git"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "scripts": {
29
+ "build": "rimraf dist && vite build",
30
+ "typecheck": "tsc --noEmit",
31
+ "test": "vitest run --passWithNoTests",
32
+ "test:watch": "vitest",
33
+ "coverage": "vitest run --coverage --passWithNoTests",
34
+ "lint": "eslint .",
35
+ "format": "prettier --write . --ignore-unknown",
36
+ "format:check": "prettier --check . --ignore-unknown",
37
+ "clean": "rimraf dist"
38
+ },
39
+ "dependencies": {
40
+ "clsx": "^2.1.1",
41
+ "tailwind-merge": "^3.5.0"
42
+ },
43
+ "devDependencies": {
44
+ "rimraf": "^6.0.1",
45
+ "typescript": "^6.0.3",
46
+ "vite": "^8.0.10",
47
+ "vite-plugin-dts": "^5.0.0"
48
+ }
49
+ }