@verajs/lite 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/development/vera-lite.d.ts +8 -1
- package/dist/development/vera-lite.d.ts.map +1 -1
- package/dist/development/vera-lite.js +16 -8
- package/dist/development/vera-lite.js.map +1 -1
- package/dist/vera-lite.min.js +1 -1
- package/dist/vera-lite.min.js.map +1 -1
- package/package.json +1 -1
package/dist/vera-lite.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const t=(t,e,n)=>`${t}: https://verajs.dev/e/${e}`,e=/^[\u0000- ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/i,n=/^(?:(href|src|action|formaction|xlink:href|data)|to|from|by|values)$/i,o=/(?:^|;)[\u0000- ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/i,r=/^on./i,l=/json\s*$/i,s=(t,e)=>e?t.replace(/</g,"\\u003c"):t.replace(/<\/(style)/gi,"<\\/$1"),i=t=>t.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),c=/<[a-zA-Z](?:[^>"']|"[^"]*"|'[^']*')*("[^"]*|'[^']*)?$/,f=/([^\s"'>/=]+)\s*=\s*(?:"[^"]*|'[^']*|[^\s"'>]*)$/,u=/^\u0001(\d+)$/,a=/\u0002(\d+)\u0002/g,d=/<!--\u0001(\d+)-->/g,h=/^(?:script|iframe|noscript|xmp|noembed|noframes|plaintext|template)$/i,v=/^(?:title|textarea|style)$/i,p=/<script\b(?:[^>"']|"[^"]*"|'[^']*')*>?/gi,y=(t=>t)`[object Object]`,$=t=>r.test(t)||"srcdoc"===t.toLowerCase(),b=t=>{const r=n.exec(t);return null===r?null:r[1]?e:o},m=new WeakMap,_=(t,e)=>{const n=[];for(;t!==e;t=t.parentNode){let e=0;for(let n=t.previousSibling;null!==n;n=n.previousSibling)e++;n.unshift(e)}return n},g=()=>{throw new TypeError(t("html","tier-hole-position"))},j=(t,e,n,o)=>(!1===e[t]&&null===n[t]===o||g(),e[t]=!0,t),x=(t,e,n,o)=>{const r=t.split(e),l=[];let s=-1;for(let t=0;t<r.length;t++)if(t%2==0)l.push(r[t]);else{const l=j(+r[t],n,o,e===d);-1===s&&(s=l)}return[l,s]},O=(t,e,n,o,r)=>{let s=!1;for(let i=t.firstChild;null!==i;i=i.nextSibling)if(1===i.nodeType){const t=i;(t.localName.includes("-")||t.hasAttribute("is"))&&(s=!0);let c=!0;const f="script"===t.localName?t.getAttribute("type")??"":"";let p=!1;for(const{name:r,value:l}of[...t.attributes]){const[s,f]=x(l,a,e,o);if(-1===f)continue;p=!0;let u=r;(/^[@.!?]/.test(r)||/^on[A-Z]/.test(o[f]))&&(u=o[f],u.toLowerCase()!==r&&g(),"o"===u[0]&&(u=`@${r.slice(2)}`),".innerHTML"!==u&&".textContent"!==u||(c=!1)),t.removeAttribute(r),n.push([i,u,s,f])}if(!c)continue;if(v.test(t.localName)||"script"===t.localName&&r&&!p&&l.test(f)){let r="",l=!0;for(let e=t.firstChild;null!==e;e=e.nextSibling)3===e.nodeType?r+=e.data:8===e.nodeType?r+=u.test(e.data)?`\x3c!--${e.data}--\x3e`:"":l=!1;if(l&&!r.includes(`\x3c!--${e.length-1}--\x3e`)){const[l,s]=x(r,d,e,o);-1!==s&&(t.textContent="",n.push([i,"",l,s]))}}else!h.test(t.localName)&&O(i,e,n,o,r)&&(s=!0)}else if(8===i.nodeType){const t=u.exec(i.data);null!==t&&n.push([i,null,null,j(+t[1],e,o,!0)])}return s},w=(e,n,o)=>{let r=m.get(e);if(void 0===r){const l=(t=>(t=>Array.isArray(t)&&Object.hasOwn(t,"raw"))(t)?t:y)(e);if(l!==e)return w(l,n,1);m.set(e,r=((e,n,o)=>{let r=e[0];const l=[];for(let t=1;t<e.length;t++){const n=c.exec(r);l.push(n?f.exec(r)?.[1]??"":null),r+=(n?`${t-1}${n[1]||!e[t].startsWith("/>")?"":" "}`:`\x3c!--${t-1}--\x3e`)+e[t]}l.push(null);const s=n.createElement("template"),i=["","","svg","math"][o],a=`\x3c!--${e.length-1}--\x3e`;s.innerHTML=i?`<${i}>${r}${a}</${i}>`:r+a;const d=s.content??s;i&&d.firstChild.replaceWith(...d.firstChild.childNodes);let h=!0;for(const[t]of e.join("").matchAll(p))t.includes("&")&&(h=!1);const v=new Array(e.length).fill(!1),y=[],$=O(d,v,y,l,h),b=v.indexOf(!1);if(-1!==b)throw b<e.length-1&&g(),new TypeError(t("html","unfinished-tag"));const[m,,,j]=y.pop();j!==e.length-1&&g(),m.remove(),null===d.firstChild&&d.append(n.createTextNode(""));const x=d.firstChild;8===x.nodeType&&u.test(x.data)&&d.prepend(n.createComment(""));for(let t=0;t<y.length;t++){const[e,o,,r]=y[t];if(null===o&&e.parentNode!==d&&1===e.parentNode.childNodes.length){const o=e.parentNode;e.replaceWith(n.createTextNode("")),y[t]=[o,"",null,r]}}const w=1===d.childNodes.length&&1===d.firstChild.nodeType?d.firstChild:d;return[w,y.map((([t,e,n,o])=>[_(t,w),e,n,o])),!$,w===s]})(e,n,o))}const[l,s,i,a]=r;let d=i?l.cloneNode(!0):n.importNode(l,!0);const h=s.slice();for(let t=0;t<s.length;t++){const[e,n,o]=s[t];let r=d;for(let t=0;t<e.length;t++){r=r.firstChild;for(let n=e[t];n>0;n--)r=r.nextSibling}h[t]=null===n?L(r.previousSibling,r):""===n?z(r.firstChild):""===n?Z(r,o):I(r,n,o)}if(a){const t=n.createDocumentFragment();t.append(...d.childNodes),d=t}return[d,h,s]},T=(t,e,n)=>{for(let o=0;o<t.length;o++)t[o](n,e[o][3])},A=(t,e)=>{for(let n=t;;){const t=n.nextSibling;if(n.remove(),n===e)return;n=t}},S=t=>Array.isArray(t)||null!==t&&"object"==typeof t&&"function"==typeof t[Symbol.iterator]&&void 0===t.nodeType,E=t=>null==t?"":"object"==typeof t&&void 0!==t.strings?k:`${t}`,k=`${{}}`,M={},C=(t,e,n,o)=>{const r=t[e],l=n.ownerDocument;if(r?._$litType$){const{strings:t,values:e,_$litType$:s}=r,[i,c,f]=/*@__NOINLINE__*/w(t,l,s);T(c,f,e);const u=11===i.nodeType,a={t:u?i.firstChild:i,o:u?i.lastChild:i,l:t,i:c,u:f};return n.insertBefore(i,o),a}if(S(r)){const r=l.createComment(""),s=l.createComment("");n.insertBefore(r,o),n.insertBefore(s,o);const i=L(r,s);return i(t,e),{t:r,o:s,h:i}}const s=l.createTextNode(E(r));return n.insertBefore(s,o),{t:s,o:s,v:r}},q=(t,e,n,o)=>{const r=t[e],l=n[o];if(l?._$litType$){if(r.l===l.strings)return T(r.i,r.u,l.values)}else if(S(l)){if(void 0!==r.h)return r.h(n,o)}else if(void 0===r.l&&void 0===r.h)return void(l!==r.v&&(r.t.data=E(r.v=l)));t[e]=C(n,o,r.o.parentNode,r.o.nextSibling),A(r.t,r.o)},L=(t,e)=>{let n,o=!1;const r=()=>{if(void 0!==n){if(null===t&&null===e.nextSibling)e.parentNode.replaceChildren(e);else for(let n=null===t?e.parentNode.firstChild:t.nextSibling;n!==e;){const t=n.nextSibling;n.remove(),n=t}n=void 0}};return(t,l)=>{let s=t[l];if(Array.isArray(s)||s?._$litType$||!S(s)||(s=[...s]),Array.isArray(s)){o&&void 0!==n&&0!==s.length||(r(),n=[],o=!0);const t=n.length;t>s.length&&(A(n[s.length].t,n[t-1].o),n.length=s.length);for(let e=0;e<Math.min(t,s.length);e++)q(n,e,s,e);if(t<s.length){const o=e.ownerDocument.createDocumentFragment();for(let e=t;e<s.length;e++)n.push(C(s,e,o,null));e.before(o)}}else null==s?r():o||void 0===n?(r(),o=!1,n=[C(t,l,e.parentNode,e)]):q(n,0,t,l)}},z=t=>{let e,n;return(o,r)=>{const l=o[r];if(void 0!==e||null!=l&&"object"==typeof l){if(void 0===e){const n=t.ownerDocument.createComment("");t.replaceWith(n),e=L(null,n)}e(o,r)}else l!==n&&(t.data=null==(n=l)?"":`${l}`)}},H=e=>{if(null==e)return"";if(Array.isArray(e)){let t="";for(const n of e)t+=H(n);return t}const n=e._$litType$?e.strings:void 0;if(Array.isArray(n)&&Object.hasOwn(n,"raw"))throw new TypeError(t("html","template-in-text"));return`${e}`},Z=(t,e)=>{let n;const o="STYLE"===t.tagName?1:"SCRIPT"===t.tagName?2:0;return(r,l)=>{let i=e[0];for(let t=1;t<e.length;t++)i+=H(r[l+t-1])+e[t];i!==n&&(t.textContent=o?/*@__NOINLINE__*/s(n=i,o>1):n=i)}},I=(t,e,n)=>{const o=e[0],r=e.slice(1),l=t;let s=M;if("@"===o){let e;return t.addEventListener(r,{handleEvent(n){"function"==typeof e?e.call(t,n):e?.handleEvent?.(n)}}),(t,n)=>{e=t[n]}}if("?"===o)return(e,n)=>{!!e[n]!==s&&t.toggleAttribute(r,s=!!e[n])};const i="."===o||"!"===o,c=i?r:e;if(i?"__proto__"===r:/*@__NOINLINE__*/$(e))return()=>{};const f=/*@__NOINLINE__*/b(c),u=i&&t.localName.includes("-"),a=2===n.length&&!n[0]&&!n[1];return(e,r)=>{let d=e[r];if(!a){let t=n[0];for(let o=1;o<n.length;o++)t+=`${e[r+o-1]??""}${n[o]}`;d=t}if(null!==f&&null!=d&&(!u||"string"==typeof d)&&(d=`${d}`,f.test(d)))return t.removeAttribute(c),void(s=M);"!"===o?l[c]!==d&&(l[c]=d):d!==s&&(s=d,i?l[c]=d:null==d?t.removeAttribute(c):t.setAttribute(c,d))}},J=(t,e)=>{if(void 0===e._$t$){const t=e.ownerDocument.createComment("");e.replaceChildren(t),e._$t$=L(null,t)}e._$t$([t],0)},N={element:void 0},P=[],R=t=>{if(void 0!==t._$l$)for(const e of t._$l$)e.delete(t);t._$l$=void 0},W=t=>{t._$u$=!1;const e=t._$f$;if("function"==typeof e&&t.isConnected){R(t);const n=N.element;let o;N.element=t;try{o=e()}finally{N.element=n}
|
|
2
2
|
/*@__NOINLINE__*/J(o,t._$r$)}},Y=()=>{let t=0;try{for(;t<P.length;t++)P[t]._$u$&&W(P[t])}finally{P.splice(0,t+1),0!==P.length&&queueMicrotask(Y)}},B=t=>{t._$u$||(t._$u$=!0,1===P.push(t)&&queueMicrotask(Y))},D=t=>{R(t),t._$f$=void 0},F=(t,e)=>{let n,o,r,l=t,s=[];"string"!=typeof t&&({tag:l,props:n,attributes:s=[],methods:o,shadow:r}=t);const c={},f={};for(const t of s)f[c[t]=i(t)]=null;const u={...f,...n},a=Object.keys(u).filter((t=>"__proto__"!==t)),d=()=>{const t={};for(const n of a)t[n]=(e=u[n],Array.isArray(e)?[...e]:e?.constructor===Object?{...e}:e);var e;return t},h=(t,e,n)=>{const o=t._$v$??=d();Object.is(o[e],n)||(o[e]=n,B(t))},v=class extends HTMLElement{},p={...o};delete p.__proto__,Object.assign(v.prototype,p,{constructor:v,connectedCallback(){if(void 0===this._$f$){for(const t of a)if(Object.hasOwn(this,t)){const e=this[t];delete this[t],this[t]=e}this._$r$??=r?this.shadowRoot??this.attachShadow({mode:r}):this;const t=e(this);this._$f$="function"==typeof t?t:void 0===t||"function"==typeof t.then?null:()=>t}W(this)},disconnectedCallback(){p.disconnectedCallback?.call(this),queueMicrotask((()=>{this.isConnected||/*@__NOINLINE__*/
|
|
3
|
-
D(this)}))}}),s.length&&(v.observedAttributes=s,v.prototype.attributeChangedCallback=function(t,e,n){h(this,c[t],n)});for(const t of a)Object.defineProperty(v.prototype,t,{get(){return(this._$v$??=d())[t]},set(e){h(this,t,e)},configurable:!0,enumerable:!0});return customElements.define(l,v),customElements.get(l)},G=
|
|
3
|
+
D(this)}))}}),s.length&&(v.observedAttributes=s,v.prototype.attributeChangedCallback=function(t,e,n){h(this,c[t],n)});for(const t of a)Object.defineProperty(v.prototype,t,{get(){return(this._$v$??=d())[t]},set(e){h(this,t,e)},configurable:!0,enumerable:!0});return customElements.define(l,v),customElements.get(l)},G=()=>!!globalThis._$ssr$,K=Symbol(),Q=Symbol(),U=Object.freeze(Object.defineProperties({},{[Symbol.toStringTag]:{value:"Signal"},value:{get(){const t=N.element;if(void 0!==t){const e=this[Q]??=new Set;e.add(t),(t._$l$??=new Set).add(e)}return this[K]},set(t){if(Object.is(this[K],t))return;this[K]=t;const e=this[Q];if(void 0!==e)for(const t of e)B(t)}},toJSON:{value(){return this[K]}}})),V=(t,e)=>{const n=Object.create(U);return n[K]=t,n},X=(t,...e)=>({_$litType$:1,strings:t,values:e}),tt=(t,...e)=>({_$litType$:2,strings:t,values:e}),et=(t,...e)=>({_$litType$:3,strings:t,values:e});export{F as define,X as html,G as isServer,et as mathml,V as signal,tt as svg};
|
|
4
4
|
//# sourceMappingURL=vera-lite.min.js.map
|