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

ceri

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ceri - npm Package Compare versions

Comparing version 1.0.25 to 1.0.26

lib/#tap.js

53

lib/c-for-clustered.js

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

var isFunction;
isFunction = require("./_helpers").isFunction;
module.exports = {

@@ -6,29 +10,26 @@ _name: "c-for-clustered",

_elLookup: {
cClustered: function(name, o, children) {
var container, ref, template;
container = document.createElement("div");
if (isFunction(children)) {
template = children;
} else {
template = (ref = o.template) != null ? ref[""] : void 0;
cForClustered: {
extract: {
"": ["tag", "names", "template", "get-count", "get-data", "computed", "id", "tap"]
},
cb: function(o, arg) {
var c, children, ref;
children = arg.children;
c = o.container = document.createElement(o.tag || "div");
if (isFunction(children)) {
o.template = children;
}
o.names = (ref = o.names) != null ? ref.split(",") : void 0;
this.$nextTick(function() {
var clusterContainer;
clusterContainer = this.$clusteredFor(o);
if (o.tap != null) {
return this.$path.setValue({
path: o.tap,
value: clusterContainer
});
}
});
return c;
}
this.$nextTick(function() {
var clusterContainer, ref1, ref2, ref3, ref4, ref5, ref6, ref7, tap;
clusterContainer = this.$clusteredFor({
container: container,
template: template,
getCount: (ref1 = o.getCount) != null ? ref1[""] : void 0,
getData: (ref2 = o.getData) != null ? ref2[""] : void 0,
names: (ref3 = o.names) != null ? (ref4 = ref3[""]) != null ? ref4.split(",") : void 0 : void 0,
computed: (ref5 = o.computed) != null ? ref5[""] : void 0,
id: (ref6 = o.id) != null ? ref6[""] : void 0
});
if ((tap = (ref7 = o.tap) != null ? ref7[""] : void 0) != null) {
return this.$path.setValue({
path: tap,
value: clusterContainer
});
}
});
return container;
}

@@ -35,0 +36,0 @@ }

@@ -10,28 +10,37 @@ var isFunction;

_elLookup: {
cFor: function(name, o, children) {
var comment, ref, template;
comment = document.createComment("c-for");
if (isFunction(children)) {
template = children;
} else {
template = (ref = o.template) != null ? ref[""] : void 0;
cFor: {
extract: {
"": ["template", "iterate", "names", "computed", "id", "tap"]
},
cb: function(o, arg) {
var children, comment, template;
children = arg.children;
comment = document.createComment("c-for");
if (isFunction(children)) {
template = children;
} else {
template = o.template;
}
this.$nextTick(function() {
var ref, scopes, tap;
scopes = this.$for({
anchor: comment,
template: template,
value: o.iterate,
names: (ref = o.names) != null ? ref.split(",") : void 0,
computed: o.computed,
id: o.id
}).scopes;
if ((tap = o.tap) != null) {
return this.$path.setValue({
path: tap,
value: scopes
});
}
});
return {
el: comment,
options: null
};
}
this.$nextTick(function() {
var ref1, ref2, ref3, ref4, ref5, ref6, scopes, tap;
scopes = this.$for({
anchor: comment,
template: template,
value: (ref1 = o.iterate) != null ? ref1[""] : void 0,
names: (ref2 = o.names) != null ? (ref3 = ref2[""]) != null ? ref3.split(",") : void 0 : void 0,
computed: (ref4 = o.computed) != null ? ref4[""] : void 0,
id: (ref5 = o.id) != null ? ref5[""] : void 0
}).scopes;
if ((tap = (ref6 = o.tap) != null ? ref6[""] : void 0) != null) {
return this.$path.setValue({
path: tap,
value: scopes
});
}
});
return comment;
}

@@ -38,0 +47,0 @@ }

@@ -10,19 +10,27 @@ var isFunction;

_elLookup: {
cIf: function(name, o, children) {
var comment;
comment = document.createComment("c-if");
if (o != null) {
this.$nextTick(function() {
var ref, ref1, ref2, ref3, ref4, ref5;
return this.$if({
value: ((ref = o["true"]) != null ? ref[""] : void 0) || ((ref1 = o["false"]) != null ? ref1[""] : void 0),
anchor: comment,
els: children,
template: (ref2 = o.template) != null ? ref2[""] : void 0,
elseTemplate: (ref3 = o["else"]) != null ? ref3[""] : void 0,
not: ((ref4 = o.not) != null ? ref4[""] : void 0) || (((ref5 = o["false"]) != null ? ref5[""] : void 0) != null)
cIf: {
extract: {
"": ["true", "false", "template", "else", "not"]
},
cb: function(o, arg) {
var children, comment;
children = arg.children;
comment = document.createComment("c-if");
if (o != null) {
this.$nextTick(function() {
return this.$if({
value: o["true"] || o["false"],
anchor: comment,
els: children,
template: o.template,
elseTemplate: o["else"],
not: o.not || o["false"]
});
});
});
}
return {
el: comment,
options: null
};
}
return comment;
}

@@ -29,0 +37,0 @@ }

@@ -6,14 +6,22 @@ module.exports = {

_elLookup: {
"cMount": function(name, options, children) {
var comment;
comment = document.createComment("c-mount");
this.$nextTick(function() {
var ref;
return this.$mount({
anchor: comment,
els: children,
template: options != null ? (ref = options.template) != null ? ref[""] : void 0 : void 0
"cMount": {
extract: {
"": ["template"]
},
cb: function(options, arg) {
var children, comment;
children = arg.children;
comment = document.createComment("c-mount");
this.$nextTick(function() {
return this.$mount({
anchor: comment,
els: children,
template: options.template
});
});
});
return comment;
return {
el: comment,
options: null
};
}
}

@@ -20,0 +28,0 @@ }

@@ -30,9 +30,5 @@ var assign, clone, getID, id, isArray, isFunction, isObject, isString, noop, ref;

o.name = o.id;
} else {
this.$path.toNameAndParent(o);
}
if (o.parent == null) {
o.parent = this;
}
if (o.name == null) {
o.name = o.path;
}
this.$watch.parse(o);

@@ -99,3 +95,3 @@ o = this.$watch.init(o);

var cb, i, instance, len, newVal, oldVal, ref1, results;
if (o.cbs.length > 0) {
if (o.cbs.length > 0 || o.lazy === false) {
instance = o.instance;

@@ -170,3 +166,3 @@ oldVal = o.value;

});
if (o.cbs.length > 0) {
if (o.cbs.length > 0 || o.lazy === false) {
return this.$nextTick(o.notify);

@@ -173,0 +169,0 @@ } else {

@@ -40,3 +40,4 @@ var clone, dEl, end, getDelta, getEvent, isString, move, ref, start;

x: e.clientX - s.x,
y: e.clientY - s.y
y: e.clientY - s.y,
start: s
};

@@ -86,3 +87,5 @@ };

$draghandle: function(o) {
o.handle = document.createElement("div");
if (o.handle == null) {
o.handle = document.createElement("div");
}
o.activate = function() {

@@ -89,0 +92,0 @@ var _el;

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

var clone, clusterTmpl, clustersTmpl, isArray, isObject, isString, noop, ref;
var clone, clusterTmpl, clustersTmpl, isArray, isFunction, isObject, isString, noop, ref;
ref = require("./_helpers"), isObject = ref.isObject, isString = ref.isString, isArray = ref.isArray, noop = ref.noop, clone = ref.clone;
ref = require("./_helpers"), isObject = ref.isObject, isString = ref.isString, isFunction = ref.isFunction, isArray = ref.isArray, noop = ref.noop, clone = ref.clone;

@@ -14,6 +14,6 @@ clustersTmpl = function(){return [this.el("div",{"class":{":":"_clusterClasses.firstRow"},"ref":{"#":"firstRow"},"style":{":":function(){return 'height:'+this._frHeight+'px';}}},[]),this.el("div",{"class":{":":"_clusterClasses.lastRow"},"ref":{"#":"lastRow"},"style":{":":function(){return 'height:'+this._lrHeight+'px';}}},[])]}

_v: 1,
mixins: [require("./for"), require("./if"), require("./structure"), require("./detach"), require("./@resize")],
mixins: [require("./for"), require("./if"), require("./structure"), require("./detach"), require("./parseFunction"), require("./@resize")],
methods: {
$clusteredFor: function(o) {
var anchor, c, clusterHeight, clusterSize, clusterVisible, clusters, clustersCount, container, el, getCount, getData, i, indexName, isInfinite, j, k, len, len1, loadingName, m, process, processScroll, reattachContainer, ref1, ref2, ref3, rowCount, rowHeight, scopes, setData, totalHeight, updateClusterCount, updateClusterHeight, updateRowCount, updateRowHeight;
var anchor, c, clusterHeight, clusterSize, clusterVisible, clusters, clustersCount, container, el, getCount, getData, i, indexName, init, j, k, len, len1, loadingName, m, process, processScroll, ready, reattachContainer, ref1, ref2, ref3, rowCount, rowHeight, scopes, setData, settedUp, totalHeight, updateClusterCount, updateClusterHeight, updateRowCount, updateRowHeight;
loadingName = o.loadingName || "isLoading";

@@ -34,2 +34,29 @@ o.value = "_clusterData";

reattachContainer = this.$detach(container = o.container);
settedUp = false;
ready = false;
init = (function(_this) {
return function() {
if (settedUp && ready) {
init = null;
_this.$on({
event: "scroll",
el: container,
cbs: processScroll,
throttled: true
});
_this.$on({
event: "resize",
el: container,
delay: true,
cbs: function() {
updateClusterHeight();
updateClusterCount();
return processScroll(true);
}
});
getData(0, 1).then(setData[0]).then(updateRowHeight).then(updateRowCount).then(processScroll);
return reattachContainer();
}
};
})(this);
ref1 = clustersTmpl.call(m);

@@ -40,5 +67,14 @@ for (j = 0, len = ref1.length; j < len; j++) {

}
getData = this.$path.resolveValue(o.getData);
getCount = this.$path.resolveValue(o.getCount);
isInfinite = getCount == null;
getData = null;
getCount = null;
this.$parseFunction(o.getData, function(fn) {
getData = fn;
if ((init != null) && isFunction(fn)) {
ready = true;
return init();
}
});
this.$parseFunction(o.getCount, function(fn) {
return getCount = fn;
});
o.clusters = clusters = [];

@@ -120,3 +156,3 @@ setData = [];

if (!(clusterSize = o.clusterSize)) {
clusterSize = Math.ceil(container.offsetHeight / rowHeight);
clusterSize = Math.ceil((container.offsetHeight || 1) / rowHeight);
if (clusterSize % 2) {

@@ -130,3 +166,3 @@ clusterSize++;

updateRowCount = function() {
if (!isInfinite) {
if (getCount != null) {
return getCount().then(function(count) {

@@ -160,6 +196,6 @@ rowCount = count;

if (c._clusternr !== (c._clusternr = absNr) || redraw === true) {
if (absNr > -1 && (isInfinite || absNr < clustersCount)) {
if (absNr > -1 && ((getCount == null) || absNr < clustersCount)) {
start = absNr * clusterSize;
end = start + clusterSize;
if (!isInfinite) {
if (getCount != null) {
end = Math.min(end, rowCount);

@@ -183,3 +219,3 @@ }

m._frHeight = Math.max(0, (clusterVisible - 1) * clusterHeight);
if (!isInfinite) {
if (getCount != null) {
m._lrHeight = Math.max(0, totalHeight - (clusterVisible + 2) * clusterHeight);

@@ -190,20 +226,6 @@ }

};
this.$on({
event: "scroll",
el: container,
cbs: processScroll,
throttled: true
});
this.$on({
event: "resize",
el: container,
delay: true,
cbs: function() {
updateClusterHeight();
updateClusterCount();
return processScroll(true);
}
});
getData(0, 1).then(setData[0]).then(updateRowHeight).then(updateRowCount).then(processScroll);
reattachContainer();
settedUp = true;
if (typeof init === "function") {
init();
}
return o;

@@ -210,0 +232,0 @@ }

@@ -11,5 +11,6 @@ var clone, isArray, isFunction, isObject, isString, noop, ref;

$for: function(arg) {
var _computed, addComputed, anchor, c, computed, getEls, id, names, objs, process, template, templateWatcher, tmpl, valname, value;
var _computed, _id, addComputed, anchor, c, computed, getEls, id, names, objs, process, template, templateWatcher, tmpl, valname, value;
anchor = arg.anchor, template = arg.template, names = arg.names, value = arg.value, computed = arg.computed, id = arg.id;
tmpl = null;
((_id = this.$path.resolveValue(id)) != null) || id;
templateWatcher = this.$parseFunction(template, function(fn) {

@@ -86,9 +87,11 @@ var el, k, l, len, len1, newEls, obj, oldEls, results;

els = tmp._els;
end = tmp._end;
results = [];
for (k = 0, len = els.length; k < len; k++) {
el = els[k];
results.push(parent.insertBefore(el, end));
if (els != null) {
end = tmp._end;
results = [];
for (k = 0, len = els.length; k < len; k++) {
el = els[k];
results.push(parent.insertBefore(el, end));
}
return results;
}
return results;
}

@@ -122,6 +125,6 @@ };

val = value[i];
if (id != null) {
if (_id) {
for (j = l = 0, len = objs.length; l < len; j = ++l) {
obj = objs[j];
if ((obj != null) && val[id] === obj[valname][id]) {
if ((obj != null) && val[_id] === obj[valname][_id]) {
if (i !== j) {

@@ -198,6 +201,6 @@ objs[j] = objs[i];

val = value[key];
if (id != null) {
if (_id) {
for (j = p = 0, len2 = objs.length; p < len2; j = ++p) {
obj = objs[j];
if (i > j && (obj != null) && val[id] === obj[valname][id]) {
if (i > j && (obj != null) && val[_id] === obj[valname][_id]) {
objs[j] = objs[i];

@@ -204,0 +207,0 @@ tmp = objs[i] = obj;

@@ -12,5 +12,9 @@ var concat, isFunction, isString, ref,

$parseFunction: function(value, cb) {
var args2, getArgumentsProcessor, hasArgs, path, splitted;
var args2, fn, getArgumentsProcessor, hasArgs, path, splitted;
if (isFunction(value)) {
return cb.call(this, value);
if (isFunction(cb)) {
return cb.call(this, value);
} else {
return value;
}
}

@@ -53,14 +57,25 @@ if (isString(value)) {

}
return this.$computed.orWatch(path, function() {
var args, fn, tmp;
fn = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
if (hasArgs && (fn != null) && isFunction(fn)) {
fn = getArgumentsProcessor.call(this, fn);
if (isFunction(cb)) {
return this.$computed.orWatch(path, function() {
var args, fn, tmp;
fn = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
if (hasArgs && (fn != null) && isFunction(fn)) {
fn = getArgumentsProcessor.call(this, fn);
}
tmp = [fn];
if (args != null) {
concat(tmp, args);
}
return cb.apply(this, tmp);
});
} else {
fn = this.$path.resolveValue(path);
if (isFunction(fn)) {
if (hasArgs) {
return getArgumentsProcessor.call(this, fn);
}
return fn;
}
tmp = [fn];
if (args != null) {
concat(tmp, args);
}
return cb.apply(this, tmp);
});
return null;
}
}

@@ -67,0 +82,0 @@ }

@@ -1,5 +0,28 @@

var arrayize, camelize, isElement, isFunction, isString, ref;
var arrayize, camelize, extract, isElement, isFunction, isString, ref;
ref = require("./_helpers"), isElement = ref.isElement, isString = ref.isString, isFunction = ref.isFunction, arrayize = ref.arrayize, camelize = ref.camelize;
extract = function(options, extr) {
var i, len, name, names, opts, ref1, t, type, val;
if (!extr) {
return [null, options];
}
opts = {};
for (type in extr) {
names = extr[type];
t = type === "@" ? "on-" : type;
for (i = 0, len = names.length; i < len; i++) {
name = names[i];
if ((val = (ref1 = options[name]) != null ? ref1[type] : void 0) != null) {
delete options[name][type];
if (Object.keys(options[name]).length === 0) {
delete options[name];
}
opts[camelize(t + name)] = val;
}
}
}
return [options, opts];
};
module.exports = {

@@ -22,9 +45,25 @@ _name: "structure",

el: function(name, options, children) {
var cb, child, el, i, len, o, ref1, type, types, value;
if ((cb = (ref1 = this._elLookup) != null ? ref1[camelize(name)] : void 0) != null) {
el = cb.call(this, name, options, children);
var child, el, i, len, o, opts, ref1, ref2, type, types, value;
if ((o = (ref1 = this._elLookup) != null ? ref1[camelize(name)] : void 0) != null) {
if (o.cb == null) {
o = {
cb: o
};
}
ref2 = extract(options, o.extract), options = ref2[0], opts = ref2[1];
el = o.cb.call(this, opts, {
children: children,
name: name
});
if (el.el != null) {
if (options == null) {
options = el.options;
}
children = el.children;
el = el.el;
}
} else {
el = document.createElement(name);
}
if ((options != null) && ((cb == null) || cb.length < 2)) {
if (options != null) {
for (name in options) {

@@ -49,3 +88,3 @@ types = options[name];

}
if ((children != null) && !isFunction(children) && ((cb == null) || cb.length < 3)) {
if ((children != null) && !isFunction(children)) {
for (i = 0, len = children.length; i < len; i++) {

@@ -52,0 +91,0 @@ child = children[i];

var createSvgElement, i, len, lookup, name, svgTags;
createSvgElement = function(name) {
var el;
createSvgElement = function(options, arg) {
var children, el, name;
name = arg.name, children = arg.children;
el = document.createElementNS("http://www.w3.org/2000/svg", name);

@@ -9,3 +10,7 @@ if (name === "svg") {

}
return el;
return {
el: el,
options: options,
children: children
};
};

@@ -12,0 +17,0 @@

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

var arrayize, clone, concat, getID, instancesStr, isArray, isObject, isString, merger, ref, watchStr,
var arrayize, assign, clone, concat, getID, instancesStr, isArray, isObject, isPlainObject, isString, merger, ref, watchStr,
hasProp = {}.hasOwnProperty;
ref = require("./_helpers"), arrayize = ref.arrayize, isString = ref.isString, isArray = ref.isArray, isObject = ref.isObject, clone = ref.clone, getID = ref.getID, concat = ref.concat;
ref = require("./_helpers"), arrayize = ref.arrayize, isString = ref.isString, isArray = ref.isArray, isObject = ref.isObject, isPlainObject = ref.isPlainObject, clone = ref.clone, getID = ref.getID, concat = ref.concat, assign = ref.assign;

@@ -25,3 +25,3 @@ merger = require("./_merger");

_rebind: "$watch",
mixins: [require("./path")],
mixins: [require("./path"), require("./parseFunction")],
methods: {

@@ -31,4 +31,10 @@ $watch: {

getObj: function(o) {
var obj, ref1;
if ((o.path != null) && ((obj = this.$watch.__w[o.path] || ((ref1 = this.__parent) != null ? ref1.$watch.__w[o.path] : void 0)) != null)) {
var i, obj, p;
if (o.path != null) {
if (!(obj = this.$watch.__w[o.path]) && ((p = this.__parents) != null)) {
i = p.length;
while (!obj && i) {
obj = p[--i].$watch.__w[o.path];
}
}
return obj;

@@ -61,11 +67,3 @@ }

parseCbs: function(o, prop) {
return o[prop] = arrayize(o[prop]).map((function(_this) {
return function(cb) {
if (isString(cb)) {
if(process.env.NODE_ENV!=='production' && !_this[cb]){console.warn('method ' + cb + ' not found')};
return _this[cb];
}
return cb;
};
})(this));
return o[prop] = arrayize(o[prop]).map(this.$parseFunction.bind(this));
},

@@ -332,3 +330,3 @@ parse: function(obj, shouldClone) {

created: function() {
var fn, j, k, len, obj, ref1, results, v;
var fn, j, k, len, obj, ref1, results, v, v2;
ref1 = this.data;

@@ -344,2 +342,5 @@ results = [];

v = obj[k];
if (((v2 = this[k]) != null) && isPlainObject(v) && isPlainObject(v2)) {
v = assign(v2, v);
}
results1.push(this.$watch.path({

@@ -346,0 +347,0 @@ parent: this,

{
"name": "ceri",
"description": "Custom Elements enRIched",
"version": "1.0.25",
"version": "1.0.26",
"homepage": "https://github.com/cerijs/",

@@ -6,0 +6,0 @@ "author": {

@@ -9,5 +9,5 @@ # ceriJS

### Ecosystem
[cerijs](https://github.com/cerijs/) - core and tooling
[ceri-comps](https://github.com/ceri-comps) - simple components built with ceri
[ceri-widgets](https://github.com/ceri-widgets) - complex components built with ceri and other ceri-components
[cerijs](https://github.com/cerijs/) - core and tooling
[ceri-comps](https://github.com/ceri-comps) - simple components built with ceri
[ceri-widgets](https://github.com/ceri-widgets) - complex components built with ceri and other ceri-components

@@ -14,0 +14,0 @@ #### Features

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