@oneplatformdev/utils 0.0.2-beta.7 → 0.1.1-2

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/README.md CHANGED
@@ -1,11 +1,7 @@
1
- # @oneplatformdev/utils
1
+ # utils
2
2
 
3
3
  This library was generated with [Nx](https://nx.dev).
4
4
 
5
- ```bush
6
- npm instsall @oneplatformdev/utils clsx tailwind-merge
7
- ```
5
+ ## Building
8
6
 
9
- ## Running unit tests
10
-
11
- Run `nx test utils` to execute the unit tests via [Vitest](https://vitest.dev/).
7
+ Run `nx build utils` to build the library.
@@ -1,4 +1,4 @@
1
- import { ClassValue } from 'clsx';
2
-
1
+ import { type ClassValue } from "clsx";
3
2
  export declare function cn(...inputs: ClassValue[]): string;
4
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,6 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
6
+ export default cn;
@@ -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,4 @@
1
+ import type { 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,13 @@
1
+ export function composeRefs(...refs) {
2
+ return (node) => {
3
+ for (const ref of refs) {
4
+ if (!ref)
5
+ continue;
6
+ if (typeof ref === "function")
7
+ ref(node);
8
+ else
9
+ ref.current = node;
10
+ }
11
+ };
12
+ }
13
+ export default composeRefs;
@@ -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 @@
1
+ export { default, composeRefs } from './composeRefs';
@@ -0,0 +1,4 @@
1
+ export * from './cn';
2
+ export * from './composeRefs';
3
+ export type * from './types';
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,MAAM,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,mBAAmB,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './cn';
2
+ export * from './composeRefs';
@@ -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
+ export {};
@@ -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
+ export {};
package/package.json CHANGED
@@ -1,54 +1,40 @@
1
1
  {
2
2
  "name": "@oneplatformdev/utils",
3
- "version": "0.0.2-beta.7",
4
- "description": "Utility functions for React components.",
5
- "author": "One Platform Development Team",
6
- "keywords": [
7
- "clsx",
8
- "cn",
9
- "oneplatform",
10
- "utils"
11
- ],
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/oneplatformdev/core.git",
15
- "directory": "packages/utils"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/oneplatformdev/core/issues"
19
- },
20
- "homepage": "private package",
21
- "main": "./index.mjs",
22
- "types": "./index.d.ts",
3
+ "version": "0.1.1-2",
23
4
  "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
24
8
  "exports": {
9
+ "./package.json": "./package.json",
25
10
  ".": {
26
- "types": "./index.d.ts",
27
- "import": "./index.mjs",
28
- "default": "./index.mjs"
11
+ "@oneplatformdev/source": "./src/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
29
15
  },
30
- "./cn": {
31
- "types": "./cn/index.d.ts",
32
- "import": "./cn/index.mjs",
33
- "default": "./cn/index.mjs"
16
+ "./*": {
17
+ "@oneplatformdev/source": "./src/*.ts",
18
+ "types": "./dist/*.d.ts",
19
+ "import": "./dist/*.js",
20
+ "default": "./dist/*.js"
34
21
  }
35
22
  },
36
- "license": "MIT",
37
- "private": false,
38
- "publishConfig": {
39
- "directory": "build",
40
- "registry": "https://registry.npmjs.org/"
41
- },
42
- "sideEffects": false,
43
- "engines": {
44
- "node": ">=20"
45
- },
46
- "scripts": {
47
- "release": "pnpm publish",
48
- "build": "vite build"
23
+ "files": [
24
+ "dist",
25
+ "!**/*.tsbuildinfo"
26
+ ],
27
+ "dependencies": {
28
+ "clsx": "^2.1.0",
29
+ "tailwind-merge": "^2.5.0",
30
+ "tslib": "^2.3.0"
49
31
  },
50
32
  "peerDependencies": {
51
- "clsx": "^2.1.1",
52
- "tailwind-merge": "^2.6.0"
33
+ "react": ">=18"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "react": {
37
+ "optional": true
38
+ }
53
39
  }
54
- }
40
+ }
package/cn/cn.mjs DELETED
@@ -1,9 +0,0 @@
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
- };
package/cn/index.mjs DELETED
@@ -1,5 +0,0 @@
1
- import { cn as e, cn as f } from "./cn.mjs";
2
- export {
3
- e as cn,
4
- f as default
5
- };
package/cn/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "main": "./index.mjs",
4
- "module": "./index.mjs",
5
- "default": "./index.mjs",
6
- "types": "./index.d.ts"
7
- }
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './cn';
2
- export * from './isValidReactElement';
package/index.mjs DELETED
@@ -1,6 +0,0 @@
1
- import { cn as r } from "./cn/cn.mjs";
2
- import { isValidReactElement as m } from "./isValidReactElement/isValidReactElement.mjs";
3
- export {
4
- r as cn,
5
- m as isValidReactElement
6
- };
@@ -1 +0,0 @@
1
- export { isValidReactElement as default, isValidReactElement } from './isValidReactElement';
@@ -1,5 +0,0 @@
1
- import { isValidReactElement as t, isValidReactElement as l } from "./isValidReactElement.mjs";
2
- export {
3
- t as default,
4
- l as isValidReactElement
5
- };
@@ -1,18 +0,0 @@
1
- import { JSXElementConstructor, ReactNode } from 'react';
2
-
3
- /**
4
- * Is Valid React Element.
5
- *
6
- * Where {@link ReactNode} represents everything that can be rendered, `ReactElement`
7
- * only represents JSX.
8
- * @returns boolean - value is valid react element or not
9
- * @template Type The type of the component or tag
10
- *
11
- * @example
12
- * ```tsx
13
- * const isValid = isValidReactElement(targetElement);
14
- * const isValidDiv = isValidReactElement(targetElement, 'div');
15
- * const isValidButton = isValidReactElement(targetElement, Button);
16
- * ```
17
- */
18
- export declare const isValidReactElement: <Type extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>>(element: ReactNode, type?: Type) => boolean;