fluidstate
Advanced tools
Comparing version 0.0.11 to 0.0.12
{ | ||
"name": "fluidstate", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Library for fine-grained reactivity state management", | ||
@@ -5,0 +5,0 @@ "repository": "https://gitlab.com/fluidstate/fluidstate", |
@@ -12,2 +12,3 @@ import { Api } from "./api"; | ||
reactive: Reactive; | ||
getProxy: () => Array<unknown>; | ||
}; | ||
@@ -14,0 +15,0 @@ declare const cleanupReactiveItems: (reactive: Reactive) => void; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var _reactiveUtils = require("./reactive-utils"); | ||
const elementArrayMap = new WeakMap(); | ||
const cleanupReactiveItems = reactive => { | ||
@@ -35,2 +36,3 @@ let index = reactive.items.length - 1; | ||
observed = context.api.createEmptyObserved(); | ||
elementArrayMap.set(observed, context.getProxy()); | ||
reactiveItemsCleanupRegistry.register(observed, context.reactive); | ||
@@ -51,2 +53,3 @@ context.reactive.items[p] = new WeakRef(observed); | ||
observed = context.api.createEmptyObserved(); | ||
elementArrayMap.set(observed, context.getProxy()); | ||
reactiveLengthCleanupRegistry.register(observed, context.reactive); | ||
@@ -67,2 +70,3 @@ context.reactive.length = new WeakRef(observed); | ||
observed = context.api.createEmptyObserved(); | ||
elementArrayMap.set(observed, context.getProxy()); | ||
reactiveKeysCleanupRegistry.register(observed, context.reactive); | ||
@@ -163,3 +167,4 @@ context.reactive.keys = new WeakRef(observed); | ||
keys: undefined | ||
} | ||
}, | ||
getProxy: () => proxy | ||
}; | ||
@@ -166,0 +171,0 @@ const proxy = new Proxy(inertArr, createReactiveArrayProxyHandler(context)); |
@@ -12,2 +12,3 @@ import { Api } from "./api"; | ||
reactive: Reactive; | ||
getProxy: () => Map<unknown, unknown>; | ||
}; | ||
@@ -14,0 +15,0 @@ declare const cleanupReactiveKeys: (reactive: Reactive) => void; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var _reactiveUtils = require("./reactive-utils"); | ||
const elementMapMap = new WeakMap(); | ||
const cleanupReactiveKeys = reactive => { | ||
@@ -38,2 +39,3 @@ for (let [key, ref] of reactive.keys) { | ||
observed = context.api.createEmptyObserved(); | ||
elementMapMap.set(observed, context.getProxy()); | ||
reactiveKeysCleanupRegistry.register(observed, context.reactive); | ||
@@ -60,2 +62,3 @@ context.reactive.keys.set(key, new WeakRef(observed)); | ||
observed = context.api.createEmptyObserved(); | ||
elementMapMap.set(observed, context.getProxy()); | ||
reactiveValuesCleanupRegistry.register(observed, context.reactive); | ||
@@ -82,2 +85,3 @@ context.reactive.values.set(key, new WeakRef(observed)); | ||
observed = context.api.createEmptyObserved(); | ||
elementMapMap.set(observed, context.getProxy()); | ||
reactiveSizeCleanupRegistry.register(observed, context.reactive); | ||
@@ -244,3 +248,4 @@ context.reactive.size = new WeakRef(observed); | ||
size: undefined | ||
} | ||
}, | ||
getProxy: () => proxy | ||
}; | ||
@@ -247,0 +252,0 @@ const fullContext = { |
@@ -13,2 +13,3 @@ import { Api } from "./api"; | ||
reactive: Reactive; | ||
getProxy: () => object; | ||
}; | ||
@@ -15,0 +16,0 @@ declare const cleanupReactiveValues: (reactive: Reactive) => void; |
@@ -9,2 +9,3 @@ "use strict"; | ||
var _reactiveUtils = require("./reactive-utils"); | ||
const elementObjectMap = new WeakMap(); | ||
const cleanupReactiveValues = reactive => { | ||
@@ -28,2 +29,3 @@ for (const key of Reflect.ownKeys(reactive.values)) { | ||
node = context.api.createComputed(computed.bind(proxy)); | ||
elementObjectMap.set(node, context.getProxy()); | ||
reactiveValuesCleanupRegistry.register(node, context.reactive); | ||
@@ -38,2 +40,3 @@ context.reactive.values[p] = new WeakRef(node); | ||
node = context.api.createEmptyObserved(); | ||
elementObjectMap.set(node, context.getProxy()); | ||
reactiveValuesCleanupRegistry.register(node, context.reactive); | ||
@@ -51,9 +54,10 @@ context.reactive.values[p] = new WeakRef(node); | ||
const readKeys = context => { | ||
let observed = context.reactive.keys?.deref(); | ||
if (!observed) { | ||
observed = context.api.createEmptyObserved(); | ||
reactiveKeysCleanupRegistry.register(observed, context.reactive); | ||
context.reactive.keys = new WeakRef(observed); | ||
let node = context.reactive.keys?.deref(); | ||
if (!node) { | ||
node = context.api.createEmptyObserved(); | ||
elementObjectMap.set(node, context.getProxy()); | ||
reactiveKeysCleanupRegistry.register(node, context.reactive); | ||
context.reactive.keys = new WeakRef(node); | ||
} | ||
context.api.get(observed); | ||
context.api.get(node); | ||
}; | ||
@@ -162,3 +166,4 @@ const notifyKeys = context => { | ||
keys: undefined | ||
} | ||
}, | ||
getProxy: () => proxy | ||
}; | ||
@@ -165,0 +170,0 @@ const proxy = new Proxy(inertObject, createReactiveObjectProxyHandler(context)); |
@@ -11,2 +11,3 @@ import { Api } from "./api"; | ||
reactive: Reactive; | ||
getProxy: () => Set<unknown>; | ||
}; | ||
@@ -13,0 +14,0 @@ declare const cleanupReactiveItems: (reactive: Reactive) => void; |
@@ -8,2 +8,3 @@ "use strict"; | ||
var _reactiveUtils = require("./reactive-utils"); | ||
const elementSetMap = new WeakMap(); | ||
const cleanupReactiveItems = reactive => { | ||
@@ -30,2 +31,3 @@ for (let [key, ref] of reactive.items) { | ||
observed = context.api.createEmptyObserved(); | ||
elementSetMap.set(observed, context.getProxy()); | ||
reactiveItemsCleanupRegistry.register(observed, context.reactive); | ||
@@ -52,2 +54,3 @@ context.reactive.items.set(item, new WeakRef(observed)); | ||
observed = context.api.createEmptyObserved(); | ||
elementSetMap.set(observed, context.getProxy()); | ||
reactiveSizeCleanupRegistry.register(observed, context.reactive); | ||
@@ -180,3 +183,4 @@ context.reactive.size = new WeakRef(observed); | ||
size: undefined | ||
} | ||
}, | ||
getProxy: () => proxy | ||
}; | ||
@@ -183,0 +187,0 @@ const fullContext = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208584
2071