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.5 to 1.0.6

lib/@popstate.js

22

lib/animate.js

@@ -124,10 +124,11 @@ var easing, isArray, step;

$animate: function(o) {
var key, ref, tmp, val;
var cb, key, ref, tmp, val;
if (o.done != null) {
o.done = o.done.bind(this);
}
if (this.__noAnimation) {
if (o.animate === false) {
return typeof o.done === "function" ? o.done() : void 0;
}
if (o.style) {
cb = step(o);
if (o.el == null) {

@@ -139,9 +140,6 @@ o.el = this;

}
if (o.delay == null) {
o.delay = 0;
}
if (o.easing == null) {
o.easing = this.$ease("in", "linear");
}
o.next = requestAnimationFrame.bind(null, step(o));
o.next = requestAnimationFrame.bind(null, cb);
if (o._percent && (o._preserve != null)) {

@@ -161,7 +159,11 @@ o.preserve = o._preserve;

}
setTimeout(o.next, o.delay);
if (o.delay) {
setTimeout(o.next, o.delay);
} else {
cb(performance.now());
}
this.$animations.push(o);
o.stop = (function(_this) {
return function(obj) {
var ref1, s;
var percent, ref1, s;
if (!o.stopped) {

@@ -181,4 +183,6 @@ o.stopped = true;

} else {
percent = Math.min(1, (performance.now() - o.start) / o.duration);
obj._preserve = o.preserve;
obj._percent = 1 - Math.min(1, (performance.now() - o.start) / o.duration);
obj._percent = 1 - percent;
obj._value = o.easing(percent);
obj._style = o.style;

@@ -185,0 +189,0 @@ }

@@ -1,7 +0,9 @@

var clone, getID, isFunction, isObject, noop, ref;
var clone, getID, id, isFunction, isObject, isString, noop, ref;
ref = require("./_helpers"), noop = ref.noop, isObject = ref.isObject, isFunction = ref.isFunction, clone = ref.clone, getID = ref.getID;
ref = require("./_helpers"), noop = ref.noop, isString = ref.isString, isObject = ref.isObject, isFunction = ref.isFunction, clone = ref.clone, getID = ref.getID;
window.__ceriDeps = null;
id = 0;
module.exports = {

@@ -21,6 +23,14 @@ _name: "computed",

var deferred;
if (!o.path) {
o.id = getID();
o.path = "__computed." + o.id;
o.parent = this.__computed;
o.name = o.id;
}
this.$watch.parse(o);
o = this.$watch.init(o);
if (o) {
o.id = getID();
if (o.id == null) {
o.id = getID();
}
o.deps = function(id) {

@@ -128,2 +138,15 @@ o.deps[id] = true;

return noop;
},
orWatch: function(val, cbs) {
if (isString(val)) {
return this.$watch.path({
path: val,
cbs: cbs
});
} else {
return this.$computed.init({
get: val,
cbs: cbs
});
}
}

@@ -134,2 +157,3 @@ }

var k, ref1, results, v;
this.__computed = {};
ref1 = this.computed;

@@ -136,0 +160,0 @@ results = [];

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

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

@@ -9,31 +9,112 @@ module.exports = {

_prio: 900,
_mergers: require("./_merger").copy({
source: "events"
}),
_mergers: [
require("./_merger").copy({
source: "events"
}), require("./_merger").copy({
source: "_evLookup"
})
],
mixins: [require("./computed")],
_evLookup: {},
methods: {
"$once": function(o) {
var cb, remover;
remover = null;
cb = o.cb;
o.cb = function(e) {
if (cb.call(this, e)) {
if (remover != null) {
return remover();
}
}
};
return remover = this.$on(o);
o.once = true;
return this.$on(o);
},
"$on": function(o) {
var remover;
var adder, cb, cbs, fn, i, len, obj, ref1, ref2, remover;
if (o.el == null) {
o.el = this;
}
o.cb = o.cb.bind(this);
o.el.addEventListener(o.event, o.cb, o.useCapture);
remover = function() {
o.el.removeEventListener(o.event, o.cb);
return remover = null;
};
return remover;
cbs = [];
ref1 = arrayize(o.cbs);
for (i = 0, len = ref1.length; i < len; i++) {
fn = ref1[i];
if (isString(fn)) {
fn = this[fn];
}
cbs.push(fn);
}
o._cbs = cbs;
if (this._evLookup[o.event] != null) {
ref2 = this._evLookup[o.event].call(this, o), adder = ref2.adder, remover = ref2.remover;
} else {
if (o.toggle) {
obj = this.$path.toNameAndParent({
path: o.toggle
});
cb = function() {
return obj.parent[obj.name] = !obj.parent[obj.name];
};
} else {
cb = function(e) {
var j, len1, ocb, ref3, target;
if (o.self && e.target !== o.el) {
return;
}
if (o.notPrevented && e.defaultPrevented) {
return;
}
if (o.keyCode && o.keyCode.indexOf(e.keyCode) === -1) {
return;
}
if (o.outside) {
target = e.target;
while (target != null) {
if (target === this) {
return;
}
target = target.parentElement;
}
}
ref3 = o._cbs;
for (j = 0, len1 = ref3.length; j < len1; j++) {
ocb = ref3[j];
ocb.apply(this, arguments);
}
if (o.prevent) {
e.preventDefault();
}
if (o.stop) {
e.stopPropagation();
}
if (o.once) {
return remover();
}
};
}
remover = noop;
cb = cb.bind(this);
adder = function() {
var el;
if (isString(o.el)) {
el = o.el === "this" ? this : this[o.el];
} else {
el = o.el;
}
el.addEventListener(o.event, cb, o.capture);
remover = function() {
el.removeEventListener(o.event, cb);
return remover = noop;
};
if (o.destroy) {
this.__eventsToDestroy.push(remover);
}
};
}
if (o.active) {
return this.$computed.orWatch(o.active, function(val) {
if (val) {
if (o.delay) {
return this.$nextTick(adder);
} else {
return adder.call(this);
}
} else {
return remover();
}
});
} else {
return adder.call(this);
}
},

@@ -51,4 +132,5 @@ "$emit": function(o) {

connectedCallback: function() {
var fn, k, ref1, results, v;
var el, k, o, ref1, results, v, v2;
if (this._isFirstConnect) {
this.__eventsToDestroy = [];
ref1 = this.events;

@@ -58,18 +140,40 @@ results = [];

v = ref1[k];
results.push((function() {
var i, len, ref2, results1;
ref2 = arrayize(v);
results1 = [];
for (i = 0, len = ref2.length; i < len; i++) {
fn = ref2[i];
if (isString(fn)) {
fn = this[fn];
if (v.cbs != null) {
o = clone(v);
o.event = k;
results.push(this.$on(o));
} else if (isString(v) || isFunction(v) || isArray(v)) {
results.push(this.$on({
cbs: v,
event: k
}));
} else {
results.push((function() {
var results1;
results1 = [];
for (el in v) {
v2 = v[el];
o = clone(v2);
if (o.el == null) {
o.el = el;
}
o.event = k;
results1.push(this.$on(o));
}
results1.push(this.addEventListener(k, fn));
}
return results1;
}).call(this));
return results1;
}).call(this));
}
}
return results;
}
},
destroy: function() {
var cb, i, len, ref1, results;
ref1 = this.__eventsToDestroy;
results = [];
for (i = 0, len = ref1.length; i < len; i++) {
cb = ref1[i];
results.push(cb());
}
return results;
}

@@ -76,0 +180,0 @@ };

@@ -42,5 +42,3 @@ module.exports = {

if (val) {
this.__noAnimation = true;
this.toggle();
return this.__noAnimation = false;
return this.toggle(false);
}

@@ -60,2 +58,7 @@ } else {

}
},
disconnectedCallback: function() {
if (this.open) {
return this.toggle(false);
}
}

@@ -62,0 +65,0 @@ };

@@ -18,3 +18,3 @@ var arrayize, camelize, isElement, isString, ref,

_rebind: "$structure",
mixins: [require("./path"), require("./watch"), require("./setAttribute")],
mixins: [require("./watch"), require("./setAttribute"), require("./events")],
_attrLookup: {

@@ -46,3 +46,3 @@ text: {

el: function(name, options, children) {
var capture, cb, child, el, fn, i, len, lookupObj, mods, path, ref1, type, types, value;
var cb, child, el, i, len, lookupObj, mods, ref1, type, types, value;
if (((ref1 = this._elLookup) != null ? ref1[name] : void 0) != null) {

@@ -89,48 +89,17 @@ el = this._elLookup[name].call(this, name);

case "@":
path = value;
if (isString(value)) {
value = this.$path.toValue({
path: path
}).value;
if (mods == null) {
mods = {};
}
if (mods != null) {
console.log(mods);
if (mods.toggle) {
value = (function(path) {
var o;
o = this.$path.toNameAndParent({
path: path
});
return function() {
return o.parent[o.name] = !o.parent[o.name];
};
}).call(this, path);
}
capture = mods.capture;
fn = (function(cb) {
return function(e) {
if (mods.self && e.target !== el) {
return;
}
if (mods.notPrevented && e.defaultPrevented) {
return;
}
cb.apply(this, arguments);
if (mods.prevent) {
e.preventDefault();
}
if (mods.stop) {
e.stopPropagation();
}
if (mods.once) {
return el.removeEventListener(name, fn);
}
};
}).call(this, value);
if (mods.toggle) {
mods.toggle = value;
} else {
capture = null;
fn = value;
mods.cbs = [value];
}
fn = fn.bind(this);
el.addEventListener(name, fn, capture);
if (mods.event == null) {
mods.event = name;
}
if (mods.el == null) {
mods.el = el;
}
this.$on(mods);
break;

@@ -137,0 +106,0 @@ case "~":

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

var camelize, capitalize, prefixes, ref;
var camelize, capitalize, isArray, prefixes, ref;
prefixes = ["Webkit", "Moz", "ms"];
ref = require("./_helpers"), camelize = ref.camelize, capitalize = ref.capitalize;
ref = require("./_helpers"), camelize = ref.camelize, capitalize = ref.capitalize, isArray = ref.isArray;

@@ -44,3 +44,7 @@ module.exports = {

v = obj[k];
results.push(el.style[k] = v);
if (isArray(v) && (v[0] != null)) {
results.push(el.style[k] = v.join(""));
} else {
results.push(el.style[k] = v);
}
}

@@ -47,0 +51,0 @@ return results;

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

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

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