Comparing version 1.0.0 to 1.1.0
@@ -1,2 +0,2 @@ | ||
// https://github.com/vasturiano/kapsule Version 1.0.0. Copyright 2017 Vasco Asturiano. | ||
// https://github.com/vasturiano/kapsule Version 1.1.0. Copyright 2017 Vasco Asturiano. | ||
(function (global, factory) { | ||
@@ -9,3 +9,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
class Prop { | ||
constructor(name, { defaultVal = null, triggerUpdate = true, onChange = (newVal, state) => {}}) { | ||
constructor(name, { default: defaultVal = null, triggerUpdate = true, onChange = (newVal, state) => {}}) { | ||
this.name = name; | ||
@@ -12,0 +12,0 @@ this.defaultVal = defaultVal; |
@@ -1,2 +0,2 @@ | ||
// https://github.com/vasturiano/kapsule Version 1.0.0. Copyright 2017 Vasco Asturiano. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Kapsule=t()}(this,function(){"use strict";class n{constructor(n,{defaultVal:defaultVal=null,triggerUpdate:triggerUpdate=!0,onChange:onChange=((newVal,state)=>{})}){this.name=n,this.defaultVal=defaultVal,this.triggerUpdate=triggerUpdate,this.onChange=onChange}}return function({props:rawProps={},methods:methods={},init:initFn=(()=>{}),update:updateFn=(()=>{})}){const t=Object.keys(rawProps).map(t=>new n(t,rawProps[t]));return function(){function n(t){return e(t),i(),n}function e(n){initFn(n,a),a.initialised=!0}function i(){a.initialised&&updateFn(a)}let a={initialised:!1};return t.forEach(t=>{n[t.name]=function(t,e=!1,o=((n,t)=>{})){return u=>{return arguments.length?(a[t]=u,o(u,a),e&&i(),n):a[t]}}(t.name,t.triggerUpdate,t.onChange),a[t.name]=t.defaultVal,t.onChange(t.defaultVal,a)}),Object.keys(methods).forEach(t=>{n[t]=((...n)=>methods[t](a,...n))}),n.resetProps=function(){return t.forEach(n=>{a[n.name]=n.defaultVal,n.onChange(n.defaultVal,a)}),i(),n},n}}}); | ||
// https://github.com/vasturiano/kapsule Version 1.1.0. Copyright 2017 Vasco Asturiano. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Kapsule=t()}(this,function(){"use strict";class n{constructor(n,{default:defaultVal=null,triggerUpdate:triggerUpdate=!0,onChange:onChange=((newVal,state)=>{})}){this.name=n,this.defaultVal=defaultVal,this.triggerUpdate=triggerUpdate,this.onChange=onChange}}return function({props:rawProps={},methods:methods={},init:initFn=(()=>{}),update:updateFn=(()=>{})}){const t=Object.keys(rawProps).map(t=>new n(t,rawProps[t]));return function(){function n(t){return e(t),i(),n}function e(n){initFn(n,a),a.initialised=!0}function i(){a.initialised&&updateFn(a)}let a={initialised:!1};return t.forEach(t=>{n[t.name]=function(t,e=!1,o=((n,t)=>{})){return u=>{return arguments.length?(a[t]=u,o(u,a),e&&i(),n):a[t]}}(t.name,t.triggerUpdate,t.onChange),a[t.name]=t.defaultVal,t.onChange(t.defaultVal,a)}),Object.keys(methods).forEach(t=>{n[t]=((...n)=>methods[t](a,...n))}),n.resetProps=function(){return t.forEach(n=>{a[n.name]=n.defaultVal,n.onChange(n.defaultVal,a)}),i(),n},n}}}); |
class Prop { | ||
constructor(name, { defaultVal = null, triggerUpdate = true, onChange = (newVal, state) => {}}) { | ||
constructor(name, { default: defaultVal = null, triggerUpdate = true, onChange = (newVal, state) => {}}) { | ||
this.name = name; | ||
@@ -4,0 +4,0 @@ this.defaultVal = defaultVal; |
{ | ||
"name": "kapsule", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A Simple Web Component library", | ||
@@ -5,0 +5,0 @@ "main": "dist/kapsule.js", |
@@ -28,3 +28,3 @@ # Kapsule | ||
props: { | ||
color: { defaultVal: 'red' }, | ||
color: { default: 'red' }, | ||
text: {} | ||
@@ -31,0 +31,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41369