@oneplatformdev/utils 0.1.1-12 → 0.1.1-17

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/.babelrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nx/react/babel",
5
+ {
6
+ "runtime": "automatic",
7
+ "useBuiltIns": "usage"
8
+ }
9
+ ]
10
+ ],
11
+ "plugins": []
12
+ }
@@ -0,0 +1,4 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ export default cn;
4
+ //# sourceMappingURL=cn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/cn/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AACD,eAAe,EAAE,CAAA"}
package/dist/cn/cn.js ADDED
@@ -0,0 +1,9 @@
1
+ import { clsx as t } from "clsx";
2
+ import { twMerge as o } from "tailwind-merge";
3
+ function m(...r) {
4
+ return o(t(r));
5
+ }
6
+ export {
7
+ m as cn,
8
+ m as default
9
+ };
@@ -0,0 +1,2 @@
1
+ export { default, cn } from './cn';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cn/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { cn as e, cn as f } from "./cn.js";
2
+ export {
3
+ e as cn,
4
+ f as default
5
+ };
@@ -0,0 +1,4 @@
1
+ import { Ref } from 'react';
2
+ export declare function composeRefs<T>(...refs: Array<Ref<T> | undefined | null>): (node: T | null) => void;
3
+ export default composeRefs;
4
+ //# sourceMappingURL=composeRefs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeRefs.d.ts","sourceRoot":"","sources":["../../src/composeRefs/composeRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAe,MAAM,OAAO,CAAC;AAE9C,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,IAC9D,MAAM,CAAC,GAAG,IAAI,UAOvB;AACD,eAAe,WAAW,CAAC"}
@@ -0,0 +1,10 @@
1
+ function t(...o) {
2
+ return (f) => {
3
+ for (const e of o)
4
+ e && (typeof e == "function" ? e(f) : e.current = f);
5
+ };
6
+ }
7
+ export {
8
+ t as composeRefs,
9
+ t as default
10
+ };
@@ -0,0 +1,2 @@
1
+ export { default, composeRefs } from './composeRefs';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composeRefs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { composeRefs as s, composeRefs as f } from "./composeRefs.js";
2
+ export {
3
+ s as composeRefs,
4
+ f as default
5
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,mBAAmB,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type PartialOne<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
2
+ //# sourceMappingURL=PartialOne.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PartialOne.d.ts","sourceRoot":"","sources":["../../src/types/PartialOne.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,2 @@
1
+ export type * from './PartialOne';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,cAAc,CAAA"}
@@ -0,0 +1 @@
1
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/utils",
3
- "version": "0.1.1-12",
3
+ "version": "0.1.1-17",
4
4
  "description": "Utility functions for React components.",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [
@@ -18,31 +18,35 @@
18
18
  "url": "https://github.com/oneplatformdev/core/issues"
19
19
  },
20
20
  "homepage": "private package",
21
+ "private": false,
21
22
  "license": "MIT",
22
23
  "type": "module",
23
- "main": "./dist/index.js",
24
- "module": "./dist/index.js",
25
- "types": "./dist/index.d.ts",
24
+ "main": "./index.js",
25
+ "module": "./index.js",
26
+ "types": "./index.d.ts",
26
27
  "exports": {
27
28
  "./package.json": "./package.json",
28
29
  ".": {
29
30
  "@oneplatformdev/source": "./src/index.ts",
30
- "types": "./dist/index.d.ts",
31
- "import": "./dist/index.js",
32
- "default": "./dist/index.js"
31
+ "types": "./index.d.ts",
32
+ "import": "./index.js",
33
+ "default": "./index.js"
33
34
  },
34
35
  "./*": {
35
- "types": "./dist/*.d.ts",
36
- "import": "./dist/*.js",
37
- "default": "./dist/*.js"
36
+ "types": "./*.d.ts",
37
+ "import": "./*.js",
38
+ "default": "./*.js"
38
39
  }
39
40
  },
40
41
  "files": [
42
+ "**/*",
43
+ "dist",
41
44
  "*.js",
42
45
  "*.d.ts",
43
46
  "*/*.js",
44
47
  "*/*.d.ts",
45
48
  "README.md",
49
+ "LICENSE",
46
50
  "!**/*.tsbuildinfo"
47
51
  ],
48
52
  "dependencies": {
package/src/cn/cn.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { clsx, type ClassValue } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
7
+ export default cn
@@ -0,0 +1 @@
1
+ export { default, cn } from './cn';
@@ -0,0 +1,12 @@
1
+ import type { Ref, RefCallback } from "react";
2
+
3
+ export function composeRefs<T>(...refs: Array<Ref<T> | undefined | null>) {
4
+ return (node: T | null) => {
5
+ for (const ref of refs) {
6
+ if (!ref) continue;
7
+ if (typeof ref === "function") (ref as RefCallback<T>)(node);
8
+ else (ref as { current: T | null }).current = node;
9
+ }
10
+ };
11
+ }
12
+ export default composeRefs;
@@ -0,0 +1 @@
1
+ export { default, composeRefs } from './composeRefs';
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './cn';
2
+ export * from './composeRefs';
3
+ export type * from './types';
@@ -0,0 +1 @@
1
+ export type PartialOne<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
@@ -0,0 +1 @@
1
+ export type * from './PartialOne'
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "files": [],
3
+ "include": [],
4
+ "references": [
5
+ {
6
+ "path": "./tsconfig.lib.json"
7
+ }
8
+ ],
9
+ "extends": "../../tsconfig.base.json"
10
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "esnext",
5
+ "outDir": "dist",
6
+ "types": [
7
+ "node",
8
+ "@nx/react/typings/cssmodule.d.ts",
9
+ "@nx/react/typings/image.d.ts",
10
+ "vite/client"
11
+ ],
12
+ "rootDir": "src",
13
+ "jsx": "react-jsx",
14
+ "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo"
15
+ },
16
+ "exclude": [
17
+ "out-tsc",
18
+ "dist",
19
+ "**/*.spec.ts",
20
+ "**/*.test.ts",
21
+ "**/*.spec.tsx",
22
+ "**/*.test.tsx",
23
+ "**/*.spec.js",
24
+ "**/*.test.js",
25
+ "**/*.spec.jsx",
26
+ "**/*.test.jsx"
27
+ ],
28
+ "include": [
29
+ "src/**/*.js",
30
+ "src/**/*.jsx",
31
+ "src/**/*.ts",
32
+ "src/**/*.tsx"
33
+ ]
34
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,54 @@
1
+ /// <reference types='vitest' />
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import dts from 'vite-plugin-dts';
5
+ import * as path from 'path';
6
+ import { globSync } from 'glob';
7
+
8
+ export default defineConfig(() => ({
9
+ root: __dirname,
10
+ cacheDir: '../../node_modules/.vite/packages/utils',
11
+ plugins: [ react(), dts({
12
+ entryRoot: 'src',
13
+ tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
14
+ }) ],
15
+ // See: https://vitejs.dev/guide/build.html#library-mode
16
+ build: {
17
+ outDir: './dist',
18
+ emptyOutDir: true,
19
+ reportCompressedSize: true,
20
+ commonjsOptions: {
21
+ transformMixedEsModules: true,
22
+ },
23
+ sourcemap: false,
24
+ target: 'es2022',
25
+ lib: {
26
+ name: '@oneplatformdev/utils',
27
+ formats: [ 'es' as const ],
28
+ entry: {
29
+ index: path.resolve(__dirname, 'src/index.ts'),
30
+ ...Object.fromEntries(
31
+ globSync('src/**/*.{ts,tsx}').map((filename) => {
32
+ return [
33
+ path.relative(
34
+ 'src',
35
+ filename.slice(0, filename.length - path.extname(filename).length)
36
+ ),
37
+ path.resolve(__dirname, filename),
38
+ ]
39
+ })
40
+ )
41
+ },
42
+ },
43
+ rollupOptions: {
44
+ external: [ 'react', 'react-dom', 'react/jsx-runtime', "clsx", "tailwind-merge" ],
45
+ output: {
46
+ preserveModules: true,
47
+ preserveModulesRoot: 'src',
48
+ globals: {
49
+ clsx: 'clsx',
50
+ },
51
+ },
52
+ }
53
+ },
54
+ }));