@griddle/svelte 0.1.4 → 0.1.5

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
@@ -38,6 +38,18 @@ shown above). `svelte` (^4 or ^5) is expected to already be in your app.
38
38
  </GriddleGrid>
39
39
  ```
40
40
 
41
+ ## Explicit reflow
42
+
43
+ Changing `cols` through `updateConfig()` does not relocate tiles. Use the
44
+ versioned reflow operation when a finite-column change should adapt geometry:
45
+
46
+ ```js
47
+ api.reflow({ cols: 4, strategy: 'preserve-v1' });
48
+ ```
49
+
50
+ Griddle has no breakpoint model, and reflow remains separate from `pack()` and
51
+ gravity. See the [reflow guide](https://github.com/Trustybits/griddle/blob/master/docs/reflow.md).
52
+
41
53
  ## Animation configuration
42
54
 
43
55
  Tile repositioning and lift animations share `config.animation` with the other
@@ -1,6 +1,6 @@
1
1
  import { type Readable } from 'svelte/store';
2
2
  import { Grid } from '@griddle/core';
3
- import type { GridConfig, Tile, GridSnapshot } from '@griddle/core';
3
+ import type { GridConfig, GridSnapshot, ReflowOptions, Tile } from '@griddle/core';
4
4
  export interface UseGriddleInit {
5
5
  config: GridConfig;
6
6
  tiles?: Tile[];
@@ -20,6 +20,7 @@ export interface GriddleApi {
20
20
  }) => boolean;
21
21
  addTile: (t: Tile) => void;
22
22
  removeTile: (id: string) => void;
23
+ reflow: (options: ReflowOptions) => boolean;
23
24
  updateConfig: (patch: Partial<GridConfig>) => void;
24
25
  toJSON: () => GridSnapshot;
25
26
  loadJSON: (snap: GridSnapshot) => void;
@@ -20,6 +20,7 @@ export function createGriddle(init) {
20
20
  resizeTile: (id, size) => grid.resizeTile(id, size),
21
21
  addTile: (t) => grid.addTile(t),
22
22
  removeTile: (id) => grid.removeTile(id),
23
+ reflow: (options) => grid.reflow(options),
23
24
  updateConfig: (patch) => grid.updateConfig(patch),
24
25
  toJSON: () => grid.toJSON(),
25
26
  loadJSON: (snap) => grid.loadJSON(snap),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@griddle/svelte",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Svelte bindings for Griddle — a headless, zero-dependency grid/canvas engine.",
5
5
  "keywords": [
6
6
  "grid",
@@ -49,15 +49,15 @@
49
49
  },
50
50
  "scripts": {
51
51
  "build": "svelte-package -i src -o dist",
52
- "test": "node --test test/animation.test.mjs",
52
+ "test": "node --test test/*.test.mjs",
53
53
  "prepublishOnly": "npm run build && npm test"
54
54
  },
55
55
  "peerDependencies": {
56
- "@griddle/core": "^0.1.4",
56
+ "@griddle/core": "^0.1.5",
57
57
  "svelte": "^4.0.0 || ^5.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@griddle/core": "^0.1.4",
60
+ "@griddle/core": "^0.1.5",
61
61
  "@sveltejs/package": "^2.5.8",
62
62
  "svelte": "^4.2.0",
63
63
  "svelte-check": "^4.7.2",