@fuf-stack/pixel-utils 0.0.1
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/LICENSE +21 -0
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fröhlich und Frei GmbH
|
|
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/index.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/cn.ts
|
|
2
|
+
var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
|
|
3
|
+
|
|
4
|
+
// src/theme.ts
|
|
5
|
+
var _theme = require('@nextui-org/theme');
|
|
6
|
+
|
|
7
|
+
// src/tv.ts
|
|
8
|
+
var _tailwindvariants = require('tailwind-variants');
|
|
9
|
+
var variantsToClassNames = (variants, className, baseSlot) => {
|
|
10
|
+
const classNameObj = typeof className === "object" && className || {};
|
|
11
|
+
return Object.fromEntries(
|
|
12
|
+
Object.entries(variants).map(([slot, variantFn]) => [
|
|
13
|
+
slot,
|
|
14
|
+
baseSlot && slot === baseSlot ? (
|
|
15
|
+
// @ts-expect-error could be improved
|
|
16
|
+
variantFn({
|
|
17
|
+
className: typeof className === "string" ? className : classNameObj[slot]
|
|
18
|
+
})
|
|
19
|
+
) : (
|
|
20
|
+
// @ts-expect-error could be improved
|
|
21
|
+
variantFn({ className: classNameObj[slot] })
|
|
22
|
+
)
|
|
23
|
+
])
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
exports.cn = _classnames2.default; exports.nextui = _theme.nextui; exports.tv = _tailwindvariants.tv; exports.variantsToClassNames = variantsToClassNames;
|
|
32
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cn.ts","../src/theme.ts","../src/tv.ts"],"names":["default"],"mappings":";AAEA,SAAoB,WAAXA,gBAAqB;;;ACD9B,SAAS,cAAc;;;ACCvB,SAAS,UAAU;AAYZ,IAAM,uBAAuB,CAClC,UACA,WACA,aAC4B;AAC5B,QAAM,eAAgB,OAAO,cAAc,YAAY,aAAc,CAAC;AAEtE,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,QAAQ,EAAE,IAAI,CAAC,CAAC,MAAM,SAAS,MAAM;AAAA,MAClD;AAAA,MACA,YAAY,SAAS;AAAA;AAAA,QAEhB,UAAU;AAAA,UACT,WACE,OAAO,cAAc,WAAW,YAAY,aAAa,IAAI;AAAA,QACjE,CAAC;AAAA;AAAA;AAAA,QAEA,UAAU,EAAE,WAAW,aAAa,IAAI,EAAE,CAAC;AAAA;AAAA,IAClD,CAAC;AAAA,EACH;AACF","sourcesContent":["/* eslint-disable import/prefer-default-export */\n\nexport { default as cn } from 'classnames';\n","/* eslint-disable import/prefer-default-export */\nexport { nextui } from '@nextui-org/theme';\n","import type { VariantProps } from '@nextui-org/theme';\n\nexport { tv } from 'tailwind-variants';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVProps<Component extends (...args: any) => any> =\n VariantProps<Component>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVClassName<Component extends (...args: any) => any> =\n | Partial<Record<keyof ReturnType<Component>, string>>\n | string;\n\n// converts tailwind-variants slots instance to actual classnames object\nexport const variantsToClassNames = <T extends Record<string, unknown>>(\n variants: T,\n className?: string | Record<string, string>,\n baseSlot?: keyof T,\n): Record<keyof T, string> => {\n const classNameObj = (typeof className === 'object' && className) || {};\n // @ts-expect-error could be improved\n return Object.fromEntries(\n Object.entries(variants).map(([slot, variantFn]) => [\n slot as keyof T,\n baseSlot && slot === baseSlot\n ? // @ts-expect-error could be improved\n (variantFn({\n className:\n typeof className === 'string' ? className : classNameObj[slot],\n }) as string)\n : // @ts-expect-error could be improved\n (variantFn({ className: classNameObj[slot] }) as string),\n ]),\n );\n};\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as cn } from 'classnames';
|
|
2
|
+
import { VariantProps } from '@nextui-org/theme';
|
|
3
|
+
export { nextui } from '@nextui-org/theme';
|
|
4
|
+
export { tv } from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
type TVProps<Component extends (...args: any) => any> = VariantProps<Component>;
|
|
7
|
+
type TVClassName<Component extends (...args: any) => any> = Partial<Record<keyof ReturnType<Component>, string>> | string;
|
|
8
|
+
declare const variantsToClassNames: <T extends Record<string, unknown>>(variants: T, className?: string | Record<string, string>, baseSlot?: keyof T) => Record<keyof T, string>;
|
|
9
|
+
|
|
10
|
+
export { type TVClassName, type TVProps, variantsToClassNames };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as cn } from 'classnames';
|
|
2
|
+
import { VariantProps } from '@nextui-org/theme';
|
|
3
|
+
export { nextui } from '@nextui-org/theme';
|
|
4
|
+
export { tv } from 'tailwind-variants';
|
|
5
|
+
|
|
6
|
+
type TVProps<Component extends (...args: any) => any> = VariantProps<Component>;
|
|
7
|
+
type TVClassName<Component extends (...args: any) => any> = Partial<Record<keyof ReturnType<Component>, string>> | string;
|
|
8
|
+
declare const variantsToClassNames: <T extends Record<string, unknown>>(variants: T, className?: string | Record<string, string>, baseSlot?: keyof T) => Record<keyof T, string>;
|
|
9
|
+
|
|
10
|
+
export { type TVClassName, type TVProps, variantsToClassNames };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/cn.ts
|
|
2
|
+
import { default as default2 } from "classnames";
|
|
3
|
+
|
|
4
|
+
// src/theme.ts
|
|
5
|
+
import { nextui } from "@nextui-org/theme";
|
|
6
|
+
|
|
7
|
+
// src/tv.ts
|
|
8
|
+
import { tv } from "tailwind-variants";
|
|
9
|
+
var variantsToClassNames = (variants, className, baseSlot) => {
|
|
10
|
+
const classNameObj = typeof className === "object" && className || {};
|
|
11
|
+
return Object.fromEntries(
|
|
12
|
+
Object.entries(variants).map(([slot, variantFn]) => [
|
|
13
|
+
slot,
|
|
14
|
+
baseSlot && slot === baseSlot ? (
|
|
15
|
+
// @ts-expect-error could be improved
|
|
16
|
+
variantFn({
|
|
17
|
+
className: typeof className === "string" ? className : classNameObj[slot]
|
|
18
|
+
})
|
|
19
|
+
) : (
|
|
20
|
+
// @ts-expect-error could be improved
|
|
21
|
+
variantFn({ className: classNameObj[slot] })
|
|
22
|
+
)
|
|
23
|
+
])
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
default2 as cn,
|
|
28
|
+
nextui,
|
|
29
|
+
tv,
|
|
30
|
+
variantsToClassNames
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cn.ts","../src/theme.ts","../src/tv.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n\nexport { default as cn } from 'classnames';\n","/* eslint-disable import/prefer-default-export */\nexport { nextui } from '@nextui-org/theme';\n","import type { VariantProps } from '@nextui-org/theme';\n\nexport { tv } from 'tailwind-variants';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVProps<Component extends (...args: any) => any> =\n VariantProps<Component>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type TVClassName<Component extends (...args: any) => any> =\n | Partial<Record<keyof ReturnType<Component>, string>>\n | string;\n\n// converts tailwind-variants slots instance to actual classnames object\nexport const variantsToClassNames = <T extends Record<string, unknown>>(\n variants: T,\n className?: string | Record<string, string>,\n baseSlot?: keyof T,\n): Record<keyof T, string> => {\n const classNameObj = (typeof className === 'object' && className) || {};\n // @ts-expect-error could be improved\n return Object.fromEntries(\n Object.entries(variants).map(([slot, variantFn]) => [\n slot as keyof T,\n baseSlot && slot === baseSlot\n ? // @ts-expect-error could be improved\n (variantFn({\n className:\n typeof className === 'string' ? className : classNameObj[slot],\n }) as string)\n : // @ts-expect-error could be improved\n (variantFn({ className: classNameObj[slot] }) as string),\n ]),\n );\n};\n"],"mappings":";AAEA,SAAoB,WAAXA,gBAAqB;;;ACD9B,SAAS,cAAc;;;ACCvB,SAAS,UAAU;AAYZ,IAAM,uBAAuB,CAClC,UACA,WACA,aAC4B;AAC5B,QAAM,eAAgB,OAAO,cAAc,YAAY,aAAc,CAAC;AAEtE,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,QAAQ,EAAE,IAAI,CAAC,CAAC,MAAM,SAAS,MAAM;AAAA,MAClD;AAAA,MACA,YAAY,SAAS;AAAA;AAAA,QAEhB,UAAU;AAAA,UACT,WACE,OAAO,cAAc,WAAW,YAAY,aAAa,IAAI;AAAA,QACjE,CAAC;AAAA;AAAA;AAAA,QAEA,UAAU,EAAE,WAAW,aAAa,IAAI,EAAE,CAAC;AAAA;AAAA,IAClD,CAAC;AAAA,EACH;AACF;","names":["default"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fuf-stack/pixel-utils",
|
|
3
|
+
"description": "fuf pixels helper utils",
|
|
4
|
+
"author": "Hannes Tiede",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"./dist"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://github.com/fuf-stack/uniform/tree/main/packages/pixel-utils",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"react",
|
|
28
|
+
"tailwind",
|
|
29
|
+
"utils"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/fuf-stack/uniforms.git",
|
|
34
|
+
"directory": "packages/pixel-utils"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/fuf-stack/uniforms/issues"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@nextui-org/theme": "2.2.5",
|
|
41
|
+
"classnames": "2.5.1",
|
|
42
|
+
"tailwind-variants": "0.2.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@repo/tsup-config": "0.0.1"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsup --config node_modules/@repo/tsup-config/config.ts"
|
|
49
|
+
}
|
|
50
|
+
}
|