@blockbite/tailwind 3.4.14 → 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.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { getAspectRatio } from './aspect-ratio.js';
2
1
  import { getColorObject, getColors } from './colors.js';
3
2
  import { getContainer } from './container.js';
4
3
  import { getScreens } from './screens.js';
5
4
  import { fluidSpacing, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing } from './spacing.js';
6
- import { themeParser } from './theme-parser.js';
7
5
  declare const blockbiteTailwindPlugin: any;
8
6
  export default blockbiteTailwindPlugin;
9
- export { fluidSpacing, getAspectRatio, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, themeParser, };
7
+ export { fluidSpacing, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, };
package/dist/index.js CHANGED
@@ -1,11 +1,9 @@
1
1
  import plugin from 'tailwindcss/plugin';
2
2
  // Utilities and helpers
3
- import { getAspectRatio } from './aspect-ratio.js';
4
3
  import { getColorObject, getColors } from './colors.js';
5
4
  import { getContainer } from './container.js';
6
5
  import { getScreens } from './screens.js';
7
6
  import { fluidSpacing, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, } from './spacing.js';
8
- import { themeParser } from './theme-parser.js';
9
7
  // Components
10
8
  import anchorPosition from './components/anchor-position.js';
11
9
  import fluidContainer from './components/fluid-container.js';
@@ -13,6 +11,7 @@ import gridContainer from './components/grid-container.js';
13
11
  import interaction from './components/interaction.js';
14
12
  import swiper from './components/swiper.js';
15
13
  // Plugins
14
+ import grid16x from './plugins/grid-16x.js';
16
15
  import viewportDimensions from './plugins/viewport-dimensions.js';
17
16
  // Gridarea utilities
18
17
  import gridAreaPlugin from './gridarea/index.js';
@@ -26,7 +25,8 @@ const blockbiteTailwindPlugin = plugin(function (api) {
26
25
  // Register all plugins/utilities
27
26
  viewportDimensions.handler(api);
28
27
  gridAreaPlugin.handler(api);
28
+ grid16x.handler(api);
29
29
  });
30
30
  export default blockbiteTailwindPlugin;
31
31
  // Export functions and constants
32
- export { fluidSpacing, getAspectRatio, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, themeParser, };
32
+ export { fluidSpacing, getColorObject, getColors, getContainer, getScreens, gridSpacing, nativeSpacing, percentSpacing, screenSpacing, spanSpacing, };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("node_modules/tailwindcss/dist/types-B254mqw1.mjs").b;
2
+ export default _default;
@@ -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
+ });
package/dist/spacing.js CHANGED
@@ -176,8 +176,8 @@ function createSpanSpacing() {
176
176
  }
177
177
  export const gridSpacing = (prefix = '') => {
178
178
  // create grid based on 16px
179
- const spacingRem = createGridSpacing(prefix);
180
- return spacingRem;
179
+ const spacingGrid = createGridSpacing(prefix);
180
+ return spacingGrid;
181
181
  };
182
182
  export const fluidSpacing = (prefix = '') => {
183
183
  const spacingFluid = createFluidSpacing(prefix);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockbite/tailwind",
3
- "version": "3.4.14",
3
+ "version": "3.4.15",
4
4
  "description": "helper for blockbite plugin and blockbite theme",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- export declare const getAspectRatio: (prefix?: string) => {};
@@ -1,6 +0,0 @@
1
- export const getAspectRatio = (prefix = 'b_') => {
2
- const ratios = {};
3
- ratios[prefix + 'portrait'] = '3 / 4';
4
- ratios[prefix + 'landscape'] = '4 / 3';
5
- return ratios;
6
- };
@@ -1,21 +0,0 @@
1
- export declare function themeParser(theme: any, prefixObject?: {
2
- prefixScreens: string;
3
- prefixAspectRatio: string;
4
- prefixSpacing: string;
5
- }, gridFluidSpacing?: boolean): {
6
- fonts: {};
7
- fontWeights: {};
8
- colors: {};
9
- spacing: {};
10
- fontSizes: {};
11
- screens: {};
12
- aspectRatio: {};
13
- container: {
14
- center: boolean;
15
- padding: {
16
- DEFAULT: string;
17
- sm: string;
18
- lg: string;
19
- };
20
- };
21
- };
@@ -1,68 +0,0 @@
1
- /*
2
- * This file is used to parse the theme.json file from the theme to generate the tailwind config
3
- */
4
- import { getAspectRatio } from './aspect-ratio.js';
5
- import { getContainer } from './container.js';
6
- import { getScreens } from './screens.js';
7
- import { fluidSpacing, gridSpacing } from './spacing.js';
8
- export function themeParser(theme, prefixObject = {
9
- prefixScreens: 'b_',
10
- prefixAspectRatio: 'b_',
11
- prefixSpacing: 'b_',
12
- }, gridFluidSpacing = true) {
13
- // get prefixes
14
- const { prefixScreens, prefixAspectRatio, prefixSpacing } = prefixObject;
15
- // import 16-grid and clamp spacing
16
- let spacing = {};
17
- if (gridFluidSpacing) {
18
- spacing = Object.assign({}, fluidSpacing(prefixSpacing), gridSpacing(prefixSpacing));
19
- }
20
- // add colors
21
- const colors = {};
22
- if (theme.settings.color && theme.settings.color.palette !== undefined) {
23
- theme.settings.color.palette.forEach((color) => {
24
- colors[color.slug] = color.color;
25
- });
26
- }
27
- // add fonts and fontWeights
28
- const fonts = {};
29
- const fontWeights = {};
30
- if (theme.settings.typography &&
31
- theme.settings.typography.fontFamilies !== undefined) {
32
- theme.settings.typography.fontFamilies.forEach((fam) => {
33
- fonts[fam.slug] = fam.fontFamily.split(',');
34
- if (fam.fontFace) {
35
- // generate fontWeights
36
- fam.fontFace.forEach((face) => {
37
- fontWeights[face.fontWeight] = face.fontWeight;
38
- });
39
- }
40
- });
41
- }
42
- // fontsizes
43
- const fontSizes = {};
44
- if (theme.settings.typography &&
45
- theme.settings.typography.fontSizes !== undefined) {
46
- theme.settings.typography.fontSizes.forEach((size) => {
47
- // add font variables
48
- fontSizes[size.slug] = `var(--wp--preset--font-size--${size.slug})`;
49
- });
50
- }
51
- // responsive
52
- const screens = getScreens(prefixScreens);
53
- // aspect ratio
54
- const aspectRatio = getAspectRatio(prefixAspectRatio);
55
- // container
56
- const container = getContainer();
57
- // export object
58
- return {
59
- fonts,
60
- fontWeights,
61
- colors,
62
- spacing,
63
- fontSizes,
64
- screens,
65
- aspectRatio,
66
- container,
67
- };
68
- }