@dot-system/css-utility 0.1.0
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 +27 -0
- package/cbt.config.js +39 -0
- package/es/config/utilities.json +1149 -0
- package/es/css_utility_layer.module.css +1 -0
- package/es/index.js +6 -0
- package/es/js/clsx.js +4 -0
- package/es/js/cn.js +5 -0
- package/es/js/csv.js +29 -0
- package/es/js/cva.js +4 -0
- package/es/js/dotMerge.js +43 -0
- package/es/utilities.plain.css +2145 -0
- package/lib/config/utilities.json +1149 -0
- package/lib/css_utility_layer.module.css +1 -0
- package/lib/index.js +45 -0
- package/lib/js/clsx.js +16 -0
- package/lib/js/cn.js +16 -0
- package/lib/js/csv.js +38 -0
- package/lib/js/cva.js +14 -0
- package/lib/js/dotMerge.js +77 -0
- package/lib/utilities.plain.css +2145 -0
- package/package.json +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer dots-css-utility, dots-css-utility.core;
|
package/es/index.js
ADDED
package/es/js/clsx.js
ADDED
package/es/js/cn.js
ADDED
package/es/js/csv.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// const buttonSlots = createSlotVariants({
|
|
2
|
+
// root: cva("d-inline-flex d-items-center", {
|
|
3
|
+
// variants: {
|
|
4
|
+
// size: {
|
|
5
|
+
// sm: "d-h-8 d-px-3",
|
|
6
|
+
// lg: "d-h-12 d-px-6"
|
|
7
|
+
// }
|
|
8
|
+
// }
|
|
9
|
+
// }),
|
|
10
|
+
// icon: cva("", {
|
|
11
|
+
// variants: {
|
|
12
|
+
// size: {
|
|
13
|
+
// sm: "d-w-3",
|
|
14
|
+
// lg: "d-w-5"
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
17
|
+
// })
|
|
18
|
+
// })
|
|
19
|
+
export const csv = function (slots) {
|
|
20
|
+
return props => {
|
|
21
|
+
const result = {};
|
|
22
|
+
|
|
23
|
+
for (const key in slots) {
|
|
24
|
+
result[key] = slots[key](props);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
};
|
package/es/js/cva.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createTailwindMerge, getDefaultConfig } from "tailwind-merge";
|
|
2
|
+
/**
|
|
3
|
+
* dotMerge is a custom tailwind-merge instance for d- prefixed utilities.
|
|
4
|
+
*
|
|
5
|
+
* It uses the default Tailwind config but applies all conflict detection
|
|
6
|
+
* and merging rules to classes that use the d- prefix instead of the default prefix.
|
|
7
|
+
*
|
|
8
|
+
* How it works:
|
|
9
|
+
* 1. Takes the default Tailwind class groups (position, display, padding, etc.)
|
|
10
|
+
* 2. Prefixes all class names with "d-"
|
|
11
|
+
* 3. Applies the same conflict resolution rules
|
|
12
|
+
*
|
|
13
|
+
* Example: cn('d-fixed', 'd-relative') → 'd-relative'
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const dotMerge = createTailwindMerge(() => {
|
|
17
|
+
const config = getDefaultConfig();
|
|
18
|
+
const transformedClassGroups = Object.fromEntries(Object.entries(config.classGroups).map(_ref => {
|
|
19
|
+
let [groupId, matchers] = _ref;
|
|
20
|
+
return [groupId, matchers.map(matcher => {
|
|
21
|
+
if (typeof matcher === "string") {
|
|
22
|
+
return `d-${matcher}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (matcher instanceof RegExp) {
|
|
26
|
+
const source = matcher.source.replace(/^\^/, "");
|
|
27
|
+
return new RegExp(`^d-${source}`, matcher.flags);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof matcher === "object") {
|
|
31
|
+
return Object.fromEntries(Object.entries(matcher).map(_ref2 => {
|
|
32
|
+
let [key, value] = _ref2;
|
|
33
|
+
return [`d-${key}`, value];
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return matcher;
|
|
38
|
+
})];
|
|
39
|
+
}));
|
|
40
|
+
return { ...config,
|
|
41
|
+
classGroups: transformedClassGroups
|
|
42
|
+
};
|
|
43
|
+
});
|