@yiin/reactive-proxy-state 1.0.17 → 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.
@@ -5,12 +5,12 @@ export interface ComputedRef<T = any> extends Omit<Ref<T>, 'value'> {
5
5
  readonly value: T;
6
6
  readonly [isComputedSymbol]: true;
7
7
  readonly [isRefSymbol]: true;
8
- readonly effect: WatchEffectStopHandle<T>;
8
+ readonly stop: WatchEffectStopHandle<T>;
9
9
  }
10
10
  export interface WritableComputedRef<T> extends Ref<T> {
11
11
  readonly [isComputedSymbol]: true;
12
12
  readonly [isRefSymbol]: true;
13
- readonly effect: WatchEffectStopHandle<T>;
13
+ readonly stop: WatchEffectStopHandle<T>;
14
14
  }
15
15
  type ComputedGetter<T> = () => T;
16
16
  type ComputedSetter<T> = (v: T) => void;
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) {
@@ -1449,7 +1452,7 @@ function computed(getterOrOptions) {
1449
1452
  console.warn("computed value is read-only");
1450
1453
  }
1451
1454
  },
1452
- effect: stopHandle
1455
+ stop: stopHandle
1453
1456
  };
1454
1457
  return computedRef;
1455
1458
  }
@@ -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.17",
3
+ "version": "1.0.19",
4
4
  "author": "Yiin <stanislovas@yiin.lt>",
5
5
  "repository": {
6
6
  "type": "git",