masonry-snap-grid-layout 1.0.10 → 1.0.12

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 CHANGED
@@ -1,196 +1,198 @@
1
-
2
- # masonry-snap-grid-layout
3
-
4
- [![npm version](https://img.shields.io/npm/v/masonry-snap-grid-layout?color=brightgreen)](https://www.npmjs.com/package/masonry-snap-grid-layout)
5
- [![CI/CD](https://github.com/khachatryan-dev/masonry-snap-grid-layout/actions/workflows/publish.yml/badge.svg)](https://github.com/khachatryan-dev/masonry-snap-grid-layout/actions)
6
- [![Demo Vanilla JS](https://img.shields.io/badge/demo-vanilla%20js-blue)](https://codesandbox.io/p/sandbox/l9xl7s)
7
- [![Demo React](https://img.shields.io/badge/demo-react-blue)](https://codesandbox.io/p/sandbox/rgxsxp)
8
-
9
- A performant masonry grid layout library with smooth animations, customizable gutter, columns, and dynamic item content.
10
-
11
- ![Masonry Grid Demo](https://i.imgur.com/JQZ4L7C.gif)
12
-
13
- ---
14
-
15
- ## 🚀 Features
16
-
17
- - **Dynamic Columns & Gutter**: Automatically adapts to container width
18
- - **Smooth Animations**: CSS-powered transitions when layout changes
19
- - **Customizable Items**: Render any content with gradient backgrounds and emojis
20
- - **Lightweight**: Zero dependencies, pure TypeScript
21
- - **React & Vanilla JS**: Works with both React and plain JavaScript
22
- - **Responsive**: Perfect for galleries, dashboards, and card layouts
23
-
24
- ---
25
-
26
- ## 🔧 Installation
27
-
28
- ```bash
29
- npm install masonry-snap-grid-layout
30
- # or
31
- yarn add masonry-snap-grid-layout
32
- # or
33
- pnpm add masonry-snap-grid-layout
34
- ```
35
-
36
- ---
37
-
38
- ## 💡 Usage Examples
39
-
40
- ### Vanilla JavaScript (Live Demo)
41
-
42
- ```javascript
43
- import MasonrySnapGridLayout from 'masonry-snap-grid-layout';
44
- import 'masonry-snap-grid-layout/dist/index.css';
45
-
46
- const container = document.getElementById('masonry-container');
47
- const items = [
48
- { id: 1, title: "Sunset", emoji: "🌅", color: "#FF9A9E" },
49
- { id: 2, title: "Ocean", emoji: "🌊", color: "#A1C4FD" },
50
- // ... more items
51
- ];
52
-
53
- const masonry = new MasonrySnapGridLayout(container, {
54
- gutter: 16,
55
- minColWidth: 200,
56
- animate: true,
57
- transitionDuration: 300,
58
- items: items,
59
- renderItem: (item) => {
60
- const div = document.createElement('div');
61
- div.style.height = `${120 + Math.random() * 200}px`;
62
- div.style.background = `linear-gradient(135deg, ${item.color} 0%, #FFFFFF 100%)`;
63
- div.style.borderRadius = '12px';
64
- div.style.padding = '16px';
65
- div.style.color = '#333';
66
- div.innerHTML = `
67
- <div style="font-size: 2rem">${item.emoji}</div>
68
- <h3 style="margin: 8px 0">${item.title}</h3>
69
- `;
70
- return div;
71
- }
72
- });
73
- ```
74
-
75
- [![Open Vanilla Demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/l9xl7s)
76
-
77
- ---
78
-
79
- ### React (Live Demo)
80
-
81
- ```jsx
82
- import MasonrySnapGrid from 'masonry-snap-grid-layout/react';
83
- import 'masonry-snap-grid-layout/dist/index.css';
84
-
85
- const items = Array.from({ length: 20 }, (_, i) => ({
86
- id: i,
87
- title: `Item ${i + 1}`,
88
- emoji: ['🌻', '🌈', '🍕', '🎸', '🚀'][Math.floor(Math.random() * 5)],
89
- height: 120 + Math.random() * 200
90
- }));
91
-
92
- export default function Gallery() {
93
- return (
94
- <MasonrySnapGrid
95
- items={items}
96
- gutter={16}
97
- minColWidth={220}
98
- animate
99
- transitionDuration={400}
100
- renderItem={(item) => (
101
- <div style={{
102
- height: `${item.height}px`,
103
- background: `linear-gradient(135deg,
104
- hsl(${Math.random() * 360}, 70%, 70%) 0%,
105
- hsl(${Math.random() * 360}, 70%, 80%) 100%)`,
106
- borderRadius: '12px',
107
- padding: '16px',
108
- color: 'white'
109
- }}>
110
- <div style={{ fontSize: '2rem' }}>{item.emoji}</div>
111
- <h3 style={{ margin: '8px 0' }}>{item.title}</h3>
112
- <small>Height: {Math.round(item.height)}px</small>
113
- </div>
114
- )}
115
- />
116
- );
117
- }
118
- ```
119
-
120
- [![Open React Demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/rgxsxp)
121
-
122
- ---
123
-
124
- ## 🛠️ API Reference
125
-
126
- ### Configuration Options
127
-
128
- | Option | Type | Default | Description |
129
- |----------------------|---------------------------|---------|--------------------------------------|
130
- | `gutter` | `number` | `16` | Spacing between items (px) |
131
- | `minColWidth` | `number` | `250` | Minimum column width (px) |
132
- | `animate` | `boolean` | `true` | Enable/disable animations |
133
- | `transitionDuration` | `number` | `400` | Animation duration (ms) |
134
- | `items` | `Array<T>` | `[]` | Your data items |
135
- | `renderItem` | `(item: T) => HTMLElement`| - | Function to render each item |
136
- | `classNames` | `Object` | - | Custom CSS class names |
137
-
138
- ### Methods
139
-
140
- - `updateItems(newItems: T[])`: Refresh with new items
141
- - `shuffleItems()`: Randomize item positions
142
- - `destroy()`: Clean up the instance
143
-
144
- ---
145
-
146
- ## 🎨 Customization Tips
147
-
148
- **1. Gradient Backgrounds**
149
- Use CSS gradients for beautiful card backgrounds:
150
-
151
- ```css
152
- background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
153
- ```
154
-
155
- **2. Random Emojis**
156
- Add personality with emojis:
157
-
158
- ```javascript
159
- const emojis = ['🌻', '🌈', '🍕', '🎸', '🚀'];
160
- const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
161
- ```
162
-
163
- **3. Responsive Breakpoints**
164
- Adjust columns based on screen size:
165
-
166
- ```javascript
167
- minColWidth: window.innerWidth < 768 ? 150 : 250
168
- ```
169
-
170
- ---
171
-
172
- ## 📦 Package Structure
173
-
174
- ```
175
- dist/
176
- ├── index.js # Vanilla JS bundle
177
- ├── react.js # React component
178
- ├── index.d.ts # TypeScript types
179
- └── index.css # Base styles
180
- ```
181
-
182
- ---
183
-
184
- ## 🤝 Contributing
185
-
186
- 1. Fork the repository
187
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
188
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
189
- 4. Push to the branch (`git push origin feature/amazing-feature`)
190
- 5. Open a Pull Request
191
-
192
- ---
193
-
194
- ## 📄 License
195
-
1
+
2
+ # masonry-snap-grid-layout
3
+
4
+ [![npm version](https://img.shields.io/npm/v/masonry-snap-grid-layout?color=brightgreen)](https://www.npmjs.com/package/masonry-snap-grid-layout)
5
+ [![CI/CD](https://github.com/khachatryan-dev/masonry-snap-grid-layout/actions/workflows/publish.yml/badge.svg)](https://github.com/khachatryan-dev/masonry-snap-grid-layout/actions)
6
+ [![Demo Vanilla JS](https://img.shields.io/badge/demo-vanilla%20js-blue)](https://codesandbox.io/p/sandbox/l9xl7s)
7
+ [![Demo React](https://img.shields.io/badge/demo-react-blue)](https://codesandbox.io/p/sandbox/rgxsxp)
8
+
9
+ A performant masonry grid layout library with smooth animations, customizable gutter, columns, and dynamic item content.
10
+
11
+ ![Masonry Grid Demo](https://i.imgur.com/JQZ4L7C.gif)
12
+
13
+ ---
14
+
15
+ ## 🚀 Features
16
+
17
+ - **Dynamic Columns & Gutter**: Automatically adapts to container width
18
+ - **Smooth Animations**: CSS-powered transitions when layout changes
19
+ - **Customizable Items**: Render any content with gradient backgrounds and emojis
20
+ - **Lightweight**: Zero dependencies, pure TypeScript
21
+ - **React & Vanilla JS**: Works with both React and plain JavaScript
22
+ - **Responsive**: Perfect for galleries, dashboards, and card layouts
23
+
24
+ ---
25
+
26
+ ## 🔧 Installation
27
+
28
+ ```bash
29
+ npm install masonry-snap-grid-layout
30
+ # or
31
+ yarn add masonry-snap-grid-layout
32
+ # or
33
+ pnpm add masonry-snap-grid-layout
34
+ ```
35
+
36
+ ---
37
+
38
+ ## 💡 Usage Examples
39
+
40
+ ### Vanilla JavaScript (Live Demo)
41
+
42
+ ```javascript
43
+ import MasonrySnapGridLayout from 'masonry-snap-grid-layout';
44
+ import 'masonry-snap-grid-layout/dist/index.css';
45
+
46
+ const container = document.getElementById('masonry-container');
47
+ const items = [
48
+ { id: 1, title: "Sunset", emoji: "🌅", color: "#FF9A9E" },
49
+ { id: 2, title: "Ocean", emoji: "🌊", color: "#A1C4FD" },
50
+ // ... more items
51
+ ];
52
+
53
+ const masonry = new MasonrySnapGridLayout(container, {
54
+ gutter: 16,
55
+ minColWidth: 200,
56
+ animate: true,
57
+ transitionDuration: 300,
58
+ items: items,
59
+ renderItem: (item) => {
60
+ const div = document.createElement('div');
61
+ div.style.height = `${120 + Math.random() * 200}px`;
62
+ div.style.background = `linear-gradient(135deg, ${item.color} 0%, #FFFFFF 100%)`;
63
+ div.style.borderRadius = '12px';
64
+ div.style.padding = '16px';
65
+ div.style.color = '#333';
66
+ div.innerHTML = `
67
+ <div style="font-size: 2rem">${item.emoji}</div>
68
+ <h3 style="margin: 8px 0">${item.title}</h3>
69
+ `;
70
+ return div;
71
+ }
72
+ });
73
+ ```
74
+
75
+ [![Open Vanilla Demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/l9xl7s)
76
+
77
+ ---
78
+
79
+ ### React (Live Demo)
80
+
81
+ ```jsx
82
+ import MasonrySnapGrid from 'masonry-snap-grid-layout/react';
83
+ import 'masonry-snap-grid-layout/dist/index.css';
84
+
85
+ const items = Array.from({ length: 20 }, (_, i) => ({
86
+ id: i,
87
+ title: `Item ${i + 1}`,
88
+ emoji: ['🌻', '🌈', '🍕', '🎸', '🚀'][Math.floor(Math.random() * 5)],
89
+ height: 120 + Math.random() * 200
90
+ }));
91
+
92
+ export default function Gallery() {
93
+ return (
94
+ <MasonrySnapGrid
95
+ items={items}
96
+ gutter={16}
97
+ minColWidth={220}
98
+ animate
99
+ transitionDuration={400}
100
+ renderItem={(item) => (
101
+ <div style={{
102
+ height: `${item.height}px`,
103
+ background: `linear-gradient(135deg,
104
+ hsl(${Math.random() * 360}, 70%, 70%) 0%,
105
+ hsl(${Math.random() * 360}, 70%, 80%) 100%)`,
106
+ borderRadius: '12px',
107
+ padding: '16px',
108
+ color: 'white'
109
+ }}>
110
+ <div style={{ fontSize: '2rem' }}>{item.emoji}</div>
111
+ <h3 style={{ margin: '8px 0' }}>{item.title}</h3>
112
+ <small>Height: {Math.round(item.height)}px</small>
113
+ </div>
114
+ )}
115
+ />
116
+ );
117
+ }
118
+ ```
119
+
120
+ [![Open React Demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/sandbox/rgxsxp)
121
+
122
+ ---
123
+
124
+ ## 🛠️ API Reference
125
+
126
+ ### Configuration Options
127
+
128
+ | Option | Type | Default | Description |
129
+ |----------------------|---------------------------|---------|--------------------------------------|
130
+ | `gutter` | `number` | `16` | Spacing between items (px) |
131
+ | `minColWidth` | `number` | `250` | Minimum column width (px) |
132
+ | `animate` | `boolean` | `true` | Enable/disable animations |
133
+ | `transitionDuration` | `number` | `400` | Animation duration (ms) |
134
+ | `items` | `Array<T>` | `[]` | Your data items |
135
+ | `renderItem` | `(item: T) => HTMLElement`| - | Function to render each item |
136
+ | `classNames` | `Object` | - | Custom CSS class names |
137
+
138
+ ### Methods
139
+
140
+ - `updateItems(newItems: T[])`: Refresh with new items
141
+ - `shuffleItems()`: Randomize item positions
142
+ - `destroy()`: Clean up the instance
143
+
144
+ ---
145
+
146
+ ## 🎨 Customization Tips
147
+
148
+ **1. Gradient Backgrounds**
149
+ Use CSS gradients for beautiful card backgrounds:
150
+
151
+ ```css
152
+ background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
153
+ ```
154
+
155
+ **2. Random Emojis**
156
+ Add personality with emojis:
157
+
158
+ ```javascript
159
+ const emojis = ['🌻', '🌈', '🍕', '🎸', '🚀'];
160
+ const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
161
+ ```
162
+
163
+ **3. Responsive Breakpoints**
164
+ Adjust columns based on screen size:
165
+
166
+ ```javascript
167
+ minColWidth: window.innerWidth < 768 ? 150 : 250
168
+ ```
169
+
170
+ ---
171
+
172
+ ## 📦 Package Structure
173
+
174
+ ```
175
+ dist/
176
+ ├── index.js # Vanilla JS bundle
177
+ ├── react.js # React component
178
+ ├── index.d.ts # TypeScript types
179
+ └── index.css # Base styles
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 🤝 Contributing
185
+
186
+ 1. Fork the repository
187
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
188
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
189
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
190
+ 5. Open a Pull Request
191
+
192
+
193
+
194
+ ---
195
+
196
+ ## 📄 License
197
+
196
198
  MIT © [Aram Khachatryan](https://github.com/khachatryan-dev)
@@ -0,0 +1,123 @@
1
+ /**
2
+ * CSS class names used by MasonrySnapGridLayout for styling.
3
+ */
4
+ interface MasonrySnapGridLayoutClassNames {
5
+ /** CSS class applied to the container element. */
6
+ container?: string;
7
+ /** CSS class applied to each item element. */
8
+ item?: string;
9
+ }
10
+ /**
11
+ * Options for configuring a MasonrySnapGridLayout instance.
12
+ *
13
+ * @template T - The type of items being rendered in the masonry grid.
14
+ */
15
+ interface MasonrySnapGridLayoutOptions<T = unknown> {
16
+ /**
17
+ * Space between grid items in pixels.
18
+ * @default 16
19
+ */
20
+ gutter?: number;
21
+ /**
22
+ * Minimum width (in pixels) of each column before layout will add another column.
23
+ * @default 250
24
+ */
25
+ minColWidth?: number;
26
+ /**
27
+ * Whether to animate item movement when the layout changes.
28
+ * @default true
29
+ */
30
+ animate?: boolean;
31
+ /**
32
+ * Duration of the item movement animation (in milliseconds).
33
+ * Only applies if `animate` is true.
34
+ * @default 400
35
+ */
36
+ transitionDuration?: number;
37
+ /**
38
+ * Data items to be rendered in the grid.
39
+ */
40
+ items: T[];
41
+ /**
42
+ * Function that renders a single item into a DOM element.
43
+ *
44
+ * @param item - The data item to render.
45
+ * @returns A DOM element representing the rendered item.
46
+ */
47
+ renderItem: (item: T) => HTMLElement;
48
+ /**
49
+ * Optional custom class names for the container and items.
50
+ */
51
+ classNames?: MasonrySnapGridLayoutClassNames;
52
+ }
53
+ /**
54
+ * Ref object shape for accessing a MasonrySnapGridLayout instance
55
+ * when used inside a React component.
56
+ */
57
+ interface MasonrySnapGridRef {
58
+ /** Reference to the underlying MasonrySnapGridLayout instance. */
59
+ layout: MasonrySnapGridLayout | null;
60
+ }
61
+
62
+ /**
63
+ * MasonrySnapGridLayout
64
+ *
65
+ * A lightweight, generic TypeScript implementation of a responsive Masonry-style grid layout
66
+ * with optional animations, custom rendering, and automatic re-layout on resize.
67
+ *
68
+ * @template T - The type of data items that will be rendered into grid elements.
69
+ */
70
+ declare class MasonrySnapGridLayout<T = any> {
71
+ /** The container element where the Masonry grid will be rendered. */
72
+ private readonly container;
73
+ /** Fully resolved options object with defaults merged. */
74
+ private readonly options;
75
+ /** A reference to all grid item elements currently rendered. */
76
+ private items;
77
+ /** Tracks the current heights of each column to position new items. */
78
+ private columnHeights;
79
+ /** Observes container resizing to trigger re-layout. */
80
+ private resizeObserver;
81
+ /** Stores requestAnimationFrame ID for layout updates to prevent redundant calls. */
82
+ private rafId;
83
+ /**
84
+ * Creates a new MasonrySnapGridLayout instance.
85
+ *
86
+ * @param container - The HTML element that will act as the grid container.
87
+ * @param options - Partial configuration object for layout behavior and rendering.
88
+ */
89
+ constructor(container: HTMLElement, options: MasonrySnapGridLayoutOptions<T>);
90
+ /**
91
+ * Renders the provided items into the container.
92
+ * Clears previous items and re-builds DOM structure.
93
+ */
94
+ private renderItems;
95
+ /**
96
+ * Sets up a ResizeObserver to re-calculate layout when container size changes.
97
+ */
98
+ private setupResizeObserver;
99
+ /**
100
+ * Calculates item positions and updates their transforms.
101
+ * Also adjusts the container height to fit all items.
102
+ */
103
+ private updateLayout;
104
+ /**
105
+ * Finds the index of the column with the smallest total height.
106
+ *
107
+ * @returns Index of the shortest column.
108
+ */
109
+ private findShortestColumn;
110
+ /**
111
+ * Replaces current items with a new set and re-renders the layout.
112
+ *
113
+ * @param newItems - New set of data items to render.
114
+ */
115
+ updateItems(newItems: T[]): void;
116
+ /**
117
+ * Cleans up event listeners, observers, and DOM modifications.
118
+ * This should be called before discarding the instance.
119
+ */
120
+ destroy(): void;
121
+ }
122
+
123
+ export { MasonrySnapGridLayout as M, type MasonrySnapGridLayoutOptions as a, type MasonrySnapGridRef as b };
@@ -0,0 +1,123 @@
1
+ /**
2
+ * CSS class names used by MasonrySnapGridLayout for styling.
3
+ */
4
+ interface MasonrySnapGridLayoutClassNames {
5
+ /** CSS class applied to the container element. */
6
+ container?: string;
7
+ /** CSS class applied to each item element. */
8
+ item?: string;
9
+ }
10
+ /**
11
+ * Options for configuring a MasonrySnapGridLayout instance.
12
+ *
13
+ * @template T - The type of items being rendered in the masonry grid.
14
+ */
15
+ interface MasonrySnapGridLayoutOptions<T = unknown> {
16
+ /**
17
+ * Space between grid items in pixels.
18
+ * @default 16
19
+ */
20
+ gutter?: number;
21
+ /**
22
+ * Minimum width (in pixels) of each column before layout will add another column.
23
+ * @default 250
24
+ */
25
+ minColWidth?: number;
26
+ /**
27
+ * Whether to animate item movement when the layout changes.
28
+ * @default true
29
+ */
30
+ animate?: boolean;
31
+ /**
32
+ * Duration of the item movement animation (in milliseconds).
33
+ * Only applies if `animate` is true.
34
+ * @default 400
35
+ */
36
+ transitionDuration?: number;
37
+ /**
38
+ * Data items to be rendered in the grid.
39
+ */
40
+ items: T[];
41
+ /**
42
+ * Function that renders a single item into a DOM element.
43
+ *
44
+ * @param item - The data item to render.
45
+ * @returns A DOM element representing the rendered item.
46
+ */
47
+ renderItem: (item: T) => HTMLElement;
48
+ /**
49
+ * Optional custom class names for the container and items.
50
+ */
51
+ classNames?: MasonrySnapGridLayoutClassNames;
52
+ }
53
+ /**
54
+ * Ref object shape for accessing a MasonrySnapGridLayout instance
55
+ * when used inside a React component.
56
+ */
57
+ interface MasonrySnapGridRef {
58
+ /** Reference to the underlying MasonrySnapGridLayout instance. */
59
+ layout: MasonrySnapGridLayout | null;
60
+ }
61
+
62
+ /**
63
+ * MasonrySnapGridLayout
64
+ *
65
+ * A lightweight, generic TypeScript implementation of a responsive Masonry-style grid layout
66
+ * with optional animations, custom rendering, and automatic re-layout on resize.
67
+ *
68
+ * @template T - The type of data items that will be rendered into grid elements.
69
+ */
70
+ declare class MasonrySnapGridLayout<T = any> {
71
+ /** The container element where the Masonry grid will be rendered. */
72
+ private readonly container;
73
+ /** Fully resolved options object with defaults merged. */
74
+ private readonly options;
75
+ /** A reference to all grid item elements currently rendered. */
76
+ private items;
77
+ /** Tracks the current heights of each column to position new items. */
78
+ private columnHeights;
79
+ /** Observes container resizing to trigger re-layout. */
80
+ private resizeObserver;
81
+ /** Stores requestAnimationFrame ID for layout updates to prevent redundant calls. */
82
+ private rafId;
83
+ /**
84
+ * Creates a new MasonrySnapGridLayout instance.
85
+ *
86
+ * @param container - The HTML element that will act as the grid container.
87
+ * @param options - Partial configuration object for layout behavior and rendering.
88
+ */
89
+ constructor(container: HTMLElement, options: MasonrySnapGridLayoutOptions<T>);
90
+ /**
91
+ * Renders the provided items into the container.
92
+ * Clears previous items and re-builds DOM structure.
93
+ */
94
+ private renderItems;
95
+ /**
96
+ * Sets up a ResizeObserver to re-calculate layout when container size changes.
97
+ */
98
+ private setupResizeObserver;
99
+ /**
100
+ * Calculates item positions and updates their transforms.
101
+ * Also adjusts the container height to fit all items.
102
+ */
103
+ private updateLayout;
104
+ /**
105
+ * Finds the index of the column with the smallest total height.
106
+ *
107
+ * @returns Index of the shortest column.
108
+ */
109
+ private findShortestColumn;
110
+ /**
111
+ * Replaces current items with a new set and re-renders the layout.
112
+ *
113
+ * @param newItems - New set of data items to render.
114
+ */
115
+ updateItems(newItems: T[]): void;
116
+ /**
117
+ * Cleans up event listeners, observers, and DOM modifications.
118
+ * This should be called before discarding the instance.
119
+ */
120
+ destroy(): void;
121
+ }
122
+
123
+ export { MasonrySnapGridLayout as M, type MasonrySnapGridLayoutOptions as a, type MasonrySnapGridRef as b };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.css"],"sourcesContent":[".masonry-snap-grid-container {\r\n position: relative;\r\n width: 100%;\r\n transition: height 0.4s ease-out;\r\n overflow: hidden;\r\n}\r\n\r\n.masonry-snap-grid-item {\r\n position: absolute;\r\n transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);\r\n will-change: transform;\r\n box-sizing: border-box;\r\n transform-origin: top left;\r\n backface-visibility: hidden;\r\n perspective: 1000px;\r\n}"],"mappings":";AAAA,CAAC;AACG,YAAU;AACV,SAAO;AACP,cAAY,OAAO,KAAK;AACxB,YAAU;AACd;AAEA,CAAC;AACG,YAAU;AACV,cAAY,UAAU,KAAK,aAAa,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;AACrD,eAAa;AACb,cAAY;AACZ,oBAAkB,IAAI;AACtB,uBAAqB;AACrB,eAAa;AACjB;","names":[]}
1
+ {"version":3,"sources":["../../src/index.css"],"sourcesContent":["/* \n====================================================================\nMasonrySnapGridLayout - Base Styles\n====================================================================\nThese styles define the core visual and positional behavior of the \nmasonry grid container and its items. They are minimal to allow \nflexibility for custom themes while ensuring smooth layout animations.\n====================================================================\n*/\n\n/* \nContainer styles:\n- Acts as the positioning context for masonry items (position: relative).\n- Takes full available width.\n- Smoothly animates height changes when items reflow.\n- Hides overflow to prevent content from spilling outside the layout.\n*/\n.masonry-snap-grid-container {\n position: relative;\n width: 100%;\n transition: height 0.4s ease-out;\n overflow: hidden;\n}\n\n/* \nItem styles:\n- Absolutely positioned within the container.\n- Animates transform changes for smooth reordering.\n- Uses GPU-accelerated transform optimizations (`will-change`, `backface-visibility`).\n- Sets `box-sizing: border-box` for consistent sizing with padding/border.\n- `transform-origin` ensures scaling/rotation pivot from the top-left corner.\n- `perspective` enables subtle 3D rendering improvements on some browsers.\n*/\n.masonry-snap-grid-item {\n position: absolute;\n transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n will-change: transform;\n box-sizing: border-box;\n transform-origin: top left;\n backface-visibility: hidden;\n perspective: 1000px;\n}\n"],"mappings":";AAiBA,CAAC;AACG,YAAU;AACV,SAAO;AACP,cAAY,OAAO,KAAK;AACxB,YAAU;AACd;AAWA,CAAC;AACG,YAAU;AACV,cAAY,UAAU,KAAK,aAAa,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE;AACrD,eAAa;AACb,cAAY;AACZ,oBAAkB,IAAI;AACtB,uBAAqB;AACrB,eAAa;AACjB;","names":[]}