File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 8787 xs: 320
8888 };
8989
90- $ : assertGridOptions ({ cols , rows , itemSize });
90+ $ : assertGridOptions ({ cols , rows , itemSize , collision });
9191
9292 /**
9393 * Bound the grid items to the grid container.
175175 }
176176
177177 $ : if (collision !== ' none' ) {
178- rows = 0 ;
178+ _rows = 0 ;
179179 }
180180
181181 /**
Original file line number Diff line number Diff line change 1- import type { GridSize , ItemSize } from '$lib/types' ;
1+ import type { Collision , GridSize , ItemSize } from '$lib/types' ;
22
33export type GridOptions = {
44 cols : GridSize ;
55 rows : GridSize ;
66 itemSize : Partial < ItemSize > ;
7+ collision ?: Collision ;
78} ;
89
910export function assertGridOptions ( options : GridOptions ) {
10- const { cols, rows, itemSize } = options ;
11+ const { cols, rows, itemSize, collision } = options ;
12+
13+ if ( rows !== 0 && collision && collision !== 'none' ) {
14+ console . warn ( '`rows` is ignored and setted to 0 when `collision` is not `none`' ) ;
15+ }
16+
17+ if ( collision && collision !== 'none' && itemSize ?. height === undefined ) {
18+ throw new Error (
19+ 'If `collision` is not `none`, the `itemSize.height` parameter must be specified'
20+ ) ;
21+ }
22+
1123 if (
1224 ( cols === 0 && itemSize ?. width === undefined ) ||
1325 ( typeof cols === 'object' && Object . values ( cols ) . includes ( 0 ) && itemSize ?. width === undefined )
You can’t perform that action at this time.
0 commit comments