@blockbite/tailwind 3.4.13 → 3.4.15
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/dist/___index copy.d.ts +7 -0
- package/dist/___index copy.js +9 -0
- package/dist/colors.d.ts +8 -0
- package/dist/colors.js +65 -0
- package/dist/components/anchor-position.d.ts +3 -0
- package/dist/components/anchor-position.js +99 -0
- package/dist/components/fluid-container.d.ts +4 -0
- package/dist/components/fluid-container.js +29 -0
- package/dist/components/grid-container.d.ts +5 -0
- package/dist/components/grid-container.js +34 -0
- package/dist/components/interaction.d.ts +3 -0
- package/dist/components/interaction.js +35 -0
- package/dist/components/swiper.d.ts +3 -0
- package/dist/components/swiper.js +13 -0
- package/dist/container.d.ts +8 -0
- package/dist/container.js +10 -0
- package/dist/gridarea/index.d.ts +2 -0
- package/dist/gridarea/index.js +7 -0
- package/dist/gridarea/utilities/area-dimensions.d.ts +3 -0
- package/dist/gridarea/utilities/area-dimensions.js +22 -0
- package/dist/gridarea/utilities/grid-area.d.ts +5 -0
- package/dist/gridarea/utilities/grid-area.js +46 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +32 -0
- package/dist/plugins/grid-16x.d.ts +2 -0
- package/dist/plugins/grid-16x.js +60 -0
- package/dist/plugins/viewport-dimensions.d.ts +2 -0
- package/dist/plugins/viewport-dimensions.js +25 -0
- package/dist/screens.d.ts +5 -0
- package/dist/screens.js +10 -0
- package/dist/spacing.d.ts +6 -0
- package/dist/spacing.js +201 -0
- package/package.json +26 -4
- package/CHANGELOG.md +0 -55
- package/components/anchor-position.js +0 -110
- package/components/fluid-container.js +0 -34
- package/components/grid-container.js +0 -37
- package/components/interaction.js +0 -37
- package/components/swiper.js +0 -13
- package/deprecated/fluid-container-aside.js +0 -48
- package/deprecated/fluid-container-half.js +0 -48
- package/dist/assets/index-BeSH1wKF.js +0 -74
- package/dist/assets/index-CFh4XZ-f.css +0 -1
- package/dist/index.html +0 -23
- package/gridarea/index.js +0 -6
- package/gridarea/utilities/area-dimensions.js +0 -13
- package/gridarea/utilities/grid-area.js +0 -49
- package/index.d.ts +0 -17
- package/index.html +0 -46
- package/index.js +0 -30
- package/lib/aspect-ratio.js +0 -6
- package/lib/colors.js +0 -58
- package/lib/container.js +0 -10
- package/lib/screens.js +0 -13
- package/lib/spacing.js +0 -215
- package/lib/theme-parser.js +0 -83
- package/motion/index.js +0 -17
- package/motion/theme.js +0 -174
- package/motion/utilities/delay.js +0 -11
- package/motion/utilities/direction.js +0 -15
- package/motion/utilities/duration.js +0 -11
- package/motion/utilities/fillMode.js +0 -15
- package/motion/utilities/iterationCount.js +0 -15
- package/motion/utilities/offset.js +0 -11
- package/motion/utilities/playState.js +0 -15
- package/motion/utilities/timingFunction.js +0 -15
- package/plugins/viewport-dimensions.js +0 -33
- package/postcss.config.js +0 -6
- package/tailwind.config.js +0 -18
- package/theme-example.json +0 -329
- package/themecolors/index.js +0 -65
- package/vite.css +0 -8
- package/vite.js +0 -64
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getAspectRatio } from './aspect-ratio.js';
|
|
2
|
+
import { getColorObject, getColors } from './colors.js';
|
|
3
|
+
import { getContainer } from './container.js';
|
|
4
|
+
import { getScreens } from './screens.js';
|
|
5
|
+
import { fluidSpacing, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing } from './spacing.js';
|
|
6
|
+
import { themeParser } from './theme-parser.js';
|
|
7
|
+
export { fluidSpacing, getAspectRatio, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, themeParser, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Import functions and constants
|
|
2
|
+
import { getAspectRatio } from './aspect-ratio.js';
|
|
3
|
+
import { getColorObject, getColors } from './colors.js';
|
|
4
|
+
import { getContainer } from './container.js';
|
|
5
|
+
import { getScreens } from './screens.js';
|
|
6
|
+
import { fluidSpacing, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, } from './spacing.js';
|
|
7
|
+
import { themeParser } from './theme-parser.js';
|
|
8
|
+
// Export functions and constants
|
|
9
|
+
export { fluidSpacing, getAspectRatio, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, themeParser, };
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const isSpecialColor: (color: any) => boolean;
|
|
2
|
+
export declare const getColors: () => {};
|
|
3
|
+
export declare const getColorObject: () => any[];
|
|
4
|
+
declare const _default: {
|
|
5
|
+
getColors: () => {};
|
|
6
|
+
getColorObject: () => any[];
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const colors = [
|
|
2
|
+
'b_theme',
|
|
3
|
+
'black',
|
|
4
|
+
'white',
|
|
5
|
+
'transparent',
|
|
6
|
+
'inherit',
|
|
7
|
+
'current',
|
|
8
|
+
'gray',
|
|
9
|
+
'red',
|
|
10
|
+
'yellow',
|
|
11
|
+
'green',
|
|
12
|
+
'blue',
|
|
13
|
+
'indigo',
|
|
14
|
+
'purple',
|
|
15
|
+
'pink',
|
|
16
|
+
];
|
|
17
|
+
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
18
|
+
const specialColors = {
|
|
19
|
+
black: true,
|
|
20
|
+
white: true,
|
|
21
|
+
transparent: true,
|
|
22
|
+
inherit: true,
|
|
23
|
+
current: true,
|
|
24
|
+
b_theme: true,
|
|
25
|
+
};
|
|
26
|
+
export const isSpecialColor = (color) => !!specialColors[color];
|
|
27
|
+
export const getColors = () => {
|
|
28
|
+
const tailwindColors = {};
|
|
29
|
+
for (let i = 0; i < colors.length; i++) {
|
|
30
|
+
const color = colors[i];
|
|
31
|
+
if (isSpecialColor(color)) {
|
|
32
|
+
tailwindColors[color] = color;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
for (let j = 0; j < shades.length; j++) {
|
|
36
|
+
const shade = shades[j];
|
|
37
|
+
tailwindColors[`${color}-${shade}`] = `${color}-${shade}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return tailwindColors;
|
|
42
|
+
};
|
|
43
|
+
export const getColorObject = () => {
|
|
44
|
+
const colorObjects = [];
|
|
45
|
+
for (let i = 0; i < colors.length; i++) {
|
|
46
|
+
const color = colors[i];
|
|
47
|
+
if (isSpecialColor(color)) {
|
|
48
|
+
colorObjects.push({
|
|
49
|
+
label: `${color.charAt(0).toUpperCase() + color.slice(1)}`,
|
|
50
|
+
id: color,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
for (let j = 0; j < shades.length; j++) {
|
|
55
|
+
const shade = shades[j];
|
|
56
|
+
colorObjects.push({
|
|
57
|
+
label: `${color.charAt(0).toUpperCase() + color.slice(1)} ${shade}`,
|
|
58
|
+
id: `${color}-${shade}`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return colorObjects;
|
|
64
|
+
};
|
|
65
|
+
export default { getColors, getColorObject };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export default function ({ addComponents }) {
|
|
2
|
+
const anchorTopCenter = {
|
|
3
|
+
'.anchor-top-center': {
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
top: '0',
|
|
6
|
+
left: '50%',
|
|
7
|
+
transform: 'translate(-50%, -50%)',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
const anchorTopLeft = {
|
|
11
|
+
'.anchor-top-left': {
|
|
12
|
+
position: 'absolute',
|
|
13
|
+
top: '0',
|
|
14
|
+
left: '0',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const anchorTopRight = {
|
|
18
|
+
'.anchor-top-right': {
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
top: '0',
|
|
21
|
+
right: '0',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const anchorBottomCenter = {
|
|
25
|
+
'.anchor-bottom-center': {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
bottom: '0',
|
|
28
|
+
left: '50%',
|
|
29
|
+
transform: 'translate(-50%, 50%)',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const anchorBottomLeft = {
|
|
33
|
+
'.anchor-bottom-left': {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
bottom: '0',
|
|
36
|
+
left: '0',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
const anchorBottomRight = {
|
|
40
|
+
'.anchor-bottom-right': {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
bottom: '0',
|
|
43
|
+
right: '0',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
const anchorCenterLeft = {
|
|
47
|
+
'.anchor-center-left': {
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
top: '50%',
|
|
50
|
+
left: '0',
|
|
51
|
+
transform: 'translate(-50%, -50%)',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const anchorCenterRight = {
|
|
55
|
+
'.anchor-center-right': {
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
top: '50%',
|
|
58
|
+
right: '0',
|
|
59
|
+
transform: 'translate(50%, -50%)',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const anchorCenterCenter = {
|
|
63
|
+
'.anchor-center-center': {
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
top: '50%',
|
|
66
|
+
left: '50%',
|
|
67
|
+
transform: 'translate(-50%, -50%)',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const anchorCenterTop = {
|
|
71
|
+
'.anchor-center-top': {
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
top: '0',
|
|
74
|
+
left: '50%',
|
|
75
|
+
transform: 'translate(-50%, 0%)',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const anchorCenterBottom = {
|
|
79
|
+
'.anchor-center-bottom': {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
bottom: '0',
|
|
82
|
+
left: '50%',
|
|
83
|
+
transform: 'translate(-50%, 0%)',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
addComponents([
|
|
87
|
+
anchorTopCenter,
|
|
88
|
+
anchorTopLeft,
|
|
89
|
+
anchorTopRight,
|
|
90
|
+
anchorBottomCenter,
|
|
91
|
+
anchorBottomLeft,
|
|
92
|
+
anchorBottomRight,
|
|
93
|
+
anchorCenterLeft,
|
|
94
|
+
anchorCenterRight,
|
|
95
|
+
anchorCenterCenter,
|
|
96
|
+
anchorCenterTop,
|
|
97
|
+
anchorCenterBottom,
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
--b_container-fluid-xs: 98vw;
|
|
3
|
+
--b_container-fluid-xl: 95vw;
|
|
4
|
+
--b_padding: 1rem;
|
|
5
|
+
*/
|
|
6
|
+
export default function ({ addComponents, theme }) {
|
|
7
|
+
// Base style
|
|
8
|
+
addComponents({
|
|
9
|
+
[`.container-fluid`]: {
|
|
10
|
+
marginLeft: 'auto',
|
|
11
|
+
marginRight: 'auto',
|
|
12
|
+
paddingLeft: 'var(--b_padding, 4vw)',
|
|
13
|
+
paddingRight: 'var(--b_padding, 4vw)',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
// Responsive style for 2xl (users must use 2xl:container-fluid)
|
|
17
|
+
const maxWidth2xl = theme('screens.2xl');
|
|
18
|
+
if (maxWidth2xl) {
|
|
19
|
+
addComponents({
|
|
20
|
+
[`.container-fluid-2xl`]: {
|
|
21
|
+
maxWidth: maxWidth2xl,
|
|
22
|
+
marginLeft: 'auto',
|
|
23
|
+
marginRight: 'auto',
|
|
24
|
+
paddingLeft: 'var(--b_padding, 1rem)',
|
|
25
|
+
paddingRight: 'var(--b_padding, 1rem)',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default function ({ addComponents, theme, config, }) {
|
|
2
|
+
const maxWidthLg = theme('screens.lg');
|
|
3
|
+
const maxWidth2xl = theme('screens.2xl');
|
|
4
|
+
const important = config('important');
|
|
5
|
+
const cssVars = config('cssVars') || false;
|
|
6
|
+
const prefix = typeof important === 'string' ? important : '';
|
|
7
|
+
// Base grid container
|
|
8
|
+
addComponents({
|
|
9
|
+
[`${prefix} .grid-container`]: {
|
|
10
|
+
display: 'grid',
|
|
11
|
+
gridTemplateColumns: '1fr repeat(12, var(--b_col-width)) 1fr!important',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
if (cssVars) {
|
|
15
|
+
// Provide separate classes for breakpoint-specific variables
|
|
16
|
+
if (maxWidthLg) {
|
|
17
|
+
addComponents({
|
|
18
|
+
[`.grid-container-lg`]: {
|
|
19
|
+
'--b_col-width': 'calc((100% - ((var(--b_padding, 4vw) ) * 2)) / 12)',
|
|
20
|
+
'--b_fr-size': '4vw',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (maxWidth2xl) {
|
|
25
|
+
addComponents({
|
|
26
|
+
[`.grid-container-2xl`]: {
|
|
27
|
+
'--b_col-width': `calc((${maxWidth2xl} - (var(--b_padding, 1rem) * 2)) / 12)`,
|
|
28
|
+
'--b_padding': 'var(--b_padding, 1rem)',
|
|
29
|
+
'--b_fr-size': `calc(100% - ${maxWidth2xl} / 2)`,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export default function ({ addComponents }) {
|
|
2
|
+
const b_tileslide_in = {
|
|
3
|
+
'.tile-in-left': {
|
|
4
|
+
position: 'absolute!important',
|
|
5
|
+
top: 0,
|
|
6
|
+
left: 0,
|
|
7
|
+
right: 0,
|
|
8
|
+
bottom: 0,
|
|
9
|
+
zIndex: 10,
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
transition: 'transform 0.5s',
|
|
12
|
+
transform: 'translateX(-100%)',
|
|
13
|
+
},
|
|
14
|
+
'.active .tile-in-left': {
|
|
15
|
+
transform: 'translateX(0%)',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const b_tilefade_in = {
|
|
19
|
+
'.tile-in-fade': {
|
|
20
|
+
opacity: 0,
|
|
21
|
+
transition: 'opacity 0.5s',
|
|
22
|
+
position: 'absolute!important',
|
|
23
|
+
top: 0,
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
zIndex: 10,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
},
|
|
30
|
+
'.active .tile-in-fade': {
|
|
31
|
+
opacity: 1,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
addComponents([b_tileslide_in, b_tilefade_in]);
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default function ({ addComponents }) {
|
|
2
|
+
// allows infinite loop for swiper continues
|
|
3
|
+
const b_newsticker = {
|
|
4
|
+
'.newsticker': {
|
|
5
|
+
'& > .swiper-free-mode > .swiper-wrapper': {
|
|
6
|
+
'-webkit-transition-timing-function': 'linear !important',
|
|
7
|
+
'-o-transition-timing-function': 'linear !important',
|
|
8
|
+
'transition-timing-function': 'linear !important',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
addComponents(b_newsticker);
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function escapeClassName(className) {
|
|
2
|
+
return className.replace(/([^a-zA-Z0-9-])/g, '\\$1');
|
|
3
|
+
}
|
|
4
|
+
export default function ({ addUtilities }) {
|
|
5
|
+
const newUtilities = {};
|
|
6
|
+
// 96 is max resolution
|
|
7
|
+
for (let i = 0; i <= 97; i++) {
|
|
8
|
+
newUtilities[`.${escapeClassName(`area-x-${i}`)}`] = {
|
|
9
|
+
'--b_area-x': `${i}`,
|
|
10
|
+
};
|
|
11
|
+
newUtilities[`.${escapeClassName(`area-y-${i}`)}`] = {
|
|
12
|
+
'--b_area-y': `${i}`,
|
|
13
|
+
};
|
|
14
|
+
newUtilities[`.${escapeClassName(`area-w-${i}`)}`] = {
|
|
15
|
+
'--b_area-w': `${i}`,
|
|
16
|
+
};
|
|
17
|
+
newUtilities[`.${escapeClassName(`area-h-${i}`)}`] = {
|
|
18
|
+
'--b_area-h': `${i}`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
addUtilities(newUtilities, ['responsive']);
|
|
22
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export default function ({ addComponents, matchUtilities, config }) {
|
|
2
|
+
const important = config('important');
|
|
3
|
+
const prefix = typeof important === 'string' ? important : '';
|
|
4
|
+
// Predefined grid-area utilities
|
|
5
|
+
addComponents({
|
|
6
|
+
[`${prefix} .area`]: {
|
|
7
|
+
gridArea: 'var(--b_area-y) / var(--b_area-x) / calc(var(--b_area-y) + var(--b_area-h)) / calc(var(--b_area-x) + var(--b_area-w))',
|
|
8
|
+
},
|
|
9
|
+
[`${prefix} .b_grid-area-16`]: {
|
|
10
|
+
display: 'grid',
|
|
11
|
+
gridTemplateColumns: 'repeat(16, 1fr)',
|
|
12
|
+
gridTemplateRows: 'repeat(16, 1fr)',
|
|
13
|
+
'--init-area': '1 / 1 / 4 / 4',
|
|
14
|
+
},
|
|
15
|
+
[`${prefix} .b_grid-area-32`]: {
|
|
16
|
+
display: 'grid',
|
|
17
|
+
gridTemplateColumns: 'repeat(32, 1fr)',
|
|
18
|
+
gridTemplateRows: 'repeat(32, 1fr)',
|
|
19
|
+
'--init-area': '1 / 1 / 8 / 8',
|
|
20
|
+
},
|
|
21
|
+
[`${prefix} .b_grid-area-64`]: {
|
|
22
|
+
display: 'grid',
|
|
23
|
+
gridTemplateColumns: 'repeat(64, 1fr)',
|
|
24
|
+
gridTemplateRows: 'repeat(64, 1fr)',
|
|
25
|
+
'--init-area': '1 / 1 / 16 / 16',
|
|
26
|
+
},
|
|
27
|
+
[`${prefix} .b_grid-area-96`]: {
|
|
28
|
+
display: 'grid',
|
|
29
|
+
gridTemplateColumns: 'repeat(96, 1fr)',
|
|
30
|
+
gridTemplateRows: 'repeat(96, 1fr)',
|
|
31
|
+
'--init-area': '1 / 1 / 24 / 24',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
matchUtilities({
|
|
35
|
+
area: (value) => {
|
|
36
|
+
// Remove the square brackets and split the value by "/"
|
|
37
|
+
const parts = value.split('-'); // slice to remove the square brackets
|
|
38
|
+
if (parts.length === 4) {
|
|
39
|
+
return {
|
|
40
|
+
'grid-area': `${parts[0]} / ${parts[1]} / ${parts[2]} / ${parts[3]}`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
}, { values: {} } // Allow arbitrary values like b_area[1/4/4/3]
|
|
45
|
+
);
|
|
46
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getColorObject, getColors } from './colors.js';
|
|
2
|
+
import { getContainer } from './container.js';
|
|
3
|
+
import { getScreens } from './screens.js';
|
|
4
|
+
import { fluidSpacing, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing } from './spacing.js';
|
|
5
|
+
declare const blockbiteTailwindPlugin: any;
|
|
6
|
+
export default blockbiteTailwindPlugin;
|
|
7
|
+
export { fluidSpacing, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
// Utilities and helpers
|
|
3
|
+
import { getColorObject, getColors } from './colors.js';
|
|
4
|
+
import { getContainer } from './container.js';
|
|
5
|
+
import { getScreens } from './screens.js';
|
|
6
|
+
import { fluidSpacing, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, } from './spacing.js';
|
|
7
|
+
// Components
|
|
8
|
+
import anchorPosition from './components/anchor-position.js';
|
|
9
|
+
import fluidContainer from './components/fluid-container.js';
|
|
10
|
+
import gridContainer from './components/grid-container.js';
|
|
11
|
+
import interaction from './components/interaction.js';
|
|
12
|
+
import swiper from './components/swiper.js';
|
|
13
|
+
// Plugins
|
|
14
|
+
import grid16x from './plugins/grid-16x.js';
|
|
15
|
+
import viewportDimensions from './plugins/viewport-dimensions.js';
|
|
16
|
+
// Gridarea utilities
|
|
17
|
+
import gridAreaPlugin from './gridarea/index.js';
|
|
18
|
+
const blockbiteTailwindPlugin = plugin(function (api) {
|
|
19
|
+
// Register all components
|
|
20
|
+
gridContainer(api);
|
|
21
|
+
fluidContainer(api);
|
|
22
|
+
anchorPosition(api);
|
|
23
|
+
interaction(api);
|
|
24
|
+
swiper(api);
|
|
25
|
+
// Register all plugins/utilities
|
|
26
|
+
viewportDimensions.handler(api);
|
|
27
|
+
gridAreaPlugin.handler(api);
|
|
28
|
+
grid16x.handler(api);
|
|
29
|
+
});
|
|
30
|
+
export default blockbiteTailwindPlugin;
|
|
31
|
+
// Export functions and constants
|
|
32
|
+
export { fluidSpacing, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
export default plugin(function ({ addBase, addUtilities }) {
|
|
3
|
+
const baseVar = '--b_grid-spacing';
|
|
4
|
+
const baseValue = '1rem'; // 16px grid
|
|
5
|
+
// Set the root spacing variable
|
|
6
|
+
addBase({
|
|
7
|
+
':root': {
|
|
8
|
+
[baseVar]: baseValue,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
// Define spacing values
|
|
12
|
+
const minimalValues = [0, 1, 2, 4, 6, 8, 10, 12, 14, 18, 20, 22, 24, 32];
|
|
13
|
+
const largeSteps = [];
|
|
14
|
+
for (let i = 1; i <= 1280 / 16; i++) {
|
|
15
|
+
largeSteps.push(i * 16); // 16, 32, 48, ..., 1280
|
|
16
|
+
}
|
|
17
|
+
const allValues = Array.from(new Set([...minimalValues, ...largeSteps])).sort((a, b) => a - b);
|
|
18
|
+
const utilities = {};
|
|
19
|
+
const properties = {
|
|
20
|
+
w: 'width',
|
|
21
|
+
h: 'height',
|
|
22
|
+
'min-w-b': 'minWidth',
|
|
23
|
+
'max-w-b': 'maxWidth',
|
|
24
|
+
'min-h-b': 'minHeight',
|
|
25
|
+
'max-h-b': 'maxHeight',
|
|
26
|
+
'p-b': 'padding',
|
|
27
|
+
'pt-b': 'paddingTop',
|
|
28
|
+
'pr-b': 'paddingRight',
|
|
29
|
+
'pb-b': 'paddingBottom',
|
|
30
|
+
'pl-b': 'paddingLeft',
|
|
31
|
+
'px-b': ['paddingLeft', 'paddingRight'],
|
|
32
|
+
'py-b': ['paddingTop', 'paddingBottom'],
|
|
33
|
+
'm-b': 'margin',
|
|
34
|
+
'mt-b': 'marginTop',
|
|
35
|
+
'mr-b': 'marginRight',
|
|
36
|
+
'mb-b': 'marginBottom',
|
|
37
|
+
'ml-b': 'marginLeft',
|
|
38
|
+
'mx-b': ['marginLeft', 'marginRight'],
|
|
39
|
+
'my-b': ['marginTop', 'marginBottom'],
|
|
40
|
+
};
|
|
41
|
+
for (const [prefix, cssProp] of Object.entries(properties)) {
|
|
42
|
+
for (const pxValue of allValues) {
|
|
43
|
+
const multiplier = pxValue / 16;
|
|
44
|
+
const className = `.${prefix}-b_${pxValue}`;
|
|
45
|
+
const cssValue = `calc(var(${baseVar}) * ${multiplier})`;
|
|
46
|
+
if (Array.isArray(cssProp)) {
|
|
47
|
+
utilities[className] = cssProp.reduce((acc, prop) => {
|
|
48
|
+
acc[prop] = cssValue;
|
|
49
|
+
return acc;
|
|
50
|
+
}, {});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
utilities[className] = {
|
|
54
|
+
[cssProp]: cssValue,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
addUtilities(utilities, { variants: ['responsive'] });
|
|
60
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
export default plugin(function ({ addUtilities }) {
|
|
3
|
+
const utilities = {};
|
|
4
|
+
for (let i = 10; i <= 100; i += 10) {
|
|
5
|
+
utilities[`.w-b_screen-${i}`] = {
|
|
6
|
+
width: `${i}vw`,
|
|
7
|
+
};
|
|
8
|
+
utilities[`.h-b_screen-${i}`] = {
|
|
9
|
+
height: `${i}vh`,
|
|
10
|
+
};
|
|
11
|
+
utilities[`.min-h-b_screen-${i}`] = {
|
|
12
|
+
minHeight: `${i}vh`,
|
|
13
|
+
};
|
|
14
|
+
utilities[`.max-h-b_screen-${i}`] = {
|
|
15
|
+
maxHeight: `${i}vh`,
|
|
16
|
+
};
|
|
17
|
+
utilities[`.min-w-b_screen-${i}`] = {
|
|
18
|
+
minWidth: `${i}vw`,
|
|
19
|
+
};
|
|
20
|
+
utilities[`.max-w-b_screen-${i}`] = {
|
|
21
|
+
maxWidth: `${i}vw`,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
addUtilities(utilities);
|
|
25
|
+
});
|
package/dist/screens.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const getScreens = (prefix = '', minxmax = { min: '768px', max: '1100px', max2xl: '1440px' }) => {
|
|
2
|
+
// max 320px
|
|
3
|
+
const screens = {};
|
|
4
|
+
screens[prefix + 'xs'] = { max: minxmax.min };
|
|
5
|
+
screens[prefix + 'md'] = { min: minxmax.min, max: minxmax.max };
|
|
6
|
+
screens[prefix + 'xl'] = { min: minxmax.max };
|
|
7
|
+
screens[prefix + 'sm'] = { max: minxmax.max };
|
|
8
|
+
screens[prefix + '2xl'] = { min: minxmax.max2xl };
|
|
9
|
+
return screens;
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const gridSpacing: (prefix?: string) => {};
|
|
2
|
+
export declare const fluidSpacing: (prefix?: string) => {};
|
|
3
|
+
export declare const percentSpacing: () => string[];
|
|
4
|
+
export declare const screenSpacing: () => {};
|
|
5
|
+
export declare const nativeSpacing: () => (string | number)[];
|
|
6
|
+
export declare const spanSpacing: () => number[];
|