brisky-struct
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -7,8 +7,8 @@ import bs from 'brisky-stamp'; | ||
if (!noContext && result && result.inherits) { | ||
if (t.context) { | ||
result.context = t.context; | ||
result.contextLevel = t.contextLevel + 1; | ||
} else if (result.context) { | ||
result.context = null; | ||
result.contextLevel = null; | ||
if (t._c) { | ||
result._c = t._c; | ||
result._cLevel = t._cLevel + 1; | ||
} else if (result._c) { | ||
result._c = null; | ||
result._cLevel = null; | ||
} | ||
@@ -20,4 +20,4 @@ } | ||
if (!noContext && result && result.inherits) { | ||
result.context = t; | ||
result.contextLevel = 1; | ||
result._c = t; | ||
result._cLevel = 1; | ||
} | ||
@@ -111,6 +111,6 @@ return result | ||
t.tStamp = stamp; | ||
if (t._p || t.context) { | ||
if (t._p || t._c) { | ||
let p = t._p; | ||
if (t.context && t.contextLevel === 1) { | ||
p = t.context; | ||
if (t._c && t._cLevel === 1) { | ||
p = t._c; | ||
} | ||
@@ -126,4 +126,4 @@ while (p && (!p.tStamp || p.tStamp[0] !== stamp[0])) { | ||
if (p.subscriptions) exec$1(p); | ||
// if (p.context && p.contextLevel === 1) { | ||
// p = p.context // waht does this even mean??? -- make more tests | ||
// if (p._c && p._cLevel === 1) { | ||
// p = p._c // waht does this even mean??? -- make more tests | ||
// } else { | ||
@@ -149,5 +149,5 @@ p = p._p; | ||
const strip = (t) => { | ||
while (t && t.context) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
while (t && t._c) { | ||
t._c = null; | ||
t._cLevel = null; | ||
t = t._p; | ||
@@ -161,4 +161,4 @@ } | ||
if (n) { strip(context); } // dont trust this... | ||
resolve.context = context; | ||
resolve.contextLevel = level; | ||
resolve._c = context; | ||
resolve._cLevel = level; | ||
subscription(context, stamp); | ||
@@ -168,4 +168,4 @@ while (n--) { fn[n](val, stamp, t); } | ||
if (exec(t, val, stamp, context._p, context.key, context, 1, j, fn)) { | ||
context.context = null; | ||
context.contextLevel = null; | ||
context._c = null; | ||
context._cLevel = null; | ||
} | ||
@@ -217,4 +217,4 @@ } | ||
remove(nest, stamp); | ||
nest.context = null; | ||
nest.contextLevel = null; | ||
nest._c = null; | ||
nest._cLevel = null; | ||
} | ||
@@ -227,4 +227,4 @@ } | ||
if (!(key in context)) { | ||
resolve.context = context; | ||
resolve.contextLevel = level; | ||
resolve._c = context; | ||
resolve._cLevel = level; | ||
subscription(context, stamp); | ||
@@ -234,4 +234,4 @@ remove(t, stamp); | ||
if (execRemove(t, stamp, context._p, context.key, context, 1)) { | ||
context.context = null; | ||
context.contextLevel = null; | ||
context._c = null; | ||
context._cLevel = null; | ||
} | ||
@@ -271,4 +271,4 @@ } | ||
updateRemove(context, t, stamp, key, t, 1); | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -285,4 +285,4 @@ }; | ||
if (exec(t, void 0, stamp, t._p, t.key, t, 1, 0)) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -298,4 +298,4 @@ } | ||
if (exec(t, val, stamp, t._p, t.key, t, 1, i, listeners)) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -328,4 +328,4 @@ } | ||
if (exec(t, val, stamp, t._p, t.key, t, 1, 0)) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -654,6 +654,6 @@ } | ||
const resolveContext = (t, val, stamp) => { | ||
let level = t.contextLevel; | ||
var cntx = t.context; | ||
let level = t._cLevel; | ||
var cntx = t._c; | ||
let key; | ||
if (cntx.context) { | ||
if (cntx._c) { | ||
cntx = resolveContext(cntx, void 0, stamp); | ||
@@ -671,4 +671,4 @@ } | ||
contextProperty(cntx, void 0, stamp, key, inherits); | ||
inherits.context = null; | ||
inherits.contextLevel = null; | ||
inherits._c = null; | ||
inherits._cLevel = null; | ||
cntx = cntx[key]; | ||
@@ -679,4 +679,4 @@ for (let i = 1, len = path.length; i < len; i++) { | ||
cntx[key] = create$1(inherits, void 0, stamp, cntx, key); | ||
inherits.context = null; | ||
inherits.contextLevel = null; | ||
inherits._c = null; | ||
inherits._cLevel = null; | ||
cntx = cntx[key]; | ||
@@ -688,4 +688,4 @@ } | ||
} | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
return contextProperty(cntx, val, stamp, key, get(cntx, key, true)) | ||
@@ -714,10 +714,10 @@ }; | ||
const storeContext = t => { | ||
var context = t.context; | ||
var context = t._c; | ||
if (context) { | ||
const arr = []; | ||
let level = t.contextLevel; | ||
let level = t._cLevel; | ||
while (context) { | ||
arr.push(context, level); | ||
level = context.contextLevel; | ||
context = context.context; | ||
level = context._cLevel; | ||
context = context._c; | ||
} | ||
@@ -767,4 +767,4 @@ return arr | ||
} else if (field !== segment) { | ||
segment.context = null; | ||
segment.contextLevel = null; | ||
segment._c = null; | ||
segment._cLevel = null; | ||
newContext = field; | ||
@@ -790,4 +790,4 @@ newLevel = len - (i + 1); | ||
if (level) { | ||
target.contextLevel = level; | ||
target.context = context; | ||
target._cLevel = level; | ||
target._c = context; | ||
if (level > 1) { | ||
@@ -797,4 +797,4 @@ let p = target._p; | ||
if (path) { path.unshift(p); } | ||
p.context = context; | ||
p.contextLevel = target.contextLevel - i; | ||
p._c = context; | ||
p._cLevel = target._cLevel - i; | ||
p = p._p; | ||
@@ -809,9 +809,9 @@ } | ||
if (level) { | ||
target.contextLevel = null; | ||
target.context = null; | ||
target._cLevel = null; | ||
target._c = null; | ||
if (level > 1) { | ||
let p = target._p; | ||
for (let i = 1; p && i < level; i++) { | ||
p.context = null; | ||
p.contextLevel = null; | ||
p._c = null; | ||
p._cLevel = null; | ||
p = p._p; | ||
@@ -827,3 +827,3 @@ } | ||
if (result && result.inherits) { | ||
if (result.context) { | ||
if (result._c) { | ||
contextProperty(t, val, stamp, key, result); | ||
@@ -879,8 +879,8 @@ } else { | ||
const parent = t => { | ||
if (t.context) { | ||
if (t.contextLevel === 1) { | ||
return t.context | ||
if (t._c) { | ||
if (t._cLevel === 1) { | ||
return t._c | ||
} else { | ||
t._p.contextLevel = t.contextLevel - 1; | ||
t._p.context = t.context; | ||
t._p._cLevel = t._cLevel - 1; | ||
t._p._c = t._c; | ||
return t._p | ||
@@ -906,4 +906,4 @@ } | ||
while (parent) { | ||
if (parent.context && !real) { | ||
let i = parent.contextLevel; | ||
if (parent._c && !real) { | ||
let i = parent._cLevel; | ||
let p = parent; | ||
@@ -914,3 +914,3 @@ while (i--) { | ||
} | ||
parent = parent.context; | ||
parent = parent._c; | ||
} else if (parent.key) { | ||
@@ -1227,3 +1227,3 @@ result.unshift(parent.key); | ||
const set = (t, val, stamp, isNew) => { | ||
if (t.context) { | ||
if (t._c) { | ||
return resolveContext(t, val, stamp) | ||
@@ -1275,4 +1275,4 @@ } else { | ||
if (context) { | ||
t.emitters.context = context; | ||
t.emitters.contextLevel = 1; | ||
t.emitters._c = context; | ||
t.emitters._cLevel = 1; | ||
} | ||
@@ -1657,3 +1657,3 @@ } else if (t.inherits) { | ||
[id]: (val, stamp, t) => { | ||
if (!t.context) { | ||
if (!t._c) { | ||
if (listener(val, stamp, t)) { | ||
@@ -1805,8 +1805,8 @@ set(t, { on: { data: { [id]: null } } }); | ||
const store = (t, branch) => { | ||
if (t.context.context) { | ||
branch.$stored = storeContext(t.context); | ||
if (t._c._c) { | ||
branch.$stored = storeContext(t._c); | ||
} | ||
branch.$tc = t.context; | ||
if (t.contextLevel > 1) { | ||
branch.$tcl = t.contextLevel; | ||
branch.$tc = t._c; | ||
if (t._cLevel > 1) { | ||
branch.$tcl = t._cLevel; | ||
} | ||
@@ -1825,11 +1825,11 @@ }; | ||
branch.$ = stamp; | ||
if (t.context) { store(t, branch); } | ||
if (t._c) { store(t, branch); } | ||
if (subs.val) { cb(t, 'new', subs, branch); } | ||
diff(t, subs, cb, branch, void 0, c); | ||
changed = true; | ||
} else if (branch.$[0] !== stamp[0] || branch.$t !== t || branch.$tc !== t.context) { | ||
} else if (branch.$[0] !== stamp[0] || branch.$t !== t || branch.$tc !== t._c) { | ||
if (subs.val) { | ||
if ( | ||
subs.val === true || (subs.val === 'switch' && | ||
(branch.$t !== t || branch.$tc !== t.context)) // | ||
(branch.$t !== t || branch.$tc !== t._c)) // | ||
) { | ||
@@ -1842,3 +1842,3 @@ cb(t, 'update', subs, branch); | ||
if (t.context) { | ||
if (t._c) { | ||
store(t, branch); | ||
@@ -1890,5 +1890,5 @@ } else if (branch.$tc) { | ||
); | ||
if (t && t.context) { | ||
t.contextLevel = null; | ||
t.context = null; | ||
if (t && t._c) { | ||
t._cLevel = null; | ||
t._c = null; | ||
} | ||
@@ -1990,5 +1990,5 @@ } | ||
update$2(i, tt, subs, cb, $keys, void 0, branch); | ||
if (tt.context) { | ||
tt.contextLevel = null; | ||
tt.context = null; | ||
if (tt._c) { | ||
tt._cLevel = null; | ||
tt._c = null; | ||
} | ||
@@ -2053,5 +2053,5 @@ } | ||
} | ||
if (tt.context) { | ||
tt.contextLevel = null; | ||
tt.context = null; | ||
if (tt._c) { | ||
tt._cLevel = null; | ||
tt._c = null; | ||
} | ||
@@ -2072,5 +2072,5 @@ } | ||
} | ||
if (tt.context) { | ||
tt.contextLevel = null; | ||
tt.context = null; | ||
if (tt._c) { | ||
tt._cLevel = null; | ||
tt._c = null; | ||
} | ||
@@ -2564,5 +2564,6 @@ } | ||
// make this nicer need to get acces to real create | ||
const create$$1 = (val, stamp) => create$1(struct, val, stamp); | ||
export { subscribe, parse$1 as parse, create$$1 as create, set, struct, get, getProp as getProperty, property, contextProperty, emitterProperty, getKeys }; | ||
export { subscribe, parse$1 as parse, create$$1 as create, create$1 as c, set, struct, get, getProp as getProperty, property, contextProperty, emitterProperty, getKeys }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -13,8 +13,8 @@ 'use strict'; | ||
if (!noContext && result && result.inherits) { | ||
if (t.context) { | ||
result.context = t.context; | ||
result.contextLevel = t.contextLevel + 1; | ||
} else if (result.context) { | ||
result.context = null; | ||
result.contextLevel = null; | ||
if (t._c) { | ||
result._c = t._c; | ||
result._cLevel = t._cLevel + 1; | ||
} else if (result._c) { | ||
result._c = null; | ||
result._cLevel = null; | ||
} | ||
@@ -26,4 +26,4 @@ } | ||
if (!noContext && result && result.inherits) { | ||
result.context = t; | ||
result.contextLevel = 1; | ||
result._c = t; | ||
result._cLevel = 1; | ||
} | ||
@@ -117,6 +117,6 @@ return result | ||
t.tStamp = stamp; | ||
if (t._p || t.context) { | ||
if (t._p || t._c) { | ||
let p = t._p; | ||
if (t.context && t.contextLevel === 1) { | ||
p = t.context; | ||
if (t._c && t._cLevel === 1) { | ||
p = t._c; | ||
} | ||
@@ -132,4 +132,4 @@ while (p && (!p.tStamp || p.tStamp[0] !== stamp[0])) { | ||
if (p.subscriptions) exec$1(p); | ||
// if (p.context && p.contextLevel === 1) { | ||
// p = p.context // waht does this even mean??? -- make more tests | ||
// if (p._c && p._cLevel === 1) { | ||
// p = p._c // waht does this even mean??? -- make more tests | ||
// } else { | ||
@@ -155,5 +155,5 @@ p = p._p; | ||
const strip = (t) => { | ||
while (t && t.context) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
while (t && t._c) { | ||
t._c = null; | ||
t._cLevel = null; | ||
t = t._p; | ||
@@ -167,4 +167,4 @@ } | ||
if (n) { strip(context); } // dont trust this... | ||
resolve.context = context; | ||
resolve.contextLevel = level; | ||
resolve._c = context; | ||
resolve._cLevel = level; | ||
subscription(context, stamp); | ||
@@ -174,4 +174,4 @@ while (n--) { fn[n](val, stamp, t); } | ||
if (exec(t, val, stamp, context._p, context.key, context, 1, j, fn)) { | ||
context.context = null; | ||
context.contextLevel = null; | ||
context._c = null; | ||
context._cLevel = null; | ||
} | ||
@@ -223,4 +223,4 @@ } | ||
remove(nest, stamp); | ||
nest.context = null; | ||
nest.contextLevel = null; | ||
nest._c = null; | ||
nest._cLevel = null; | ||
} | ||
@@ -233,4 +233,4 @@ } | ||
if (!(key in context)) { | ||
resolve.context = context; | ||
resolve.contextLevel = level; | ||
resolve._c = context; | ||
resolve._cLevel = level; | ||
subscription(context, stamp); | ||
@@ -240,4 +240,4 @@ remove(t, stamp); | ||
if (execRemove(t, stamp, context._p, context.key, context, 1)) { | ||
context.context = null; | ||
context.contextLevel = null; | ||
context._c = null; | ||
context._cLevel = null; | ||
} | ||
@@ -277,4 +277,4 @@ } | ||
updateRemove(context, t, stamp, key, t, 1); | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -291,4 +291,4 @@ }; | ||
if (exec(t, void 0, stamp, t._p, t.key, t, 1, 0)) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -304,4 +304,4 @@ } | ||
if (exec(t, val, stamp, t._p, t.key, t, 1, i, listeners)) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -334,4 +334,4 @@ } | ||
if (exec(t, val, stamp, t._p, t.key, t, 1, 0)) { | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
} | ||
@@ -660,6 +660,6 @@ } | ||
const resolveContext = (t, val, stamp) => { | ||
let level = t.contextLevel; | ||
var cntx = t.context; | ||
let level = t._cLevel; | ||
var cntx = t._c; | ||
let key; | ||
if (cntx.context) { | ||
if (cntx._c) { | ||
cntx = resolveContext(cntx, void 0, stamp); | ||
@@ -677,4 +677,4 @@ } | ||
contextProperty(cntx, void 0, stamp, key, inherits); | ||
inherits.context = null; | ||
inherits.contextLevel = null; | ||
inherits._c = null; | ||
inherits._cLevel = null; | ||
cntx = cntx[key]; | ||
@@ -685,4 +685,4 @@ for (let i = 1, len = path.length; i < len; i++) { | ||
cntx[key] = create$1(inherits, void 0, stamp, cntx, key); | ||
inherits.context = null; | ||
inherits.contextLevel = null; | ||
inherits._c = null; | ||
inherits._cLevel = null; | ||
cntx = cntx[key]; | ||
@@ -694,4 +694,4 @@ } | ||
} | ||
t.context = null; | ||
t.contextLevel = null; | ||
t._c = null; | ||
t._cLevel = null; | ||
return contextProperty(cntx, val, stamp, key, get(cntx, key, true)) | ||
@@ -720,10 +720,10 @@ }; | ||
const storeContext = t => { | ||
var context = t.context; | ||
var context = t._c; | ||
if (context) { | ||
const arr = []; | ||
let level = t.contextLevel; | ||
let level = t._cLevel; | ||
while (context) { | ||
arr.push(context, level); | ||
level = context.contextLevel; | ||
context = context.context; | ||
level = context._cLevel; | ||
context = context._c; | ||
} | ||
@@ -773,4 +773,4 @@ return arr | ||
} else if (field !== segment) { | ||
segment.context = null; | ||
segment.contextLevel = null; | ||
segment._c = null; | ||
segment._cLevel = null; | ||
newContext = field; | ||
@@ -796,4 +796,4 @@ newLevel = len - (i + 1); | ||
if (level) { | ||
target.contextLevel = level; | ||
target.context = context; | ||
target._cLevel = level; | ||
target._c = context; | ||
if (level > 1) { | ||
@@ -803,4 +803,4 @@ let p = target._p; | ||
if (path) { path.unshift(p); } | ||
p.context = context; | ||
p.contextLevel = target.contextLevel - i; | ||
p._c = context; | ||
p._cLevel = target._cLevel - i; | ||
p = p._p; | ||
@@ -815,9 +815,9 @@ } | ||
if (level) { | ||
target.contextLevel = null; | ||
target.context = null; | ||
target._cLevel = null; | ||
target._c = null; | ||
if (level > 1) { | ||
let p = target._p; | ||
for (let i = 1; p && i < level; i++) { | ||
p.context = null; | ||
p.contextLevel = null; | ||
p._c = null; | ||
p._cLevel = null; | ||
p = p._p; | ||
@@ -833,3 +833,3 @@ } | ||
if (result && result.inherits) { | ||
if (result.context) { | ||
if (result._c) { | ||
contextProperty(t, val, stamp, key, result); | ||
@@ -885,8 +885,8 @@ } else { | ||
const parent = t => { | ||
if (t.context) { | ||
if (t.contextLevel === 1) { | ||
return t.context | ||
if (t._c) { | ||
if (t._cLevel === 1) { | ||
return t._c | ||
} else { | ||
t._p.contextLevel = t.contextLevel - 1; | ||
t._p.context = t.context; | ||
t._p._cLevel = t._cLevel - 1; | ||
t._p._c = t._c; | ||
return t._p | ||
@@ -912,4 +912,4 @@ } | ||
while (parent) { | ||
if (parent.context && !real) { | ||
let i = parent.contextLevel; | ||
if (parent._c && !real) { | ||
let i = parent._cLevel; | ||
let p = parent; | ||
@@ -920,3 +920,3 @@ while (i--) { | ||
} | ||
parent = parent.context; | ||
parent = parent._c; | ||
} else if (parent.key) { | ||
@@ -1233,3 +1233,3 @@ result.unshift(parent.key); | ||
const set = (t, val, stamp, isNew) => { | ||
if (t.context) { | ||
if (t._c) { | ||
return resolveContext(t, val, stamp) | ||
@@ -1281,4 +1281,4 @@ } else { | ||
if (context) { | ||
t.emitters.context = context; | ||
t.emitters.contextLevel = 1; | ||
t.emitters._c = context; | ||
t.emitters._cLevel = 1; | ||
} | ||
@@ -1663,3 +1663,3 @@ } else if (t.inherits) { | ||
[id]: (val, stamp, t) => { | ||
if (!t.context) { | ||
if (!t._c) { | ||
if (listener(val, stamp, t)) { | ||
@@ -1811,8 +1811,8 @@ set(t, { on: { data: { [id]: null } } }); | ||
const store = (t, branch) => { | ||
if (t.context.context) { | ||
branch.$stored = storeContext(t.context); | ||
if (t._c._c) { | ||
branch.$stored = storeContext(t._c); | ||
} | ||
branch.$tc = t.context; | ||
if (t.contextLevel > 1) { | ||
branch.$tcl = t.contextLevel; | ||
branch.$tc = t._c; | ||
if (t._cLevel > 1) { | ||
branch.$tcl = t._cLevel; | ||
} | ||
@@ -1831,11 +1831,11 @@ }; | ||
branch.$ = stamp; | ||
if (t.context) { store(t, branch); } | ||
if (t._c) { store(t, branch); } | ||
if (subs.val) { cb(t, 'new', subs, branch); } | ||
diff(t, subs, cb, branch, void 0, c); | ||
changed = true; | ||
} else if (branch.$[0] !== stamp[0] || branch.$t !== t || branch.$tc !== t.context) { | ||
} else if (branch.$[0] !== stamp[0] || branch.$t !== t || branch.$tc !== t._c) { | ||
if (subs.val) { | ||
if ( | ||
subs.val === true || (subs.val === 'switch' && | ||
(branch.$t !== t || branch.$tc !== t.context)) // | ||
(branch.$t !== t || branch.$tc !== t._c)) // | ||
) { | ||
@@ -1848,3 +1848,3 @@ cb(t, 'update', subs, branch); | ||
if (t.context) { | ||
if (t._c) { | ||
store(t, branch); | ||
@@ -1896,5 +1896,5 @@ } else if (branch.$tc) { | ||
); | ||
if (t && t.context) { | ||
t.contextLevel = null; | ||
t.context = null; | ||
if (t && t._c) { | ||
t._cLevel = null; | ||
t._c = null; | ||
} | ||
@@ -1996,5 +1996,5 @@ } | ||
update$2(i, tt, subs, cb, $keys, void 0, branch); | ||
if (tt.context) { | ||
tt.contextLevel = null; | ||
tt.context = null; | ||
if (tt._c) { | ||
tt._cLevel = null; | ||
tt._c = null; | ||
} | ||
@@ -2059,5 +2059,5 @@ } | ||
} | ||
if (tt.context) { | ||
tt.contextLevel = null; | ||
tt.context = null; | ||
if (tt._c) { | ||
tt._cLevel = null; | ||
tt._c = null; | ||
} | ||
@@ -2078,5 +2078,5 @@ } | ||
} | ||
if (tt.context) { | ||
tt.contextLevel = null; | ||
tt.context = null; | ||
if (tt._c) { | ||
tt._cLevel = null; | ||
tt._c = null; | ||
} | ||
@@ -2570,2 +2570,3 @@ } | ||
// make this nicer need to get acces to real create | ||
const create$$1 = (val, stamp) => create$1(struct, val, stamp); | ||
@@ -2576,2 +2577,3 @@ | ||
exports.create = create$$1; | ||
exports.c = create$1; | ||
exports.set = set; | ||
@@ -2578,0 +2580,0 @@ exports.struct = struct; |
{ | ||
"name": "brisky-struct", | ||
"description": "An observable data structure", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.es.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4730
531932