New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hydroxide

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydroxide - npm Package Compare versions

Comparing version 0.13.0 to 0.14.0

58

dist/dev-cjs.js

@@ -1,2 +0,2 @@

/* hydroxide v0.13.0 */
/* hydroxide v0.14.0 */
'use strict';

@@ -161,4 +161,4 @@

// data phase
if (reactive.subs[DATA_PHASE]) {
reactive.subs[DATA_PHASE].forEach(cb => cb());
if (reactive[DATA_PHASE]) {
reactive[DATA_PHASE].forEach(cb => cb());
} // connection phase

@@ -168,8 +168,8 @@

if (batching.enabled && !invalidatedReactives.has(reactive)) {
if (reactive.subs[CONNECTION_PHASE]) {
connectionQueue.push(reactive.subs[CONNECTION_PHASE]);
if (reactive[CONNECTION_PHASE]) {
connectionQueue.push(reactive[CONNECTION_PHASE]);
}
} else {
if (reactive.subs[CONNECTION_PHASE]) {
reactive.subs[CONNECTION_PHASE].forEach(cb => cb());
if (reactive[CONNECTION_PHASE]) {
reactive[CONNECTION_PHASE].forEach(cb => cb());
}

@@ -179,3 +179,3 @@ } // list update phase

if (reactive.subs[LIST_PHASE]) {
if (reactive[LIST_PHASE]) {
const inv = reactive.listInvalidator;

@@ -185,3 +185,3 @@

// @ts-expect-error - we only care about first argument
reactive.subs[LIST_PHASE].forEach(inv); // @ts-expect-error
reactive[LIST_PHASE].forEach(inv); // @ts-expect-error

@@ -194,8 +194,8 @@ reactive.listInvalidator = undefined;

if (!batching.enabled) {
if (reactive.subs[RENDER_PHASE]) {
reactive.subs[RENDER_PHASE].forEach(cb => cb());
if (reactive[RENDER_PHASE]) {
reactive[RENDER_PHASE].forEach(cb => cb());
}
if (reactive.subs[USER_EFFECT_PHASE]) {
reactive.subs[USER_EFFECT_PHASE].forEach(cb => cb());
if (reactive[USER_EFFECT_PHASE]) {
reactive[USER_EFFECT_PHASE].forEach(cb => cb());
}

@@ -206,12 +206,12 @@ } else {

if (reactive.subs[CONNECTION_PHASE]) {
connectionQueue.push(reactive.subs[CONNECTION_PHASE]);
if (reactive[CONNECTION_PHASE]) {
connectionQueue.push(reactive[CONNECTION_PHASE]);
}
if (reactive.subs[RENDER_PHASE]) {
renderQueue.push(reactive.subs[RENDER_PHASE]);
if (reactive[RENDER_PHASE]) {
renderQueue.push(reactive[RENDER_PHASE]);
}
if (reactive.subs[USER_EFFECT_PHASE]) {
userEffectQueue.push(reactive.subs[USER_EFFECT_PHASE]);
if (reactive[USER_EFFECT_PHASE]) {
userEffectQueue.push(reactive[USER_EFFECT_PHASE]);
}

@@ -228,3 +228,3 @@ }

function subscribe(reactive, callback, phase, context = coreInfo.context) {
const subs = reactive.subs[phase] || (reactive.subs[phase] = new Set()); // subscribe
const subs = reactive[phase] || (reactive[phase] = new Set()); // subscribe

@@ -258,3 +258,3 @@ subs.add(callback); // if non local dependencies, setup unsubscribe on disconnect and resubscribe on connect

function unsubscribe(reactive, callback, phase) {
reactive.subs[phase].delete(callback);
reactive[phase].delete(callback);
}

@@ -451,3 +451,3 @@

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -579,3 +579,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -604,3 +604,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -624,3 +624,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -670,3 +670,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -696,3 +696,2 @@ state.listInvalidator = cb => {

state.value = value;
state.subs = new Array(5);
state.context = coreInfo.context;

@@ -747,5 +746,4 @@ state.mutable = true;

if (!SubsCollection[targetValue]) {
const lightWeightReactive = {
subs: new Array(5)
};
// subs will be added in this object
const lightWeightReactive = {};
SubsCollection[targetValue] = lightWeightReactive;

@@ -752,0 +750,0 @@ }

@@ -1,2 +0,2 @@

/* hydroxide v0.13.0 */
/* hydroxide v0.14.0 */
function targetKey(obj, path) {

@@ -157,4 +157,4 @@ if (path.length === 1) return [obj, path[0]];

// data phase
if (reactive.subs[DATA_PHASE]) {
reactive.subs[DATA_PHASE].forEach(cb => cb());
if (reactive[DATA_PHASE]) {
reactive[DATA_PHASE].forEach(cb => cb());
} // connection phase

@@ -164,8 +164,8 @@

if (batching.enabled && !invalidatedReactives.has(reactive)) {
if (reactive.subs[CONNECTION_PHASE]) {
connectionQueue.push(reactive.subs[CONNECTION_PHASE]);
if (reactive[CONNECTION_PHASE]) {
connectionQueue.push(reactive[CONNECTION_PHASE]);
}
} else {
if (reactive.subs[CONNECTION_PHASE]) {
reactive.subs[CONNECTION_PHASE].forEach(cb => cb());
if (reactive[CONNECTION_PHASE]) {
reactive[CONNECTION_PHASE].forEach(cb => cb());
}

@@ -175,3 +175,3 @@ } // list update phase

if (reactive.subs[LIST_PHASE]) {
if (reactive[LIST_PHASE]) {
const inv = reactive.listInvalidator;

@@ -181,3 +181,3 @@

// @ts-expect-error - we only care about first argument
reactive.subs[LIST_PHASE].forEach(inv); // @ts-expect-error
reactive[LIST_PHASE].forEach(inv); // @ts-expect-error

@@ -190,8 +190,8 @@ reactive.listInvalidator = undefined;

if (!batching.enabled) {
if (reactive.subs[RENDER_PHASE]) {
reactive.subs[RENDER_PHASE].forEach(cb => cb());
if (reactive[RENDER_PHASE]) {
reactive[RENDER_PHASE].forEach(cb => cb());
}
if (reactive.subs[USER_EFFECT_PHASE]) {
reactive.subs[USER_EFFECT_PHASE].forEach(cb => cb());
if (reactive[USER_EFFECT_PHASE]) {
reactive[USER_EFFECT_PHASE].forEach(cb => cb());
}

@@ -202,12 +202,12 @@ } else {

if (reactive.subs[CONNECTION_PHASE]) {
connectionQueue.push(reactive.subs[CONNECTION_PHASE]);
if (reactive[CONNECTION_PHASE]) {
connectionQueue.push(reactive[CONNECTION_PHASE]);
}
if (reactive.subs[RENDER_PHASE]) {
renderQueue.push(reactive.subs[RENDER_PHASE]);
if (reactive[RENDER_PHASE]) {
renderQueue.push(reactive[RENDER_PHASE]);
}
if (reactive.subs[USER_EFFECT_PHASE]) {
userEffectQueue.push(reactive.subs[USER_EFFECT_PHASE]);
if (reactive[USER_EFFECT_PHASE]) {
userEffectQueue.push(reactive[USER_EFFECT_PHASE]);
}

@@ -224,3 +224,3 @@ }

function subscribe(reactive, callback, phase, context = coreInfo.context) {
const subs = reactive.subs[phase] || (reactive.subs[phase] = new Set()); // subscribe
const subs = reactive[phase] || (reactive[phase] = new Set()); // subscribe

@@ -254,3 +254,3 @@ subs.add(callback); // if non local dependencies, setup unsubscribe on disconnect and resubscribe on connect

function unsubscribe(reactive, callback, phase) {
reactive.subs[phase].delete(callback);
reactive[phase].delete(callback);
}

@@ -447,3 +447,3 @@

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -575,3 +575,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -600,3 +600,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -620,3 +620,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -666,3 +666,3 @@ state.listInvalidator = cb => {

if (state.subs[LIST_PHASE]) {
if (state[LIST_PHASE]) {

@@ -692,3 +692,2 @@ state.listInvalidator = cb => {

state.value = value;
state.subs = new Array(5);
state.context = coreInfo.context;

@@ -743,5 +742,4 @@ state.mutable = true;

if (!SubsCollection[targetValue]) {
const lightWeightReactive = {
subs: new Array(5)
};
// subs will be added in this object
const lightWeightReactive = {};
SubsCollection[targetValue] = lightWeightReactive;

@@ -748,0 +746,0 @@ }

@@ -1,1 +0,1 @@

"use strict";function e(e,t){if(1===t.length)return[e,t[0]];const n=t.length-1;let s=e;for(let e=0;e<n;e++)s=s[t[e]];return[s,t[n]]}function t(e,t,n=0,s=t.length-1){let o=e;for(let e=n;e<=s;e++)o=o[t[e]];return o}function n(e){const t=H.detected,n=H.detectorEnabled;H.detectorEnabled=!0,H.detected=new Set;const s=e(),o=H.detected;return n&&o.forEach((e=>{t.add(e)})),H.detectorEnabled=n,H.detected=t,[o,s]}Object.defineProperty(exports,"__esModule",{value:!0});const s=new Set,o={enabled:!1,cloned:new Set},c=[],i=[],u=[];function l(e,t){for(let n=0;n<t;n++){const t=e[n];for(const e of t)e()}e.splice(0,t)}function a(){s.clear();const e=c.length,t=i.length,n=u.length;0!==e&&l(c,e),0!==t&&l(i,t),0!==n&&l(u,n),0!==s.size&&a()}function r(e){if(e.subs[0]&&e.subs[0].forEach((e=>e())),o.enabled&&!s.has(e)?e.subs[1]&&c.push(e.subs[1]):e.subs[1]&&e.subs[1].forEach((e=>e())),e.subs[2]){const t=e.listInvalidator;t&&(e.subs[2].forEach(t),e.listInvalidator=void 0)}o.enabled?s.has(e)||(s.add(e),e.subs[1]&&c.push(e.subs[1]),e.subs[3]&&i.push(e.subs[3]),e.subs[4]&&u.push(e.subs[4])):(e.subs[3]&&e.subs[3].forEach((e=>e())),e.subs[4]&&e.subs[4].forEach((e=>e())))}function d(e,t,n,s=H.context){const o=e.subs[n]||(e.subs[n]=new Set);if(o.add(t),s&&s!==e.context){const e=()=>{o.delete(t)},n=()=>{o.add(t)};s.onDisconnect?s.onDisconnect.push(e):s.onDisconnect=[e],s.onConnect?s.onConnect.push(n):s.onConnect=[n]}}function h(e,t,n){e.subs[n].delete(t)}function f(e,t=4){let s=new Set;const o=H.context;function c(){const i=n(e)[0];s.forEach((e=>{i.has(e)||h(e,c,t)})),i.forEach((e=>{s.has(e)||d(e,c,t,o)})),s=i}function i(){s=n(e)[0],s.forEach((e=>d(e,c,t,o)))}3!==t&&0!==t&&o?o.onConnect?o.onConnect.push(i):o.onConnect=[i]:i()}function b(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function v(e,t,n){if(o.enabled&&o.cloned.has(e))return e.splice(t,n),e;const s=[...e.slice(0,t),...e.slice(t+n)];return o.enabled&&o.cloned.add(s),s}function p(e,t,n){const s=g(e),o=t.length-1;let c=s;for(let e=0;e<o;e++)c[t[e]]=g(c[t[e]]),c=c[t[e]];return c[t[o]]=n,s}function x(e,t,n){if(o.enabled&&o.cloned.has(e))return e.splice(t,0,...n),e;const s=[...e.slice(0,t),...n,...e.slice(t)];return o.enabled&&o.cloned.add(s),s}function E(e,t,n){if(o.enabled&&o.cloned.has(e))return b(e,t,n),e;const s=[...e];return b(s,t,n),o.enabled&&o.cloned.add(s),s}function g(e){if(o.enabled&&o.cloned.has(e))return e;const t=Array.isArray(e)?[...e]:{...e};return o.enabled&&o.cloned.add(t),t}class m{constructor(e,t){this.reactive=e,this.path=t}set(e){const t=this.reactive,n=this.path;if(t.mutable){const s=n.length-1;let o=t.value;for(let e=0;e<s;e++)o=o[n[e]];if(e===o[n[s]])return;o[n[s]]=e}else t.value=p(t.value,n,e);t.subs[2]&&(t.listInvalidator=t=>{t("set",n,e)}),r(t)}do(e){const n=t(this.reactive.value,this.path),s=e(n);n!==s&&this.set(s)}insertList(e,n){const{reactive:s,path:o}=this,c=t(s.value,o),i=e<0?c.length+e+1:e;s.mutable?c.splice(i,0,...n):s.value=p(s.value,o,x(c,i,n)),r(s)}remove(e,n=1){const{reactive:s,path:o}=this,c=t(s.value,o),i=e<0?c.length+e:e;s.mutable?c.splice(i,n):s.value=p(s.value,o,v(c,i,n)),r(s)}insert(e,t){this.insertList(e,[t])}clear(){const t=this.reactive,n=this.path,[s,o]=e(t.value,n),c=s[o];0!==c.length&&(t.mutable?s[o]=[]:t.value=p(c,n,[]),r(t))}swap(e,n){const s=this.reactive,o=this.path,c=t(s.value,o);if(s.mutable)b(c,e,n);else{const c=t(s.value,o);s.value=p(s.value,o,E(c,e,n))}r(s)}push(e){this.insertList(-1,[e])}pushList(e){this.insertList(-1,e)}pop(e=1){this.remove(-1*e,e)}}function A(e){const t=this;e!==t.value&&(t.value=e,t.subs[2]&&(t.listInvalidator=t=>{t("set",null,e)}),r(t))}function C(e){const t=e(this.value);this.value!==t&&this.set(t)}function S(e,t){const n=this,s=e<0?this.value.length+e+1:e;n.mutable?n.value.splice(s,0,...t):n.value=x(n.value,s,t),n.subs[2]&&(n.listInvalidator=e=>{e("insert",s,t)}),r(n)}function w(e,t=1){const n=this,s=e<0?n.value.length+e:e;n.mutable?n.value.splice(s,t):n.value=v(n.value,s,t),n.subs[2]&&(n.listInvalidator=e=>{e("remove",s,t)}),r(n)}function I(e,t){this.insertList(e,[t])}function L(e){this.insertList(-1,[e])}function D(e){this.insertList(-1,e)}function y(e=1){this.remove(-1*e,e)}function _(){const e=this;0!==e.value.length&&(e.value=[],e.listInvalidator=e=>{e("clear")},r(e))}function P(e,t){const n=this;n.mutable?b(n.value,e,t):n.value=E(n.value,e,t),n.subs[2]&&(n.listInvalidator=n=>{n("swap",e,t)}),r(n)}const H={context:null,detectorEnabled:!1,detected:new Set};exports.CONNECTION_PHASE=1,exports.DATA_PHASE=0,exports.LIST_PHASE=2,exports.RENDER_PHASE=3,exports.USER_EFFECT_PHASE=4,exports.batch=function(e){o.enabled=!0,e(),o.enabled=!1,o.cloned.clear(),a()},exports.batching=o,exports.coreInfo=H,exports.detect=n,exports.effect=f,exports.invalidate=r,exports.memo=function(e){let t,n;return f((()=>{t=e(),n=H.detected}),0),()=>(n&&H.detectorEnabled&&n.forEach((e=>{H.detected.add(e)})),t)},exports.onConnect=function(e){H.context.onConnect?H.context.onConnect.push(e):H.context.onConnect=[e]},exports.onDisconnect=function(e){H.context.onDisconnect?H.context.onDisconnect.push(e):H.context.onDisconnect=[e]},exports.reactive=function(e){const t=function(...e){return 0!==e.length?new m(t,e):(H.detectorEnabled&&H.detected.add(t),t.value)};return t.value=e,t.subs=new Array(5),t.context=H.context,t.mutable=!0,t.set=A,t.do=C,Array.isArray(e)&&(t.insert=I,t.insertList=S,t.remove=w,t.swap=P,t.clear=_,t.push=L,t.pushList=D,t.pop=y),t},exports.selector=function(e){let t=e.value;d(e,(function(){const s=e.value;t!==s&&(s in n&&r(n[s]),t in n&&r(n[t]),t=s)}),0);const n={};return t=>{if(!n[t]){const e={subs:new Array(5)};n[t]=e}return H.detectorEnabled&&H.detected.add(n[t]),t===e.value}},exports.subscribe=d,exports.targetKey=e,exports.unsubscribe=h,exports.valueAt=t;
"use strict";function t(t,e){if(1===e.length)return[t,e[0]];const n=e.length-1;let o=t;for(let t=0;t<n;t++)o=o[e[t]];return[o,e[n]]}function e(t,e,n=0,o=e.length-1){let c=t;for(let t=n;t<=o;t++)c=c[e[t]];return c}function n(t){const e=H.detected,n=H.detectorEnabled;H.detectorEnabled=!0,H.detected=new Set;const o=t(),c=H.detected;return n&&c.forEach((t=>{e.add(t)})),H.detectorEnabled=n,H.detected=e,[c,o]}Object.defineProperty(exports,"__esModule",{value:!0});const o=new Set,c={enabled:!1,cloned:new Set},s=[],i=[],l=[];function a(t,e){for(let n=0;n<e;n++){const e=t[n];for(const t of e)t()}t.splice(0,e)}function r(){o.clear();const t=s.length,e=i.length,n=l.length;0!==t&&a(s,t),0!==e&&a(i,e),0!==n&&a(l,n),0!==o.size&&r()}function u(t){if(t[0]&&t[0].forEach((t=>t())),c.enabled&&!o.has(t)?t[1]&&s.push(t[1]):t[1]&&t[1].forEach((t=>t())),t[2]){const e=t.listInvalidator;e&&(t[2].forEach(e),t.listInvalidator=void 0)}c.enabled?o.has(t)||(o.add(t),t[1]&&s.push(t[1]),t[3]&&i.push(t[3]),t[4]&&l.push(t[4])):(t[3]&&t[3].forEach((t=>t())),t[4]&&t[4].forEach((t=>t())))}function d(t,e,n,o=H.context){const c=t[n]||(t[n]=new Set);if(c.add(e),o&&o!==t.context){const t=()=>{c.delete(e)},n=()=>{c.add(e)};o.onDisconnect?o.onDisconnect.push(t):o.onDisconnect=[t],o.onConnect?o.onConnect.push(n):o.onConnect=[n]}}function h(t,e,n){t[n].delete(e)}function f(t,e=4){let o=new Set;const c=H.context;function s(){const i=n(t)[0];o.forEach((t=>{i.has(t)||h(t,s,e)})),i.forEach((t=>{o.has(t)||d(t,s,e,c)})),o=i}function i(){o=n(t)[0],o.forEach((t=>d(t,s,e,c)))}3!==e&&0!==e&&c?c.onConnect?c.onConnect.push(i):c.onConnect=[i]:i()}function v(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function p(t,e,n){if(c.enabled&&c.cloned.has(t))return t.splice(e,n),t;const o=[...t.slice(0,e),...t.slice(e+n)];return c.enabled&&c.cloned.add(o),o}function b(t,e,n){const o=g(t),c=e.length-1;let s=o;for(let t=0;t<c;t++)s[e[t]]=g(s[e[t]]),s=s[e[t]];return s[e[c]]=n,o}function x(t,e,n){if(c.enabled&&c.cloned.has(t))return t.splice(e,0,...n),t;const o=[...t.slice(0,e),...n,...t.slice(e)];return c.enabled&&c.cloned.add(o),o}function E(t,e,n){if(c.enabled&&c.cloned.has(t))return v(t,e,n),t;const o=[...t];return v(o,e,n),c.enabled&&c.cloned.add(o),o}function g(t){if(c.enabled&&c.cloned.has(t))return t;const e=Array.isArray(t)?[...t]:{...t};return c.enabled&&c.cloned.add(e),e}class m{constructor(t,e){this.reactive=t,this.path=e}set(t){const e=this.reactive,n=this.path;if(e.mutable){const o=n.length-1;let c=e.value;for(let t=0;t<o;t++)c=c[n[t]];if(t===c[n[o]])return;c[n[o]]=t}else e.value=b(e.value,n,t);e[2]&&(e.listInvalidator=e=>{e("set",n,t)}),u(e)}do(t){const n=e(this.reactive.value,this.path),o=t(n);n!==o&&this.set(o)}insertList(t,n){const{reactive:o,path:c}=this,s=e(o.value,c),i=t<0?s.length+t+1:t;o.mutable?s.splice(i,0,...n):o.value=b(o.value,c,x(s,i,n)),u(o)}remove(t,n=1){const{reactive:o,path:c}=this,s=e(o.value,c),i=t<0?s.length+t:t;o.mutable?s.splice(i,n):o.value=b(o.value,c,p(s,i,n)),u(o)}insert(t,e){this.insertList(t,[e])}clear(){const e=this.reactive,n=this.path,[o,c]=t(e.value,n),s=o[c];0!==s.length&&(e.mutable?o[c]=[]:e.value=b(s,n,[]),u(e))}swap(t,n){const o=this.reactive,c=this.path,s=e(o.value,c);if(o.mutable)v(s,t,n);else{const s=e(o.value,c);o.value=b(o.value,c,E(s,t,n))}u(o)}push(t){this.insertList(-1,[t])}pushList(t){this.insertList(-1,t)}pop(t=1){this.remove(-1*t,t)}}function C(t){const e=this;t!==e.value&&(e.value=t,e[2]&&(e.listInvalidator=e=>{e("set",null,t)}),u(e))}function S(t){const e=t(this.value);this.value!==e&&this.set(e)}function A(t,e){const n=this,o=t<0?this.value.length+t+1:t;n.mutable?n.value.splice(o,0,...e):n.value=x(n.value,o,e),n[2]&&(n.listInvalidator=t=>{t("insert",o,e)}),u(n)}function I(t,e=1){const n=this,o=t<0?n.value.length+t:t;n.mutable?n.value.splice(o,e):n.value=p(n.value,o,e),n[2]&&(n.listInvalidator=t=>{t("remove",o,e)}),u(n)}function L(t,e){this.insertList(t,[e])}function w(t){this.insertList(-1,[t])}function D(t){this.insertList(-1,t)}function _(t=1){this.remove(-1*t,t)}function y(){const t=this;0!==t.value.length&&(t.value=[],t.listInvalidator=t=>{t("clear")},u(t))}function P(t,e){const n=this;n.mutable?v(n.value,t,e):n.value=E(n.value,t,e),n[2]&&(n.listInvalidator=n=>{n("swap",t,e)}),u(n)}const H={context:null,detectorEnabled:!1,detected:new Set};exports.CONNECTION_PHASE=1,exports.DATA_PHASE=0,exports.LIST_PHASE=2,exports.RENDER_PHASE=3,exports.USER_EFFECT_PHASE=4,exports.batch=function(t){c.enabled=!0,t(),c.enabled=!1,c.cloned.clear(),r()},exports.batching=c,exports.coreInfo=H,exports.detect=n,exports.effect=f,exports.invalidate=u,exports.memo=function(t){let e,n;return f((()=>{e=t(),n=H.detected}),0),()=>(n&&H.detectorEnabled&&n.forEach((t=>{H.detected.add(t)})),e)},exports.onConnect=function(t){H.context.onConnect?H.context.onConnect.push(t):H.context.onConnect=[t]},exports.onDisconnect=function(t){H.context.onDisconnect?H.context.onDisconnect.push(t):H.context.onDisconnect=[t]},exports.reactive=function(t){const e=function(...t){return 0!==t.length?new m(e,t):(H.detectorEnabled&&H.detected.add(e),e.value)};return e.value=t,e.context=H.context,e.mutable=!0,e.set=C,e.do=S,Array.isArray(t)&&(e.insert=L,e.insertList=A,e.remove=I,e.swap=P,e.clear=y,e.push=w,e.pushList=D,e.pop=_),e},exports.selector=function(t){let e=t.value;d(t,(function(){const o=t.value;e!==o&&(o in n&&u(n[o]),e in n&&u(n[e]),e=o)}),0);const n={};return e=>{if(!n[e]){const t={};n[e]=t}return H.detectorEnabled&&H.detected.add(n[e]),e===t.value}},exports.subscribe=d,exports.targetKey=t,exports.unsubscribe=h,exports.valueAt=e;

@@ -1,1 +0,1 @@

function t(t,e){if(1===e.length)return[t,e[0]];const n=e.length-1;let s=t;for(let t=0;t<n;t++)s=s[e[t]];return[s,e[n]]}function e(t,e,n=0,s=e.length-1){let o=t;for(let t=n;t<=s;t++)o=o[e[t]];return o}function n(t){P.context.onConnect?P.context.onConnect.push(t):P.context.onConnect=[t]}function s(t){P.context.onDisconnect?P.context.onDisconnect.push(t):P.context.onDisconnect=[t]}function o(t){const e=P.detected,n=P.detectorEnabled;P.detectorEnabled=!0,P.detected=new Set;const s=t(),o=P.detected;return n&&o.forEach((t=>{e.add(t)})),P.detectorEnabled=n,P.detected=e,[o,s]}const c=new Set,l=0,u=1,i=2,a=3,r=4,d={enabled:!1,cloned:new Set},h=[],f=[],v=[];function b(t,e){for(let n=0;n<e;n++){const e=t[n];for(const t of e)t()}t.splice(0,e)}function p(){c.clear();const t=h.length,e=f.length,n=v.length;0!==t&&b(h,t),0!==e&&b(f,e),0!==n&&b(v,n),0!==c.size&&p()}function E(t){d.enabled=!0,t(),d.enabled=!1,d.cloned.clear(),p()}function g(t){if(t.subs[0]&&t.subs[0].forEach((t=>t())),d.enabled&&!c.has(t)?t.subs[1]&&h.push(t.subs[1]):t.subs[1]&&t.subs[1].forEach((t=>t())),t.subs[2]){const e=t.listInvalidator;e&&(t.subs[2].forEach(e),t.listInvalidator=void 0)}d.enabled?c.has(t)||(c.add(t),t.subs[1]&&h.push(t.subs[1]),t.subs[3]&&f.push(t.subs[3]),t.subs[4]&&v.push(t.subs[4])):(t.subs[3]&&t.subs[3].forEach((t=>t())),t.subs[4]&&t.subs[4].forEach((t=>t())))}function m(t,e,n,s=P.context){const o=t.subs[n]||(t.subs[n]=new Set);if(o.add(e),s&&s!==t.context){const t=()=>{o.delete(e)},n=()=>{o.add(e)};s.onDisconnect?s.onDisconnect.push(t):s.onDisconnect=[t],s.onConnect?s.onConnect.push(n):s.onConnect=[n]}}function x(t,e,n){t.subs[n].delete(e)}function w(t,e=4){let n=new Set;const s=P.context;function c(){const l=o(t)[0];n.forEach((t=>{l.has(t)||x(t,c,e)})),l.forEach((t=>{n.has(t)||m(t,c,e,s)})),n=l}function l(){n=o(t)[0],n.forEach((t=>m(t,c,e,s)))}3!==e&&0!==e&&s?s.onConnect?s.onConnect.push(l):s.onConnect=[l]:l()}function L(t){let e,n;return w((()=>{e=t(),n=P.detected}),0),()=>(n&&P.detectorEnabled&&n.forEach((t=>{P.detected.add(t)})),e)}function C(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function I(t,e,n){if(d.enabled&&d.cloned.has(t))return t.splice(e,n),t;const s=[...t.slice(0,e),...t.slice(e+n)];return d.enabled&&d.cloned.add(s),s}function y(t,e,n){const s=S(t),o=e.length-1;let c=s;for(let t=0;t<o;t++)c[e[t]]=S(c[e[t]]),c=c[e[t]];return c[e[o]]=n,s}function A(t,e,n){if(d.enabled&&d.cloned.has(t))return t.splice(e,0,...n),t;const s=[...t.slice(0,e),...n,...t.slice(e)];return d.enabled&&d.cloned.add(s),s}function D(t,e,n){if(d.enabled&&d.cloned.has(t))return C(t,e,n),t;const s=[...t];return C(s,e,n),d.enabled&&d.cloned.add(s),s}function S(t){if(d.enabled&&d.cloned.has(t))return t;const e=Array.isArray(t)?[...t]:{...t};return d.enabled&&d.cloned.add(e),e}class z{constructor(t,e){this.reactive=t,this.path=e}set(t){const e=this.reactive,n=this.path;if(e.mutable){const s=n.length-1;let o=e.value;for(let t=0;t<s;t++)o=o[n[t]];if(t===o[n[s]])return;o[n[s]]=t}else e.value=y(e.value,n,t);e.subs[2]&&(e.listInvalidator=e=>{e("set",n,t)}),g(e)}do(t){const n=e(this.reactive.value,this.path),s=t(n);n!==s&&this.set(s)}insertList(t,n){const{reactive:s,path:o}=this,c=e(s.value,o),l=t<0?c.length+t+1:t;s.mutable?c.splice(l,0,...n):s.value=y(s.value,o,A(c,l,n)),g(s)}remove(t,n=1){const{reactive:s,path:o}=this,c=e(s.value,o),l=t<0?c.length+t:t;s.mutable?c.splice(l,n):s.value=y(s.value,o,I(c,l,n)),g(s)}insert(t,e){this.insertList(t,[e])}clear(){const e=this.reactive,n=this.path,[s,o]=t(e.value,n),c=s[o];0!==c.length&&(e.mutable?s[o]=[]:e.value=y(c,n,[]),g(e))}swap(t,n){const s=this.reactive,o=this.path,c=e(s.value,o);if(s.mutable)C(c,t,n);else{const c=e(s.value,o);s.value=y(s.value,o,D(c,t,n))}g(s)}push(t){this.insertList(-1,[t])}pushList(t){this.insertList(-1,t)}pop(t=1){this.remove(-1*t,t)}}function j(t){const e=this;t!==e.value&&(e.value=t,e.subs[2]&&(e.listInvalidator=e=>{e("set",null,t)}),g(e))}function k(t){const e=t(this.value);this.value!==e&&this.set(e)}function q(t,e){const n=this,s=t<0?this.value.length+t+1:t;n.mutable?n.value.splice(s,0,...e):n.value=A(n.value,s,e),n.subs[2]&&(n.listInvalidator=t=>{t("insert",s,e)}),g(n)}function B(t,e=1){const n=this,s=t<0?n.value.length+t:t;n.mutable?n.value.splice(s,e):n.value=I(n.value,s,e),n.subs[2]&&(n.listInvalidator=t=>{t("remove",s,e)}),g(n)}function F(t,e){this.insertList(t,[e])}function G(t){this.insertList(-1,[t])}function H(t){this.insertList(-1,t)}function J(t=1){this.remove(-1*t,t)}function K(){const t=this;0!==t.value.length&&(t.value=[],t.listInvalidator=t=>{t("clear")},g(t))}function M(t,e){const n=this;n.mutable?C(n.value,t,e):n.value=D(n.value,t,e),n.subs[2]&&(n.listInvalidator=n=>{n("swap",t,e)}),g(n)}function N(t){const e=function(...t){return 0!==t.length?new z(e,t):(P.detectorEnabled&&P.detected.add(e),e.value)};return e.value=t,e.subs=new Array(5),e.context=P.context,e.mutable=!0,e.set=j,e.do=k,Array.isArray(t)&&(e.insert=F,e.insertList=q,e.remove=B,e.swap=M,e.clear=K,e.push=G,e.pushList=H,e.pop=J),e}function O(t){let e=t.value;m(t,(function(){const s=t.value;e!==s&&(s in n&&g(n[s]),e in n&&g(n[e]),e=s)}),0);const n={};return e=>{if(!n[e]){const t={subs:new Array(5)};n[e]=t}return P.detectorEnabled&&P.detected.add(n[e]),e===t.value}}const P={context:null,detectorEnabled:!1,detected:new Set};export{u as CONNECTION_PHASE,l as DATA_PHASE,i as LIST_PHASE,a as RENDER_PHASE,r as USER_EFFECT_PHASE,E as batch,d as batching,P as coreInfo,o as detect,w as effect,g as invalidate,L as memo,n as onConnect,s as onDisconnect,N as reactive,O as selector,m as subscribe,t as targetKey,x as unsubscribe,e as valueAt};
function t(t,e){if(1===e.length)return[t,e[0]];const n=e.length-1;let o=t;for(let t=0;t<n;t++)o=o[e[t]];return[o,e[n]]}function e(t,e,n=0,o=e.length-1){let c=t;for(let t=n;t<=o;t++)c=c[e[t]];return c}function n(t){P.context.onConnect?P.context.onConnect.push(t):P.context.onConnect=[t]}function o(t){P.context.onDisconnect?P.context.onDisconnect.push(t):P.context.onDisconnect=[t]}function c(t){const e=P.detected,n=P.detectorEnabled;P.detectorEnabled=!0,P.detected=new Set;const o=t(),c=P.detected;return n&&c.forEach((t=>{e.add(t)})),P.detectorEnabled=n,P.detected=e,[c,o]}const s=new Set,l=0,i=1,a=2,u=3,r=4,d={enabled:!1,cloned:new Set},h=[],f=[],v=[];function p(t,e){for(let n=0;n<e;n++){const e=t[n];for(const t of e)t()}t.splice(0,e)}function b(){s.clear();const t=h.length,e=f.length,n=v.length;0!==t&&p(h,t),0!==e&&p(f,e),0!==n&&p(v,n),0!==s.size&&b()}function E(t){d.enabled=!0,t(),d.enabled=!1,d.cloned.clear(),b()}function g(t){if(t[0]&&t[0].forEach((t=>t())),d.enabled&&!s.has(t)?t[1]&&h.push(t[1]):t[1]&&t[1].forEach((t=>t())),t[2]){const e=t.listInvalidator;e&&(t[2].forEach(e),t.listInvalidator=void 0)}d.enabled?s.has(t)||(s.add(t),t[1]&&h.push(t[1]),t[3]&&f.push(t[3]),t[4]&&v.push(t[4])):(t[3]&&t[3].forEach((t=>t())),t[4]&&t[4].forEach((t=>t())))}function m(t,e,n,o=P.context){const c=t[n]||(t[n]=new Set);if(c.add(e),o&&o!==t.context){const t=()=>{c.delete(e)},n=()=>{c.add(e)};o.onDisconnect?o.onDisconnect.push(t):o.onDisconnect=[t],o.onConnect?o.onConnect.push(n):o.onConnect=[n]}}function x(t,e,n){t[n].delete(e)}function w(t,e=4){let n=new Set;const o=P.context;function s(){const l=c(t)[0];n.forEach((t=>{l.has(t)||x(t,s,e)})),l.forEach((t=>{n.has(t)||m(t,s,e,o)})),n=l}function l(){n=c(t)[0],n.forEach((t=>m(t,s,e,o)))}3!==e&&0!==e&&o?o.onConnect?o.onConnect.push(l):o.onConnect=[l]:l()}function L(t){let e,n;return w((()=>{e=t(),n=P.detected}),0),()=>(n&&P.detectorEnabled&&n.forEach((t=>{P.detected.add(t)})),e)}function C(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function I(t,e,n){if(d.enabled&&d.cloned.has(t))return t.splice(e,n),t;const o=[...t.slice(0,e),...t.slice(e+n)];return d.enabled&&d.cloned.add(o),o}function D(t,e,n){const o=A(t),c=e.length-1;let s=o;for(let t=0;t<c;t++)s[e[t]]=A(s[e[t]]),s=s[e[t]];return s[e[c]]=n,o}function S(t,e,n){if(d.enabled&&d.cloned.has(t))return t.splice(e,0,...n),t;const o=[...t.slice(0,e),...n,...t.slice(e)];return d.enabled&&d.cloned.add(o),o}function y(t,e,n){if(d.enabled&&d.cloned.has(t))return C(t,e,n),t;const o=[...t];return C(o,e,n),d.enabled&&d.cloned.add(o),o}function A(t){if(d.enabled&&d.cloned.has(t))return t;const e=Array.isArray(t)?[...t]:{...t};return d.enabled&&d.cloned.add(e),e}class z{constructor(t,e){this.reactive=t,this.path=e}set(t){const e=this.reactive,n=this.path;if(e.mutable){const o=n.length-1;let c=e.value;for(let t=0;t<o;t++)c=c[n[t]];if(t===c[n[o]])return;c[n[o]]=t}else e.value=D(e.value,n,t);e[2]&&(e.listInvalidator=e=>{e("set",n,t)}),g(e)}do(t){const n=e(this.reactive.value,this.path),o=t(n);n!==o&&this.set(o)}insertList(t,n){const{reactive:o,path:c}=this,s=e(o.value,c),l=t<0?s.length+t+1:t;o.mutable?s.splice(l,0,...n):o.value=D(o.value,c,S(s,l,n)),g(o)}remove(t,n=1){const{reactive:o,path:c}=this,s=e(o.value,c),l=t<0?s.length+t:t;o.mutable?s.splice(l,n):o.value=D(o.value,c,I(s,l,n)),g(o)}insert(t,e){this.insertList(t,[e])}clear(){const e=this.reactive,n=this.path,[o,c]=t(e.value,n),s=o[c];0!==s.length&&(e.mutable?o[c]=[]:e.value=D(s,n,[]),g(e))}swap(t,n){const o=this.reactive,c=this.path,s=e(o.value,c);if(o.mutable)C(s,t,n);else{const s=e(o.value,c);o.value=D(o.value,c,y(s,t,n))}g(o)}push(t){this.insertList(-1,[t])}pushList(t){this.insertList(-1,t)}pop(t=1){this.remove(-1*t,t)}}function j(t){const e=this;t!==e.value&&(e.value=t,e[2]&&(e.listInvalidator=e=>{e("set",null,t)}),g(e))}function k(t){const e=t(this.value);this.value!==e&&this.set(e)}function q(t,e){const n=this,o=t<0?this.value.length+t+1:t;n.mutable?n.value.splice(o,0,...e):n.value=S(n.value,o,e),n[2]&&(n.listInvalidator=t=>{t("insert",o,e)}),g(n)}function B(t,e=1){const n=this,o=t<0?n.value.length+t:t;n.mutable?n.value.splice(o,e):n.value=I(n.value,o,e),n[2]&&(n.listInvalidator=t=>{t("remove",o,e)}),g(n)}function F(t,e){this.insertList(t,[e])}function G(t){this.insertList(-1,[t])}function H(t){this.insertList(-1,t)}function J(t=1){this.remove(-1*t,t)}function K(){const t=this;0!==t.value.length&&(t.value=[],t.listInvalidator=t=>{t("clear")},g(t))}function M(t,e){const n=this;n.mutable?C(n.value,t,e):n.value=y(n.value,t,e),n[2]&&(n.listInvalidator=n=>{n("swap",t,e)}),g(n)}function N(t){const e=function(...t){return 0!==t.length?new z(e,t):(P.detectorEnabled&&P.detected.add(e),e.value)};return e.value=t,e.context=P.context,e.mutable=!0,e.set=j,e.do=k,Array.isArray(t)&&(e.insert=F,e.insertList=q,e.remove=B,e.swap=M,e.clear=K,e.push=G,e.pushList=H,e.pop=J),e}function O(t){let e=t.value;m(t,(function(){const o=t.value;e!==o&&(o in n&&g(n[o]),e in n&&g(n[e]),e=o)}),0);const n={};return e=>{if(!n[e]){const t={};n[e]=t}return P.detectorEnabled&&P.detected.add(n[e]),e===t.value}}const P={context:null,detectorEnabled:!1,detected:new Set};export{i as CONNECTION_PHASE,l as DATA_PHASE,a as LIST_PHASE,u as RENDER_PHASE,r as USER_EFFECT_PHASE,E as batch,d as batching,P as coreInfo,c as detect,w as effect,g as invalidate,L as memo,n as onConnect,o as onDisconnect,N as reactive,O as selector,m as subscribe,t as targetKey,x as unsubscribe,e as valueAt};

@@ -16,9 +16,2 @@ import { Reactive } from './reactive';

export declare type Phase = 0 | 1 | 2 | 3 | 4;
export declare type Subs = [
dataUpdate?: Set<Function>,
listUpdate?: Set<Function>,
connection?: Set<Function>,
render?: Set<Function>,
user?: Set<Function>
];
export declare type Context = {

@@ -25,0 +18,0 @@ /** tasks to be performed after the component is connected */

@@ -1,2 +0,2 @@

import { Subs, Context, GenericPath, AnyArrayOp } from './others';
import { Context, GenericPath, AnyArrayOp } from './others';
import { Paths, PathTarget } from './path';

@@ -39,2 +39,9 @@ export declare namespace Methods {

} & Methods<V>;
export declare type PhaseSubs = {
0?: Set<Function>;
1?: Set<Function>;
2?: Set<Function>;
3?: Set<Function>;
4?: Set<Function>;
};
export declare type Reactive<T> = {

@@ -44,12 +51,10 @@ (): T;

value: T;
subs: Subs;
context: Context | null;
mutable: boolean;
} & Methods<T>;
} & Methods<T> & PhaseSubs;
export declare type ReadonlyReactive<T> = {
(): T;
value: T;
subs: Subs;
context: Context | null;
};
} & PhaseSubs;
export {};
{
"name": "hydroxide",
"description": "Next Generation Reactive Framework",
"version": "0.13.0",
"version": "0.14.0",
"author": "Manan Tank",

@@ -6,0 +6,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc