@oneplatformdev/utils 0.1.1-2 → 0.1.1-25
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 +12 -0
- package/CHANGELOG.md +3 -0
- package/LICENSE +21 -0
- package/README.md +3 -3
- package/dist/LICENSE +21 -0
- package/dist/README.md +7 -0
- package/dist/cn/cn.d.ts +1 -1
- package/dist/cn/cn.js +8 -5
- package/dist/cn/index.js +5 -1
- package/dist/composeRefs/composeRefs.d.ts +1 -1
- package/dist/composeRefs/composeRefs.js +9 -12
- package/dist/composeRefs/index.js +5 -1
- package/dist/index.js +6 -2
- package/dist/package.json +61 -0
- package/dist/types/PartialOne.js +1 -1
- package/dist/types/index.js +1 -1
- package/package.json +34 -13
- package/src/cn/cn.ts +7 -0
- package/src/cn/index.ts +1 -0
- package/src/composeRefs/composeRefs.ts +12 -0
- package/src/composeRefs/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/types/PartialOne.ts +1 -0
- package/src/types/index.ts +1 -0
- package/tsconfig.json +10 -0
- package/tsconfig.lib.json +34 -0
- package/vite.config.ts +60 -0
package/.babelrc
ADDED
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Oleh Maksimenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# utils
|
|
1
|
+
# @oneplatformdev/utils
|
|
2
2
|
|
|
3
3
|
This library was generated with [Nx](https://nx.dev).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Running unit tests
|
|
6
6
|
|
|
7
|
-
Run `nx
|
|
7
|
+
Run `nx test @oneplatformdev/utils` to execute the unit tests via [Vitest](https://vitest.dev/).
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Oleh Maksimenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
package/dist/cn/cn.d.ts
CHANGED
package/dist/cn/cn.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { clsx } from "clsx";
|
|
2
|
-
import { twMerge } from "tailwind-merge";
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export {
|
|
7
|
+
m as cn,
|
|
8
|
+
m as default
|
|
9
|
+
};
|
package/dist/cn/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (typeof ref === "function")
|
|
7
|
-
ref(node);
|
|
8
|
-
else
|
|
9
|
-
ref.current = node;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
1
|
+
function t(...o) {
|
|
2
|
+
return (f) => {
|
|
3
|
+
for (const e of o)
|
|
4
|
+
e && (typeof e == "function" ? e(f) : e.current = f);
|
|
5
|
+
};
|
|
12
6
|
}
|
|
13
|
-
export
|
|
7
|
+
export {
|
|
8
|
+
t as composeRefs,
|
|
9
|
+
t as default
|
|
10
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oneplatformdev/utils",
|
|
3
|
+
"version": "0.1.1-24",
|
|
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
|
+
"private": false,
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./index.js",
|
|
25
|
+
"module": "./index.js",
|
|
26
|
+
"types": "./index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
".": {
|
|
30
|
+
"@oneplatformdev/source": "./src/index.ts",
|
|
31
|
+
"types": "./index.d.ts",
|
|
32
|
+
"import": "./index.js",
|
|
33
|
+
"default": "./index.js"
|
|
34
|
+
},
|
|
35
|
+
"./*": {
|
|
36
|
+
"types": "./*.d.ts",
|
|
37
|
+
"import": "./*.js",
|
|
38
|
+
"default": "./*.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"**/*",
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE",
|
|
46
|
+
"!**/*.tsbuildinfo"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"clsx": "^2.1.0",
|
|
50
|
+
"tailwind-merge": "^2.5.0",
|
|
51
|
+
"class-variance-authority": "^0.7.1"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": ">=18 || >=19"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"react": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/dist/types/PartialOne.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,36 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/utils",
|
|
3
|
-
"version": "0.1.1-
|
|
3
|
+
"version": "0.1.1-25",
|
|
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
|
+
"private": false,
|
|
22
|
+
"license": "MIT",
|
|
4
23
|
"type": "module",
|
|
5
|
-
"main": "./
|
|
6
|
-
"module": "./
|
|
7
|
-
"types": "./
|
|
24
|
+
"main": "./index.js",
|
|
25
|
+
"module": "./index.js",
|
|
26
|
+
"types": "./index.d.ts",
|
|
8
27
|
"exports": {
|
|
9
28
|
"./package.json": "./package.json",
|
|
10
29
|
".": {
|
|
11
30
|
"@oneplatformdev/source": "./src/index.ts",
|
|
12
|
-
"types": "./
|
|
13
|
-
"import": "./
|
|
14
|
-
"default": "./
|
|
31
|
+
"types": "./index.d.ts",
|
|
32
|
+
"import": "./index.js",
|
|
33
|
+
"default": "./index.js"
|
|
15
34
|
},
|
|
16
35
|
"./*": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"default": "./dist/*.js"
|
|
36
|
+
"types": "./*.d.ts",
|
|
37
|
+
"import": "./*.js",
|
|
38
|
+
"default": "./*.js"
|
|
21
39
|
}
|
|
22
40
|
},
|
|
23
41
|
"files": [
|
|
42
|
+
"**/*",
|
|
24
43
|
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE",
|
|
25
46
|
"!**/*.tsbuildinfo"
|
|
26
47
|
],
|
|
27
48
|
"dependencies": {
|
|
28
49
|
"clsx": "^2.1.0",
|
|
29
50
|
"tailwind-merge": "^2.5.0",
|
|
30
|
-
"
|
|
51
|
+
"class-variance-authority": "^0.7.1"
|
|
31
52
|
},
|
|
32
53
|
"peerDependencies": {
|
|
33
|
-
"react": ">=18"
|
|
54
|
+
"react": ">=18 || >=19"
|
|
34
55
|
},
|
|
35
56
|
"peerDependenciesMeta": {
|
|
36
57
|
"react": {
|
package/src/cn/cn.ts
ADDED
package/src/cn/index.ts
ADDED
|
@@ -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 @@
|
|
|
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,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,60 @@
|
|
|
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
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
8
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
9
|
+
|
|
10
|
+
export default defineConfig(() => ({
|
|
11
|
+
root: __dirname,
|
|
12
|
+
cacheDir: '../../node_modules/.vite/packages/utils',
|
|
13
|
+
plugins: [
|
|
14
|
+
react(),
|
|
15
|
+
nxViteTsPaths(),
|
|
16
|
+
nxCopyAssetsPlugin([ '*.md', 'LICENSE', 'package.json' ]),
|
|
17
|
+
dts({
|
|
18
|
+
entryRoot: 'src',
|
|
19
|
+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json')
|
|
20
|
+
})
|
|
21
|
+
],
|
|
22
|
+
build: {
|
|
23
|
+
outDir: './dist',
|
|
24
|
+
emptyOutDir: true,
|
|
25
|
+
reportCompressedSize: true,
|
|
26
|
+
commonjsOptions: {
|
|
27
|
+
transformMixedEsModules: true,
|
|
28
|
+
},
|
|
29
|
+
sourcemap: false,
|
|
30
|
+
target: 'es2022',
|
|
31
|
+
lib: {
|
|
32
|
+
name: '@oneplatformdev/utils',
|
|
33
|
+
formats: [ 'es' as const ],
|
|
34
|
+
entry: {
|
|
35
|
+
index: path.resolve(__dirname, 'src/index.ts'),
|
|
36
|
+
...Object.fromEntries(
|
|
37
|
+
globSync('src/**/*.{ts,tsx}').map((filename) => {
|
|
38
|
+
return [
|
|
39
|
+
path.relative(
|
|
40
|
+
'src',
|
|
41
|
+
filename.slice(0, filename.length - path.extname(filename).length)
|
|
42
|
+
),
|
|
43
|
+
path.resolve(__dirname, filename),
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
rollupOptions: {
|
|
50
|
+
external: [ 'react', 'react-dom', 'react/jsx-runtime', "clsx", "tailwind-merge", "class-variance-authority" ],
|
|
51
|
+
output: {
|
|
52
|
+
preserveModules: true,
|
|
53
|
+
preserveModulesRoot: 'src',
|
|
54
|
+
globals: {
|
|
55
|
+
clsx: 'clsx',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
}));
|