@limetech/lime-elements 36.4.0-next.5 → 36.4.0-next.7

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 @@
1
+ import{r as t,h as i,g as e}from"./p-d4e788e1.js";import{c as r}from"./p-240fda3b.js";const s=new class{constructor(){this.promises={},this.cache=caches.open("@limetech/lime-elements/icons")}async get(t,i=""){const e=await this.cache,r=this.getUrl(t,i);let s=await e.match(r);return s||(s=await this.fetchData(r,e)),this.getIcon(s)}async fetchData(t,i){let e=this.promises[t];return void 0===e&&(e=i.add(t),this.promises[t]=e),await e,i.match(t)}async getIcon(t){let i=await t.text();if(i=i.replace(/#000000/g,"currentColor"),!this.validSvg(i))throw new Error("Invalid SVG");return i}validSvg(t){return"svg"===(new DOMParser).parseFromString(t,"image/svg+xml").documentElement.tagName.toLowerCase()}getUrl(t,i){let e=i||"";return i&&!i.endsWith("/")&&(e=`${i}/`),`${e}assets/icons/${t}.svg`}},a=class{constructor(i){t(this,i),this.size=void 0,this.name=void 0,this.badge=void 0}componentDidLoad(){this.loadIcon(this.name)}render(){return i("div",{class:"container"})}async loadIcon(t){if(void 0===t||""===t)return;const i=await this.loadSvg(t);this.renderSvg(i)}loadSvg(t){return s.get(t,r.iconPath)}renderSvg(t){const i=this.host.shadowRoot.querySelector("div.container");i&&(i.innerHTML=t)}get host(){return e(this)}static get watchers(){return{name:["loadIcon"]}}};a.style=":host{background-color:var(--icon-background-color, transparent);border-radius:50%;display:inline-block;line-height:0;box-sizing:border-box}:host svg{fill:currentColor;height:100%;pointer-events:none;width:100%}:host([hidden]){display:none}:host([size=x-small]){height:0.9375rem !important;width:0.9375rem !important}:host([size=small]){height:1.25rem !important;width:1.25rem !important}:host([size=medium]){height:1.5625rem !important;width:1.5625rem !important}:host([size=large]){height:1.875rem !important;width:1.875rem !important}:host([badge][size=x-small]){height:1.4375rem !important;width:1.4375rem !important}:host([badge][size=x-small])>div{margin:0.25rem}:host([badge][size=small]){height:1.875rem !important;width:1.875rem !important}:host([badge][size=small])>div{margin:0.3125rem}:host([badge][size=medium]){height:2.5rem !important;width:2.5rem !important}:host([badge][size=medium])>div{margin:0.5rem}:host([badge][size=large]){height:2.875rem !important;width:2.875rem !important}:host([badge][size=large])>div{margin:0.5rem}";export{a as limel_icon}
@@ -1,17 +1,18 @@
1
1
  export declare class IconCache {
2
2
  private cache;
3
- private resolveFunctions;
3
+ private promises;
4
+ constructor();
4
5
  /**
5
6
  * Get icon data from the cache
6
7
  * @param {string} name name of the icon
7
8
  * @param {string} path path on the server where the assets are located
8
- * @returns {string} svg markup
9
+ * @returns {Promise<string>} svg markup
9
10
  */
10
- get(name: any, path?: string): Promise<any>;
11
- private getIcon;
11
+ get(name: string, path?: string): Promise<string>;
12
12
  private fetchData;
13
+ private getIcon;
13
14
  private validSvg;
14
- private resolvePromises;
15
+ private getUrl;
15
16
  }
16
17
  declare const _default: IconCache;
17
18
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-elements",
3
- "version": "36.4.0-next.5",
3
+ "version": "36.4.0-next.7",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -49,16 +49,16 @@
49
49
  "@types/html-escaper": "^3.0.0",
50
50
  "@types/jest": "^27.4.0",
51
51
  "@types/lodash-es": "^4.17.7",
52
- "@types/react": "^18.2.12",
52
+ "@types/react": "^18.2.13",
53
53
  "@types/tabulator-tables": "^4.9.4",
54
- "@typescript-eslint/eslint-plugin": "^5.59.11",
55
- "@typescript-eslint/parser": "^5.59.11",
54
+ "@typescript-eslint/eslint-plugin": "^5.60.0",
55
+ "@typescript-eslint/parser": "^5.60.0",
56
56
  "ajv": "^6.12.6",
57
57
  "awesome-debounce-promise": "^2.1.0",
58
58
  "codemirror": "^5.65.9",
59
59
  "cross-env": "^7.0.3",
60
60
  "dayjs": "^1.11.8",
61
- "eslint": "^8.42.0",
61
+ "eslint": "^8.43.0",
62
62
  "eslint-config-prettier": "^8.8.0",
63
63
  "eslint-plugin-ban": "^1.6.0",
64
64
  "eslint-plugin-jsdoc": "^46.2.6",
@@ -1 +0,0 @@
1
- import{r as t,h as i,g as e}from"./p-d4e788e1.js";import{c as r}from"./p-240fda3b.js";const s=new class{constructor(){this.cache={},this.resolveFunctions={}}async get(t,i=""){return this.cache[t]||(this.cache[t]=await this.getIcon(t,i)),this.cache[t]}getIcon(t,i){return new Promise((e=>{this.resolveFunctions[t]||(this.resolveFunctions[t]=[],this.fetchData(t,i)),this.resolveFunctions[t].push(e)}))}async fetchData(t,i){let e=i||"";i&&!i.endsWith("/")&&(e=`${i}/`);const r=await fetch(`${e}assets/icons/${t}.svg`);let s=await r.text();if(s=s.replace(/#000000/g,"currentColor"),!this.validSvg(s))throw new Error("Invalid SVG");this.resolvePromises(t,s)}validSvg(t){return"svg"===(new DOMParser).parseFromString(t,"image/svg+xml").documentElement.tagName.toLowerCase()}resolvePromises(t,i){this.resolveFunctions[t].forEach((t=>{t(i)})),this.resolveFunctions[t]=null}},o=class{constructor(i){t(this,i),this.size=void 0,this.name=void 0,this.badge=void 0}componentDidLoad(){this.loadIcon(this.name)}render(){return i("div",{class:"container"})}async loadIcon(t){if(void 0===t||""===t)return;const i=await this.loadSvg(t);this.renderSvg(i)}loadSvg(t){return s.get(t,r.iconPath)}renderSvg(t){const i=this.host.shadowRoot.querySelector("div.container");i&&(i.innerHTML=t)}get host(){return e(this)}static get watchers(){return{name:["loadIcon"]}}};o.style=":host{background-color:var(--icon-background-color, transparent);border-radius:50%;display:inline-block;line-height:0;box-sizing:border-box}:host svg{fill:currentColor;height:100%;pointer-events:none;width:100%}:host([hidden]){display:none}:host([size=x-small]){height:0.9375rem !important;width:0.9375rem !important}:host([size=small]){height:1.25rem !important;width:1.25rem !important}:host([size=medium]){height:1.5625rem !important;width:1.5625rem !important}:host([size=large]){height:1.875rem !important;width:1.875rem !important}:host([badge][size=x-small]){height:1.4375rem !important;width:1.4375rem !important}:host([badge][size=x-small])>div{margin:0.25rem}:host([badge][size=small]){height:1.875rem !important;width:1.875rem !important}:host([badge][size=small])>div{margin:0.3125rem}:host([badge][size=medium]){height:2.5rem !important;width:2.5rem !important}:host([badge][size=medium])>div{margin:0.5rem}:host([badge][size=large]){height:2.875rem !important;width:2.875rem !important}:host([badge][size=large])>div{margin:0.5rem}";export{o as limel_icon}