@blockbite/tailwind 3.4.2

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.
Files changed (41) hide show
  1. package/.gitattributes +2 -0
  2. package/.tool-versions +1 -0
  3. package/README.md +75 -0
  4. package/blockbite-tailwind.code-workspace +7 -0
  5. package/components/anchor-position.js +110 -0
  6. package/components/fluid-container.js +34 -0
  7. package/components/grid-container.js +37 -0
  8. package/components/interaction.js +37 -0
  9. package/components/swiper.js +13 -0
  10. package/deprecated/fluid-container-aside.js +48 -0
  11. package/deprecated/fluid-container-half.js +48 -0
  12. package/gridarea/index.js +6 -0
  13. package/gridarea/utilities/area-dimensions.js +13 -0
  14. package/gridarea/utilities/grid-area.js +51 -0
  15. package/index.d.ts +17 -0
  16. package/index.html +46 -0
  17. package/index.js +30 -0
  18. package/lib/aspect-ratio.js +6 -0
  19. package/lib/colors.js +59 -0
  20. package/lib/container.js +10 -0
  21. package/lib/screens.js +13 -0
  22. package/lib/spacing.js +215 -0
  23. package/lib/theme-parser.js +83 -0
  24. package/motion/index.js +14 -0
  25. package/motion/theme.js +174 -0
  26. package/motion/utilities/delay.js +7 -0
  27. package/motion/utilities/direction.js +14 -0
  28. package/motion/utilities/duration.js +7 -0
  29. package/motion/utilities/fillMode.js +14 -0
  30. package/motion/utilities/iterationCount.js +14 -0
  31. package/motion/utilities/offset.js +11 -0
  32. package/motion/utilities/playState.js +14 -0
  33. package/motion/utilities/timingFunction.js +14 -0
  34. package/package.json +25 -0
  35. package/plugins/viewport-dimensions.js +33 -0
  36. package/postcss.config.js +6 -0
  37. package/tailwind.config.js +18 -0
  38. package/theme-example.json +329 -0
  39. package/themecolors/index.js +66 -0
  40. package/vite.css +8 -0
  41. package/vite.js +64 -0
package/lib/spacing.js ADDED
@@ -0,0 +1,215 @@
1
+ function createFluidSpacing(prefix) {
2
+ const fluid = [
3
+ {
4
+ size: "0px",
5
+ slug: "0",
6
+ name: "0",
7
+ },
8
+ {
9
+ size: "clamp(16px, 1vw, 32px)",
10
+ slug: "1",
11
+ name: "1",
12
+ },
13
+ {
14
+ size: "clamp(32px, 1vw, 48px)",
15
+ slug: "2",
16
+ name: "2",
17
+ },
18
+ {
19
+ size: "clamp(40px, 1vw, 50px)",
20
+ slug: "3",
21
+ name: "3",
22
+ },
23
+ {
24
+ size: "clamp(64px, 1vw, 80px)",
25
+ slug: "4",
26
+ name: "4",
27
+ },
28
+ {
29
+ size: "clamp(128px, 1vw, 144px)",
30
+ slug: "5",
31
+ name: "5",
32
+ },
33
+ {
34
+ size: "clamp(144px, 1vw, 164px)",
35
+ slug: "6",
36
+ name: "6",
37
+ },
38
+ {
39
+ slug: "8",
40
+ size: "clamp(16px, 1vw, 32px)",
41
+ name: "8",
42
+ },
43
+ {
44
+ slug: "9",
45
+ size: "clamp(16px, 1vw, 32px)",
46
+ name: "9",
47
+ },
48
+ {
49
+ slug: "10",
50
+ size: "clamp(16px, 1vw, 32px)",
51
+ name: "10",
52
+ },
53
+ // can be used to push contain inside grid-container
54
+ {
55
+ slug: "1fr",
56
+ size: "var(--b_fr-size, 1rem)",
57
+ name: "1FR",
58
+ },
59
+ ];
60
+
61
+ const FluidSizes = {};
62
+ // add clamp spacing for gaps
63
+ fluid.forEach((size) => {
64
+ // add to spacing
65
+ FluidSizes[prefix + "fluid-" + size.slug] = size.size;
66
+ });
67
+
68
+ return FluidSizes;
69
+ }
70
+
71
+ function createPercentSpacing(prefix) {
72
+ const percentUnits = [
73
+ "1/2",
74
+ "1/3",
75
+ "2/3",
76
+ "1/4",
77
+ "2/4",
78
+ "3/4",
79
+ "1/5",
80
+ "2/5",
81
+ "3/5",
82
+ "4/5",
83
+ "1/6",
84
+ "2/6",
85
+ "3/6",
86
+ "4/6",
87
+ "5/6",
88
+ "1/12",
89
+ "2/12",
90
+ "3/12",
91
+ "4/12",
92
+ "5/12",
93
+ "6/12",
94
+ "7/12",
95
+ "8/12",
96
+ "9/12",
97
+ "10/12",
98
+ "11/12",
99
+ "full",
100
+ ];
101
+ return percentUnits;
102
+ }
103
+ function createScreenSpacing() {
104
+ const screenSpacing = [
105
+ "b_screen-10",
106
+ "b_screen-20",
107
+ "b_screen-30",
108
+ "b_screen-40",
109
+ "b_screen-50",
110
+ "b_screen-60",
111
+ "b_screen-70",
112
+ "b_screen-80",
113
+ "b_screen-90",
114
+ "b_screen-100",
115
+ ];
116
+
117
+ const screenSpacingValues = {};
118
+ screenSpacing.forEach((size) => {
119
+ screenSpacingValues[size] = size;
120
+ });
121
+ return screenSpacingValues;
122
+ }
123
+
124
+ function createGridSpacing(prefix) {
125
+ // create grid based on 16px
126
+ const gridSpacing = {};
127
+
128
+ const minimalValues = [0, 1, 2, 4, 6, 8, 10, 12, 14, 18, 20, 22, 24, 32];
129
+ for (let i = 0; i < minimalValues.length; i++) {
130
+ let minimalValue = minimalValues[i];
131
+ gridSpacing[`${prefix}${minimalValue}`] = minimalValue / 16 + "rem";
132
+ }
133
+ for (let i = 1; i < 1280 / 16; i++) {
134
+ const gridsize = i * 16;
135
+ gridSpacing[`${prefix}${gridsize}`] = i + "rem";
136
+ }
137
+ return gridSpacing;
138
+ }
139
+
140
+ function createNativeSpacing() {
141
+ const nativeSpacing = [
142
+ 0,
143
+ "px",
144
+ 0.5,
145
+ 1,
146
+ 1.5,
147
+ 2,
148
+ 2.5,
149
+ 3,
150
+ 3.5,
151
+ 4,
152
+ 5,
153
+ 6,
154
+ 7,
155
+ 8,
156
+ 9,
157
+ 10,
158
+ 11,
159
+ 12,
160
+ 14,
161
+ 16,
162
+ 20,
163
+ 24,
164
+ 28,
165
+ 32,
166
+ 36,
167
+ 40,
168
+ 44,
169
+ 48,
170
+ 52,
171
+ 56,
172
+ 60,
173
+ 64,
174
+ 72,
175
+ 80,
176
+ 96,
177
+ ];
178
+ return nativeSpacing;
179
+ }
180
+
181
+ function createSpanSpacing() {
182
+ const colSpanValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
183
+ return colSpanValues;
184
+ }
185
+
186
+ export const gridSpacing = (prefix = "") => {
187
+ // create grid based on 16px
188
+ const spacingRem = createGridSpacing(prefix);
189
+ return spacingRem;
190
+ };
191
+
192
+ export const fluidSpacing = (prefix = "") => {
193
+ const spacingFluid = createFluidSpacing(prefix);
194
+ return spacingFluid;
195
+ };
196
+
197
+ export const percentSpacing = () => {
198
+ const spacingPercent = createPercentSpacing();
199
+ return spacingPercent;
200
+ };
201
+
202
+ export const screenSpacing = () => {
203
+ const spacingScreen = createScreenSpacing();
204
+ return spacingScreen;
205
+ };
206
+
207
+ export const nativeSpacing = () => {
208
+ const spacingNative = createNativeSpacing();
209
+ return spacingNative;
210
+ };
211
+
212
+ export const spanSpacing = () => {
213
+ const spacingSpan = createSpanSpacing();
214
+ return spacingSpan;
215
+ };
@@ -0,0 +1,83 @@
1
+ /*
2
+ * This file is used to parse the theme.json file from the theme to generate the tailwind config
3
+ */
4
+ import { fluidSpacing, gridSpacing, nativeSpacing } from "./spacing";
5
+ import { getScreens } from "./screens";
6
+ import { getAspectRatio } from "./aspect-ratio";
7
+ import { getContainer } from "./container";
8
+
9
+ export function themeParser(
10
+ theme,
11
+ prefixObject = {
12
+ prefixScreens: "b_",
13
+ prefixAspectRatio: "b_",
14
+ prefixSpacing: "b_",
15
+ },
16
+ gridFluidSpacing = true
17
+ ) {
18
+ // get prefixes
19
+ const { prefixScreens, prefixAspectRatio, prefixSpacing } = prefixObject;
20
+
21
+ // import 16-grid and clamp spacing
22
+ let spacing = {};
23
+ if (gridFluidSpacing) {
24
+ spacing = [...fluidSpacing(prefixSpacing), ...gridSpacing(prefixSpacing)];
25
+ }
26
+
27
+ // add colors
28
+ let colors = {};
29
+ if (theme.settings.color && theme.settings.color.palette !== undefined) {
30
+ theme.settings.color.palette.forEach((color) => {
31
+ colors[color.slug] = color.color;
32
+ });
33
+ }
34
+
35
+ // add fonts and fontWeights
36
+ let fonts = {};
37
+ let fontWeights = {};
38
+ if (
39
+ theme.settings.typography &&
40
+ theme.settings.typography.fontFamilies !== undefined
41
+ ) {
42
+ theme.settings.typography.fontFamilies.forEach((fam) => {
43
+ fonts[fam.slug] = fam.fontFamily.split(",");
44
+ if (fam.fontFace) {
45
+ // generate fontWeights
46
+ fam.fontFace.forEach((face) => {
47
+ fontWeights[face.fontWeight] = face.fontWeight;
48
+ });
49
+ }
50
+ });
51
+ }
52
+
53
+ // fontsizes
54
+ let fontSizes = {};
55
+ if (
56
+ theme.settings.typography &&
57
+ theme.settings.typography.fontSizes !== undefined
58
+ ) {
59
+ theme.settings.typography.fontSizes.forEach((size) => {
60
+ // add font variables
61
+ fontSizes[size.slug] = `var(--wp--preset--font-size--${size.slug})`;
62
+ });
63
+ }
64
+
65
+ // responsive
66
+ const screens = getScreens(prefixScreens);
67
+ // aspect ratio
68
+ const aspectRatio = getAspectRatio(prefixAspectRatio);
69
+ // container
70
+ const container = getContainer();
71
+
72
+ // export object
73
+ return {
74
+ fonts: fonts,
75
+ fontWeights: fontWeights,
76
+ colors: colors,
77
+ spacing: spacing,
78
+ fontSizes: fontSizes,
79
+ screens: screens,
80
+ aspectRatio: aspectRatio,
81
+ container: container,
82
+ };
83
+ }
@@ -0,0 +1,14 @@
1
+ const plugin = require('tailwindcss/plugin');
2
+
3
+ module.exports = plugin(api => {
4
+ require('./utilities/delay')(api);
5
+ require('./utilities/direction')(api);
6
+ require('./utilities/duration')(api);
7
+ require('./utilities/fillMode')(api);
8
+ require('./utilities/iterationCount')(api);
9
+ require('./utilities/playState')(api);
10
+ require('./utilities/timingFunction')(api);
11
+ require('./utilities/offset')(api);
12
+ }, {
13
+ theme: require('./theme'),
14
+ });
@@ -0,0 +1,174 @@
1
+ module.exports = {
2
+ extend: {
3
+ keyframes: {
4
+ 'wiggle': {
5
+ '0%, 100%': {
6
+ transform: 'rotate(-3deg)',
7
+ },
8
+ '50%': {
9
+ transform: 'rotate(3deg)',
10
+ },
11
+ },
12
+ 'wiggle-more': {
13
+ '0%, 100%': {
14
+ transform: 'rotate(-12deg)',
15
+ },
16
+ '50%': {
17
+ transform: 'rotate(12deg)',
18
+ },
19
+ },
20
+ 'rotate-y': {
21
+ '0%': {
22
+ transform: 'rotateY(360deg)',
23
+ },
24
+ '100%': {
25
+ transform: 'rotateY(0)',
26
+ },
27
+ },
28
+ 'rotate-x': {
29
+ '0%': {
30
+ transform: 'rotateX(360deg)',
31
+ },
32
+ '100%': {
33
+ transform: 'rotateX(0)',
34
+ },
35
+ },
36
+ 'jump': {
37
+ '0%, 100%': {
38
+ transform: 'scale(100%)',
39
+ },
40
+ '10%': {
41
+ transform: 'scale(80%)',
42
+ },
43
+ '50%': {
44
+ transform: 'scale(120%)',
45
+ },
46
+ },
47
+ 'jump-in': {
48
+ '0%': {
49
+ transform: 'scale(0%)',
50
+ },
51
+ '80%': {
52
+ transform: 'scale(120%)',
53
+ },
54
+ '100%': {
55
+ transform: 'scale(100%)',
56
+ },
57
+ },
58
+ 'jump-out': {
59
+ '0%': {
60
+ transform: 'scale(100%)',
61
+ },
62
+ '20%': {
63
+ transform: 'scale(120%)',
64
+ },
65
+ '100%': {
66
+ transform: 'scale(0%)',
67
+ },
68
+ },
69
+ 'shake': {
70
+ '0%': {
71
+ transform: 'translateX(0rem)',
72
+ },
73
+ '25%': {
74
+ transform: 'translateX(-1rem)',
75
+ },
76
+ '75%': {
77
+ transform: 'translateX(1rem)',
78
+ },
79
+ '100%': {
80
+ transform: 'translateX(0rem)',
81
+ },
82
+ },
83
+ 'fade': {
84
+ '0%': {
85
+ opacity: '0',
86
+ transform: 'translate(var(--an-ani-x), var(--an-ani-y))',
87
+ },
88
+ '100%': {
89
+ opacity: '1',
90
+ transform: 'translateY(var(--tw-translate-y))',
91
+ },
92
+ },
93
+ 'fade-left': {
94
+ '0%': {
95
+ opacity: '0',
96
+ transform: 'translateY(var(--an-translate-y))',
97
+ },
98
+ '100%': {
99
+ opacity: '1',
100
+ transform: 'translateY(var(--tw-translate-y))',
101
+ },
102
+ },
103
+ 'fade-right': {
104
+ '0%': {
105
+ opacity: '0',
106
+ transform: 'translateY(var(--an-translate-y))',
107
+ },
108
+ '100%': {
109
+ opacity: '1',
110
+ transform: 'translateY(var(--tw-translate-y))',
111
+ },
112
+ },
113
+ 'flip-up': {
114
+ '0%': {
115
+ transform: 'rotateX(90deg)',
116
+ transformOrigin: 'bottom',
117
+ },
118
+ '100%': {
119
+ transform: 'rotateX(0)',
120
+ transformOrigin: 'bottom',
121
+ },
122
+ },
123
+ 'flip-down': {
124
+ '0%': {
125
+ transform: 'rotateX(-90deg)',
126
+ transformOrigin: 'top',
127
+ },
128
+ '100%': {
129
+ transform: 'rotateX(0)',
130
+ transformOrigin: 'top',
131
+ },
132
+ },
133
+ },
134
+ animation: {
135
+ 'wiggle': 'wiggle 1s both',
136
+ 'wiggle-more': 'wiggle-more 1s both',
137
+ 'rotate-y': 'rotate-y 1s both',
138
+ 'rotate-x': 'rotate-x 1s both',
139
+ 'jump': 'jump .5s both',
140
+ 'jump-in': 'jump-in .5s both',
141
+ 'jump-out': 'jump-out .5s both',
142
+ 'shake': 'shake .5s both',
143
+ 'fade': 'fade 1s both',
144
+ 'fade-down': 'fade-down 1s both',
145
+ 'fade-up': 'fade-up 1s both',
146
+ 'fade-left': 'fade-left 1s both',
147
+ 'fade-right': 'fade-right 1s both',
148
+ 'flip-up': 'flip-up 1s both',
149
+ 'flip-down': 'flip-down 1s both',
150
+ },
151
+ animationDelay: {
152
+ none: '0ms',
153
+ 0: '0ms',
154
+ 75: '75ms',
155
+ 100: '100ms',
156
+ 150: '150ms',
157
+ 200: '200ms',
158
+ 300: '300ms',
159
+ 500: '500ms',
160
+ 700: '700ms',
161
+ 1000: '1000ms',
162
+ },
163
+ animationDuration: {
164
+ 75: '75ms',
165
+ 100: '100ms',
166
+ 150: '150ms',
167
+ 200: '200ms',
168
+ 300: '300ms',
169
+ 500: '500ms',
170
+ 700: '700ms',
171
+ 1000: '1000ms',
172
+ },
173
+ },
174
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = ({ matchUtilities, theme }) => matchUtilities({
2
+ 'animate-delay': value => ({
3
+ 'animation-delay': value,
4
+ }),
5
+ }, {
6
+ values: theme('animationDelay'),
7
+ });
@@ -0,0 +1,14 @@
1
+ module.exports = ({ addUtilities }) => addUtilities({
2
+ '.animate-normal': {
3
+ 'animation-direction': 'normal',
4
+ },
5
+ '.animate-reverse': {
6
+ 'animation-direction': 'reverse',
7
+ },
8
+ '.animate-alternate': {
9
+ 'animation-direction': 'alternate',
10
+ },
11
+ '.animate-alternate-reverse': {
12
+ 'animation-direction': 'alternate-reverse',
13
+ },
14
+ });
@@ -0,0 +1,7 @@
1
+ module.exports = ({ matchUtilities, theme }) => matchUtilities({
2
+ 'animate-duration': value => ({
3
+ 'animation-duration': value,
4
+ }),
5
+ }, {
6
+ values: theme('animationDuration'),
7
+ });
@@ -0,0 +1,14 @@
1
+ module.exports = ({ addUtilities }) => addUtilities({
2
+ '.animate-fill-none': {
3
+ 'animation-fill-mode': 'normal',
4
+ },
5
+ '.animate-fill-forwards': {
6
+ 'animation-fill-mode': 'forwards',
7
+ },
8
+ '.animate-fill-backwards': {
9
+ 'animation-fill-mode': 'backwards',
10
+ },
11
+ '.animate-fill-both': {
12
+ 'animation-fill-mode': 'both',
13
+ },
14
+ });
@@ -0,0 +1,14 @@
1
+ module.exports = ({ addUtilities }) => addUtilities({
2
+ '.animate-infinite': {
3
+ 'animation-iteration-count': 'infinite',
4
+ },
5
+ '.animate-once': {
6
+ 'animation-iteration-count': '1',
7
+ },
8
+ '.animate-twice': {
9
+ 'animation-iteration-count': '2',
10
+ },
11
+ '.animate-thrice': {
12
+ 'animation-iteration-count': '3',
13
+ },
14
+ });
@@ -0,0 +1,11 @@
1
+ module.exports = function ({ addUtilities, theme, e }, gridSpacing) {
2
+ const spacing = theme("spacing");
3
+ const newUtilities = {};
4
+
5
+ Object.entries(spacing).map(([key, value]) => {
6
+ newUtilities[`.${e(`b_ani-x-${key}`)}`] = { "--an-ani-x": `${value}` };
7
+ newUtilities[`.${e(`b_ani-y-${key}`)}`] = { "--an-ani-y": `${value}` };
8
+ });
9
+
10
+ addUtilities(newUtilities, ["responsive"]);
11
+ };
@@ -0,0 +1,14 @@
1
+ module.exports = ({ addUtilities }) => addUtilities({
2
+ '.animate-run': {
3
+ 'animation-play-state': 'running',
4
+ },
5
+ '.animate-play': {
6
+ 'animation-play-state': 'running',
7
+ },
8
+ '.animate-stop': {
9
+ 'animation-play-state': 'paused',
10
+ },
11
+ '.animate-pause': {
12
+ 'animation-play-state': 'paused',
13
+ },
14
+ });
@@ -0,0 +1,14 @@
1
+ module.exports = ({ addUtilities }) => addUtilities({
2
+ '.animate-ease-linear': {
3
+ 'animation-timing-function': 'linear',
4
+ },
5
+ '.animate-ease-in': {
6
+ 'animation-timing-function': 'cubic-bezier(0.4, 0, 1, 1)',
7
+ },
8
+ '.animate-ease-out': {
9
+ 'animation-timing-function': 'cubic-bezier(0, 0, 0.2, 1)',
10
+ },
11
+ '.animate-ease-in-out': {
12
+ 'animation-timing-function': 'cubic-bezier(0.4, 0, 0.2, 1)',
13
+ },
14
+ });
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@blockbite/tailwind",
3
+ "version": "3.4.2",
4
+ "description": "helper for blockbite plugin and blockbite theme",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "dev": "vite",
9
+ "build": "vite build"
10
+ },
11
+ "author": "block-bite.com",
12
+ "license": "ISC",
13
+ "dependencies": {
14
+ "user": "^0.0.0"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "devDependencies": {
20
+ "autoprefixer": "^10.4.19",
21
+ "postcss": "^8.4.38",
22
+ "tailwindcss": "^3.4.3",
23
+ "vite": "^5.2.0"
24
+ }
25
+ }
@@ -0,0 +1,33 @@
1
+ const plugin = require("tailwindcss/plugin");
2
+
3
+ module.exports = plugin(function ({ addUtilities }) {
4
+ const utilities = {};
5
+
6
+ for (let i = 10; i <= 100; i += 10) {
7
+ utilities[`.w-b_screen-${i}`] = {
8
+ width: `${i}vw`,
9
+ };
10
+
11
+ utilities[`.h-b_screen-${i}`] = {
12
+ height: `${i}vh`,
13
+ };
14
+
15
+ utilities[`.min-h-b_screen-${i}`] = {
16
+ minHeight: `${i}vh`,
17
+ };
18
+
19
+ utilities[`.max-h-b_screen-${i}`] = {
20
+ maxHeight: `${i}vh`,
21
+ };
22
+
23
+ utilities[`.min-w-b_screen-${i}`] = {
24
+ minWidth: `${i}vw`,
25
+ };
26
+
27
+ utilities[`.max-w-b_screen-${i}`] = {
28
+ maxWidth: `${i}vw`,
29
+ };
30
+ }
31
+
32
+ addUtilities(utilities);
33
+ });
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -0,0 +1,18 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+
3
+ import { getContainer } from "./lib/container.js";
4
+
5
+ module.exports = {
6
+ content: ["./vite.html", "./vite.js"],
7
+ theme: {
8
+ extend: {
9
+ container: getContainer(),
10
+ },
11
+ },
12
+ plugins: [
13
+ require("./gridarea"),
14
+ require("./components/fluid-container.js"),
15
+ require("./components/grid-container.js"),
16
+ require("./themecolors"),
17
+ ],
18
+ };