@zag-js/splitter 0.10.1 → 0.10.2

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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-3GDOPT5W.mjs";
7
7
  import {
8
8
  getHandleBounds
9
- } from "./chunk-MV44GBQY.mjs";
9
+ } from "./chunk-MXEXJMQ6.mjs";
10
10
 
11
11
  // src/splitter.connect.ts
12
12
  import { getEventKey, getEventStep } from "@zag-js/dom-event";
@@ -34,20 +34,20 @@ function connect(state, send, normalize) {
34
34
  */
35
35
  setToMinSize(id) {
36
36
  const panel = panels.find((panel2) => panel2.id === id);
37
- send({ type: "SET_SIZE", id, size: panel?.minSize, src: "collapse" });
37
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.minSize, src: "setToMinSize" });
38
38
  },
39
39
  /**
40
40
  * Function to set a panel to its maximum size.
41
41
  */
42
42
  setToMaxSize(id) {
43
43
  const panel = panels.find((panel2) => panel2.id === id);
44
- send({ type: "SET_SIZE", id, size: panel?.maxSize, src: "expand" });
44
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.maxSize, src: "setToMaxSize" });
45
45
  },
46
46
  /**
47
47
  * Function to set the size of a panel.
48
48
  */
49
49
  setSize(id, size) {
50
- send({ type: "SET_SIZE", id, size });
50
+ send({ type: "SET_PANEL_SIZE", id, size });
51
51
  },
52
52
  /**
53
53
  * Returns the state details for a resize trigger.
@@ -7,7 +7,7 @@ import {
7
7
  getHandlePanels,
8
8
  getNormalizedPanels,
9
9
  getPanelBounds
10
- } from "./chunk-MV44GBQY.mjs";
10
+ } from "./chunk-MXEXJMQ6.mjs";
11
11
 
12
12
  // src/splitter.machine.ts
13
13
  import { createMachine } from "@zag-js/core";
@@ -41,22 +41,7 @@ function machine(userContext) {
41
41
  panels: (ctx2) => getNormalizedPanels(ctx2)
42
42
  },
43
43
  on: {
44
- COLLAPSE: {
45
- actions: "setStartPanelToMin"
46
- },
47
- EXPAND: {
48
- actions: "setStartPanelToMax"
49
- },
50
- TOGGLE: [
51
- {
52
- guard: "isStartPanelAtMin",
53
- actions: "setStartPanelToMax"
54
- },
55
- {
56
- actions: "setStartPanelToMin"
57
- }
58
- ],
59
- SET_SIZE: {
44
+ SET_PANEL_SIZE: {
60
45
  actions: "setPanelSize"
61
46
  }
62
47
  },
@@ -9,7 +9,7 @@ function getNormalizedPanels(ctx) {
9
9
  let totalSize = 0;
10
10
  let totalMinSize = 0;
11
11
  const panels = ctx.size.map((panel) => {
12
- const minSize = panel.minSize ?? 10;
12
+ const minSize = panel.minSize ?? 0;
13
13
  const maxSize = panel.maxSize ?? 100;
14
14
  totalMinSize += minSize;
15
15
  if (panel.size == null) {
package/dist/index.js CHANGED
@@ -103,7 +103,7 @@ function getNormalizedPanels(ctx) {
103
103
  let totalSize = 0;
104
104
  let totalMinSize = 0;
105
105
  const panels = ctx.size.map((panel) => {
106
- const minSize = panel.minSize ?? 10;
106
+ const minSize = panel.minSize ?? 0;
107
107
  const maxSize = panel.maxSize ?? 100;
108
108
  totalMinSize += minSize;
109
109
  if (panel.size == null) {
@@ -238,20 +238,20 @@ function connect(state, send, normalize) {
238
238
  */
239
239
  setToMinSize(id) {
240
240
  const panel = panels.find((panel2) => panel2.id === id);
241
- send({ type: "SET_SIZE", id, size: panel?.minSize, src: "collapse" });
241
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.minSize, src: "setToMinSize" });
242
242
  },
243
243
  /**
244
244
  * Function to set a panel to its maximum size.
245
245
  */
246
246
  setToMaxSize(id) {
247
247
  const panel = panels.find((panel2) => panel2.id === id);
248
- send({ type: "SET_SIZE", id, size: panel?.maxSize, src: "expand" });
248
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.maxSize, src: "setToMaxSize" });
249
249
  },
250
250
  /**
251
251
  * Function to set the size of a panel.
252
252
  */
253
253
  setSize(id, size) {
254
- send({ type: "SET_SIZE", id, size });
254
+ send({ type: "SET_PANEL_SIZE", id, size });
255
255
  },
256
256
  /**
257
257
  * Returns the state details for a resize trigger.
@@ -421,22 +421,7 @@ function machine(userContext) {
421
421
  panels: (ctx2) => getNormalizedPanels(ctx2)
422
422
  },
423
423
  on: {
424
- COLLAPSE: {
425
- actions: "setStartPanelToMin"
426
- },
427
- EXPAND: {
428
- actions: "setStartPanelToMax"
429
- },
430
- TOGGLE: [
431
- {
432
- guard: "isStartPanelAtMin",
433
- actions: "setStartPanelToMax"
434
- },
435
- {
436
- actions: "setStartPanelToMin"
437
- }
438
- ],
439
- SET_SIZE: {
424
+ SET_PANEL_SIZE: {
440
425
  actions: "setPanelSize"
441
426
  }
442
427
  },
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-53T2VZ2R.mjs";
3
+ } from "./chunk-2ZKYBJFK.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-HPRMFGOY.mjs";
7
7
  import {
8
8
  machine
9
- } from "./chunk-X2E2LAC5.mjs";
9
+ } from "./chunk-E3EBKL5P.mjs";
10
10
  import "./chunk-3GDOPT5W.mjs";
11
- import "./chunk-MV44GBQY.mjs";
11
+ import "./chunk-MXEXJMQ6.mjs";
12
12
  export {
13
13
  anatomy,
14
14
  connect,
@@ -145,20 +145,20 @@ function connect(state, send, normalize) {
145
145
  */
146
146
  setToMinSize(id) {
147
147
  const panel = panels.find((panel2) => panel2.id === id);
148
- send({ type: "SET_SIZE", id, size: panel?.minSize, src: "collapse" });
148
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.minSize, src: "setToMinSize" });
149
149
  },
150
150
  /**
151
151
  * Function to set a panel to its maximum size.
152
152
  */
153
153
  setToMaxSize(id) {
154
154
  const panel = panels.find((panel2) => panel2.id === id);
155
- send({ type: "SET_SIZE", id, size: panel?.maxSize, src: "expand" });
155
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.maxSize, src: "setToMaxSize" });
156
156
  },
157
157
  /**
158
158
  * Function to set the size of a panel.
159
159
  */
160
160
  setSize(id, size) {
161
- send({ type: "SET_SIZE", id, size });
161
+ send({ type: "SET_PANEL_SIZE", id, size });
162
162
  },
163
163
  /**
164
164
  * Returns the state details for a resize trigger.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-53T2VZ2R.mjs";
3
+ } from "./chunk-2ZKYBJFK.mjs";
4
4
  import "./chunk-HPRMFGOY.mjs";
5
5
  import "./chunk-3GDOPT5W.mjs";
6
- import "./chunk-MV44GBQY.mjs";
6
+ import "./chunk-MXEXJMQ6.mjs";
7
7
  export {
8
8
  connect
9
9
  };
@@ -96,7 +96,7 @@ function getNormalizedPanels(ctx) {
96
96
  let totalSize = 0;
97
97
  let totalMinSize = 0;
98
98
  const panels = ctx.size.map((panel) => {
99
- const minSize = panel.minSize ?? 10;
99
+ const minSize = panel.minSize ?? 0;
100
100
  const maxSize = panel.maxSize ?? 100;
101
101
  totalMinSize += minSize;
102
102
  if (panel.size == null) {
@@ -235,22 +235,7 @@ function machine(userContext) {
235
235
  panels: (ctx2) => getNormalizedPanels(ctx2)
236
236
  },
237
237
  on: {
238
- COLLAPSE: {
239
- actions: "setStartPanelToMin"
240
- },
241
- EXPAND: {
242
- actions: "setStartPanelToMax"
243
- },
244
- TOGGLE: [
245
- {
246
- guard: "isStartPanelAtMin",
247
- actions: "setStartPanelToMax"
248
- },
249
- {
250
- actions: "setStartPanelToMin"
251
- }
252
- ],
253
- SET_SIZE: {
238
+ SET_PANEL_SIZE: {
254
239
  actions: "setPanelSize"
255
240
  }
256
241
  },
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-X2E2LAC5.mjs";
3
+ } from "./chunk-E3EBKL5P.mjs";
4
4
  import "./chunk-3GDOPT5W.mjs";
5
- import "./chunk-MV44GBQY.mjs";
5
+ import "./chunk-MXEXJMQ6.mjs";
6
6
  export {
7
7
  machine
8
8
  };
@@ -37,7 +37,7 @@ function getNormalizedPanels(ctx) {
37
37
  let totalSize = 0;
38
38
  let totalMinSize = 0;
39
39
  const panels = ctx.size.map((panel) => {
40
- const minSize = panel.minSize ?? 10;
40
+ const minSize = panel.minSize ?? 0;
41
41
  const maxSize = panel.maxSize ?? 100;
42
42
  totalMinSize += minSize;
43
43
  if (panel.size == null) {
@@ -4,7 +4,7 @@ import {
4
4
  getHandlePanels,
5
5
  getNormalizedPanels,
6
6
  getPanelBounds
7
- } from "./chunk-MV44GBQY.mjs";
7
+ } from "./chunk-MXEXJMQ6.mjs";
8
8
  export {
9
9
  clamp,
10
10
  getHandleBounds,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/splitter",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Core logic for the splitter widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -28,13 +28,13 @@
28
28
  "url": "https://github.com/chakra-ui/zag/issues"
29
29
  },
30
30
  "dependencies": {
31
- "@zag-js/anatomy": "0.10.1",
32
- "@zag-js/core": "0.10.1",
33
- "@zag-js/types": "0.10.1",
34
- "@zag-js/dom-query": "0.10.1",
35
- "@zag-js/dom-event": "0.10.1",
36
- "@zag-js/number-utils": "0.10.1",
37
- "@zag-js/utils": "0.10.1"
31
+ "@zag-js/anatomy": "0.10.2",
32
+ "@zag-js/core": "0.10.2",
33
+ "@zag-js/types": "0.10.2",
34
+ "@zag-js/dom-query": "0.10.2",
35
+ "@zag-js/dom-event": "0.10.2",
36
+ "@zag-js/number-utils": "0.10.2",
37
+ "@zag-js/utils": "0.10.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"
@@ -30,20 +30,20 @@ export function connect<T extends PropTypes>(state: State, send: Send, normalize
30
30
  */
31
31
  setToMinSize(id: PanelId) {
32
32
  const panel = panels.find((panel) => panel.id === id)
33
- send({ type: "SET_SIZE", id, size: panel?.minSize, src: "collapse" })
33
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.minSize, src: "setToMinSize" })
34
34
  },
35
35
  /**
36
36
  * Function to set a panel to its maximum size.
37
37
  */
38
38
  setToMaxSize(id: PanelId) {
39
39
  const panel = panels.find((panel) => panel.id === id)
40
- send({ type: "SET_SIZE", id, size: panel?.maxSize, src: "expand" })
40
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.maxSize, src: "setToMaxSize" })
41
41
  },
42
42
  /**
43
43
  * Function to set the size of a panel.
44
44
  */
45
45
  setSize(id: PanelId, size: number) {
46
- send({ type: "SET_SIZE", id, size })
46
+ send({ type: "SET_PANEL_SIZE", id, size })
47
47
  },
48
48
  /**
49
49
  * Returns the state details for a resize trigger.
@@ -37,22 +37,7 @@ export function machine(userContext: UserDefinedContext) {
37
37
  },
38
38
 
39
39
  on: {
40
- COLLAPSE: {
41
- actions: "setStartPanelToMin",
42
- },
43
- EXPAND: {
44
- actions: "setStartPanelToMax",
45
- },
46
- TOGGLE: [
47
- {
48
- guard: "isStartPanelAtMin",
49
- actions: "setStartPanelToMax",
50
- },
51
- {
52
- actions: "setStartPanelToMin",
53
- },
54
- ],
55
- SET_SIZE: {
40
+ SET_PANEL_SIZE: {
56
41
  actions: "setPanelSize",
57
42
  },
58
43
  },
@@ -12,7 +12,7 @@ export function getNormalizedPanels(ctx: Ctx): NormalizedPanelData {
12
12
  let totalMinSize = 0
13
13
 
14
14
  const panels = ctx.size.map((panel) => {
15
- const minSize = panel.minSize ?? 10
15
+ const minSize = panel.minSize ?? 0
16
16
  const maxSize = panel.maxSize ?? 100
17
17
 
18
18
  totalMinSize += minSize