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

lucia

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucia - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1-0

16

dist/lucia.js

@@ -262,3 +262,3 @@ (function (global, factory) {

set: function set(target, key, value) {
target[key] = value; // Support array mutators - note that it patches ALL arrays, not specific ones or a weak arr compare
target[key] = value;

@@ -443,3 +443,8 @@ if (key === 'length') {

var cssId = el.id ? "#".concat(el.id) : '';
var cssClass = el.className ? ".".concat(el.className.replace(/\s+/g, '.')) : '';
var cssClass = '';
if (el.className && typeof el.className === 'string') {
cssClass = ".".concat(el.className.replace(/\s+/g, '.').replace(/[:*+?^${}()|[\]\\]/gi, '\\$&'));
}
parents.unshift({

@@ -551,3 +556,3 @@ el: el,

var VDom = /*#__PURE__*/function () {
function VDom(data) {
function VDom(options) {
_classCallCheck(this, VDom);

@@ -560,3 +565,3 @@

this.$vdom = null;
this.$view = data;
this.$view = options;
}

@@ -724,2 +729,3 @@

var components = Array.from(document.querySelectorAll('[l-use]'));
var scopedEval = eval;

@@ -730,3 +736,3 @@ for (var _i = 0, _components = components; _i < _components.length; _i++) {

if (options === null) return;
var app = createApp(eval(options));
var app = createApp(scopedEval("(".concat(options, ")")));
app.mount(component);

@@ -733,0 +739,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Lucia={})}(this,(function(exports){function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var o=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){a=!0,i=e},f:function(){try{c||null==r.return||r.return()}finally{if(a)throw i}}}}var arrayEquals=function(e,t){return e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((function(e,r){return e===t[r]}))},observer=function(e,t,r){var n={get:function(e,t){return"object"===_typeof(e[t])&&null!==e[t]?new Proxy(e[t],n):e[t]},set:function(n,o,i){return n[o]=i,t(r,"length"===o?Object.keys(e).filter((function(t){return e[t]instanceof Array&&arrayEquals(n,e[t])})):[o]),!0},deleteProperty:function(n,o){return delete n[o],t(r,"length"===o?Object.keys(e).filter((function(t){return e[t]instanceof Array})):[o]),!0}};return new Proxy(e,n)},wrapScope=function(e){return"(function(){with(_){".concat(e,"}})()")},computeProperties=function computeProperties(expression,_){var returnable=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return eval(wrapScope(returnable?"return ".concat(expression):expression))},bindDirective=function(e,t,r,n){switch(t.split(":")[1]){case"class":var o=computeProperties(r,n,!0);if("string"==typeof o)return e.setAttribute("class","".concat(e.className," ").concat(o).trim());if(o instanceof Array)return e.setAttribute("class","".concat(e.className," ").concat(o.join(" ").trim()));var i=[];for(var c in o)o[c]&&i.push(c);return i.length>0?e.setAttribute("class","".concat(e.className," ").concat(o.join(" ").trim())):e.className.length.trim()>0?e.setAttribute("class",e.className):e.removeAttribute("class");case"style":var a=computeProperties(r,n);for(var u in e.removeAttribute("style"),a)e.style[u]=a[u];break;default:var s=computeProperties(r,n);s?e.setAttribute(t.split(":")[1],s):e.removeAttribute(t.split(":")[1])}},joinDirective=function(e,t,r,n){var o=r.split("by "),i=computeProperties(o[0],n);e.innerHTML=void 0!==i?i.join(o[1]||""):o[0].join(o[1]||"")},htmlDirective=function(e,t,r,n){var o=computeProperties(r,n);e.innerHTML=void 0!==o?o:r},ifDirective=function(e,t,r,n){e.hidden=!computeProperties(r,n)},modelDirective=function(e,t,r,n){e.value=n[r],e.oninput=function(){var t="number"==typeof n[r]&&!isNaN(e.value),o="boolean"==typeof n[r]&&("true"===e.value||"false"===e.value),i=!(null!==n[r]&&void 0!==n[r]||"null"!==e.value&&"undefined"!==e.value);t?n[r]=Number(e.value).toPrecision():o?n[r]=Boolean(e.value):i?"null"===e.value?n[r]=null:n[r]=void 0:n[r]=e.value}},onDirective=function(e,t,r,n){var o=t.split("."),i=o[0].split(":")[1],c=o[1]||null;e["on".concat(i)]=function(e){"prevent"===c&&e.preventDefault(),"stop"===c&&e.stopPropagation(),computeProperties(r,n,!0)}},textDirective=function(e,t,r,n){var o=computeProperties(r,n);e.textContent=void 0!==o?o:r},renderDirective=function(e){var t=e.el,r=e.name,n=e.value,o=e.view;({bind:bindDirective,join:joinDirective,html:htmlDirective,if:ifDirective,model:modelDirective,on:onDirective,text:textDirective})[r.split(":")[0]](t,r,n,o)},parentElements=function(e){for(var t=[];e;){var r=e.nodeName.toLowerCase(),n=e.id?"#".concat(e.id):"",o=e.className?".".concat(e.className.replace(/\s+/g,".")):"";t.unshift({el:e,selector:r+n+o}),e=e.parentNode!==document&&e.parentNode}return t},nthElement=function(e){for(var t=e,r=1;null!==t.previousElementSibling;)t.previousElementSibling.nodeName===e.nodeName&&r++,t=t.previousElementSibling;return r},nthSelectorNeeded=function(e,t){var r=""===t?e:"".concat(t," > ").concat(e);return document.querySelectorAll(r).length>1},buildPathString=function(e){var t,r=[],n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;nthSelectorNeeded(o.selector,r.join(" > "))&&(o.selector+=":nth-of-type(".concat(nthElement(o.el),")")),r.push(o.selector)}}catch(e){n.e(e)}finally{n.f()}var i,c=_createForOfIteratorHelper(r);try{for(c.s();!(i=c.n()).done;){var a=i.value;a.includes("#")&&(r=r.slice(r.indexOf(a)))}}catch(e){c.e(e)}finally{c.f()}return r.join(" > ")},getProps=function(e){var t={},r={};if(e.attributes||e.directives){var n,o=_createForOfIteratorHelper(e.attributes);try{for(o.s();!(n=o.n()).done;){var i=n.value,c=i.name,a=i.value;c.startsWith("l-")?r[c.replace("l-","")]=a:t[c]=a}}catch(e){o.e(e)}finally{o.f()}}return{attributes:t,directives:r}},getSelector=function(e){return buildPathString(parentElements(e))},VDom=function(){function e(t){_classCallCheck(this,e),_defineProperty(this,"$vdom",void 0),_defineProperty(this,"$view",void 0),this.$vdom=null,this.$view=t}return _createClass(e,[{key:"mount",value:function(e){return this.$vdom=this.$buildVNodeTree("string"==typeof e?document.querySelector(e):e),this.$view=observer(this.$view,this.$patch.bind(this),this.$vdom),this.$patch(this.$vdom,Object.keys(this.$view)),this.$view}},{key:"$createVNode",value:function(e,t){var r=t.tag,n=t.attributes,o=void 0===n?{}:n,i=t.directives,c=void 0===i?{}:i,a=t.children;return{sel:e,tag:r,attributes:o,directives:c,children:void 0===a?[]:a}}},{key:"$buildVNodeTree",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)throw new Error("Please provide a Element");var r,n=[],o=Array.prototype.slice.call(e.childNodes),i=_createForOfIteratorHelper(o);try{for(i.s();!(r=i.n()).done;){var c=r.value;switch(c.nodeType){case Node.TEXT_NODE:n.push(c.nodeValue);break;case Node.ELEMENT_NODE:var a=getProps(c),u=a.attributes,s=a.directives;n.push(this.$createVNode(getSelector(c),{tag:c.tagName.toLowerCase(),attributes:u,directives:s,children:this.$buildVNodeTree(c,!0)}))}}}catch(e){i.e(e)}finally{i.f()}var l=getProps(e),f=l.attributes,p=l.directives;return t?n:this.$createVNode(getSelector(e),{tag:e.tagName.toLowerCase(),attributes:f,directives:p,children:n})}},{key:"$patch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){for(var n=_objectSpread2({},this.$view),o=0;o<e.children.length;o++){var i=e.children[o],c=i,a=c.sel,u=c.directives,s=c.attributes;if("string"!=typeof i){for(var l in u){var f,p=u[l],v=_createForOfIteratorHelper(t);try{for(v.s();!(f=v.n()).done;){var d=f.value,y=p.toString().includes(d),h=!1;for(var b in n)if("function"==typeof n[b]&&n[b].toString().includes("this.".concat(b))){h=!0;break}if(y||h){var m=s.id?document.getElementById(s.id):document.querySelector(a);renderDirective({el:m,name:l,value:p,view:this.$view});break}}}catch(e){v.e(e)}finally{v.f()}}i=this.$patch(i,t,!0)}}return r?e:void 0}}}]),e}(),Lucia=function(e){_inherits(r,e);var t=_createSuper(r);function r(e){return _classCallCheck(this,r),t.call(this,e||{})}return r}(VDom),createApp=function(e){return new Lucia(e)};document.addEventListener("DOMContentLoaded",(function(){for(var components=Array.from(document.querySelectorAll("[l-use]")),_i=0,_components=components;_i<_components.length;_i++){var component=_components[_i],options=component.getAttribute("l-use");if(null===options)return;var app=createApp(eval(options));app.mount(component)}})),exports.Lucia=Lucia,exports.createApp=createApp,Object.defineProperty(exports,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Lucia={})}(this,(function(exports){function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var o=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}var arrayEquals=function(e,t){return e instanceof Array&&t instanceof Array&&e.length===t.length&&e.every((function(e,r){return e===t[r]}))},observer=function(e,t,r){var n={get:function(e,t){return"object"===_typeof(e[t])&&null!==e[t]?new Proxy(e[t],n):e[t]},set:function(n,o,i){return n[o]=i,t(r,"length"===o?Object.keys(e).filter((function(t){return e[t]instanceof Array&&arrayEquals(n,e[t])})):[o]),!0},deleteProperty:function(n,o){return delete n[o],t(r,"length"===o?Object.keys(e).filter((function(t){return e[t]instanceof Array})):[o]),!0}};return new Proxy(e,n)},wrapScope=function(e){return"(function(){with(_){".concat(e,"}})()")},computeProperties=function computeProperties(expression,_){var returnable=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return eval(wrapScope(returnable?"return ".concat(expression):expression))},bindDirective=function(e,t,r,n){switch(t.split(":")[1]){case"class":var o=computeProperties(r,n,!0);if("string"==typeof o)return e.setAttribute("class","".concat(e.className," ").concat(o).trim());if(o instanceof Array)return e.setAttribute("class","".concat(e.className," ").concat(o.join(" ").trim()));var i=[];for(var a in o)o[a]&&i.push(a);return i.length>0?e.setAttribute("class","".concat(e.className," ").concat(o.join(" ").trim())):e.className.length.trim()>0?e.setAttribute("class",e.className):e.removeAttribute("class");case"style":var c=computeProperties(r,n);for(var u in e.removeAttribute("style"),c)e.style[u]=c[u];break;default:var s=computeProperties(r,n);s?e.setAttribute(t.split(":")[1],s):e.removeAttribute(t.split(":")[1])}},joinDirective=function(e,t,r,n){var o=r.split("by "),i=computeProperties(o[0],n);e.innerHTML=void 0!==i?i.join(o[1]||""):o[0].join(o[1]||"")},htmlDirective=function(e,t,r,n){var o=computeProperties(r,n);e.innerHTML=void 0!==o?o:r},ifDirective=function(e,t,r,n){e.hidden=!computeProperties(r,n)},modelDirective=function(e,t,r,n){e.value=n[r],e.oninput=function(){var t="number"==typeof n[r]&&!isNaN(e.value),o="boolean"==typeof n[r]&&("true"===e.value||"false"===e.value),i=!(null!==n[r]&&void 0!==n[r]||"null"!==e.value&&"undefined"!==e.value);t?n[r]=Number(e.value).toPrecision():o?n[r]=Boolean(e.value):i?"null"===e.value?n[r]=null:n[r]=void 0:n[r]=e.value}},onDirective=function(e,t,r,n){var o=t.split("."),i=o[0].split(":")[1],a=o[1]||null;e["on".concat(i)]=function(e){"prevent"===a&&e.preventDefault(),"stop"===a&&e.stopPropagation(),computeProperties(r,n,!0)}},textDirective=function(e,t,r,n){var o=computeProperties(r,n);e.textContent=void 0!==o?o:r},renderDirective=function(e){var t=e.el,r=e.name,n=e.value,o=e.view;({bind:bindDirective,join:joinDirective,html:htmlDirective,if:ifDirective,model:modelDirective,on:onDirective,text:textDirective})[r.split(":")[0]](t,r,n,o)},parentElements=function(e){for(var t=[];e;){var r=e.nodeName.toLowerCase(),n=e.id?"#".concat(e.id):"",o="";e.className&&"string"==typeof e.className&&(o=".".concat(e.className.replace(/\s+/g,".").replace(/[:*+?^${}()|[\]\\]/gi,"\\$&"))),t.unshift({el:e,selector:r+n+o}),e=e.parentNode!==document&&e.parentNode}return t},nthElement=function(e){for(var t=e,r=1;null!==t.previousElementSibling;)t.previousElementSibling.nodeName===e.nodeName&&r++,t=t.previousElementSibling;return r},nthSelectorNeeded=function(e,t){var r=""===t?e:"".concat(t," > ").concat(e);return document.querySelectorAll(r).length>1},buildPathString=function(e){var t,r=[],n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;nthSelectorNeeded(o.selector,r.join(" > "))&&(o.selector+=":nth-of-type(".concat(nthElement(o.el),")")),r.push(o.selector)}}catch(e){n.e(e)}finally{n.f()}var i,a=_createForOfIteratorHelper(r);try{for(a.s();!(i=a.n()).done;){var c=i.value;c.includes("#")&&(r=r.slice(r.indexOf(c)))}}catch(e){a.e(e)}finally{a.f()}return r.join(" > ")},getProps=function(e){var t={},r={};if(e.attributes||e.directives){var n,o=_createForOfIteratorHelper(e.attributes);try{for(o.s();!(n=o.n()).done;){var i=n.value,a=i.name,c=i.value;a.startsWith("l-")?r[a.replace("l-","")]=c:t[a]=c}}catch(e){o.e(e)}finally{o.f()}}return{attributes:t,directives:r}},getSelector=function(e){return buildPathString(parentElements(e))},VDom=function(){function e(t){_classCallCheck(this,e),_defineProperty(this,"$vdom",void 0),_defineProperty(this,"$view",void 0),this.$vdom=null,this.$view=t}return _createClass(e,[{key:"mount",value:function(e){return this.$vdom=this.$buildVNodeTree("string"==typeof e?document.querySelector(e):e),this.$view=observer(this.$view,this.$patch.bind(this),this.$vdom),this.$patch(this.$vdom,Object.keys(this.$view)),this.$view}},{key:"$createVNode",value:function(e,t){var r=t.tag,n=t.attributes,o=void 0===n?{}:n,i=t.directives,a=void 0===i?{}:i,c=t.children;return{sel:e,tag:r,attributes:o,directives:a,children:void 0===c?[]:c}}},{key:"$buildVNodeTree",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)throw new Error("Please provide a Element");var r,n=[],o=Array.prototype.slice.call(e.childNodes),i=_createForOfIteratorHelper(o);try{for(i.s();!(r=i.n()).done;){var a=r.value;switch(a.nodeType){case Node.TEXT_NODE:n.push(a.nodeValue);break;case Node.ELEMENT_NODE:var c=getProps(a),u=c.attributes,s=c.directives;n.push(this.$createVNode(getSelector(a),{tag:a.tagName.toLowerCase(),attributes:u,directives:s,children:this.$buildVNodeTree(a,!0)}))}}}catch(e){i.e(e)}finally{i.f()}var l=getProps(e),f=l.attributes,p=l.directives;return t?n:this.$createVNode(getSelector(e),{tag:e.tagName.toLowerCase(),attributes:f,directives:p,children:n})}},{key:"$patch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){for(var n=_objectSpread2({},this.$view),o=0;o<e.children.length;o++){var i=e.children[o],a=i,c=a.sel,u=a.directives,s=a.attributes;if("string"!=typeof i){for(var l in u){var f,p=u[l],v=_createForOfIteratorHelper(t);try{for(v.s();!(f=v.n()).done;){var d=f.value,y=p.toString().includes(d),h=!1;for(var b in n)if("function"==typeof n[b]&&n[b].toString().includes("this.".concat(b))){h=!0;break}if(y||h){var m=s.id?document.getElementById(s.id):document.querySelector(c);renderDirective({el:m,name:l,value:p,view:this.$view});break}}}catch(e){v.e(e)}finally{v.f()}}i=this.$patch(i,t,!0)}}return r?e:void 0}}}]),e}(),Lucia=function(e){_inherits(r,e);var t=_createSuper(r);function r(e){return _classCallCheck(this,r),t.call(this,e||{})}return r}(VDom),createApp=function(e){return new Lucia(e)};document.addEventListener("DOMContentLoaded",(function(){for(var e=Array.from(document.querySelectorAll("[l-use]")),t=eval,r=0,n=e;r<n.length;r++){var o=n[r],i=o.getAttribute("l-use");if(null===i)return;createApp(t("(".concat(i,")"))).mount(o)}})),exports.Lucia=Lucia,exports.createApp=createApp,Object.defineProperty(exports,"__esModule",{value:!0})}));
{
"name": "lucia",
"version": "0.1.0",
"version": "0.1.1-0",
"description": "Tiny library for tiny web apps.",
"main": "dist/lucia.js",
"browser": "dist/lucia.min.js",
"module": "dist/lucia.esm.js",
"scripts": {
"build": "del-cli dist/ && rollup -c",
"build:dev": "del-cli dist/ && rollup -c -w"
"dev": "del-cli dist/ && rollup -c -w",
"build": "npm run build:src && npm run build:docs",
"build:src": "del-cli dist/ && rollup -c",
"build:docs": "typedoc --out docs src",
"test": "exit 0"
},

@@ -45,4 +47,6 @@ "repository": {

"rollup": "2.15.0",
"rollup-plugin-terser": "^7.0.2"
"rollup-plugin-terser": "^7.0.2",
"typedoc": "^0.19.2",
"typescript": "^4.0.3"
}
}

@@ -11,3 +11,3 @@ [![Lucia](https://raw.githubusercontent.com/aidenybai/lucia/master/.github/img/banner.svg)](https://lucia.js.org)

- **Reactive:** When the view is changed, the interal reference Virtual DOM will automatically react and will update and render the new view in realtime.
- **Lightweight:** Lucia is extremely light (~3kb min+brotli) and performant as it does not use a tranditional VDom, rather it renders directives only if necessary by skipping static nodes through selectors.
- **Lightweight:** Lucia is extremely light (~4kb min+brotli) and performant as it does not use a tranditional Virtual DOM, rather it renders directives only if necessary by skipping static nodes through selectors.

@@ -20,3 +20,3 @@ ## Installation

<!-- development version, includes helpful console warnings -->
<script src="https://unpkg.com/lucia/dist/lucia.js"></script>
<script src="https://unpkg.com/lucia/dist/lucia.js" defer></script>
```

@@ -26,3 +26,3 @@

<!-- production version, optimized for size and speed -->
<script src="https://unpkg.com/lucia"></script>
<script src="https://unpkg.com/lucia" defer></script>
```

@@ -32,22 +32,10 @@

Below is an example of a clicker game in Lucia.
Below is an example of a clicker game in Lucia. No, your eyes aren't fooling you - it's really that simple.
```html
<div l-use="ClickerGame()">
<button l-on:click="addPoints(1)" l-text="points"></button>
<div l-use="{ count: 0 }">
<button l-text="count" l-on:click="++count"></button>
</div>
```
```js
function ClickerGame() {
return {
points: localStorage.points || 0,
addPoints(amount = 1) {
this.points += amount;
localStorage.points = this.points;
},
};
}
```
## Features

@@ -54,0 +42,0 @@

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