@oneplatformdev/utils 0.1.1-13 → 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 +12 -0
- package/dist/cn/cn.d.ts +4 -0
- package/dist/cn/cn.d.ts.map +1 -0
- package/dist/cn/cn.js +9 -0
- package/dist/cn/index.d.ts +2 -0
- package/dist/cn/index.d.ts.map +1 -0
- package/dist/cn/index.js +5 -0
- package/dist/composeRefs/composeRefs.d.ts +4 -0
- package/dist/composeRefs/composeRefs.d.ts.map +1 -0
- package/dist/composeRefs/composeRefs.js +10 -0
- package/dist/composeRefs/index.d.ts +2 -0
- package/dist/composeRefs/index.d.ts.map +1 -0
- package/dist/composeRefs/index.js +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/types/PartialOne.d.ts +2 -0
- package/dist/types/PartialOne.d.ts.map +1 -0
- package/dist/types/PartialOne.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +5 -1
- 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 +54 -0
package/.babelrc
ADDED
package/dist/cn/cn.d.ts
ADDED
|
@@ -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 @@
|
|
|
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"}
|
package/dist/cn/index.js
ADDED
|
@@ -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 @@
|
|
|
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
|
+
{"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 @@
|
|
|
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 @@
|
|
|
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-
|
|
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,6 +18,7 @@
|
|
|
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
24
|
"main": "./index.js",
|
|
@@ -38,11 +39,14 @@
|
|
|
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
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,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
|
+
}));
|