@zag-js/tabs 0.2.5 → 0.2.7

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.js CHANGED
@@ -31,10 +31,29 @@ var import_anatomy = require("@zag-js/anatomy");
31
31
  var anatomy = (0, import_anatomy.createAnatomy)("tabs").parts("root", "tablist", "trigger", "contentGroup", "content", "indicator");
32
32
  var parts = anatomy.build();
33
33
 
34
- // ../../utilities/dom/dist/index.mjs
34
+ // ../../utilities/dom/src/attrs.ts
35
35
  var dataAttr = (guard) => {
36
36
  return guard ? "" : void 0;
37
37
  };
38
+
39
+ // ../../utilities/core/src/array.ts
40
+ var first = (v) => v[0];
41
+ var last = (v) => v[v.length - 1];
42
+
43
+ // ../../utilities/core/src/guard.ts
44
+ var isArray = (v) => Array.isArray(v);
45
+ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
46
+
47
+ // ../../utilities/core/src/object.ts
48
+ function compact(obj) {
49
+ if (obj === void 0)
50
+ return obj;
51
+ return Object.fromEntries(
52
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
53
+ );
54
+ }
55
+
56
+ // ../../utilities/dom/src/platform.ts
38
57
  var isDom = () => typeof window !== "undefined";
39
58
  function getPlatform() {
40
59
  var _a;
@@ -45,6 +64,8 @@ var pt = (v) => isDom() && v.test(getPlatform());
45
64
  var vn = (v) => isDom() && v.test(navigator.vendor);
46
65
  var isSafari = () => isApple() && vn(/apple/i);
47
66
  var isApple = () => pt(/mac|iphone|ipad|ipod/i);
67
+
68
+ // ../../utilities/dom/src/query.ts
48
69
  function isDocument(el) {
49
70
  return el.nodeType === Node.DOCUMENT_NODE;
50
71
  }
@@ -74,25 +95,7 @@ function defineDomHelpers(helpers) {
74
95
  return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
75
96
  },
76
97
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
77
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id),
78
- createEmitter: (ctx, target) => {
79
- const win = dom2.getWin(ctx);
80
- return function emit(evt, detail, options) {
81
- const { bubbles = true, cancelable, composed = true } = options != null ? options : {};
82
- const eventName = `zag:${evt}`;
83
- const init = { bubbles, cancelable, composed, detail };
84
- const event = new win.CustomEvent(eventName, init);
85
- target.dispatchEvent(event);
86
- };
87
- },
88
- createListener: (target) => {
89
- return function listen(evt, handler) {
90
- const eventName = `zag:${evt}`;
91
- const listener = (e) => handler(e);
92
- target.addEventListener(eventName, listener);
93
- return () => target.removeEventListener(eventName, listener);
94
- };
95
- }
98
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
96
99
  };
97
100
  return {
98
101
  ...dom2,
@@ -107,6 +110,8 @@ function isVisible(el) {
107
110
  return false;
108
111
  return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
109
112
  }
113
+
114
+ // ../../utilities/dom/src/focusable.ts
110
115
  var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
111
116
  var getFocusables = (container, includeContainer = false) => {
112
117
  if (!container)
@@ -130,6 +135,8 @@ function isFocusable(element) {
130
135
  return false;
131
136
  return element.matches(focusableSelector) && isVisible(element);
132
137
  }
138
+
139
+ // ../../utilities/dom/src/keyboard-event.ts
133
140
  var rtlKeyMap = {
134
141
  ArrowLeft: "ArrowRight",
135
142
  ArrowRight: "ArrowLeft"
@@ -154,6 +161,8 @@ function getEventKey(event, options = {}) {
154
161
  }
155
162
  return key;
156
163
  }
164
+
165
+ // ../../utilities/dom/src/next-tick.ts
157
166
  function nextTick(fn) {
158
167
  const set = /* @__PURE__ */ new Set();
159
168
  function raf2(fn2) {
@@ -173,6 +182,8 @@ function raf(fn) {
173
182
  globalThis.cancelAnimationFrame(id);
174
183
  };
175
184
  }
185
+
186
+ // ../../utilities/dom/src/nodelist.ts
176
187
  function queryAll(root, selector) {
177
188
  var _a;
178
189
  return Array.from((_a = root == null ? void 0 : root.querySelectorAll(selector)) != null ? _a : []);
@@ -197,19 +208,6 @@ function prevById(v, id, loop = true) {
197
208
  return v[idx];
198
209
  }
199
210
 
200
- // ../../utilities/core/dist/index.mjs
201
- var first = (v) => v[0];
202
- var last = (v) => v[v.length - 1];
203
- var isArray = (v) => Array.isArray(v);
204
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
205
- function compact(obj) {
206
- if (obj === void 0)
207
- return obj;
208
- return Object.fromEntries(
209
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
210
- );
211
- }
212
-
213
211
  // src/tabs.dom.ts
214
212
  var dom = defineDomHelpers({
215
213
  getRootId: (ctx) => {