@yiin/reactive-proxy-state 1.0.18 → 1.0.19

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.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './watch-effect';
10
10
  export * from './ref';
11
11
  export * from './computed';
12
12
  export * from './constants';
13
+ export * from './mark-raw';
package/dist/index.js CHANGED
@@ -1240,6 +1240,9 @@ function toRaw(observed) {
1240
1240
  return raw ? toRaw(raw) : observed;
1241
1241
  }
1242
1242
  function reactive(obj, emit, path = []) {
1243
+ if (obj["__v_skip" /* SKIP */]) {
1244
+ return obj;
1245
+ }
1243
1246
  if (globalSeen.has(obj))
1244
1247
  return globalSeen.get(obj);
1245
1248
  if (emit && path.length === 0) {
@@ -1524,6 +1527,18 @@ function watch(source, callback, options = {}) {
1524
1527
  });
1525
1528
  return stopEffect;
1526
1529
  }
1530
+ // src/mark-raw.ts
1531
+ function markRaw(obj) {
1532
+ if (obj && typeof obj === "object") {
1533
+ Object.defineProperty(obj, "__v_skip" /* SKIP */, {
1534
+ value: true,
1535
+ enumerable: false,
1536
+ configurable: false,
1537
+ writable: false
1538
+ });
1539
+ }
1540
+ return obj;
1541
+ }
1527
1542
  export {
1528
1543
  wrapperCache,
1529
1544
  wrapSet,
@@ -1548,6 +1563,7 @@ export {
1548
1563
  reactive,
1549
1564
  pathConcatCache,
1550
1565
  pathCache,
1566
+ markRaw,
1551
1567
  isRefSymbol,
1552
1568
  isRef,
1553
1569
  isReactive,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Marks an object so that it will never be converted into a reactive proxy.
3
+ *
4
+ * Similar to Vue's `markRaw`, this is useful when you need to store
5
+ * non-reactive, opaque objects (e.g. DOM nodes, complex class instances,
6
+ * third-party library objects) inside a reactive tree without having them
7
+ * wrapped by the reactivity system.
8
+ */
9
+ export declare function markRaw<T extends object>(obj: T): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yiin/reactive-proxy-state",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "author": "Yiin <stanislovas@yiin.lt>",
5
5
  "repository": {
6
6
  "type": "git",