lit-litelements 1.0.0 → 1.0.2

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.
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class MarkdownRenderer extends LitElement {
3
+ src: string;
4
+ static styles: import("lit").CSSResult;
5
+ updated(changedProperties: Map<string | number | symbol, unknown>): void;
6
+ private loadMarkdown;
7
+ render(): import("lit-html").TemplateResult<1>;
8
+ }
@@ -0,0 +1,65 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12
+ return new (P || (P = Promise))(function (resolve, reject) {
13
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17
+ });
18
+ };
19
+ import { LitElement, html, css } from 'lit';
20
+ import { customElement, property } from "lit/decorators.js";
21
+ import { marked } from 'marked';
22
+ let MarkdownRenderer = class MarkdownRenderer extends LitElement {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.src = '';
26
+ }
27
+ updated(changedProperties) {
28
+ super.updated(changedProperties);
29
+ if (changedProperties.has('src')) {
30
+ this.loadMarkdown();
31
+ }
32
+ }
33
+ loadMarkdown() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ try {
36
+ const response = yield fetch(this.src);
37
+ const markdown = yield response.text();
38
+ console.log(markdown);
39
+ console.log(marked('# Hello \n This is **markdown** printed in the `terminal`'));
40
+ // const htmlContent = marked(markdown);
41
+ this.innerHTML = `htmlContent`;
42
+ }
43
+ catch (error) {
44
+ console.error('Error loading Markdown:', error);
45
+ }
46
+ });
47
+ }
48
+ render() {
49
+ return html `<div>hello</div>`;
50
+ return html `<!-- Render markdown content here dynamically -->`;
51
+ }
52
+ };
53
+ MarkdownRenderer.styles = css `
54
+ :host {
55
+ display: block;
56
+ }
57
+ `;
58
+ __decorate([
59
+ property({ type: String }),
60
+ __metadata("design:type", Object)
61
+ ], MarkdownRenderer.prototype, "src", void 0);
62
+ MarkdownRenderer = __decorate([
63
+ customElement('markdown-renderer-element')
64
+ ], MarkdownRenderer);
65
+ export { MarkdownRenderer };
package/dist/main.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  import './component/spinner.lit';
2
+ import './component/markdown.lit';
package/dist/main.js CHANGED
@@ -1,517 +1,3 @@
1
- function t(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n}function e(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"function"==typeof SuppressedError&&SuppressedError;
2
- /**
3
- * @license
4
- * Copyright 2019 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */
7
- const i=globalThis,r=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&o.set(e,t))}return t}toString(){return this.cssText}}const a=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(e)})(t):t
8
- /**
9
- * @license
10
- * Copyright 2017 Google LLC
11
- * SPDX-License-Identifier: BSD-3-Clause
12
- */,{is:l,defineProperty:d,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:c,getPrototypeOf:u}=Object,f=globalThis,g=f.trustedTypes,b=g?g.emptyScript:"",m=f.reactiveElementPolyfillSupport,x=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},$=(t,e)=>!l(t,e),_={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:$};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class v extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_;if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,e);void 0!==r&&d(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){const{get:r,set:s}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const o=r?.call(this);s.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...p(t),...c(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(r)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const r of e){const e=document.createElement("style"),s=i.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=r.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EC(t,e){const i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,r=i._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=i.getPropertyOptions(r),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=r,this[r]=s.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??$)(this[t],e))return;this.P(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],i)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}v.elementStyles=[],v.shadowRootOptions={mode:"open"},v[x("elementProperties")]=new Map,v[x("finalized")]=new Map,m?.({ReactiveElement:v}),(f.reactiveElementVersions??=[]).push("2.0.4");
13
- /**
14
- * @license
15
- * Copyright 2017 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */
18
- const A=globalThis,w=A.trustedTypes,S=w?w.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+C,P=`<${k}>`,z=document,U=()=>z.createComment(""),O=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,R="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,M=/>/g,j=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,L=/"/g,B=/^(?:script|style|textarea|title)$/i,I=(t=>function(e){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return{_$litType$:t,strings:e,values:r}})(1),Y=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),V=new WeakMap,q=z.createTreeWalker(z,129);function F(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const Z=(t,e)=>{const i=t.length-1,r=[];let s,o=2===e?"<svg>":"",n=H;for(let e=0;e<i;e++){const i=t[e];let a,l,d=-1,h=0;for(;h<i.length&&(n.lastIndex=h,l=n.exec(i),null!==l);)h=n.lastIndex,n===H?"!--"===l[1]?n=N:void 0!==l[1]?n=M:void 0!==l[2]?(B.test(l[2])&&(s=RegExp("</"+l[2],"g")),n=j):void 0!==l[3]&&(n=j):n===j?">"===l[0]?(n=s??H,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,a=l[1],n=void 0===l[3]?j:'"'===l[3]?L:D):n===L||n===D?n=j:n===N||n===M?n=H:(n=j,s=void 0);const p=n===j&&t[e+1].startsWith("/>")?" ":"";o+=n===H?i+P:d>=0?(r.push(a),i.slice(0,d)+E+i.slice(d)+C+p):i+C+(-2===d?e:p)}return[F(t,o+(t[i]||"<?>")+(2===e?"</svg>":"")),r]};class J{constructor(t,e){let i,{strings:r,_$litType$:s}=t;this.parts=[];let o=0,n=0;const a=r.length-1,l=this.parts,[d,h]=Z(r,s);if(this.el=J.createElement(d,e),q.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=q.nextNode())&&l.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(E)){const e=h[n++],r=i.getAttribute(t).split(C),s=/([.?@])?(.*)/.exec(e);l.push({type:1,index:o,name:s[2],strings:r,ctor:"."===s[1]?tt:"?"===s[1]?et:"@"===s[1]?it:X}),i.removeAttribute(t)}else t.startsWith(C)&&(l.push({type:6,index:o}),i.removeAttribute(t));if(B.test(i.tagName)){const t=i.textContent.split(C),e=t.length-1;if(e>0){i.textContent=w?w.emptyScript:"";for(let r=0;r<e;r++)i.append(t[r],U()),q.nextNode(),l.push({type:2,index:++o});i.append(t[e],U())}}}else if(8===i.nodeType)if(i.data===k)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=i.data.indexOf(C,t+1));)l.push({type:7,index:o}),t+=C.length-1}o++}}static createElement(t,e){const i=z.createElement("template");return i.innerHTML=t,i}}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3?arguments[3]:void 0;if(e===Y)return e;let s=void 0!==r?i._$Co?.[r]:i._$Cl;const o=O(e)?void 0:e._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(!1),void 0===o?s=void 0:(s=new o(t),s._$AT(t,i,r)),void 0!==r?(i._$Co??=[])[r]=s:i._$Cl=s),void 0!==s&&(e=K(t,s._$AS(t,e.values),s,r)),e}class G{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??z).importNode(e,!0);q.currentNode=r;let s=q.nextNode(),o=0,n=0,a=i[0];for(;void 0!==a;){if(o===a.index){let e;2===a.type?e=new Q(s,s.nextSibling,this,t):1===a.type?e=new a.ctor(s,a.name,a.strings,this,t):6===a.type&&(e=new rt(s,this,t)),this._$AV.push(e),a=i[++n]}o!==a?.index&&(s=q.nextNode(),o++)}return q.currentNode=z,r}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Q{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t){t=K(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),O(t)?t===W||null==t||""===t?(this._$AH!==W&&this._$AR(),this._$AH=W):t!==this._$AH&&t!==Y&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(z.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=J.createElement(F(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new G(r,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new J(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,r=0;for(const s of t)r===e.length?e.push(i=new Q(this.S(U()),this.S(U()),this,this.options)):i=e[r],i._$AI(s),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,e=arguments.length>1?arguments[1]:void 0;for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class X{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,s){this.type=1,this._$AH=W,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=s,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=W}_$AI(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;const s=this.strings;let o=!1;if(void 0===s)t=K(this,t,e,0),o=!O(t)||t!==this._$AH&&t!==Y,o&&(this._$AH=t);else{const r=t;let n,a;for(t=s[0],n=0;n<s.length-1;n++)a=K(this,r[i+n],e,n),a===Y&&(a=this._$AH[n]),o||=!O(a)||a!==this._$AH[n],a===W?t=W:t!==W&&(t+=(a??"")+s[n+1]),this._$AH[n]=a}o&&!r&&this.j(t)}j(t){t===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===W?void 0:t}}class et extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==W)}}class it extends X{constructor(t,e,i,r,s){super(t,e,i,r,s),this.type=5}_$AI(t){if((t=K(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0)??W)===Y)return;const e=this._$AH,i=t===W&&e!==W||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,r=t!==W&&(e===W||i);i&&this.element.removeEventListener(this.name,this,e),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class rt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){K(this,t)}}const st=A.litHtmlPolyfillSupport;st?.(J,Q),(A.litHtmlVersions??=[]).push("3.1.4");
19
- /**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */
24
- class ot extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const r=i?.renderBefore??e;let s=r._$litPart$;if(void 0===s){const t=i?.renderBefore??null;r._$litPart$=s=new Q(e.insertBefore(U(),t),t,void 0,i??{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Y}}ot._$litElement$=!0,ot.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ot});const nt=globalThis.litElementPolyfillSupport;nt?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.0.6");
25
- /**
26
- * @license
27
- * Copyright 2017 Google LLC
28
- * SPDX-License-Identifier: BSD-3-Clause
29
- */
30
- const at={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:$},lt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:at,e=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;const{kind:r,metadata:s}=i;let o=globalThis.litPropertyMetadata.get(s);if(void 0===o&&globalThis.litPropertyMetadata.set(s,o=new Map),o.set(i.name,t),"accessor"===r){const{name:r}=i;return{set(i){const s=e.get.call(this);e.set.call(this,i),this.requestUpdate(r,s,t)},init(e){return void 0!==e&&this.P(r,void 0,t),e}}}if("setter"===r){const{name:r}=i;return function(i){const s=this[r];e.call(this,i),this.requestUpdate(r,s,t)}}throw Error("Unsupported decorator location: "+r)};
31
- /**
32
- * @license
33
- * Copyright 2017 Google LLC
34
- * SPDX-License-Identifier: BSD-3-Clause
35
- */function dt(t){return(e,i)=>"object"==typeof i?lt(t,e,i):((t,e,i)=>{const r=e.hasOwnProperty(i);return e.constructor.createProperty(i,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}const ht={spinner1:"lds-dual-ring",spinner2:"lds-circle",spinner3:"loader",spinner4:"lds-hourglass",spinner5:"loader-3rd",spinner6:"loader-ying-yang",spinner7:"loader-in-out-circle",spinner8:"loader-arrow",spinner9:"loader-jump-stair",spinner10:"loader-yin-yang-2",spinner11:"loader-sent-email"},pt=(function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];const o=1===t.length?t[0]:i.reduce(((e,i,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[r+1]),t[0]);return new n(o,t,s)})`
36
- .spin-container {
37
- display: flex;
38
- justify-content: center;
39
- align-items: center;
40
- background-color: var(--lds-backgroundColor, rgb(153, 153, 153));
41
- z-index: 99999;
42
- position: fixed;
43
- top: 0;
44
- left: 0;
45
- right: 0;
46
- bottom: 0;
47
- width: 100%;
48
- height: 100%;
49
- opacity: 1;
50
- }
51
-
52
- .lds-dual-ring,
53
- .lds-dual-ring:after {
54
- box-sizing: border-box;
55
- }
56
- .lds-dual-ring {
57
- display: inline-block;
58
- width: 80px;
59
- height: 80px;
60
- }
61
- .lds-dual-ring:after {
62
- content: " ";
63
- display: block;
64
- width: var(--lds-dual-ring-size, 64px);
65
- height: var(--lds-dual-ring-size, 64px);
66
- margin: 8px;
67
- border-radius: 50%;
68
- border: 6.4px solid currentColor;
69
- border-color: currentColor transparent currentColor transparent;
70
- animation: lds-dual-ring 1.2s linear infinite;
71
- }
72
- @keyframes lds-dual-ring {
73
- 0% {
74
- transform: rotate(0deg);
75
- }
76
- 100% {
77
- transform: rotate(360deg);
78
- }
79
- }
80
-
81
- .loader {
82
- width: var(--lds-dual-ring-size, 64px);
83
- aspect-ratio: 1;
84
- border-radius: 50%;
85
- border: 8px solid;
86
- animation: l20-1 0.8s infinite linear alternate, l20-2 1.6s infinite linear;
87
- }
88
- @keyframes l20-1 {
89
- 0% {
90
- clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%);
91
- }
92
- 12.5% {
93
- clip-path: polygon(
94
- 50% 50%,
95
- 0 0,
96
- 50% 0%,
97
- 100% 0%,
98
- 100% 0%,
99
- 100% 0%,
100
- 100% 0%
101
- );
102
- }
103
- 25% {
104
- clip-path: polygon(
105
- 50% 50%,
106
- 0 0,
107
- 50% 0%,
108
- 100% 0%,
109
- 100% 100%,
110
- 100% 100%,
111
- 100% 100%
112
- );
113
- }
114
- 50% {
115
- clip-path: polygon(
116
- 50% 50%,
117
- 0 0,
118
- 50% 0%,
119
- 100% 0%,
120
- 100% 100%,
121
- 50% 100%,
122
- 0% 100%
123
- );
124
- }
125
- 62.5% {
126
- clip-path: polygon(
127
- 50% 50%,
128
- 100% 0,
129
- 100% 0%,
130
- 100% 0%,
131
- 100% 100%,
132
- 50% 100%,
133
- 0% 100%
134
- );
135
- }
136
- 75% {
137
- clip-path: polygon(
138
- 50% 50%,
139
- 100% 100%,
140
- 100% 100%,
141
- 100% 100%,
142
- 100% 100%,
143
- 50% 100%,
144
- 0% 100%
145
- );
146
- }
147
- 100% {
148
- clip-path: polygon(
149
- 50% 50%,
150
- 50% 100%,
151
- 50% 100%,
152
- 50% 100%,
153
- 50% 100%,
154
- 50% 100%,
155
- 0% 100%
156
- );
157
- }
158
- }
159
- @keyframes l20-2 {
160
- 0% {
161
- transform: scaleY(1) rotate(0deg);
162
- }
163
- 49.99% {
164
- transform: scaleY(1) rotate(135deg);
165
- }
166
- 50% {
167
- transform: scaleY(-1) rotate(0deg);
168
- }
169
- 100% {
170
- transform: scaleY(-1) rotate(-135deg);
171
- }
172
- }
173
-
174
- .lds-circle,
175
- .lds-circle {
176
- box-sizing: border-box;
177
- }
178
- .lds-circle {
179
- display: inline-block;
180
- transform: translateZ(1px);
181
- }
182
- .lds-circle {
183
- display: inline-block;
184
- width: 64px;
185
- height: 64px;
186
- margin: 8px;
187
- background: currentColor;
188
- border-radius: 50%;
189
- animation: lds-circle 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite;
190
- }
191
- @keyframes lds-circle {
192
- 0%,
193
- 100% {
194
- animation-timing-function: cubic-bezier(0.5, 0, 1, 0.5);
195
- }
196
- 0% {
197
- transform: rotateY(0deg);
198
- }
199
- 50% {
200
- transform: rotateY(1800deg);
201
- animation-timing-function: cubic-bezier(0, 0.5, 0.5, 1);
202
- }
203
- 100% {
204
- transform: rotateY(3600deg);
205
- }
206
- }
207
-
208
- .lds-hourglass,
209
- .lds-hourglass:after {
210
- box-sizing: border-box;
211
- }
212
- .lds-hourglass {
213
- display: inline-block;
214
- position: relative;
215
- width: 80px;
216
- height: 80px;
217
- }
218
- .lds-hourglass:after {
219
- content: " ";
220
- display: block;
221
- border-radius: 50%;
222
- width: 0;
223
- height: 0;
224
- margin: 8px;
225
- box-sizing: border-box;
226
- border: 32px solid currentColor;
227
- border-color: currentColor transparent currentColor transparent;
228
- animation: lds-hourglass 1.2s infinite;
229
- }
230
- @keyframes lds-hourglass {
231
- 0% {
232
- transform: rotate(0);
233
- animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
234
- }
235
- 50% {
236
- transform: rotate(900deg);
237
- animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
238
- }
239
- 100% {
240
- transform: rotate(1800deg);
241
- }
242
- }
243
-
244
- .loader-3rd {
245
- width: var(--lds-dual-ring-size, 64px);
246
- aspect-ratio: 1;
247
- display: grid;
248
- border: 4px solid #0000;
249
- border-radius: 50%;
250
- border-right-color: inherit;
251
- animation: l15 1s infinite linear;
252
- }
253
- .loader-3rd::before,
254
- .loader-3rd::after {
255
- content: "";
256
- grid-area: 1/1;
257
- margin: 2px;
258
- border: inherit;
259
- border-radius: 50%;
260
- animation: l15 2s infinite;
261
- }
262
- .loader-3rd::after {
263
- margin: 8px;
264
- animation-duration: 3s;
265
- }
266
- @keyframes l15 {
267
- 100% {
268
- transform: rotate(1turn);
269
- }
270
- }
271
-
272
- .loader-ying-yang {
273
- width: var(--lds-dual-ring-size, 64px);
274
- height: var(--lds-dual-ring-size, 64px);
275
- border-radius: 50%;
276
- display: inline-block;
277
- border-top: 4px solid #fff;
278
- border-right: 4px solid transparent;
279
- box-sizing: border-box;
280
- animation: rotation 1s linear infinite;
281
- }
282
- .loader-ying-yang::after {
283
- content: "";
284
- box-sizing: border-box;
285
- position: absolute;
286
- left: 0;
287
- top: 0;
288
- width: var(--lds-dual-ring-size, 64px);
289
- height: var(--lds-dual-ring-size, 64px);
290
- border-radius: 50%;
291
- border-left: 4px solid #ff3d00;
292
- border-bottom: 4px solid transparent;
293
- animation: rotation 0.5s linear infinite reverse;
294
- }
295
- @keyframes rotation {
296
- 0% {
297
- transform: rotate(0deg);
298
- }
299
- 100% {
300
- transform: rotate(360deg);
301
- }
302
- }
303
-
304
- .loader-in-out-circle {
305
- width: var(--lds-dual-ring-size, 64px);
306
- height: var(--lds-dual-ring-size, 64px);
307
- border-radius: 50%;
308
- display: inline-block;
309
- position: relative;
310
- border: 4px solid #ff3d00;
311
- box-sizing: border-box;
312
- animation: rotation 1s linear infinite;
313
- }
314
- .loader-in-out-circle::after {
315
- content: "";
316
- box-sizing: border-box;
317
- position: absolute;
318
- left: 4px;
319
- top: 4px;
320
- border: 4px solid #fff;
321
- width: 20px;
322
- height: 20px;
323
- border-radius: 50%;
324
- }
325
-
326
- @keyframes rotation {
327
- 0% {
328
- transform: rotate(0deg);
329
- }
330
- 100% {
331
- transform: rotate(360deg);
332
- }
333
- }
334
-
335
- .loader-arrow {
336
- width: 48px;
337
- height: 48px;
338
- display: inline-block;
339
- position: relative;
340
- border: 3px solid;
341
- border-color: #de3500 #0000 #fff #0000;
342
- border-radius: 50%;
343
- box-sizing: border-box;
344
- animation: 1s rotate linear infinite;
345
- }
346
- .loader-arrow:before,
347
- .loader-arrow:after {
348
- content: "";
349
- top: 0;
350
- left: 0;
351
- position: absolute;
352
- border: 10px solid transparent;
353
- border-bottom-color: #fff;
354
- transform: translate(-10px, 19px) rotate(-35deg);
355
- }
356
- .loader-arrow:after {
357
- border-color: #de3500 #0000 #0000 #0000;
358
- transform: translate(32px, 3px) rotate(-35deg);
359
- }
360
- @keyframes rotate {
361
- 100% {
362
- transform: rotate(360deg);
363
- }
364
- }
365
-
366
- .loader-jump-stair {
367
- position: relative;
368
- width: 120px;
369
- height: 90px;
370
- margin: 0 auto;
371
- }
372
- .loader-jump-stair:before {
373
- content: "";
374
- position: absolute;
375
- bottom: 30px;
376
- left: 50px;
377
- height: 30px;
378
- width: 30px;
379
- border-radius: 50%;
380
- background: #ff3d00;
381
- animation: loading-bounce 0.5s ease-in-out infinite alternate;
382
- }
383
- .loader-jump-stair:after {
384
- content: "";
385
- position: absolute;
386
- right: 0;
387
- top: 0;
388
- height: 7px;
389
- width: 45px;
390
- border-radius: 4px;
391
- box-shadow: 0 5px 0 #fff, -35px 50px 0 #fff, -70px 95px 0 #fff;
392
- animation: loading-step 1s ease-in-out infinite;
393
- }
394
-
395
- @keyframes loading-bounce {
396
- 0% {
397
- transform: scale(1, 0.7);
398
- }
399
- 40% {
400
- transform: scale(0.8, 1.2);
401
- }
402
- 60% {
403
- transform: scale(1, 1);
404
- }
405
- 100% {
406
- bottom: 140px;
407
- }
408
- }
409
- @keyframes loading-step {
410
- 0% {
411
- box-shadow: 0 10px 0 rgba(0, 0, 0, 0), 0 10px 0 #fff, -35px 50px 0 #fff,
412
- -70px 90px 0 #fff;
413
- }
414
- 100% {
415
- box-shadow: 0 10px 0 #fff, -35px 50px 0 #fff, -70px 90px 0 #fff,
416
- -70px 90px 0 rgba(0, 0, 0, 0);
417
- }
418
- }
419
-
420
- .loader-yin-yang-2 {
421
- width: 96px;
422
- box-sizing: content-box;
423
- height: 48px;
424
- background: #fff;
425
- border-color: #de3500;
426
- border-style: solid;
427
- border-width: 2px 2px 50px 2px;
428
- border-radius: 100%;
429
- position: relative;
430
- animation: 3s yinYang linear infinite;
431
- }
432
- .loader-yin-yang-2:before {
433
- content: "";
434
- position: absolute;
435
- top: 50%;
436
- left: 0;
437
- background: #fff;
438
- border: 18px solid #de3500;
439
- border-radius: 100%;
440
- width: 12px;
441
- height: 12px;
442
- box-sizing: content-box;
443
- }
444
- .loader-yin-yang-2:after {
445
- content: "";
446
- position: absolute;
447
- top: 50%;
448
- left: 50%;
449
- background: #de3500;
450
- border: 18px solid #fff;
451
- border-radius: 100%;
452
- width: 12px;
453
- height: 12px;
454
- box-sizing: content-box;
455
- }
456
- @keyframes yinYang {
457
- 100% {
458
- transform: rotate(360deg);
459
- }
460
- }
461
-
462
- .loader-sent-email {
463
- position: relative;
464
- border-style: solid;
465
- box-sizing: border-box;
466
- border-width: 40px 60px 30px 60px;
467
- border-color: #3760c9 #96ddfc #96ddfc #36bbf7;
468
- animation: envFloating 1s ease-in infinite alternate;
469
- }
470
-
471
- .loader-sent-email:after {
472
- content: "";
473
- position: absolute;
474
- right: 62px;
475
- top: -40px;
476
- height: 70px;
477
- width: 50px;
478
- background-image: linear-gradient(#fff 45px, transparent 0),
479
- linear-gradient(#fff 45px, transparent 0),
480
- linear-gradient(#fff 45px, transparent 0);
481
- background-repeat: no-repeat;
482
- background-size: 30px 4px;
483
- background-position: 0px 11px, 8px 35px, 0px 60px;
484
- animation: envDropping 0.75s linear infinite;
485
- }
486
-
487
- @keyframes envFloating {
488
- 0% {
489
- transform: translate(-2px, -5px);
490
- }
491
- 100% {
492
- transform: translate(0, 5px);
493
- }
494
- }
495
-
496
- @keyframes envDropping {
497
- 0% {
498
- background-position: 100px 11px, 115px 35px, 105px 60px;
499
- opacity: 1;
500
- }
501
- 50% {
502
- background-position: 0px 11px, 20px 35px, 5px 60px;
503
- }
504
- 60% {
505
- background-position: -30px 11px, 0px 35px, -10px 60px;
506
- }
507
- 75%,
508
- 100% {
509
- background-position: -30px 11px, -30px 35px, -30px 60px;
510
- opacity: 0;
511
- }
512
- }
513
- `;let ct=class extends ot{constructor(){super(...arguments),this.name="spinner1",this.size="64px",this.backgroundColor="rgb(153, 153, 153)",this.center=!1}updated(t){t.has("size")&&this.style.setProperty("--lds-dual-ring-size",this.size),t.has("backgroundColor")&&this.style.setProperty("--lds-backgroundColor",this.backgroundColor)}render(){return I`
514
- <div class="${this.center?"spin-container":""}">
515
- <div class="${ht[this.name]}"></div>
516
- </div>
517
- `}};ct.styles=[pt],t([dt({type:String}),e("design:type",Object)],ct.prototype,"name",void 0),t([dt({type:String}),e("design:type",Object)],ct.prototype,"size",void 0),t([dt({type:String}),e("design:type",Object)],ct.prototype,"backgroundColor",void 0),t([dt({type:Boolean}),e("design:type",Object)],ct.prototype,"center",void 0),ct=t([(t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)})("loading-spinner-element")],ct);
1
+ import './component/spinner.lit';
2
+ import './component/markdown.lit';
3
+ // Import other components as needed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lit-litelements",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "My LitElement component build for loading spinner with 10 types",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.js",
package/readme.md CHANGED
@@ -12,3 +12,31 @@
12
12
  2. size : size for some loader, default 64px
13
13
  3. backgroundColor: the color background of the spinner
14
14
  4. center: to make the spinner in the center of page or not
15
+
16
+ - ex:
17
+ <loading-spinner-element center name="spinner11" style="color: red;"></loading-spinner-element>
18
+ <loading-spinner-element center name="spinner11" style="color: red;" size="100px"></loading-spinner-element>
19
+ <loading-spinner-element center name="spinner11" style="color: red;" size="100px" backgroundColor="white"></loading-spinner-element>
20
+
21
+ ## Integrate
22
+
23
+ ### angular
24
+ add to angular.json
25
+ "architect": {
26
+ "build": {
27
+ "builder": "@angular-devkit/build-angular:browser",
28
+ "options": {
29
+ ...
30
+ ],
31
+ "styles": [
32
+ ],
33
+ "scripts": [
34
+
35
+ "./node_modules/lit-litelements/dist/main.js"
36
+ ]
37
+ }
38
+ }
39
+ }
40
+
41
+ ### html
42
+ <script type="module" src="./node_modules/lit-litelements/dist/main.js"></script>