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

ceri

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ceri - npm Package Compare versions

Comparing version

to
1.0.5

@@ -13,12 +13,36 @@ var arrayize, isString, ref;

methods: {
"$emit": function(el, name, options) {
"$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);
},
"$on": function(o) {
var 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;
},
"$emit": function(o) {
var evt;
if (isString(el)) {
options = name;
name = el;
el = this;
if (o.el == null) {
o.el = this;
}
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(name, false, false, options);
return el.dispatchEvent(evt);
evt.initCustomEvent(o.name, false, false, o.detail);
return o.el.dispatchEvent(evt);
}

@@ -25,0 +49,0 @@ },

@@ -27,3 +27,3 @@ var arrayize, camelize, hyphenate, ref;

}),
mixins: [require("./watch"), require("./$setAttribute")],
mixins: [require("./watch"), require("./setAttribute")],
attributeChangedCallback: function(name, oldVal, newVal) {

@@ -30,0 +30,0 @@ var camelized, prop, val;

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

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

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

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

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

case "@":
path = value;
if (isString(value)) {
value = this.$path.toValue({
path: value
path: path
}).value;
}
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(e) {
if (mods.self && e.target !== el) {
return;
}
if (mods.notPrevented && e.defaultPrevented) {
return;
}
value.apply(this, arguments);
if (mods.prevent) {
e.preventDefault();
}
if (mods.stop) {
e.stopPropagation();
}
if (mods.once) {
return el.removeEventListener(name, fn);
}
};
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);
} else {

@@ -184,11 +199,13 @@ capture = null;

child = ref2[j];
slot = child.getAttribute("slot");
if (slot != null) {
if ((ref3 = this._slots[slot]) != null) {
ref3.appendChild(slot);
if (child != null) {
slot = child.getAttribute("slot");
if (slot != null) {
if ((ref3 = this._slots[slot]) != null) {
ref3.appendChild(slot);
}
} else {
if ((ref4 = this._slots["default"]) != null) {
ref4.appendChild(child);
}
}
} else {
if ((ref4 = this._slots["default"]) != null) {
ref4.appendChild(child);
}
}

@@ -195,0 +212,0 @@ }

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

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

@@ -33,3 +33,3 @@ # ceriJS

Custom elements aren't widely adopted, yet.
So you have to use the lightweight custom-element polyfill:
So you have to use the lightweight [custom-element polyfill](https://github.com/WebReflection/document-register-element):
```sh

@@ -67,2 +67,12 @@ npm install --save-dev document-register-element

The native customElements implementation depends on ES6 classes, this requires some setup of webpack when using the UglifyJSPlugin:
```sh
npm install --save-dev uglifyjs-webpack-plugin git://github.com/mishoo/UglifyJS2#harmony
```
then use it in your webpack.config
```coffee
UglifyJSPlugin = require("uglifyjs-webpack-plugin")
plugins: [new UglifyJSPlugin()]
```
## I want to build a component with ceri

@@ -69,0 +79,0 @@