@zag-js/splitter 0.10.1 → 0.10.3

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/dist/index.mjs CHANGED
@@ -1,16 +1,3 @@
1
- import {
2
- connect
3
- } from "./chunk-53T2VZ2R.mjs";
4
- import {
5
- anatomy
6
- } from "./chunk-HPRMFGOY.mjs";
7
- import {
8
- machine
9
- } from "./chunk-X2E2LAC5.mjs";
10
- import "./chunk-3GDOPT5W.mjs";
11
- import "./chunk-MV44GBQY.mjs";
12
- export {
13
- anatomy,
14
- connect,
15
- machine
16
- };
1
+ export { anatomy } from './splitter.anatomy.mjs';
2
+ export { connect } from './splitter.connect.mjs';
3
+ export { machine } from './splitter.machine.mjs';
@@ -1,6 +1,3 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
-
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "panel" | "toggleTrigger" | "resizeTrigger">;
4
- declare const parts: Record<"root" | "panel" | "toggleTrigger" | "resizeTrigger", _zag_js_anatomy.AnatomyPart>;
5
-
6
- export { anatomy, parts };
1
+ import type { AnatomyInstance, AnatomyPart } from '@zag-js/anatomy';
2
+ export declare const anatomy: AnatomyInstance<"root" | "panel" | "toggleTrigger" | "resizeTrigger">;
3
+ export declare const parts: Record<"root" | "panel" | "toggleTrigger" | "resizeTrigger", AnatomyPart>;
@@ -1,34 +1,11 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
19
2
 
20
- // src/splitter.anatomy.ts
21
- var splitter_anatomy_exports = {};
22
- __export(splitter_anatomy_exports, {
23
- anatomy: () => anatomy,
24
- parts: () => parts
25
- });
26
- module.exports = __toCommonJS(splitter_anatomy_exports);
27
- var import_anatomy = require("@zag-js/anatomy");
28
- var anatomy = (0, import_anatomy.createAnatomy)("splitter").parts("root", "panel", "toggleTrigger", "resizeTrigger");
29
- var parts = anatomy.build();
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- anatomy,
33
- parts
34
- });
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const anatomy$1 = require('@zag-js/anatomy');
6
+
7
+ const anatomy = anatomy$1.createAnatomy("splitter").parts("root", "panel", "toggleTrigger", "resizeTrigger");
8
+ const parts = anatomy.build();
9
+
10
+ exports.anatomy = anatomy;
11
+ exports.parts = parts;
@@ -1,8 +1,6 @@
1
- import {
2
- anatomy,
3
- parts
4
- } from "./chunk-HPRMFGOY.mjs";
5
- export {
6
- anatomy,
7
- parts
8
- };
1
+ import { createAnatomy } from '@zag-js/anatomy';
2
+
3
+ const anatomy = createAnatomy("splitter").parts("root", "panel", "toggleTrigger", "resizeTrigger");
4
+ const parts = anatomy.build();
5
+
6
+ export { anatomy, parts };
@@ -1,8 +1,6 @@
1
- import { PropTypes, NormalizeProps } from '@zag-js/types';
2
- import { State, Send, PanelId, ResizeTriggerProps, PanelProps } from './splitter.types.js';
3
- import '@zag-js/core';
4
-
5
- declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
1
+ import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
+ import type { PanelId, PanelProps, ResizeTriggerProps, Send, State } from "./splitter.types";
3
+ export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
6
4
  /**
7
5
  * Whether the splitter is focused.
8
6
  */
@@ -45,5 +43,3 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
45
43
  getPanelProps(props: PanelProps): T["element"];
46
44
  getResizeTriggerProps(props: ResizeTriggerProps): T["element"];
47
45
  };
48
-
49
- export { connect };
@@ -1,127 +1,13 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
19
2
 
20
- // src/splitter.connect.ts
21
- var splitter_connect_exports = {};
22
- __export(splitter_connect_exports, {
23
- connect: () => connect
24
- });
25
- module.exports = __toCommonJS(splitter_connect_exports);
26
- var import_dom_event = require("@zag-js/dom-event");
27
- var import_dom_query2 = require("@zag-js/dom-query");
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
28
4
 
29
- // src/splitter.anatomy.ts
30
- var import_anatomy = require("@zag-js/anatomy");
31
- var anatomy = (0, import_anatomy.createAnatomy)("splitter").parts("root", "panel", "toggleTrigger", "resizeTrigger");
32
- var parts = anatomy.build();
5
+ const domEvent = require('@zag-js/dom-event');
6
+ const domQuery = require('@zag-js/dom-query');
7
+ const splitter_anatomy = require('./splitter.anatomy.js');
8
+ const splitter_dom = require('./splitter.dom.js');
9
+ const splitter_utils = require('./splitter.utils.js');
33
10
 
34
- // src/splitter.dom.ts
35
- var import_dom_query = require("@zag-js/dom-query");
36
- var dom = (0, import_dom_query.createScope)({
37
- getRootId: (ctx) => ctx.ids?.root ?? `splitter:${ctx.id}`,
38
- getResizeTriggerId: (ctx, id) => ctx.ids?.resizeTrigger?.(id) ?? `splitter:${ctx.id}:splitter:${id}`,
39
- getToggleTriggerId: (ctx) => ctx.ids?.toggleTrigger?.(ctx.id) ?? `splitter:${ctx.id}:toggle-btn`,
40
- getLabelId: (ctx) => ctx.ids?.label ?? `splitter:${ctx.id}:label`,
41
- getPanelId: (ctx, id) => ctx.ids?.panel?.(id) ?? `splitter:${ctx.id}:panel:${id}`,
42
- globalCursorId: (ctx) => `splitter:${ctx.id}:global-cursor`,
43
- getRootEl: (ctx) => dom.queryById(ctx, dom.getRootId(ctx)),
44
- getResizeTriggerEl: (ctx, id) => dom.getById(ctx, dom.getResizeTriggerId(ctx, id)),
45
- getPanelEl: (ctx, id) => dom.getById(ctx, dom.getPanelId(ctx, id)),
46
- getCursor(ctx) {
47
- const x = ctx.isHorizontal;
48
- let cursor = x ? "col-resize" : "row-resize";
49
- if (ctx.activeResizeState.isAtMin)
50
- cursor = x ? "e-resize" : "s-resize";
51
- if (ctx.activeResizeState.isAtMax)
52
- cursor = x ? "w-resize" : "n-resize";
53
- return cursor;
54
- },
55
- getPanelStyle(ctx, id) {
56
- const flexGrow = ctx.panels.find((panel) => panel.id === id)?.size ?? "0";
57
- return {
58
- flexBasis: 0,
59
- flexGrow,
60
- flexShrink: 1,
61
- overflow: "hidden"
62
- };
63
- },
64
- getActiveHandleEl(ctx) {
65
- const activeId = ctx.activeResizeId;
66
- if (activeId == null)
67
- return;
68
- return dom.getById(ctx, dom.getResizeTriggerId(ctx, activeId));
69
- },
70
- getResizeTriggerEls(ctx) {
71
- const ownerId = CSS.escape(dom.getRootId(ctx));
72
- return (0, import_dom_query.queryAll)(dom.getRootEl(ctx), `[role=separator][data-ownedby='${ownerId}']`);
73
- },
74
- setupGlobalCursor(ctx) {
75
- const styleEl = dom.getById(ctx, dom.globalCursorId(ctx));
76
- const textContent = `* { cursor: ${dom.getCursor(ctx)} !important; }`;
77
- if (styleEl) {
78
- styleEl.textContent = textContent;
79
- } else {
80
- const style = dom.getDoc(ctx).createElement("style");
81
- style.id = dom.globalCursorId(ctx);
82
- style.textContent = textContent;
83
- dom.getDoc(ctx).head.appendChild(style);
84
- }
85
- },
86
- removeGlobalCursor(ctx) {
87
- dom.getById(ctx, dom.globalCursorId(ctx))?.remove();
88
- }
89
- });
90
-
91
- // src/splitter.utils.ts
92
- function getHandlePanels(ctx, id = ctx.activeResizeId) {
93
- const [beforeId, afterId] = id?.split(":") ?? [];
94
- if (!beforeId || !afterId)
95
- return;
96
- const beforeIndex = ctx.previousPanels.findIndex((panel) => panel.id === beforeId);
97
- const afterIndex = ctx.previousPanels.findIndex((panel) => panel.id === afterId);
98
- if (beforeIndex === -1 || afterIndex === -1)
99
- return;
100
- const before = ctx.previousPanels[beforeIndex];
101
- const after = ctx.previousPanels[afterIndex];
102
- return {
103
- before: {
104
- ...before,
105
- index: beforeIndex
106
- },
107
- after: {
108
- ...after,
109
- index: afterIndex
110
- }
111
- };
112
- }
113
- function getHandleBounds(ctx, id = ctx.activeResizeId) {
114
- const panels = getHandlePanels(ctx, id);
115
- if (!panels)
116
- return;
117
- const { before, after } = panels;
118
- return {
119
- min: Math.max(before.start + before.minSize, after.end - after.maxSize),
120
- max: Math.min(after.end - after.minSize, before.maxSize + before.start)
121
- };
122
- }
123
-
124
- // src/splitter.connect.ts
125
11
  function connect(state, send, normalize) {
126
12
  const isHorizontal = state.context.isHorizontal;
127
13
  const isFocused = state.hasTag("focus");
@@ -139,26 +25,26 @@ function connect(state, send, normalize) {
139
25
  /**
140
26
  * The bounds of the currently dragged splitter handle.
141
27
  */
142
- bounds: getHandleBounds(state.context),
28
+ bounds: splitter_utils.getHandleBounds(state.context),
143
29
  /**
144
30
  * Function to set a panel to its minimum size.
145
31
  */
146
32
  setToMinSize(id) {
147
33
  const panel = panels.find((panel2) => panel2.id === id);
148
- send({ type: "SET_SIZE", id, size: panel?.minSize, src: "collapse" });
34
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.minSize, src: "setToMinSize" });
149
35
  },
150
36
  /**
151
37
  * Function to set a panel to its maximum size.
152
38
  */
153
39
  setToMaxSize(id) {
154
40
  const panel = panels.find((panel2) => panel2.id === id);
155
- send({ type: "SET_SIZE", id, size: panel?.maxSize, src: "expand" });
41
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.maxSize, src: "setToMaxSize" });
156
42
  },
157
43
  /**
158
44
  * Function to set the size of a panel.
159
45
  */
160
46
  setSize(id, size) {
161
- send({ type: "SET_SIZE", id, size });
47
+ send({ type: "SET_PANEL_SIZE", id, size });
162
48
  },
163
49
  /**
164
50
  * Returns the state details for a resize trigger.
@@ -166,8 +52,8 @@ function connect(state, send, normalize) {
166
52
  getResizeTriggerState(props) {
167
53
  const { id, disabled } = props;
168
54
  const ids = id.split(":");
169
- const panelIds = ids.map((id2) => dom.getPanelId(state.context, id2));
170
- const panels2 = getHandleBounds(state.context, id);
55
+ const panelIds = ids.map((id2) => splitter_dom.dom.getPanelId(state.context, id2));
56
+ const panels2 = splitter_utils.getHandleBounds(state.context, id);
171
57
  return {
172
58
  isDisabled: !!disabled,
173
59
  isFocused: state.context.activeResizeId === id && isFocused,
@@ -178,9 +64,9 @@ function connect(state, send, normalize) {
178
64
  };
179
65
  },
180
66
  rootProps: normalize.element({
181
- ...parts.root.attrs,
67
+ ...splitter_anatomy.parts.root.attrs,
182
68
  "data-orientation": state.context.orientation,
183
- id: dom.getRootId(state.context),
69
+ id: splitter_dom.dom.getRootId(state.context),
184
70
  dir: state.context.dir,
185
71
  style: {
186
72
  display: "flex",
@@ -193,22 +79,22 @@ function connect(state, send, normalize) {
193
79
  getPanelProps(props) {
194
80
  const { id } = props;
195
81
  return normalize.element({
196
- ...parts.panel.attrs,
82
+ ...splitter_anatomy.parts.panel.attrs,
197
83
  dir: state.context.dir,
198
- id: dom.getPanelId(state.context, id),
199
- "data-ownedby": dom.getRootId(state.context),
200
- style: dom.getPanelStyle(state.context, id)
84
+ id: splitter_dom.dom.getPanelId(state.context, id),
85
+ "data-ownedby": splitter_dom.dom.getRootId(state.context),
86
+ style: splitter_dom.dom.getPanelStyle(state.context, id)
201
87
  });
202
88
  },
203
89
  getResizeTriggerProps(props) {
204
90
  const { id, disabled, step = 1 } = props;
205
91
  const triggerState = api.getResizeTriggerState(props);
206
92
  return normalize.element({
207
- ...parts.resizeTrigger.attrs,
93
+ ...splitter_anatomy.parts.resizeTrigger.attrs,
208
94
  dir: state.context.dir,
209
- id: dom.getResizeTriggerId(state.context, id),
95
+ id: splitter_dom.dom.getResizeTriggerId(state.context, id),
210
96
  role: "separator",
211
- "data-ownedby": dom.getRootId(state.context),
97
+ "data-ownedby": splitter_dom.dom.getRootId(state.context),
212
98
  tabIndex: disabled ? void 0 : 0,
213
99
  "aria-valuenow": triggerState.value,
214
100
  "aria-valuemin": triggerState.min,
@@ -216,8 +102,8 @@ function connect(state, send, normalize) {
216
102
  "data-orientation": state.context.orientation,
217
103
  "aria-orientation": state.context.orientation,
218
104
  "aria-controls": triggerState.panelIds.join(" "),
219
- "data-focus": (0, import_dom_query2.dataAttr)(triggerState.isFocused),
220
- "data-disabled": (0, import_dom_query2.dataAttr)(disabled),
105
+ "data-focus": domQuery.dataAttr(triggerState.isFocused),
106
+ "data-disabled": domQuery.dataAttr(disabled),
221
107
  style: {
222
108
  touchAction: "none",
223
109
  userSelect: "none",
@@ -259,7 +145,7 @@ function connect(state, send, normalize) {
259
145
  onKeyDown(event) {
260
146
  if (disabled)
261
147
  return;
262
- const moveStep = (0, import_dom_event.getEventStep)(event) * step;
148
+ const moveStep = domEvent.getEventStep(event) * step;
263
149
  const keyMap = {
264
150
  Enter() {
265
151
  send("ENTER");
@@ -283,7 +169,7 @@ function connect(state, send, normalize) {
283
169
  send("END");
284
170
  }
285
171
  };
286
- const key = (0, import_dom_event.getEventKey)(event, state.context);
172
+ const key = domEvent.getEventKey(event, state.context);
287
173
  const exec = keyMap[key];
288
174
  if (exec) {
289
175
  exec(event);
@@ -295,7 +181,5 @@ function connect(state, send, normalize) {
295
181
  };
296
182
  return api;
297
183
  }
298
- // Annotate the CommonJS export names for ESM import in node:
299
- 0 && (module.exports = {
300
- connect
301
- });
184
+
185
+ exports.connect = connect;
@@ -1,9 +1,181 @@
1
- import {
2
- connect
3
- } from "./chunk-53T2VZ2R.mjs";
4
- import "./chunk-HPRMFGOY.mjs";
5
- import "./chunk-3GDOPT5W.mjs";
6
- import "./chunk-MV44GBQY.mjs";
7
- export {
8
- connect
9
- };
1
+ import { getEventStep, getEventKey } from '@zag-js/dom-event';
2
+ import { dataAttr } from '@zag-js/dom-query';
3
+ import { parts } from './splitter.anatomy.mjs';
4
+ import { dom } from './splitter.dom.mjs';
5
+ import { getHandleBounds } from './splitter.utils.mjs';
6
+
7
+ function connect(state, send, normalize) {
8
+ const isHorizontal = state.context.isHorizontal;
9
+ const isFocused = state.hasTag("focus");
10
+ const isDragging = state.matches("dragging");
11
+ const panels = state.context.panels;
12
+ const api = {
13
+ /**
14
+ * Whether the splitter is focused.
15
+ */
16
+ isFocused,
17
+ /**
18
+ * Whether the splitter is being dragged.
19
+ */
20
+ isDragging,
21
+ /**
22
+ * The bounds of the currently dragged splitter handle.
23
+ */
24
+ bounds: getHandleBounds(state.context),
25
+ /**
26
+ * Function to set a panel to its minimum size.
27
+ */
28
+ setToMinSize(id) {
29
+ const panel = panels.find((panel2) => panel2.id === id);
30
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.minSize, src: "setToMinSize" });
31
+ },
32
+ /**
33
+ * Function to set a panel to its maximum size.
34
+ */
35
+ setToMaxSize(id) {
36
+ const panel = panels.find((panel2) => panel2.id === id);
37
+ send({ type: "SET_PANEL_SIZE", id, size: panel?.maxSize, src: "setToMaxSize" });
38
+ },
39
+ /**
40
+ * Function to set the size of a panel.
41
+ */
42
+ setSize(id, size) {
43
+ send({ type: "SET_PANEL_SIZE", id, size });
44
+ },
45
+ /**
46
+ * Returns the state details for a resize trigger.
47
+ */
48
+ getResizeTriggerState(props) {
49
+ const { id, disabled } = props;
50
+ const ids = id.split(":");
51
+ const panelIds = ids.map((id2) => dom.getPanelId(state.context, id2));
52
+ const panels2 = getHandleBounds(state.context, id);
53
+ return {
54
+ isDisabled: !!disabled,
55
+ isFocused: state.context.activeResizeId === id && isFocused,
56
+ panelIds,
57
+ min: panels2?.min,
58
+ max: panels2?.max,
59
+ value: 0
60
+ };
61
+ },
62
+ rootProps: normalize.element({
63
+ ...parts.root.attrs,
64
+ "data-orientation": state.context.orientation,
65
+ id: dom.getRootId(state.context),
66
+ dir: state.context.dir,
67
+ style: {
68
+ display: "flex",
69
+ flexDirection: isHorizontal ? "row" : "column",
70
+ height: "100%",
71
+ width: "100%",
72
+ overflow: "hidden"
73
+ }
74
+ }),
75
+ getPanelProps(props) {
76
+ const { id } = props;
77
+ return normalize.element({
78
+ ...parts.panel.attrs,
79
+ dir: state.context.dir,
80
+ id: dom.getPanelId(state.context, id),
81
+ "data-ownedby": dom.getRootId(state.context),
82
+ style: dom.getPanelStyle(state.context, id)
83
+ });
84
+ },
85
+ getResizeTriggerProps(props) {
86
+ const { id, disabled, step = 1 } = props;
87
+ const triggerState = api.getResizeTriggerState(props);
88
+ return normalize.element({
89
+ ...parts.resizeTrigger.attrs,
90
+ dir: state.context.dir,
91
+ id: dom.getResizeTriggerId(state.context, id),
92
+ role: "separator",
93
+ "data-ownedby": dom.getRootId(state.context),
94
+ tabIndex: disabled ? void 0 : 0,
95
+ "aria-valuenow": triggerState.value,
96
+ "aria-valuemin": triggerState.min,
97
+ "aria-valuemax": triggerState.max,
98
+ "data-orientation": state.context.orientation,
99
+ "aria-orientation": state.context.orientation,
100
+ "aria-controls": triggerState.panelIds.join(" "),
101
+ "data-focus": dataAttr(triggerState.isFocused),
102
+ "data-disabled": dataAttr(disabled),
103
+ style: {
104
+ touchAction: "none",
105
+ userSelect: "none",
106
+ flex: "0 0 auto",
107
+ pointerEvents: isDragging && !triggerState.isFocused ? "none" : void 0,
108
+ cursor: isHorizontal ? "col-resize" : "row-resize",
109
+ [isHorizontal ? "minHeight" : "minWidth"]: "0"
110
+ },
111
+ onPointerDown(event) {
112
+ if (disabled) {
113
+ event.preventDefault();
114
+ return;
115
+ }
116
+ send({ type: "POINTER_DOWN", id });
117
+ event.preventDefault();
118
+ event.stopPropagation();
119
+ },
120
+ onPointerOver() {
121
+ if (disabled)
122
+ return;
123
+ send({ type: "POINTER_OVER", id });
124
+ },
125
+ onPointerLeave() {
126
+ if (disabled)
127
+ return;
128
+ send({ type: "POINTER_LEAVE", id });
129
+ },
130
+ onBlur() {
131
+ send("BLUR");
132
+ },
133
+ onFocus() {
134
+ send({ type: "FOCUS", id });
135
+ },
136
+ onDoubleClick() {
137
+ if (disabled)
138
+ return;
139
+ send({ type: "DOUBLE_CLICK", id });
140
+ },
141
+ onKeyDown(event) {
142
+ if (disabled)
143
+ return;
144
+ const moveStep = getEventStep(event) * step;
145
+ const keyMap = {
146
+ Enter() {
147
+ send("ENTER");
148
+ },
149
+ ArrowUp() {
150
+ send({ type: "ARROW_UP", step: moveStep });
151
+ },
152
+ ArrowDown() {
153
+ send({ type: "ARROW_DOWN", step: moveStep });
154
+ },
155
+ ArrowLeft() {
156
+ send({ type: "ARROW_LEFT", step: moveStep });
157
+ },
158
+ ArrowRight() {
159
+ send({ type: "ARROW_RIGHT", step: moveStep });
160
+ },
161
+ Home() {
162
+ send("HOME");
163
+ },
164
+ End() {
165
+ send("END");
166
+ }
167
+ };
168
+ const key = getEventKey(event, state.context);
169
+ const exec = keyMap[key];
170
+ if (exec) {
171
+ exec(event);
172
+ event.preventDefault();
173
+ }
174
+ }
175
+ });
176
+ }
177
+ };
178
+ return api;
179
+ }
180
+
181
+ export { connect };
@@ -1,42 +1,38 @@
1
- import { JSX } from '@zag-js/types';
2
- import { MachineContext, PanelId } from './splitter.types.js';
3
- import '@zag-js/core';
4
-
5
- declare const dom: {
1
+ import type { JSX } from "@zag-js/types";
2
+ import type { MachineContext as Ctx, PanelId } from "./splitter.types";
3
+ export declare const dom: {
6
4
  getRootNode: (ctx: {
7
- getRootNode?: (() => Document | Node | ShadowRoot) | undefined;
8
- }) => Document | ShadowRoot;
5
+ getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
6
+ }) => ShadowRoot | Document;
9
7
  getDoc: (ctx: {
10
- getRootNode?: (() => Document | Node | ShadowRoot) | undefined;
8
+ getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
11
9
  }) => Document;
12
10
  getWin: (ctx: {
13
- getRootNode?: (() => Document | Node | ShadowRoot) | undefined;
11
+ getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
14
12
  }) => Window & typeof globalThis;
15
13
  getActiveElement: (ctx: {
16
- getRootNode?: (() => Document | Node | ShadowRoot) | undefined;
14
+ getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
17
15
  }) => HTMLElement | null;
18
16
  getById: <T extends HTMLElement = HTMLElement>(ctx: {
19
- getRootNode?: (() => Document | Node | ShadowRoot) | undefined;
17
+ getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
20
18
  }, id: string) => T | null;
21
19
  queryById: <T_1 extends HTMLElement = HTMLElement>(ctx: {
22
- getRootNode?: (() => Document | Node | ShadowRoot) | undefined;
20
+ getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
23
21
  }, id: string) => T_1;
24
22
  } & {
25
- getRootId: (ctx: MachineContext) => string;
26
- getResizeTriggerId: (ctx: MachineContext, id: string) => string;
27
- getToggleTriggerId: (ctx: MachineContext) => string;
28
- getLabelId: (ctx: MachineContext) => string | ((id: string) => string);
29
- getPanelId: (ctx: MachineContext, id: string | number) => string;
30
- globalCursorId: (ctx: MachineContext) => string;
31
- getRootEl: (ctx: MachineContext) => HTMLElement;
32
- getResizeTriggerEl: (ctx: MachineContext, id: string) => HTMLElement | null;
33
- getPanelEl: (ctx: MachineContext, id: string | number) => HTMLElement | null;
34
- getCursor(ctx: MachineContext): (string & {}) | "col-resize" | "e-resize" | "n-resize" | "row-resize" | "s-resize" | "w-resize";
35
- getPanelStyle(ctx: MachineContext, id: PanelId): JSX.CSSProperties;
36
- getActiveHandleEl(ctx: MachineContext): HTMLElement | null | undefined;
37
- getResizeTriggerEls(ctx: MachineContext): HTMLElement[];
38
- setupGlobalCursor(ctx: MachineContext): void;
39
- removeGlobalCursor(ctx: MachineContext): void;
23
+ getRootId: (ctx: Ctx) => string;
24
+ getResizeTriggerId: (ctx: Ctx, id: string) => string;
25
+ getToggleTriggerId: (ctx: Ctx) => string;
26
+ getLabelId: (ctx: Ctx) => string | ((id: string) => string);
27
+ getPanelId: (ctx: Ctx, id: string | number) => string;
28
+ globalCursorId: (ctx: Ctx) => string;
29
+ getRootEl: (ctx: Ctx) => HTMLElement;
30
+ getResizeTriggerEl: (ctx: Ctx, id: string) => HTMLElement | null;
31
+ getPanelEl: (ctx: Ctx, id: string | number) => HTMLElement | null;
32
+ getCursor(ctx: Ctx): (string & {}) | "col-resize" | "e-resize" | "n-resize" | "row-resize" | "s-resize" | "w-resize";
33
+ getPanelStyle(ctx: Ctx, id: PanelId): JSX.CSSProperties;
34
+ getActiveHandleEl(ctx: Ctx): HTMLElement | null | undefined;
35
+ getResizeTriggerEls(ctx: Ctx): HTMLElement[];
36
+ setupGlobalCursor(ctx: Ctx): void;
37
+ removeGlobalCursor(ctx: Ctx): void;
40
38
  };
41
-
42
- export { dom };