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

lithiumjs

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lithiumjs - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

dist/index.d.ts

77

dist/index.js

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

// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
require = (function (modules, cache, entry) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof require === "function" && require;
function newRequire(name, jumped) {
if (!cache[name]) {
if (!modules[name]) {
// if we cannot find the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof require === "function" && require;
if (!jumped && currentRequire) {
return currentRequire(name, true);
}
// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) {
return previousRequire(name, true);
}
var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}
function localRequire(x) {
return newRequire(localRequire.resolve(x));
}
localRequire.resolve = function (x) {
return modules[name][1][x] || x;
};
var module = cache[name] = new newRequire.Module;
modules[name][0].call(module.exports, localRequire, module, module.exports);
}
return cache[name].exports;
}
function Module() {
this.bundle = newRequire;
this.exports = {};
}
newRequire.Module = Module;
newRequire.modules = modules;
newRequire.cache = cache;
newRequire.parent = previousRequire;
for (var i = 0; i < entry.length; i++) {
newRequire(entry[i]);
}
// Override the current require with this new one
return newRequire;
})({2:[function(require,module,exports) {
"use strict";function e(e,t,n,i){const o=s?e:e.join("{{--uniqueness-workaround--}}");let l=n.get(o);return void 0===l&&(l=new _(e,i),n.set(o,l)),new r(l,t)}function t(e,t,s=x){let n=t.__templateInstance;if(void 0!==n&&n.template===e.template&&n._partCallback===s)return void n.update(e.values);n=new b(e.template,s),t.__templateInstance=n;const i=n._clone();n.update(e.values);let o;for(;o=t.lastChild;)t.removeChild(o);t.appendChild(i)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.render=t;const s=(e=>e()==e())(()=>e=>e``),n=new Map,i=new Map,o=exports.html=((t,...s)=>e(t,s,n,!1)),l=exports.svg=((t,...s)=>e(t,s,i,!0));class r{constructor(e,t){this.template=e,this.values=t}}exports.TemplateResult=r;const a=`{{lit-${Math.random()}}}`,h=/>[^<]*$/,u=/[^<]*/,p="_-lit-html-_",c=`\x3c!--${p}--\x3e`,d=new RegExp(`${a}|${c}`);class m{constructor(e,t,s,n,i){this.type=e,this.index=t,this.name=s,this.rawName=n,this.strings=i}}exports.TemplatePart=m;class _{constructor(e,t=!1){this.parts=[],this.svg=t,this.element=document.createElement("template"),this.element.innerHTML=this._getHtml(e,t);const s=document.createTreeWalker(this.element.content,133,null,!1);let n=-1,i=0;const o=[];let l,r;for(;s.nextNode();){n++,l=r;const t=r=s.currentNode;if(1===t.nodeType){if(!t.hasAttributes())continue;const s=t.attributes;for(let o=0;o<s.length;o++){const l=s.item(o),r=l.value.split(d);if(r.length>1){const s=e[i],a=s.substring(0,s.length-r[0].length).match(/((?:\w|[.\-_$])+)=["']?$/)[1];this.parts.push(new m("attribute",n,l.name,a,r)),t.removeAttribute(l.name),i+=r.length-1,o--}}}else if(3===t.nodeType){const e=t.nodeValue,s=e.split(a);if(s.length>1){const e=t.parentNode,o=s.length-1;i+=o,t.textContent=s[o];for(let i=0;i<o;i++)e.insertBefore(document.createTextNode(s[i]),t),this.parts.push(new m("node",n++))}else{const s=t.previousSibling,i=t.nextSibling;null!==s&&1!==s.nodeType||null!==i&&1!==i.nodeType||""!==e.trim()||(o.push(t),r=l,n--)}}else if(8===t.nodeType&&t.nodeValue===p){const e=t.parentNode;null===t.previousSibling||t.previousSibling!==l?e.insertBefore(new Text,t):n--,this.parts.push(new m("node",n++)),o.push(t),null===t.nextSibling?e.insertBefore(new Text,t):n--,r=l,i++}}for(const e of o)e.parentNode.removeChild(e)}_getHtml(e,t){const s=e.length,n=[];let i=!1;for(let t=0;t<s-1;t++){const s=e[t];n.push(s),i=null!==s.match(h)||null!==s.match(u)&&i,n.push(i?c:a)}n.push(e[s-1]);const o=n.join("");return t?`<svg>${o}</svg>`:o}}exports.Template=_;const f=exports.getValue=((e,t)=>(null!=t&&!0===t.__litDirective&&(t=t(e)),null===t?void 0:t)),v=exports.directive=(e=>(e.__litDirective=!0,e));class g{constructor(e,t,s,n){this.instance=e,this.element=t,this.name=s,this.strings=n,this.size=n.length-1}setValue(e,t){const s=this.strings;let n="";for(let i=0;i<s.length;i++)if(n+=s[i],i<s.length-1){const s=f(this,e[t+i]);if(s&&(Array.isArray(s)||"string"!=typeof s&&s[Symbol.iterator]))for(const e of s)n+=e;else n+=s}this.element.setAttribute(this.name,n)}}exports.AttributePart=g;class N{constructor(e,t,s){this.instance=e,this.startNode=t,this.endNode=s,this._previousValue=void 0}setValue(e){if(null===(e=f(this,e))||"object"!=typeof e&&"function"!=typeof e){if(e===this._previousValue)return;this._setText(e)}else e instanceof r?this._setTemplateResult(e):Array.isArray(e)||e[Symbol.iterator]?this._setIterable(e):e instanceof Node?this._setNode(e):void 0!==e.then?this._setPromise(e):this._setText(e)}_insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}_setNode(e){this.clear(),this._insert(e),this._previousValue=e}_setText(e){const t=this.startNode.nextSibling;t===this.endNode.previousSibling&&t.nodeType===Node.TEXT_NODE?t.textContent=e:this._setNode(document.createTextNode(void 0===e?"":e)),this._previousValue=e}_setTemplateResult(e){let t;this._previousValue&&this._previousValue.template===e.template?t=this._previousValue:(t=new b(e.template,this.instance._partCallback),this._setNode(t._clone()),this._previousValue=t),t.update(e.values)}_setIterable(e){Array.isArray(this._previousValue)||(this.clear(),this._previousValue=[]);const t=this._previousValue;let s=0;for(const n of e){let e=t[s];if(void 0===e){let n=this.startNode;if(s>0){n=t[s-1].endNode=document.createTextNode(""),this._insert(n)}e=new N(this.instance,n,this.endNode),t.push(e)}e.setValue(n),s++}if(0===s)this.clear(),this._previousValue=void 0;else if(s<t.length){const e=t[s-1];t.length=s,this.clear(e.endNode.previousSibling),e.endNode=this.endNode}}_setPromise(e){e.then(t=>{this._previousValue===e&&this.setValue(t)}),this._previousValue=e}clear(e=this.startNode){let t;for(;(t=e.nextSibling)!==this.endNode;)t.parentNode.removeChild(t)}}exports.NodePart=N;const x=exports.defaultPartCallback=((e,t,s)=>{if("attribute"===t.type)return new g(e,s,t.name,t.strings);if("node"===t.type)return new N(e,s,s.nextSibling);throw new Error(`Unknown part type ${t.type}`)});class b{constructor(e,t=x){this._parts=[],this.template=e,this._partCallback=t}update(e){let t=0;for(const s of this._parts)void 0===s.size?(s.setValue(e[t]),t++):(s.setValue(e,t),t+=s.size)}_clone(){const e=document.importNode(this.template.element.content,!0);if(this.template.parts.length>0){const t=document.createTreeWalker(e,133,null,!1),s=this.template.parts;let n=0,i=0,o=s[0],l=t.nextNode();for(;null!=l&&i<s.length;)n===o.index?(this._parts.push(this._partCallback(this,o,l)),o=s[++i]):(n++,l=t.nextNode())}if(this.template.svg){const t=e.firstChild;e.removeChild(t);const s=t.childNodes;for(let t=0;t<s.length;t++)e.appendChild(s.item(t))}return e}}exports.TemplateInstance=b;
},{}],3:[function(require,module,exports) {
"use strict";function e(e,s){(0,t.render)(e,s,n)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventPart=exports.PropertyPart=exports.extendedPartCallback=exports.html=void 0;var t=require("../lit-html.js");Object.defineProperty(exports,"html",{enumerable:!0,get:function(){return t.html}}),exports.render=e;const n=exports.extendedPartCallback=((e,n,i)=>{if("attribute"===n.type){if(n.rawName.startsWith("on-")){const t=n.rawName.substring(3);return new r(e,i,t)}if(n.name.endsWith("$")){const s=n.name.substring(0,n.name.length-1);return new t.AttributePart(e,i,s,n.strings)}return new s(e,i,n.rawName,n.strings)}return(0,t.defaultPartCallback)(e,n,i)});class s extends t.AttributePart{setValue(e,n){const s=this.strings;let r;if(2===s.length&&""===s[0]&&""===s[s.length-1])r=(0,t.getValue)(this,e[n]);else{r="";for(let i=0;i<s.length;i++)r+=s[i],i<s.length-1&&(r+=(0,t.getValue)(this,e[n+i]))}this.element[this.name]=r}}exports.PropertyPart=s;class r{constructor(e,t,n){this.instance=e,this.element=t,this.eventName=n}setValue(e){const n=(0,t.getValue)(this,e);n!==this._listener&&(null==n?this.element.removeEventListener(this.eventName,this):null==this._listener&&this.element.addEventListener(this.eventName,this),this._listener=n)}handleEvent(e){"function"==typeof this._listener?this._listener.call(this.element,e):"function"==typeof this._listener.handleEvent&&this._listener.handleEvent(e)}}exports.EventPart=r;
},{"../lit-html.js":2}],4:[function(require,module,exports) {
"use strict";function e(e,o,d){let s;return 2===arguments.length?d=o:3===arguments.length&&(s=o),(0,t.directive)(o=>{let r=n.get(o);void 0===r&&(r={keyMap:s&&new Map,parts:[]},n.set(o,r));const i=o.startNode.parentNode,a=r.parts,N=new Map(a.map(e=>[e.endNode,e])),c=r.keyMap,l=[];let f,g=0;for(const n of e){let e,r;try{e=d(n,g++),r=s&&s(n)}catch(e){continue}let p=void 0===c?a[0]:c.get(r);if(void 0===p){void 0===f&&(f=new Text,i.insertBefore(f,o.startNode.nextSibling));const e=new Text;i.insertBefore(e,f.nextSibling),p=new t.NodePart(o.instance,f,e),void 0!==r&&void 0!==c&&c.set(r,p)}else{const e=document.createRange();if(e.setStartBefore(p.startNode),e.setEndBefore(p.endNode),void 0===f){if(o.startNode.nextSibling!==p.startNode){const t=N.get(p.startNode);t&&(t.endNode=p.endNode,N.set(t.endNode,t));const n=e.extractContents();o.startNode.nextSibling===o.endNode?(p.endNode=new Text,i.insertBefore(p.endNode,o.startNode.nextSibling)):p.endNode=o.startNode.nextSibling,i.insertBefore(n,o.startNode.nextSibling)}}else if(f!==p.startNode){const t=N.get(p.startNode);t&&(t.endNode=p.endNode,N.set(t.endNode,t));const n=e.extractContents();i.insertBefore(n,f)}a.splice(a.indexOf(p),1)}p.setValue(e),l.push(p),f=p.endNode}if(a.length>0){const e=a[0].startNode,t=a[a.length-1].endNode,n=document.createRange();0===l.length?n.setStartBefore(e):n.setStartAfter(e),n.setEndAfter(t),n.deleteContents(),n.detach()}r.parts=l})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.repeat=e;var t=require("../lit-html.js");const n=new WeakMap;
},{"../lit-html.js":2}],1:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LithiumComponent=exports.TemplateResult=exports.repeat=exports.html=void 0;var e=require("lit-html/lib/lit-extended"),t=require("lit-html/lib/repeat"),r=require("lit-html");exports.html=e.html,exports.repeat=t.repeat,exports.TemplateResult=r.TemplateResult;class s extends HTMLElement{constructor(){super(),this.props={},this._props={},this.attachShadow({mode:"open"})}static get tagName(){throw new Error("Element must have tag name")}connectedCallback(){this._render(),this.onInit(),this.makeGetterSetters()}disconnectedCallback(){this.onDestroy()}attributeChangedCallback(e,t,r){const s=e.replace(/-([a-z])/g,e=>e[1].toUpperCase());this.props[s]=r,this.onChange(s,t,r)}emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}render(){return e.html`Render Function not defined`}onInit(){}onDestroy(){}onChange(e,t,r){}_render(){(0,e.render)(this.render(),this.shadowRoot)}makeGetterSetters(){for(const e in this.props)this._props[e]=this.props[e],Object.defineProperty(this.props,e,{set:t=>{this._props[e]!==t&&(this._props[e]=t,this._render())},get:()=>this._props[e],enumerable:!0,configurable:!0})}}exports.LithiumComponent=s;
},{"lit-html":2,"lit-html/lib/lit-extended":3,"lit-html/lib/repeat":4}]},{},[1])
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const lit_extended_1=require("lit-html/lib/lit-extended");exports.html=lit_extended_1.html;const repeat_1=require("lit-html/lib/repeat");exports.repeat=repeat_1.repeat;const lit_html_1=require("lit-html");exports.TemplateResult=lit_html_1.TemplateResult;class LithiumComponent extends HTMLElement{constructor(){super(),this.props={},this._props={},this.attachShadow({mode:"open"})}static get tagName(){throw new Error("Element must have tag name")}connectedCallback(){this._render(),this.onInit(),this.makeGetterSetters()}disconnectedCallback(){this.onDestroy()}attributeChangedCallback(a,b,c){const d=a.replace(/-([a-z])/g,(a)=>a[1].toUpperCase());this.props[d]=c,this.onChange(d,b,c)}emit(a,b){this.dispatchEvent(new CustomEvent(a,{detail:b}))}render(){return lit_extended_1.html`Render Function not defined`}onInit(){}onDestroy(){}onChange(){}_render(){lit_extended_1.render(this.render(),this.shadowRoot)}makeGetterSetters(){for(const a in this.props)this._props[a]=this.props[a],Object.defineProperty(this.props,a,{set:(b)=>{this._props[a]!==b&&(this._props[a]=b,this._render())},get:()=>this._props[a],enumerable:!0,configurable:!0})}}exports.LithiumComponent=LithiumComponent;
{
"name": "lithiumjs",
"version": "0.0.17",
"version": "0.0.18",
"description": "",

@@ -9,3 +9,3 @@ "main": "./dist/index.js",

"start": "npm run build",
"build": "rm -rf dist && parcel build ./src/index.ts",
"build": "rm -rf dist && tsc && minify dist -d dist",
"publish": "npm run build && npm publish"

@@ -12,0 +12,0 @@ },

{
"compilerOptions": {
"target": "es2016",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "ES2015",
"module": "commonjs",
"declaration": true,
"lib": [
"dom",
"es2016"
]
"outDir": "dist",
},
"include": [
"src/**/*"
],
]
}
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