@maverick-js/signals
Advanced tools
Comparing version 5.6.0 to 5.6.1
@@ -1,1 +0,1 @@ | ||
export { HANDLERS, SCOPE, STATE, computed, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-MFBTUIE4.js'; | ||
export { computed, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-7RQMPL6B.js'; |
@@ -1,2 +0,2 @@ | ||
import { effect, write, onDispose, read, STATE, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-MFBTUIE4.js'; | ||
import { effect, write, onDispose, read, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-7RQMPL6B.js'; | ||
@@ -22,3 +22,3 @@ // src/selector.ts | ||
function Selector(key, initialValue, nodes) { | ||
this[STATE] = 0; | ||
this._state = 0; | ||
this._key = key; | ||
@@ -25,0 +25,0 @@ this._value = initialValue; |
@@ -1,1 +0,1 @@ | ||
export { HANDLERS, SCOPE, STATE, computed, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-6GJTXBNF.js'; | ||
export { computed, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-K5LR4LRP.js'; |
@@ -1,2 +0,2 @@ | ||
import { effect, write, onDispose, read, STATE, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-6GJTXBNF.js'; | ||
import { effect, write, onDispose, read, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-K5LR4LRP.js'; | ||
@@ -16,3 +16,3 @@ // src/selector.ts | ||
nodes.set(key, node = new Selector(key, key === currentKey, nodes)); | ||
node.q += 1; | ||
node.r += 1; | ||
onDispose(node); | ||
@@ -23,6 +23,6 @@ return read.bind(node); | ||
function Selector(key, initialValue, nodes) { | ||
this[STATE] = 0; | ||
this.t = key; | ||
this.i = initialValue; | ||
this.q = 0; | ||
this.f = 0; | ||
this.u = key; | ||
this.k = initialValue; | ||
this.r = 0; | ||
this.b = nodes; | ||
@@ -32,7 +32,7 @@ this.d = null; | ||
var SelectorProto = Selector.prototype; | ||
SelectorProto.p = isNotEqual; | ||
SelectorProto.q = isNotEqual; | ||
SelectorProto.call = function() { | ||
this.q -= 1; | ||
if (!this.q) { | ||
this.b.delete(this.t); | ||
this.r -= 1; | ||
if (!this.r) { | ||
this.b.delete(this.u); | ||
this.b = null; | ||
@@ -48,7 +48,7 @@ } | ||
updateMap.bind({ | ||
m: createScope(), | ||
g: 0, | ||
r: list, | ||
f: [], | ||
n: map, | ||
g: createScope(), | ||
i: 0, | ||
s: list, | ||
h: [], | ||
o: map, | ||
e: [], | ||
@@ -62,10 +62,10 @@ b: [] | ||
function updateMap() { | ||
let i = 0, newItems = this.r() || [], mapper = () => this.n(read.bind(this.b[i]), i); | ||
let i = 0, newItems = this.s() || [], mapper = () => this.o(read.bind(this.b[i]), i); | ||
scoped(() => { | ||
if (newItems.length === 0) { | ||
if (this.g !== 0) { | ||
dispose.call(this.m, false); | ||
this.f = []; | ||
if (this.i !== 0) { | ||
dispose.call(this.g, false); | ||
this.h = []; | ||
this.e = []; | ||
this.g = 0; | ||
this.i = 0; | ||
this.b = []; | ||
@@ -76,5 +76,5 @@ } | ||
for (i = 0; i < newItems.length; i++) { | ||
if (i < this.f.length && this.f[i] !== newItems[i]) { | ||
if (i < this.h.length && this.h[i] !== newItems[i]) { | ||
write.call(this.b[i], newItems[i]); | ||
} else if (i >= this.f.length) { | ||
} else if (i >= this.h.length) { | ||
this.e[i] = compute( | ||
@@ -87,8 +87,8 @@ this.b[i] = createComputation(newItems[i], null), | ||
} | ||
for (; i < this.f.length; i++) | ||
for (; i < this.h.length; i++) | ||
dispose.call(this.b[i]); | ||
this.g = this.b.length = newItems.length; | ||
this.f = newItems.slice(0); | ||
this.e = this.e.slice(0, this.g); | ||
}, this.m); | ||
this.i = this.b.length = newItems.length; | ||
this.h = newItems.slice(0); | ||
this.e = this.e.slice(0, this.i); | ||
}, this.g); | ||
return this.e; | ||
@@ -101,7 +101,7 @@ } | ||
updateKeyedMap.bind({ | ||
m: createScope(), | ||
g: 0, | ||
r: list, | ||
f: [], | ||
n: map, | ||
g: createScope(), | ||
i: 0, | ||
s: list, | ||
h: [], | ||
o: map, | ||
e: [], | ||
@@ -115,17 +115,17 @@ b: [] | ||
function updateKeyedMap() { | ||
const newItems = this.r() || [], indexed = this.n.length > 1; | ||
const newItems = this.s() || [], indexed = this.o.length > 1; | ||
scoped(() => { | ||
let newLen = newItems.length, i, j, mapper = indexed ? () => this.n(newItems[j], read.bind(this.b[j])) : () => this.n(newItems[j]); | ||
let newLen = newItems.length, i, j, mapper = indexed ? () => this.o(newItems[j], read.bind(this.b[j])) : () => this.o(newItems[j]); | ||
if (newLen === 0) { | ||
if (this.g !== 0) { | ||
dispose.call(this.m, false); | ||
if (this.i !== 0) { | ||
dispose.call(this.g, false); | ||
this.b = []; | ||
this.f = []; | ||
this.h = []; | ||
this.e = []; | ||
this.g = 0; | ||
this.i = 0; | ||
} | ||
} else if (this.g === 0) { | ||
} else if (this.i === 0) { | ||
this.e = new Array(newLen); | ||
for (j = 0; j < newLen; j++) { | ||
this.f[j] = newItems[j]; | ||
this.h[j] = newItems[j]; | ||
this.e[j] = compute( | ||
@@ -137,8 +137,8 @@ this.b[j] = createComputation(j, null), | ||
} | ||
this.g = newLen; | ||
this.i = newLen; | ||
} else { | ||
let start, end, newEnd, item, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen); | ||
for (start = 0, end = Math.min(this.g, newLen); start < end && this.f[start] === newItems[start]; start++) | ||
for (start = 0, end = Math.min(this.i, newLen); start < end && this.h[start] === newItems[start]; start++) | ||
; | ||
for (end = this.g - 1, newEnd = newLen - 1; end >= start && newEnd >= start && this.f[end] === newItems[newEnd]; end--, newEnd--) { | ||
for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && this.h[end] === newItems[newEnd]; end--, newEnd--) { | ||
temp[newEnd] = this.e[end]; | ||
@@ -156,3 +156,3 @@ tempNodes[newEnd] = this.b[end]; | ||
for (i = start; i <= end; i++) { | ||
item = this.f[i]; | ||
item = this.h[i]; | ||
j = newIndices.get(item); | ||
@@ -180,6 +180,6 @@ if (j !== void 0 && j !== -1) { | ||
} | ||
this.e = this.e.slice(0, this.g = newLen); | ||
this.f = newItems.slice(0); | ||
this.e = this.e.slice(0, this.i = newLen); | ||
this.h = newItems.slice(0); | ||
} | ||
}, this.m); | ||
}, this.g); | ||
return this.e; | ||
@@ -186,0 +186,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export { HANDLERS, SCOPE, STATE, computed, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-IOI65MNJ.js'; | ||
export { computed, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-AKYPVQNN.js'; |
@@ -1,2 +0,2 @@ | ||
import { effect, write, onDispose, read, STATE, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-IOI65MNJ.js'; | ||
import { effect, write, onDispose, read, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-AKYPVQNN.js'; | ||
@@ -16,3 +16,3 @@ // src/selector.ts | ||
nodes.set(key, node = new Selector(key, key === currentKey, nodes)); | ||
node.q += 1; | ||
node.r += 1; | ||
onDispose(node); | ||
@@ -23,6 +23,6 @@ return read.bind(node); | ||
function Selector(key, initialValue, nodes) { | ||
this[STATE] = 0; | ||
this.t = key; | ||
this.i = initialValue; | ||
this.q = 0; | ||
this.f = 0; | ||
this.u = key; | ||
this.k = initialValue; | ||
this.r = 0; | ||
this.b = nodes; | ||
@@ -32,7 +32,7 @@ this.d = null; | ||
var SelectorProto = Selector.prototype; | ||
SelectorProto.p = isNotEqual; | ||
SelectorProto.q = isNotEqual; | ||
SelectorProto.call = function() { | ||
this.q -= 1; | ||
if (!this.q) { | ||
this.b.delete(this.t); | ||
this.r -= 1; | ||
if (!this.r) { | ||
this.b.delete(this.u); | ||
this.b = null; | ||
@@ -48,7 +48,7 @@ } | ||
updateMap.bind({ | ||
m: createScope(), | ||
g: 0, | ||
r: list, | ||
f: [], | ||
n: map, | ||
g: createScope(), | ||
i: 0, | ||
s: list, | ||
h: [], | ||
o: map, | ||
e: [], | ||
@@ -62,10 +62,10 @@ b: [] | ||
function updateMap() { | ||
let i = 0, newItems = this.r() || [], mapper = () => this.n(read.bind(this.b[i]), i); | ||
let i = 0, newItems = this.s() || [], mapper = () => this.o(read.bind(this.b[i]), i); | ||
scoped(() => { | ||
if (newItems.length === 0) { | ||
if (this.g !== 0) { | ||
dispose.call(this.m, false); | ||
this.f = []; | ||
if (this.i !== 0) { | ||
dispose.call(this.g, false); | ||
this.h = []; | ||
this.e = []; | ||
this.g = 0; | ||
this.i = 0; | ||
this.b = []; | ||
@@ -76,5 +76,5 @@ } | ||
for (i = 0; i < newItems.length; i++) { | ||
if (i < this.f.length && this.f[i] !== newItems[i]) { | ||
if (i < this.h.length && this.h[i] !== newItems[i]) { | ||
write.call(this.b[i], newItems[i]); | ||
} else if (i >= this.f.length) { | ||
} else if (i >= this.h.length) { | ||
this.e[i] = compute( | ||
@@ -87,8 +87,8 @@ this.b[i] = createComputation(newItems[i], null), | ||
} | ||
for (; i < this.f.length; i++) | ||
for (; i < this.h.length; i++) | ||
dispose.call(this.b[i]); | ||
this.g = this.b.length = newItems.length; | ||
this.f = newItems.slice(0); | ||
this.e = this.e.slice(0, this.g); | ||
}, this.m); | ||
this.i = this.b.length = newItems.length; | ||
this.h = newItems.slice(0); | ||
this.e = this.e.slice(0, this.i); | ||
}, this.g); | ||
return this.e; | ||
@@ -101,7 +101,7 @@ } | ||
updateKeyedMap.bind({ | ||
m: createScope(), | ||
g: 0, | ||
r: list, | ||
f: [], | ||
n: map, | ||
g: createScope(), | ||
i: 0, | ||
s: list, | ||
h: [], | ||
o: map, | ||
e: [], | ||
@@ -115,17 +115,17 @@ b: [] | ||
function updateKeyedMap() { | ||
const newItems = this.r() || [], indexed = this.n.length > 1; | ||
const newItems = this.s() || [], indexed = this.o.length > 1; | ||
scoped(() => { | ||
let newLen = newItems.length, i, j, mapper = indexed ? () => this.n(newItems[j], read.bind(this.b[j])) : () => this.n(newItems[j]); | ||
let newLen = newItems.length, i, j, mapper = indexed ? () => this.o(newItems[j], read.bind(this.b[j])) : () => this.o(newItems[j]); | ||
if (newLen === 0) { | ||
if (this.g !== 0) { | ||
dispose.call(this.m, false); | ||
if (this.i !== 0) { | ||
dispose.call(this.g, false); | ||
this.b = []; | ||
this.f = []; | ||
this.h = []; | ||
this.e = []; | ||
this.g = 0; | ||
this.i = 0; | ||
} | ||
} else if (this.g === 0) { | ||
} else if (this.i === 0) { | ||
this.e = new Array(newLen); | ||
for (j = 0; j < newLen; j++) { | ||
this.f[j] = newItems[j]; | ||
this.h[j] = newItems[j]; | ||
this.e[j] = compute( | ||
@@ -137,8 +137,8 @@ this.b[j] = createComputation(j, null), | ||
} | ||
this.g = newLen; | ||
this.i = newLen; | ||
} else { | ||
let start, end, newEnd, item, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen); | ||
for (start = 0, end = Math.min(this.g, newLen); start < end && this.f[start] === newItems[start]; start++) | ||
for (start = 0, end = Math.min(this.i, newLen); start < end && this.h[start] === newItems[start]; start++) | ||
; | ||
for (end = this.g - 1, newEnd = newLen - 1; end >= start && newEnd >= start && this.f[end] === newItems[newEnd]; end--, newEnd--) { | ||
for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && this.h[end] === newItems[newEnd]; end--, newEnd--) { | ||
temp[newEnd] = this.e[end]; | ||
@@ -156,3 +156,3 @@ tempNodes[newEnd] = this.b[end]; | ||
for (i = start; i <= end; i++) { | ||
item = this.f[i]; | ||
item = this.h[i]; | ||
j = newIndices.get(item); | ||
@@ -180,6 +180,6 @@ if (j !== void 0 && j !== -1) { | ||
} | ||
this.e = this.e.slice(0, this.g = newLen); | ||
this.f = newItems.slice(0); | ||
this.e = this.e.slice(0, this.i = newLen); | ||
this.h = newItems.slice(0); | ||
} | ||
}, this.m); | ||
}, this.g); | ||
return this.e; | ||
@@ -186,0 +186,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export * from './dist/prod/map.js'; | ||
export * from './dist/types/map.js'; |
@@ -5,4 +5,5 @@ { | ||
"license": "MIT", | ||
"version": "5.6.0", | ||
"version": "5.6.1", | ||
"type": "module", | ||
"types": "dist/types/index.d.ts", | ||
"module": "dist/prod/index.js", | ||
@@ -17,2 +18,3 @@ "sideEffects": false, | ||
"build": "rimraf dist && tsup", | ||
"types": "tsc -p tsconfig.build.json", | ||
"format": "prettier src --write --loglevel warn", | ||
@@ -24,3 +26,3 @@ "test": "vitest run", | ||
"bench:layers": "pnpm build && node bench/layers.js", | ||
"validate": "pnpm test && pnpm test:gc && pnpm build", | ||
"validate": "pnpm test && pnpm test:gc && pnpm build && pnpm types", | ||
"release": "pnpm validate && standard-version && git push --follow-tags origin main && npm publish" | ||
@@ -60,2 +62,3 @@ }, | ||
".": { | ||
"types": "./index.d.ts", | ||
"development": "./dist/dev/index.js", | ||
@@ -69,2 +72,3 @@ "test": "./dist/dev/index.js", | ||
"./map": { | ||
"types": "./map.d.ts", | ||
"development": "./dist/dev/map.js", | ||
@@ -71,0 +75,0 @@ "test": "./dist/dev/map.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22
94888
2618