@zag-js/utils 1.18.1 → 1.18.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.js CHANGED
@@ -120,12 +120,15 @@ var baseGetTag = (v) => Object.prototype.toString.call(v);
120
120
  var fnToString = Function.prototype.toString;
121
121
  var objectCtorString = fnToString.call(Object);
122
122
  var isPlainObject = (v) => {
123
- if (!isObjectLike(v) || baseGetTag(v) != "[object Object]") return false;
123
+ if (!isObjectLike(v) || baseGetTag(v) != "[object Object]" || isFrameworkElement(v)) return false;
124
124
  const proto = Object.getPrototypeOf(v);
125
125
  if (proto === null) return true;
126
126
  const Ctor = hasProp(proto, "constructor") && proto.constructor;
127
127
  return typeof Ctor == "function" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString;
128
128
  };
129
+ var isReactElement = (x) => typeof x === "object" && x !== null && "$$typeof" in x && "props" in x;
130
+ var isVueElement = (x) => typeof x === "object" && x !== null && "__v_isVNode" in x;
131
+ var isFrameworkElement = (x) => isReactElement(x) || isVueElement(x);
129
132
 
130
133
  // src/functions.ts
131
134
  var runIfFn = (v, ...a) => {
@@ -318,7 +321,7 @@ var toPx = (v) => v != null ? `${v}px` : void 0;
318
321
 
319
322
  // src/object.ts
320
323
  function compact(obj) {
321
- if (!isPlainObject2(obj) || obj === void 0) return obj;
324
+ if (!isPlainObject(obj) || obj === void 0) return obj;
322
325
  const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
323
326
  const filtered = {};
324
327
  for (const key of keys) {
@@ -330,9 +333,6 @@ function compact(obj) {
330
333
  return filtered;
331
334
  }
332
335
  var json = (v) => JSON.parse(JSON.stringify(v));
333
- var isPlainObject2 = (v) => {
334
- return v && typeof v === "object" && v.constructor === Object;
335
- };
336
336
  function pick(obj, keys) {
337
337
  const filtered = {};
338
338
  for (const key of keys) {
package/dist/index.mjs CHANGED
@@ -118,12 +118,15 @@ var baseGetTag = (v) => Object.prototype.toString.call(v);
118
118
  var fnToString = Function.prototype.toString;
119
119
  var objectCtorString = fnToString.call(Object);
120
120
  var isPlainObject = (v) => {
121
- if (!isObjectLike(v) || baseGetTag(v) != "[object Object]") return false;
121
+ if (!isObjectLike(v) || baseGetTag(v) != "[object Object]" || isFrameworkElement(v)) return false;
122
122
  const proto = Object.getPrototypeOf(v);
123
123
  if (proto === null) return true;
124
124
  const Ctor = hasProp(proto, "constructor") && proto.constructor;
125
125
  return typeof Ctor == "function" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString;
126
126
  };
127
+ var isReactElement = (x) => typeof x === "object" && x !== null && "$$typeof" in x && "props" in x;
128
+ var isVueElement = (x) => typeof x === "object" && x !== null && "__v_isVNode" in x;
129
+ var isFrameworkElement = (x) => isReactElement(x) || isVueElement(x);
127
130
 
128
131
  // src/functions.ts
129
132
  var runIfFn = (v, ...a) => {
@@ -316,7 +319,7 @@ var toPx = (v) => v != null ? `${v}px` : void 0;
316
319
 
317
320
  // src/object.ts
318
321
  function compact(obj) {
319
- if (!isPlainObject2(obj) || obj === void 0) return obj;
322
+ if (!isPlainObject(obj) || obj === void 0) return obj;
320
323
  const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
321
324
  const filtered = {};
322
325
  for (const key of keys) {
@@ -328,9 +331,6 @@ function compact(obj) {
328
331
  return filtered;
329
332
  }
330
333
  var json = (v) => JSON.parse(JSON.stringify(v));
331
- var isPlainObject2 = (v) => {
332
- return v && typeof v === "object" && v.constructor === Object;
333
- };
334
334
  function pick(obj, keys) {
335
335
  const filtered = {};
336
336
  for (const key of keys) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/utils",
3
- "version": "1.18.1",
3
+ "version": "1.18.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",