@zag-js/splitter 0.2.7 → 0.2.8

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.
@@ -55,7 +55,7 @@ function connect(state, send, normalize) {
55
55
  const isHorizontal = state.context.isHorizontal;
56
56
  const isFocused = state.hasTag("focus");
57
57
  const isDragging = state.matches("dragging");
58
- return {
58
+ const api = {
59
59
  isFocused,
60
60
  isDragging,
61
61
  bounds: getHandleBounds(state.context),
@@ -94,11 +94,13 @@ function connect(state, send, normalize) {
94
94
  style: dom.getPanelStyle(state.context, id)
95
95
  });
96
96
  },
97
- getResizeTriggerState(id) {
97
+ getResizeTriggerState(props) {
98
+ const { id, disabled } = props;
98
99
  const ids = id.split(":");
99
100
  const panelIds = ids.map((id2) => dom.getPanelId(state.context, id2));
100
101
  const panels = getHandleBounds(state.context, id);
101
102
  return {
103
+ isDisabled: !!disabled,
102
104
  isFocused: state.context.activeResizeId === id && isFocused,
103
105
  panelIds,
104
106
  min: panels == null ? void 0 : panels.min,
@@ -108,7 +110,7 @@ function connect(state, send, normalize) {
108
110
  },
109
111
  getResizeTriggerProps(props) {
110
112
  const { id, disabled, step = 1 } = props;
111
- const triggerState = this.getResizeTriggerState(id);
113
+ const triggerState = api.getResizeTriggerState(props);
112
114
  return normalize.element({
113
115
  ...parts.resizeTrigger.attrs,
114
116
  dir: state.context.dir,
@@ -199,6 +201,7 @@ function connect(state, send, normalize) {
199
201
  });
200
202
  }
201
203
  };
204
+ return api;
202
205
  }
203
206
 
204
207
  export {
package/dist/index.js CHANGED
@@ -555,7 +555,7 @@ function connect(state2, send, normalize) {
555
555
  const isHorizontal = state2.context.isHorizontal;
556
556
  const isFocused = state2.hasTag("focus");
557
557
  const isDragging = state2.matches("dragging");
558
- return {
558
+ const api = {
559
559
  isFocused,
560
560
  isDragging,
561
561
  bounds: getHandleBounds(state2.context),
@@ -594,11 +594,13 @@ function connect(state2, send, normalize) {
594
594
  style: dom.getPanelStyle(state2.context, id)
595
595
  });
596
596
  },
597
- getResizeTriggerState(id) {
597
+ getResizeTriggerState(props) {
598
+ const { id, disabled } = props;
598
599
  const ids = id.split(":");
599
600
  const panelIds = ids.map((id2) => dom.getPanelId(state2.context, id2));
600
601
  const panels = getHandleBounds(state2.context, id);
601
602
  return {
603
+ isDisabled: !!disabled,
602
604
  isFocused: state2.context.activeResizeId === id && isFocused,
603
605
  panelIds,
604
606
  min: panels == null ? void 0 : panels.min,
@@ -608,7 +610,7 @@ function connect(state2, send, normalize) {
608
610
  },
609
611
  getResizeTriggerProps(props) {
610
612
  const { id, disabled, step = 1 } = props;
611
- const triggerState = this.getResizeTriggerState(id);
613
+ const triggerState = api.getResizeTriggerState(props);
612
614
  return normalize.element({
613
615
  ...parts.resizeTrigger.attrs,
614
616
  dir: state2.context.dir,
@@ -699,6 +701,7 @@ function connect(state2, send, normalize) {
699
701
  });
700
702
  }
701
703
  };
704
+ return api;
702
705
  }
703
706
 
704
707
  // src/splitter.machine.ts
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-X2M4RMIJ.mjs";
3
+ } from "./chunk-UC2SKBKO.mjs";
4
4
  import {
5
5
  anatomy
6
6
  } from "./chunk-HPRMFGOY.mjs";
@@ -15,7 +15,8 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
15
15
  setSize(id: PanelId, size: number): void;
16
16
  rootProps: T["element"];
17
17
  getPanelProps(props: PanelProps): T["element"];
18
- getResizeTriggerState(id: string): {
18
+ getResizeTriggerState(props: ResizeTriggerProps): {
19
+ isDisabled: boolean;
19
20
  isFocused: boolean;
20
21
  panelIds: string[];
21
22
  min: number | undefined;
@@ -209,7 +209,7 @@ function connect(state, send, normalize) {
209
209
  const isHorizontal = state.context.isHorizontal;
210
210
  const isFocused = state.hasTag("focus");
211
211
  const isDragging = state.matches("dragging");
212
- return {
212
+ const api = {
213
213
  isFocused,
214
214
  isDragging,
215
215
  bounds: getHandleBounds(state.context),
@@ -248,11 +248,13 @@ function connect(state, send, normalize) {
248
248
  style: dom.getPanelStyle(state.context, id)
249
249
  });
250
250
  },
251
- getResizeTriggerState(id) {
251
+ getResizeTriggerState(props) {
252
+ const { id, disabled } = props;
252
253
  const ids = id.split(":");
253
254
  const panelIds = ids.map((id2) => dom.getPanelId(state.context, id2));
254
255
  const panels = getHandleBounds(state.context, id);
255
256
  return {
257
+ isDisabled: !!disabled,
256
258
  isFocused: state.context.activeResizeId === id && isFocused,
257
259
  panelIds,
258
260
  min: panels == null ? void 0 : panels.min,
@@ -262,7 +264,7 @@ function connect(state, send, normalize) {
262
264
  },
263
265
  getResizeTriggerProps(props) {
264
266
  const { id, disabled, step = 1 } = props;
265
- const triggerState = this.getResizeTriggerState(id);
267
+ const triggerState = api.getResizeTriggerState(props);
266
268
  return normalize.element({
267
269
  ...parts.resizeTrigger.attrs,
268
270
  dir: state.context.dir,
@@ -353,6 +355,7 @@ function connect(state, send, normalize) {
353
355
  });
354
356
  }
355
357
  };
358
+ return api;
356
359
  }
357
360
  // Annotate the CommonJS export names for ESM import in node:
358
361
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-X2M4RMIJ.mjs";
3
+ } from "./chunk-UC2SKBKO.mjs";
4
4
  import "./chunk-HPRMFGOY.mjs";
5
5
  import "./chunk-T56NFB6E.mjs";
6
6
  import "./chunk-SQ3UMXCZ.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/splitter",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Core logic for the splitter widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",