Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solid-js

Package Overview
Dependencies
Maintainers
1
Versions
463
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-js - npm Package Compare versions

Comparing version 0.0.9-beta.4 to 0.0.9-beta.5

264

dist/operators.js

@@ -1,8 +0,6 @@

import Solid, { Core, Utils } from 'solid-js';
import Solid, { ignore, Core, Utils, root } from 'solid-js';
function map(fn) {
return function(obsv) {
if (!('sid' in obsv)) {
obsv = Solid(obsv);
}
obsv = Solid(obsv);
return Solid(() => {

@@ -13,3 +11,3 @@ var v;

}
return Solid.ignore(() => {
return ignore(() => {
return fn(v);

@@ -33,3 +31,3 @@ });

}
return Core.context.disposables.push(function() {
Core.context.disposables.push(function() {
var d, k, len;

@@ -40,24 +38,42 @@ for (k = 0, len = disposables.length; k < len; k++) {

}
disposables = null;
return map((newList) => {
var end, i, indexedItems, item, itemIndex, j, l, len1, len2, len3, m, n, newEnd, newLength, newListUnwrapped, newMapped, start, tempDisposables, tempSignals;
// non-arrays
newListUnwrapped = Utils.unwrap(newList, true);
if (!Array.isArray(newListUnwrapped)) {
if ((newListUnwrapped == null) || newListUnwrapped === false) {
mapped = [];
list = [];
for (l = 0, len1 = disposables.length; l < len1; l++) {
d = disposables[l];
d();
}
disposables = [];
if (trackIndex) {
signals = [];
}
return null;
return disposables = null;
});
return map((newList) => {
var d, end, i, indexedItems, item, itemIndex, j, k, l, len, len1, len2, m, newEnd, newLength, newListUnwrapped, newMapped, start, tempDisposables, tempSignals;
// non-arrays
newListUnwrapped = Utils.unwrap(newList, true);
if (!Array.isArray(newListUnwrapped)) {
if ((newListUnwrapped == null) || newListUnwrapped === false) {
mapped = [];
list = [];
for (k = 0, len = disposables.length; k < len; k++) {
d = disposables[k];
d();
}
if (list[0] === newListUnwrapped) {
return mapped[0];
disposables = [];
if (trackIndex) {
signals = [];
}
return null;
}
if (list[0] === newListUnwrapped) {
return mapped[0];
}
for (l = 0, len1 = disposables.length; l < len1; l++) {
d = disposables[l];
d();
}
disposables = [];
list[0] = newListUnwrapped;
return mapped[0] = root(function(dispose) {
disposables[0] = dispose;
return mapFn(newList);
});
}
newLength = newListUnwrapped.length;
if (newLength === 0) {
if (length !== 0) {
list = [];
mapped = [];
length = 0;
for (m = 0, len2 = disposables.length; m < len2; m++) {

@@ -68,124 +84,106 @@ d = disposables[m];

disposables = [];
list[0] = newListUnwrapped;
return mapped[0] = root(function(dispose) {
disposables[0] = dispose;
return mapFn(newList);
});
if (trackIndex) {
signals = [];
}
}
newLength = newListUnwrapped.length;
if (newLength === 0) {
if (length !== 0) {
list = [];
mapped = [];
length = 0;
for (n = 0, len3 = disposables.length; n < len3; n++) {
d = disposables[n];
d();
}
disposables = [];
} else if (length === 0) {
i = 0;
while (i < newLength) {
list[i] = newListUnwrapped[i];
mapped[i] = root(function(dispose) {
disposables[i] = dispose;
if (trackIndex) {
signals = [];
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i], signals[i] = new Signal(i), newList);
}
}
} else if (length === 0) {
i = 0;
while (i < newLength) {
list[i] = newListUnwrapped[i];
mapped[i] = root(function(dispose) {
disposables[i] = dispose;
if (trackIndex) {
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i], signals[i] = new Signal(i), newList);
}
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i]);
});
i++;
}
length = newLength;
} else {
newMapped = new Array(newLength);
tempDisposables = new Array(newLength);
indexedItems = new Map();
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i]);
});
i++;
}
length = newLength;
} else {
newMapped = new Array(newLength);
tempDisposables = new Array(newLength);
indexedItems = new Map();
if (trackIndex) {
tempSignals = new Array(newLength);
}
end = Math.min(length, newLength);
// reduce from both ends
start = 0;
while (start < end && newListUnwrapped[start] === list[start]) {
start++;
}
end = length - 1;
newEnd = newLength - 1;
while (end >= 0 && newEnd >= 0 && newListUnwrapped[newEnd] === list[end]) {
newMapped[newEnd] = mapped[end];
tempDisposables[newEnd] = disposables[newEnd];
if (trackIndex) {
tempSignals = new Array(newLength);
tempSignals[newEnd] = signals[newEnd];
}
end = Math.min(length, newLength);
// reduce from both ends
start = 0;
while (start < end && newListUnwrapped[start] === list[start]) {
start++;
end--;
newEnd--;
}
// create indices
j = newEnd;
while (j >= start) {
item = newListUnwrapped[j];
itemIndex = indexedItems.get(item);
if (itemIndex != null) {
itemIndex.push(j);
} else {
indexedItems.set(item, [j]);
}
end = length - 1;
newEnd = newLength - 1;
while (end >= 0 && newEnd >= 0 && newListUnwrapped[newEnd] === list[end]) {
newMapped[newEnd] = mapped[end];
tempDisposables[newEnd] = disposables[newEnd];
j--;
}
// find old items
i = start;
while (i <= end) {
item = list[i];
itemIndex = indexedItems.get(item);
if ((itemIndex != null) && itemIndex.length > 0) {
j = itemIndex.pop();
newMapped[j] = mapped[i];
tempDisposables[j] = disposables[i];
if (trackIndex) {
tempSignals[newEnd] = signals[newEnd];
tempSignals[j] = signals[i];
}
end--;
newEnd--;
} else {
disposables[i]();
}
// create indices
j = newEnd;
while (j >= start) {
item = newListUnwrapped[j];
itemIndex = indexedItems.get(item);
if (itemIndex != null) {
itemIndex.push(j);
} else {
indexedItems.set(item, [j]);
}
j--;
}
// find old items
i = start;
while (i <= end) {
item = list[i];
itemIndex = indexedItems.get(item);
if ((itemIndex != null) && itemIndex.length > 0) {
j = itemIndex.pop();
newMapped[j] = mapped[i];
tempDisposables[j] = disposables[i];
if (trackIndex) {
tempSignals[j] = signals[i];
i++;
}
// set all new values
j = start;
while (j < newLength) {
if (newMapped.hasOwnProperty(j)) {
mapped[j] = newMapped[j];
disposables[j] = tempDisposables[j];
if (trackIndex) {
signals[j] = tempSignals[j];
if (signals[j].peek() !== j) {
signals[j].next(j);
}
} else {
disposables[i]();
}
i++;
}
// set all new values
j = start;
while (j < newLength) {
if (newMapped.hasOwnProperty(j)) {
mapped[j] = newMapped[j];
disposables[j] = tempDisposables[j];
} else {
mapped[j] = root(function(dispose) {
disposables[j] = dispose;
if (trackIndex) {
signals[j] = tempSignals[j];
if (signals[j].peek() !== j) {
signals[j].next(j);
}
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j], signals[j] = new Signal(j), newList);
}
} else {
mapped[j] = root(function(dispose) {
disposables[j] = dispose;
if (trackIndex) {
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j], signals[j] = new Signal(j), newList);
}
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j]);
});
}
j++;
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j]);
});
}
// truncate extra length
length = mapped.length = disposables.length = newLength;
if (trackIndex) {
signals.length = newLength;
}
// save list for next iteration
list = newListUnwrapped.slice(0);
j++;
}
return mapped;
})(obsv);
});
// truncate extra length
length = mapped.length = disposables.length = newLength;
if (trackIndex) {
signals.length = newLength;
}
// save list for next iteration
list = newListUnwrapped.slice(0);
}
return mapped;
})(obsv);
};

@@ -192,0 +190,0 @@ }

@@ -231,5 +231,5 @@ import { createRuntime } from 'babel-plugin-jsx-dom-expressions';

return fn(function() {
var disposable, j, len;
for (j = 0, len = d.length; j < len; j++) {
disposable = d[j];
var disposable, i, len;
for (i = 0, len = d.length; i < len; i++) {
disposable = d[i];
disposable();

@@ -255,18 +255,2 @@ }

var pipe = function(...fns) {
if (!fns) {
return i(() => {
return i;
});
}
if (fns.length === 1) {
return fns[0];
}
return (obsv) => {
return fns.reduce(((prev, fn) => {
return fn(prev);
}), obsv);
};
};
var Sync;

@@ -378,3 +362,3 @@

var Selector, Signal, Stream, counter, observableProvider, promiseProvider, resolveAsync, sequenceCounter;
var S, Selector, Signal, Stream, counter, observableProvider, promiseProvider, resolveAsync, rxCompat, sequenceCounter;

@@ -433,2 +417,20 @@ counter = 0;

rxCompat = function(obsv, op) {
var newObsv;
newObsv = {
subscribe: function(sub) {
return op.call(sub, obsv);
},
lift: function(op) {
return rxCompat(this, op);
}
};
Object.defineProperty(newObsv, result, {
value: function() {
return newObsv;
}
});
return newObsv;
};
Signal = class Signal {

@@ -503,3 +505,3 @@ constructor(value) {

}
queueTask(handler, value);
queueTask(handler.bind(sub), value);
if (++i === size) {

@@ -511,2 +513,10 @@ break;

lift(op) {
return rxCompat(this, op);
}
pipe() {
return pipe.apply(this, arguments)(this);
}
};

@@ -661,3 +671,6 @@

function Signal$1(payload, options = {}) {
var Signal$1 = S = function(payload, options = {}) {
if ('sid' in payload) {
return payload;
}
if (isFunction(payload)) {

@@ -673,5 +686,22 @@ return new Selector(payload, options);

return new Signal(payload, options);
}
};
var pipe = function(...fns) {
if (!fns) {
return i(() => {
return i;
});
}
if (fns.length === 1) {
return fns[0];
}
return (obsv) => {
obsv = S(obsv);
return fns.reduce(((prev, fn) => {
return fn(prev);
}), obsv);
};
};
export default Signal$1;
export { Utils, Sync$1 as Sync, Renderer as r, Core, queueTask, run, setContext, root, ignore, onClean, pipe };
export { Utils, Sync$1 as Sync, Renderer as r, pipe, Core, queueTask, run, setContext, root, ignore, onClean };

@@ -12,5 +12,3 @@ 'use strict';

return function(obsv) {
if (!('sid' in obsv)) {
obsv = Solid__default(obsv);
}
obsv = Solid__default(obsv);
return Solid__default(() => {

@@ -21,3 +19,3 @@ var v;

}
return Solid__default.ignore(() => {
return Solid.ignore(() => {
return fn(v);

@@ -41,3 +39,3 @@ });

}
return Solid.Core.context.disposables.push(function() {
Solid.Core.context.disposables.push(function() {
var d, k, len;

@@ -48,24 +46,42 @@ for (k = 0, len = disposables.length; k < len; k++) {

}
disposables = null;
return map((newList) => {
var end, i, indexedItems, item, itemIndex, j, l, len1, len2, len3, m, n, newEnd, newLength, newListUnwrapped, newMapped, start, tempDisposables, tempSignals;
// non-arrays
newListUnwrapped = Solid.Utils.unwrap(newList, true);
if (!Array.isArray(newListUnwrapped)) {
if ((newListUnwrapped == null) || newListUnwrapped === false) {
mapped = [];
list = [];
for (l = 0, len1 = disposables.length; l < len1; l++) {
d = disposables[l];
d();
}
disposables = [];
if (trackIndex) {
signals = [];
}
return null;
return disposables = null;
});
return map((newList) => {
var d, end, i, indexedItems, item, itemIndex, j, k, l, len, len1, len2, m, newEnd, newLength, newListUnwrapped, newMapped, start, tempDisposables, tempSignals;
// non-arrays
newListUnwrapped = Solid.Utils.unwrap(newList, true);
if (!Array.isArray(newListUnwrapped)) {
if ((newListUnwrapped == null) || newListUnwrapped === false) {
mapped = [];
list = [];
for (k = 0, len = disposables.length; k < len; k++) {
d = disposables[k];
d();
}
if (list[0] === newListUnwrapped) {
return mapped[0];
disposables = [];
if (trackIndex) {
signals = [];
}
return null;
}
if (list[0] === newListUnwrapped) {
return mapped[0];
}
for (l = 0, len1 = disposables.length; l < len1; l++) {
d = disposables[l];
d();
}
disposables = [];
list[0] = newListUnwrapped;
return mapped[0] = Solid.root(function(dispose) {
disposables[0] = dispose;
return mapFn(newList);
});
}
newLength = newListUnwrapped.length;
if (newLength === 0) {
if (length !== 0) {
list = [];
mapped = [];
length = 0;
for (m = 0, len2 = disposables.length; m < len2; m++) {

@@ -76,124 +92,106 @@ d = disposables[m];

disposables = [];
list[0] = newListUnwrapped;
return mapped[0] = root(function(dispose) {
disposables[0] = dispose;
return mapFn(newList);
});
if (trackIndex) {
signals = [];
}
}
newLength = newListUnwrapped.length;
if (newLength === 0) {
if (length !== 0) {
list = [];
mapped = [];
length = 0;
for (n = 0, len3 = disposables.length; n < len3; n++) {
d = disposables[n];
d();
}
disposables = [];
} else if (length === 0) {
i = 0;
while (i < newLength) {
list[i] = newListUnwrapped[i];
mapped[i] = Solid.root(function(dispose) {
disposables[i] = dispose;
if (trackIndex) {
signals = [];
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i], signals[i] = new Signal(i), newList);
}
}
} else if (length === 0) {
i = 0;
while (i < newLength) {
list[i] = newListUnwrapped[i];
mapped[i] = root(function(dispose) {
disposables[i] = dispose;
if (trackIndex) {
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i], signals[i] = new Signal(i), newList);
}
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i]);
});
i++;
}
length = newLength;
} else {
newMapped = new Array(newLength);
tempDisposables = new Array(newLength);
indexedItems = new Map();
return mapFn((typeof newList.peek === "function" ? newList.peek(i) : void 0) || newList[i]);
});
i++;
}
length = newLength;
} else {
newMapped = new Array(newLength);
tempDisposables = new Array(newLength);
indexedItems = new Map();
if (trackIndex) {
tempSignals = new Array(newLength);
}
end = Math.min(length, newLength);
// reduce from both ends
start = 0;
while (start < end && newListUnwrapped[start] === list[start]) {
start++;
}
end = length - 1;
newEnd = newLength - 1;
while (end >= 0 && newEnd >= 0 && newListUnwrapped[newEnd] === list[end]) {
newMapped[newEnd] = mapped[end];
tempDisposables[newEnd] = disposables[newEnd];
if (trackIndex) {
tempSignals = new Array(newLength);
tempSignals[newEnd] = signals[newEnd];
}
end = Math.min(length, newLength);
// reduce from both ends
start = 0;
while (start < end && newListUnwrapped[start] === list[start]) {
start++;
end--;
newEnd--;
}
// create indices
j = newEnd;
while (j >= start) {
item = newListUnwrapped[j];
itemIndex = indexedItems.get(item);
if (itemIndex != null) {
itemIndex.push(j);
} else {
indexedItems.set(item, [j]);
}
end = length - 1;
newEnd = newLength - 1;
while (end >= 0 && newEnd >= 0 && newListUnwrapped[newEnd] === list[end]) {
newMapped[newEnd] = mapped[end];
tempDisposables[newEnd] = disposables[newEnd];
j--;
}
// find old items
i = start;
while (i <= end) {
item = list[i];
itemIndex = indexedItems.get(item);
if ((itemIndex != null) && itemIndex.length > 0) {
j = itemIndex.pop();
newMapped[j] = mapped[i];
tempDisposables[j] = disposables[i];
if (trackIndex) {
tempSignals[newEnd] = signals[newEnd];
tempSignals[j] = signals[i];
}
end--;
newEnd--;
} else {
disposables[i]();
}
// create indices
j = newEnd;
while (j >= start) {
item = newListUnwrapped[j];
itemIndex = indexedItems.get(item);
if (itemIndex != null) {
itemIndex.push(j);
} else {
indexedItems.set(item, [j]);
}
j--;
}
// find old items
i = start;
while (i <= end) {
item = list[i];
itemIndex = indexedItems.get(item);
if ((itemIndex != null) && itemIndex.length > 0) {
j = itemIndex.pop();
newMapped[j] = mapped[i];
tempDisposables[j] = disposables[i];
if (trackIndex) {
tempSignals[j] = signals[i];
i++;
}
// set all new values
j = start;
while (j < newLength) {
if (newMapped.hasOwnProperty(j)) {
mapped[j] = newMapped[j];
disposables[j] = tempDisposables[j];
if (trackIndex) {
signals[j] = tempSignals[j];
if (signals[j].peek() !== j) {
signals[j].next(j);
}
} else {
disposables[i]();
}
i++;
}
// set all new values
j = start;
while (j < newLength) {
if (newMapped.hasOwnProperty(j)) {
mapped[j] = newMapped[j];
disposables[j] = tempDisposables[j];
} else {
mapped[j] = Solid.root(function(dispose) {
disposables[j] = dispose;
if (trackIndex) {
signals[j] = tempSignals[j];
if (signals[j].peek() !== j) {
signals[j].next(j);
}
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j], signals[j] = new Signal(j), newList);
}
} else {
mapped[j] = root(function(dispose) {
disposables[j] = dispose;
if (trackIndex) {
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j], signals[j] = new Signal(j), newList);
}
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j]);
});
}
j++;
return mapFn((typeof newList.peek === "function" ? newList.peek(j) : void 0) || newList[j]);
});
}
// truncate extra length
length = mapped.length = disposables.length = newLength;
if (trackIndex) {
signals.length = newLength;
}
// save list for next iteration
list = newListUnwrapped.slice(0);
j++;
}
return mapped;
})(obsv);
});
// truncate extra length
length = mapped.length = disposables.length = newLength;
if (trackIndex) {
signals.length = newLength;
}
// save list for next iteration
list = newListUnwrapped.slice(0);
}
return mapped;
})(obsv);
};

@@ -200,0 +198,0 @@ }

@@ -235,5 +235,5 @@ 'use strict';

return fn(function() {
var disposable, j, len;
for (j = 0, len = d.length; j < len; j++) {
disposable = d[j];
var disposable, i, len;
for (i = 0, len = d.length; i < len; i++) {
disposable = d[i];
disposable();

@@ -259,18 +259,2 @@ }

var pipe = function(...fns) {
if (!fns) {
return i(() => {
return i;
});
}
if (fns.length === 1) {
return fns[0];
}
return (obsv) => {
return fns.reduce(((prev, fn) => {
return fn(prev);
}), obsv);
};
};
var Sync;

@@ -382,3 +366,3 @@

var Selector, Signal, Stream, counter, observableProvider, promiseProvider, resolveAsync, sequenceCounter;
var S, Selector, Signal, Stream, counter, observableProvider, promiseProvider, resolveAsync, rxCompat, sequenceCounter;

@@ -437,2 +421,20 @@ counter = 0;

rxCompat = function(obsv, op) {
var newObsv;
newObsv = {
subscribe: function(sub) {
return op.call(sub, obsv);
},
lift: function(op) {
return rxCompat(this, op);
}
};
Object.defineProperty(newObsv, result, {
value: function() {
return newObsv;
}
});
return newObsv;
};
Signal = class Signal {

@@ -507,3 +509,3 @@ constructor(value) {

}
queueTask(handler, value);
queueTask(handler.bind(sub), value);
if (++i === size) {

@@ -515,2 +517,10 @@ break;

lift(op) {
return rxCompat(this, op);
}
pipe() {
return pipe.apply(this, arguments)(this);
}
};

@@ -665,3 +675,6 @@

function Signal$1(payload, options = {}) {
var Signal$1 = S = function(payload, options = {}) {
if ('sid' in payload) {
return payload;
}
if (isFunction(payload)) {

@@ -677,4 +690,21 @@ return new Selector(payload, options);

return new Signal(payload, options);
}
};
var pipe = function(...fns) {
if (!fns) {
return i(() => {
return i;
});
}
if (fns.length === 1) {
return fns[0];
}
return (obsv) => {
obsv = S(obsv);
return fns.reduce(((prev, fn) => {
return fn(prev);
}), obsv);
};
};
exports.Utils = Utils;

@@ -684,2 +714,3 @@ exports.Sync = Sync$1;

exports.default = Signal$1;
exports.pipe = pipe;
exports.Core = Core;

@@ -692,2 +723,1 @@ exports.queueTask = queueTask;

exports.onClean = onClean;
exports.pipe = pipe;
{
"name": "solid-js",
"description": "A declarative JavaScript library for building user interfaces.",
"version": "0.0.9-beta.4",
"version": "0.0.9-beta.5",
"author": "Ryan Carniato",

@@ -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