diff --git a/Gruntfile.js b/Gruntfile.js index e9ab71a3..e5efd75e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,7 +21,6 @@ module.exports = function(grunt) { dist: { files: { 'dist/gridstack.css': 'src/gridstack.scss', - 'dist/gridstack-extra.css': 'src/gridstack-extra.scss' } } }, @@ -33,7 +32,6 @@ module.exports = function(grunt) { }, files: { 'dist/gridstack.min.css': ['dist/gridstack.css'], - 'dist/gridstack-extra.min.css': ['dist/gridstack-extra.css'] } } }, @@ -42,7 +40,6 @@ module.exports = function(grunt) { files: { 'dist/es5/gridstack-poly.js': ['src/gridstack-poly.js'], 'dist/src/gridstack.scss': ['src/gridstack.scss'], - 'dist/src/gridstack-extra.scss': ['src/gridstack-extra.scss'], 'dist/angular/README.md': ['angular/README.md'], 'dist/angular/src/gridstack.component.ts': ['angular/projects/lib/src/lib/gridstack.component.ts'], 'dist/angular/src/gridstack-item.component.ts': ['angular/projects/lib/src/lib/gridstack-item.component.ts'], diff --git a/README.md b/README.md index 315a825c..326bec10 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Join us on Slack: [https://gridstackjs.slack.com](https://join.slack.com/t/grids - [Extend Library](#extend-library) - [Extend Engine](#extend-engine) - [Change grid columns](#change-grid-columns) - - [Custom columns CSS](#custom-columns-css) + - [Custom columns CSS (OLD, not needed with v12+)](#custom-columns-css-old-not-needed-with-v12) - [Override resizable/draggable options](#override-resizabledraggable-options) - [Touch devices support](#touch-devices-support) - [Migrating](#migrating) @@ -48,6 +48,7 @@ Join us on Slack: [https://gridstackjs.slack.com](https://join.slack.com/t/grids - [Migrating to v9](#migrating-to-v9) - [Migrating to v10](#migrating-to-v10) - [Migrating to v11](#migrating-to-v11) + - [Migrating to v12](#migrating-to-v12) - [jQuery Application](#jquery-application) - [Changes](#changes) - [Usage Trend](#usage-trend) @@ -207,6 +208,8 @@ GridStack makes it very easy if you need [1-12] columns out of the box (default GridStack.init( {column: N} ); ``` +NOTE: step 2 is OLD and not needed with v12+ which uses CSS variables instead of classes + 2) also include `gridstack-extra.css` if **N < 12** (else custom CSS - see next). Without these, things will not render/work correctly. ```html @@ -219,7 +222,9 @@ Note: class `.grid-stack-N` will automatically be added and we include `gridstac See example: [2 grids demo](http://gridstack.github.io/gridstack.js/demo/two.html) with 6 columns -## Custom columns CSS +## Custom columns CSS (OLD, not needed with v12+) + +NOTE: step is OLD and not needed with v12+ which uses CSS variables instead of classes If you need > 12 columns or want to generate the CSS manually you will need to generate CSS rules for `.grid-stack-item[gs-w="X"]` and `.grid-stack-item[gs-x="X"]`. @@ -491,6 +496,14 @@ GridStack.renderCB = function(el: HTMLElement, w: GridStackNode) { 4. if no `GridStackWidget` is defined, the helper will now be inserted as is, and NOT original sidepanel item. 5. support DOM gs- attr as well as gridstacknode JSON (see two.html) alternatives. +## Migrating to v12 + +* column and cell height code has been re-writen to use browser CSS variables, and we no longer need a tons of custom CSS classes! +this fixes a long standing issue where people forget to include the right CSS for non 12 columns layouts, and a big speedup in many cases (many columns, or small cellHeight values). + +**Breaking change:** +* `gridstack-extra.min.css` no longer exist, nor is custom column CSS needed. API/options hasn't changed. + # jQuery Application This is **old and no longer apply to v6+**. You'll need to use v5.1.1 and before diff --git a/angular/README.md b/angular/README.md index 58737045..2af7cd84 100644 --- a/angular/README.md +++ b/angular/README.md @@ -18,7 +18,6 @@ MyComponent CSS ```css @import "https://github.com/gridstack/dist/gridstack.min.css"; -@import "https://github.com/gridstack/dist/gridstack-extra.min.css"; // if you use 2-11 column .grid-stack { background: #fafad2; diff --git a/angular/angular.json b/angular/angular.json index c7961035..ad2ef721 100644 --- a/angular/angular.json +++ b/angular/angular.json @@ -55,7 +55,6 @@ ], "styles": [ "node_modules/gridstack/dist/gridstack.min.css", - "node_modules/gridstack/dist/gridstack-extra.min.css", "projects/demo/src/styles.css" ], "scripts": [] @@ -121,7 +120,6 @@ ], "styles": [ "node_modules/gridstack/dist/gridstack.min.css", - "node_modules/gridstack/dist/gridstack-extra.min.css", "projects/demo/src/styles.css" ], "scripts": [] diff --git a/angular/projects/demo/src/app/app.component.ts b/angular/projects/demo/src/app/app.component.ts index c827d627..4874f9b9 100644 --- a/angular/projects/demo/src/app/app.component.ts +++ b/angular/projects/demo/src/app/app.component.ts @@ -56,7 +56,7 @@ export class AppComponent implements OnInit { // nested grid options private subOptions: GridStackOptions = { cellHeight: 50, // should be 50 - top/bottom - column: 'auto', // size to match container. make sure to include gridstack-extra.min.css + column: 'auto', // size to match container acceptWidgets: true, // will accept .grid-stack-item by default margin: 5, }; diff --git a/demo/column.html b/demo/column.html index bed7fc05..61433ba6 100644 --- a/demo/column.html +++ b/demo/column.html @@ -7,7 +7,6 @@ Column grid demo - diff --git a/demo/mobile.html b/demo/mobile.html index 6018bc3f..6cbdb36a 100644 --- a/demo/mobile.html +++ b/demo/mobile.html @@ -7,7 +7,6 @@ Simple mobile demo - diff --git a/demo/nested.html b/demo/nested.html index 9366b60f..2f80b9e7 100644 --- a/demo/nested.html +++ b/demo/nested.html @@ -6,7 +6,6 @@ Nested grids demo - diff --git a/demo/nested_advanced.html b/demo/nested_advanced.html index 9b9fd136..8d7febce 100644 --- a/demo/nested_advanced.html +++ b/demo/nested_advanced.html @@ -6,7 +6,6 @@ Advance Nested grids demo - diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 00952538..da5ff21d 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -5,7 +5,7 @@ Change log **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* -- [11.5.0-dev (TBD)](#1150-dev-tbd) +- [12-dev (TBD)](#12-dev-tbd) - [11.5.1 (2025-03-23)](#1151-2025-03-23) - [11.5.0 (2025-03-16)](#1150-2025-03-16) - [11.4.0 (2025-02-27)](#1140-2025-02-27) @@ -123,8 +123,9 @@ Change log - [v0.1.0 (2014-11-18)](#v010-2014-11-18) -## 11.5.0-dev (TBD) +## 12-dev (TBD) * feat: [#2854](https://github.com/gridstack/gridstack.js/pull/2854) Removed dynamic stylesheet and migrated to CSS vars. Thank you [lmartorella](https://github.com/lmartorella) +* feat: [#3013](https://github.com/gridstack/gridstack.js/pull/3013) columns no longer require custom classes nor `gridstack-extra.css` as we now use CSS vars. ## 11.5.1 (2025-03-23) * revert: [#2981](https://github.com/gridstack/gridstack.js/issues/2981) Locked was incorrectly changed. fixed doc instead diff --git a/doc/README.md b/doc/README.md index 21441b45..e4c31a9e 100644 --- a/doc/README.md +++ b/doc/README.md @@ -405,8 +405,6 @@ Gets current cell width (grid width / # of columns). set the number of columns in the grid. Will update existing widgets to conform to new number of columns, as well as cache the original layout so you can revert back to previous positions without loss. -Requires `gridstack-extra.css` (or minimized version) for [2-11], -else you will need to generate correct CSS (see https://github.com/gridstack/gridstack.js#change-grid-columns) - `column` - Integer > 0 (default 12) - `layout` - specify the type of re-layout that will happen (position, size, etc...). Values are: `'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' | ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);` diff --git a/react/README.md b/react/README.md index 38185e28..33ed2154 100644 --- a/react/README.md +++ b/react/README.md @@ -20,7 +20,6 @@ import { GridStackRenderProvider, } from "path/to/lib"; import "gridstack/dist/gridstack.css"; -import "gridstack/dist/gridstack-extra.css"; import "path/to/demo.css"; function Text({ content }: { content: string }) { diff --git a/react/src/demo/demo.tsx b/react/src/demo/demo.tsx index 2e1499b5..6b02be90 100644 --- a/react/src/demo/demo.tsx +++ b/react/src/demo/demo.tsx @@ -9,7 +9,6 @@ import { useGridStackContext, } from "../../lib"; -import "gridstack/dist/gridstack-extra.css"; import "gridstack/dist/gridstack.css"; import "./demo.css"; diff --git a/react/src/main.tsx b/react/src/main.tsx index 0bf19b8c..52f705e3 100644 --- a/react/src/main.tsx +++ b/react/src/main.tsx @@ -2,7 +2,6 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' -import 'gridstack/dist/gridstack-extra.css'; import 'gridstack/dist/gridstack.css'; import App from './App.tsx' diff --git a/spec/e2e/html/1571_drop_onto_full.html b/spec/e2e/html/1571_drop_onto_full.html index b15eb927..24f9834a 100644 --- a/spec/e2e/html/1571_drop_onto_full.html +++ b/spec/e2e/html/1571_drop_onto_full.html @@ -9,7 +9,6 @@ -