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

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.
@@ -5,16 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-287e25e0.js');
6
6
  const config = require('./config-c6520559.js');
7
7
 
8
+ const CACHE_NAME = '@limetech/lime-elements/icons';
8
9
  class IconCache {
9
10
  constructor() {
10
- /*
11
- * Cache of all loaded SVGs
12
- */
13
- this.cache = {};
14
- /*
15
- * Contains resolve functions for all unresolved promises that are waiting for SVG data.
16
- */
17
- this.resolveFunctions = {};
11
+ this.promises = {};
12
+ this.cache = caches.open(CACHE_NAME);
18
13
  }
19
14
  /**
20
15
  * Get icon data from the cache
@@ -23,32 +18,27 @@ class IconCache {
23
18
  * @returns {string} svg markup
24
19
  */
25
20
  async get(name, path = '') {
26
- if (!this.cache[name]) {
27
- this.cache[name] = await this.getIcon(name, path);
21
+ const cache = await this.cache;
22
+ const url = this.getUrl(name, path);
23
+ let response = await cache.match(url);
24
+ if (!response) {
25
+ response = await this.fetchData(url, cache);
28
26
  }
29
- return this.cache[name];
27
+ return this.getIcon(response);
30
28
  }
31
- /*
32
- * Creates and returns a promise that will be resolved when SVG data is available
33
- */
34
- getIcon(name, path) {
35
- return new Promise((resolve) => {
36
- if (!this.resolveFunctions[name]) {
37
- this.resolveFunctions[name] = [];
38
- this.fetchData(name, path);
39
- }
40
- this.resolveFunctions[name].push(resolve);
41
- });
29
+ async fetchData(url, cache) {
30
+ let requestPromise = this.promises[url];
31
+ if (requestPromise === undefined) {
32
+ requestPromise = cache.add(url);
33
+ this.promises[url] = requestPromise;
34
+ }
35
+ await requestPromise;
36
+ return cache.match(url);
42
37
  }
43
38
  /*
44
- * Fetch SVG data from the server
39
+ * Get icon data from a response
45
40
  */
46
- async fetchData(name, path) {
47
- let iconPath = path || '';
48
- if (path && !path.endsWith('/')) {
49
- iconPath = `${path}/`;
50
- }
51
- const response = await fetch(`${iconPath}assets/icons/${name}.svg`);
41
+ async getIcon(response) {
52
42
  let svgData = await response.text();
53
43
  // Some of the icons in the Icons8 library have hard coded black color on some of the paths.
54
44
  // In order to apply coloring with CSS, these have to be set to 'currentColor'
@@ -56,7 +46,7 @@ class IconCache {
56
46
  if (!this.validSvg(svgData)) {
57
47
  throw new Error('Invalid SVG');
58
48
  }
59
- this.resolvePromises(name, svgData);
49
+ return svgData;
60
50
  }
61
51
  /*
62
52
  * Check if the given data is a valid SVG document
@@ -66,20 +56,17 @@ class IconCache {
66
56
  const svgDoc = parser.parseFromString(data, 'image/svg+xml');
67
57
  return svgDoc.documentElement.tagName.toLowerCase() === 'svg';
68
58
  }
69
- /*
70
- * Resolve all promises waiting for data for a specific icon
71
- */
72
- resolvePromises(name, svgData) {
73
- const resolves = this.resolveFunctions[name];
74
- resolves.forEach((resolve) => {
75
- resolve(svgData);
76
- });
77
- this.resolveFunctions[name] = null;
59
+ getUrl(name, path) {
60
+ let iconPath = path || '';
61
+ if (path && !path.endsWith('/')) {
62
+ iconPath = `${path}/`;
63
+ }
64
+ return `${iconPath}assets/icons/${name}.svg`;
78
65
  }
79
66
  }
80
- const cache = new IconCache();
81
- const iconCache = (() => {
82
- return cache;
67
+ const iconCache = new IconCache();
68
+ const iconCache$1 = (() => {
69
+ return iconCache;
83
70
  })();
84
71
 
85
72
  const iconCss = ":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}";
@@ -110,7 +97,7 @@ const Icon = class {
110
97
  * @returns {string} the icon SVG data
111
98
  */
112
99
  loadSvg(name) {
113
- return iconCache.get(name, config.config.iconPath);
100
+ return iconCache$1.get(name, config.config.iconPath);
114
101
  }
115
102
  /*
116
103
  * There is no way to style external SVG files with CSS, i.e. SVGs loaded
@@ -1,13 +1,8 @@
1
+ const CACHE_NAME = '@limetech/lime-elements/icons';
1
2
  export class IconCache {
2
3
  constructor() {
3
- /*
4
- * Cache of all loaded SVGs
5
- */
6
- this.cache = {};
7
- /*
8
- * Contains resolve functions for all unresolved promises that are waiting for SVG data.
9
- */
10
- this.resolveFunctions = {};
4
+ this.promises = {};
5
+ this.cache = caches.open(CACHE_NAME);
11
6
  }
12
7
  /**
13
8
  * Get icon data from the cache
@@ -16,32 +11,27 @@ export class IconCache {
16
11
  * @returns {string} svg markup
17
12
  */
18
13
  async get(name, path = '') {
19
- if (!this.cache[name]) {
20
- this.cache[name] = await this.getIcon(name, path);
14
+ const cache = await this.cache;
15
+ const url = this.getUrl(name, path);
16
+ let response = await cache.match(url);
17
+ if (!response) {
18
+ response = await this.fetchData(url, cache);
21
19
  }
22
- return this.cache[name];
20
+ return this.getIcon(response);
23
21
  }
24
- /*
25
- * Creates and returns a promise that will be resolved when SVG data is available
26
- */
27
- getIcon(name, path) {
28
- return new Promise((resolve) => {
29
- if (!this.resolveFunctions[name]) {
30
- this.resolveFunctions[name] = [];
31
- this.fetchData(name, path);
32
- }
33
- this.resolveFunctions[name].push(resolve);
34
- });
22
+ async fetchData(url, cache) {
23
+ let requestPromise = this.promises[url];
24
+ if (requestPromise === undefined) {
25
+ requestPromise = cache.add(url);
26
+ this.promises[url] = requestPromise;
27
+ }
28
+ await requestPromise;
29
+ return cache.match(url);
35
30
  }
36
31
  /*
37
- * Fetch SVG data from the server
32
+ * Get icon data from a response
38
33
  */
39
- async fetchData(name, path) {
40
- let iconPath = path || '';
41
- if (path && !path.endsWith('/')) {
42
- iconPath = `${path}/`;
43
- }
44
- const response = await fetch(`${iconPath}assets/icons/${name}.svg`);
34
+ async getIcon(response) {
45
35
  let svgData = await response.text();
46
36
  // Some of the icons in the Icons8 library have hard coded black color on some of the paths.
47
37
  // In order to apply coloring with CSS, these have to be set to 'currentColor'
@@ -49,7 +39,7 @@ export class IconCache {
49
39
  if (!this.validSvg(svgData)) {
50
40
  throw new Error('Invalid SVG');
51
41
  }
52
- this.resolvePromises(name, svgData);
42
+ return svgData;
53
43
  }
54
44
  /*
55
45
  * Check if the given data is a valid SVG document
@@ -59,18 +49,15 @@ export class IconCache {
59
49
  const svgDoc = parser.parseFromString(data, 'image/svg+xml');
60
50
  return svgDoc.documentElement.tagName.toLowerCase() === 'svg';
61
51
  }
62
- /*
63
- * Resolve all promises waiting for data for a specific icon
64
- */
65
- resolvePromises(name, svgData) {
66
- const resolves = this.resolveFunctions[name];
67
- resolves.forEach((resolve) => {
68
- resolve(svgData);
69
- });
70
- this.resolveFunctions[name] = null;
52
+ getUrl(name, path) {
53
+ let iconPath = path || '';
54
+ if (path && !path.endsWith('/')) {
55
+ iconPath = `${path}/`;
56
+ }
57
+ return `${iconPath}assets/icons/${name}.svg`;
71
58
  }
72
59
  }
73
- const cache = new IconCache();
60
+ const iconCache = new IconCache();
74
61
  export default (() => {
75
- return cache;
62
+ return iconCache;
76
63
  })();
@@ -1,16 +1,11 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-cdfd351d.js';
2
2
  import { c as config } from './config-f7362aeb.js';
3
3
 
4
+ const CACHE_NAME = '@limetech/lime-elements/icons';
4
5
  class IconCache {
5
6
  constructor() {
6
- /*
7
- * Cache of all loaded SVGs
8
- */
9
- this.cache = {};
10
- /*
11
- * Contains resolve functions for all unresolved promises that are waiting for SVG data.
12
- */
13
- this.resolveFunctions = {};
7
+ this.promises = {};
8
+ this.cache = caches.open(CACHE_NAME);
14
9
  }
15
10
  /**
16
11
  * Get icon data from the cache
@@ -19,32 +14,27 @@ class IconCache {
19
14
  * @returns {string} svg markup
20
15
  */
21
16
  async get(name, path = '') {
22
- if (!this.cache[name]) {
23
- this.cache[name] = await this.getIcon(name, path);
17
+ const cache = await this.cache;
18
+ const url = this.getUrl(name, path);
19
+ let response = await cache.match(url);
20
+ if (!response) {
21
+ response = await this.fetchData(url, cache);
24
22
  }
25
- return this.cache[name];
23
+ return this.getIcon(response);
26
24
  }
27
- /*
28
- * Creates and returns a promise that will be resolved when SVG data is available
29
- */
30
- getIcon(name, path) {
31
- return new Promise((resolve) => {
32
- if (!this.resolveFunctions[name]) {
33
- this.resolveFunctions[name] = [];
34
- this.fetchData(name, path);
35
- }
36
- this.resolveFunctions[name].push(resolve);
37
- });
25
+ async fetchData(url, cache) {
26
+ let requestPromise = this.promises[url];
27
+ if (requestPromise === undefined) {
28
+ requestPromise = cache.add(url);
29
+ this.promises[url] = requestPromise;
30
+ }
31
+ await requestPromise;
32
+ return cache.match(url);
38
33
  }
39
34
  /*
40
- * Fetch SVG data from the server
35
+ * Get icon data from a response
41
36
  */
42
- async fetchData(name, path) {
43
- let iconPath = path || '';
44
- if (path && !path.endsWith('/')) {
45
- iconPath = `${path}/`;
46
- }
47
- const response = await fetch(`${iconPath}assets/icons/${name}.svg`);
37
+ async getIcon(response) {
48
38
  let svgData = await response.text();
49
39
  // Some of the icons in the Icons8 library have hard coded black color on some of the paths.
50
40
  // In order to apply coloring with CSS, these have to be set to 'currentColor'
@@ -52,7 +42,7 @@ class IconCache {
52
42
  if (!this.validSvg(svgData)) {
53
43
  throw new Error('Invalid SVG');
54
44
  }
55
- this.resolvePromises(name, svgData);
45
+ return svgData;
56
46
  }
57
47
  /*
58
48
  * Check if the given data is a valid SVG document
@@ -62,20 +52,17 @@ class IconCache {
62
52
  const svgDoc = parser.parseFromString(data, 'image/svg+xml');
63
53
  return svgDoc.documentElement.tagName.toLowerCase() === 'svg';
64
54
  }
65
- /*
66
- * Resolve all promises waiting for data for a specific icon
67
- */
68
- resolvePromises(name, svgData) {
69
- const resolves = this.resolveFunctions[name];
70
- resolves.forEach((resolve) => {
71
- resolve(svgData);
72
- });
73
- this.resolveFunctions[name] = null;
55
+ getUrl(name, path) {
56
+ let iconPath = path || '';
57
+ if (path && !path.endsWith('/')) {
58
+ iconPath = `${path}/`;
59
+ }
60
+ return `${iconPath}assets/icons/${name}.svg`;
74
61
  }
75
62
  }
76
- const cache = new IconCache();
77
- const iconCache = (() => {
78
- return cache;
63
+ const iconCache = new IconCache();
64
+ const iconCache$1 = (() => {
65
+ return iconCache;
79
66
  })();
80
67
 
81
68
  const iconCss = ":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}";
@@ -106,7 +93,7 @@ const Icon = class {
106
93
  * @returns {string} the icon SVG data
107
94
  */
108
95
  loadSvg(name) {
109
- return iconCache.get(name, config.iconPath);
96
+ return iconCache$1.get(name, config.iconPath);
110
97
  }
111
98
  /*
112
99
  * There is no way to style external SVG files with CSS, i.e. SVGs loaded
@@ -1 +1 @@
1
- import{p as e,b as l}from"./p-d4e788e1.js";(()=>{const l=import.meta.url,i={};return""!==l&&(i.resourcesUrl=new URL(".",l).href),e(i)})().then((e=>l([["p-edbd8d62",[[1,"limel-color-picker",{value:[513],label:[513],helperText:[513,"helper-text"],tooltipLabel:[513,"tooltip-label"],required:[516],readonly:[516],isOpen:[32]}]]],["p-30f5cc4d",[[1,"limel-action-bar",{actions:[16],accessibleLabel:[513,"accessible-label"],layout:[513],openDirection:[513,"open-direction"],overflowCutoff:[32]}]]],["p-3618f8be",[[1,"limel-dock",{dockItems:[16],dockFooterItems:[16],accessibleLabel:[513,"accessible-label"],expanded:[516],allowResize:[516,"allow-resize"],mobileBreakPoint:[514,"mobile-break-point"],useMobileLayout:[32]}]]],["p-cb2c9562",[[1,"limel-picker",{disabled:[4],readonly:[516],label:[1],searchLabel:[1,"search-label"],helperText:[513,"helper-text"],leadingIcon:[1,"leading-icon"],emptyResultMessage:[1,"empty-result-message"],required:[4],value:[16],searcher:[16],multiple:[4],delimiter:[513],actions:[16],actionPosition:[1,"action-position"],actionScrollBehavior:[1,"action-scroll-behavior"],badgeIcons:[516,"badge-icons"],items:[32],textValue:[32],loading:[32],chips:[32]}]]],["p-46a76d55",[[1,"limel-split-button",{label:[513],primary:[516],icon:[513],disabled:[516],items:[16]}]]],["p-b40f37d7",[[1,"limel-date-picker",{disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[16],type:[513],format:[513],language:[513],formatter:[16],formattedValue:[32],internalFormat:[32],showPortal:[32]}]]],["p-4a62273c",[[1,"limel-button-group",{value:[16],disabled:[516],selectedButtonId:[32]}]]],["p-29350441",[[1,"limel-select",{disabled:[516],readonly:[516],invalid:[516],required:[516],label:[513],helperText:[513,"helper-text"],value:[16],options:[16],multiple:[4],menuOpen:[32]}]]],["p-4eeabc1f",[[1,"limel-file",{value:[16],label:[513],required:[516],disabled:[516],readonly:[516],accept:[513],language:[1],isDraggingOverDropZone:[32]}]]],["p-eda87f8c",[[1,"limel-info-tile",{value:[520],icon:[1],label:[513],prefix:[513],suffix:[513],disabled:[516],badge:[520],loading:[516],link:[16],progress:[16]}]]],["p-eb154600",[[1,"limel-snackbar",{message:[1],timeout:[2],actionText:[1,"action-text"],dismissible:[4],multiline:[4],language:[1],show:[64]}]]],["p-3fda3473",[[1,"limel-tab-panel",{tabs:[1040]}]]],["p-7d7d19de",[[1,"limel-table",{data:[16],columns:[16],mode:[1],layout:[1],pageSize:[2,"page-size"],totalRows:[2,"total-rows"],sorting:[16],activeRow:[1040],movableColumns:[4,"movable-columns"],loading:[4],page:[2],emptyMessage:[1,"empty-message"],aggregates:[16],selectable:[4],selection:[16]}]]],["p-f11e7ce1",[[1,"limel-collapsible-section",{isOpen:[1540,"is-open"],header:[513],actions:[16]}]]],["p-cc3529bb",[[1,"limel-dialog",{heading:[1],fullscreen:[516],open:[1540],closingActions:[16]}]]],["p-35a6ab13",[[1,"limel-progress-flow",{flowItems:[16],disabled:[4],readonly:[4]}]]],["p-7719a91d",[[1,"limel-shortcut",{icon:[513],label:[513],disabled:[516],badge:[520],link:[16]}]]],["p-bf3d6097",[[1,"limel-banner",{message:[513],icon:[513],isOpen:[32],open:[64],close:[64]}]]],["p-79049482",[[1,"limel-callout",{heading:[513],icon:[513],type:[513],language:[1]}]]],["p-8acabe02",[[1,"limel-slider",{disabled:[516],readonly:[516],factor:[514],label:[513],helperText:[513,"helper-text"],unit:[513],value:[514],valuemax:[514],valuemin:[514],step:[514],percentageClass:[32]}]]],["p-b80de0ea",[[1,"limel-code-editor",{value:[1],language:[1],readonly:[4],lineNumbers:[4,"line-numbers"],fold:[4],lint:[4],colorScheme:[1,"color-scheme"],random:[32]}]]],["p-6c38b505",[[1,"limel-config",{config:[16]}]]],["p-5338663b",[[1,"limel-flex-container",{direction:[513],justify:[513],align:[513],reverse:[516]}]]],["p-8a2d1761",[[1,"limel-form",{schema:[16],value:[16],disabled:[4],propsFactory:[16],transformErrors:[16],errors:[16]}]]],["p-82cd7bb6",[[1,"limel-grid"]]],["p-c6e913a4",[[1,"limel-switch",{label:[513],disabled:[516],readonly:[516],value:[516],fieldId:[32]}]]],["p-75d01713",[[1,"limel-icon",{size:[513],name:[513],badge:[516]}]]],["p-076de623",[[0,"limel-dock-button",{item:[16],expanded:[516],useMobileLayout:[516,"use-mobile-layout"],isOpen:[32]}]]],["p-f979c0f2",[[1,"limel-color-picker-palette",{value:[513],label:[513],helperText:[513,"helper-text"],required:[516]}]]],["p-ef93fd3e",[[1,"limel-badge",{label:[520]}]]],["p-55c8cb64",[[1,"limel-tab-bar",{tabs:[1040],canScrollLeft:[32],canScrollRight:[32]},[[9,"resize","handleWindowResize"]]]]],["p-6b8142ba",[[1,"limel-checkbox",{disabled:[516],readonly:[516],label:[513],helperText:[513,"helper-text"],checked:[516],indeterminate:[516],required:[516],modified:[32]}]]],["p-95cefb5f",[[1,"limel-header",{icon:[1],heading:[1],subheading:[1],supportingText:[1,"supporting-text"]}]]],["p-cfaa685f",[[0,"limel-progress-flow-item",{item:[16],disabled:[4],readonly:[4]}]]],["p-da4d1bc1",[[1,"limel-flatpickr-adapter",{value:[16],type:[1],format:[1],isOpen:[4,"is-open"],inputElement:[16],language:[1],formatter:[16]}]]],["p-b526ebd4",[[0,"limel-action-bar-overflow-menu",{items:[16],openDirection:[513,"open-direction"]}],[0,"limel-action-bar-item",{item:[16],isVisible:[516,"is-visible"]}]]],["p-094dd76a",[[1,"limel-chip-set",{value:[16],type:[513],label:[513],helperText:[513,"helper-text"],disabled:[516],readonly:[516],inputType:[513,"input-type"],maxItems:[514,"max-items"],required:[516],searchLabel:[513,"search-label"],emptyInputOnBlur:[516,"empty-input-on-blur"],clearAllButton:[4,"clear-all-button"],leadingIcon:[513,"leading-icon"],delimiter:[513],language:[1],editMode:[32],textValue:[32],blurred:[32],inputChipIndexSelected:[32],getEditMode:[64],setFocus:[64],emptyInput:[64]}]]],["p-9336fd7f",[[1,"limel-button",{label:[513],primary:[516],outlined:[516],icon:[513],disabled:[516],loading:[516],loadingFailed:[516,"loading-failed"],justLoaded:[32]}]]],["p-727fd4ea",[[1,"limel-circular-progress",{value:[2],maxValue:[2,"max-value"],prefix:[513],suffix:[1],displayPercentageColors:[4,"display-percentage-colors"],size:[513]}],[1,"limel-linear-progress",{value:[2],indeterminate:[4]}]]],["p-f1d963ec",[[1,"limel-list",{items:[16],badgeIcons:[4,"badge-icons"],iconSize:[1,"icon-size"],type:[1],maxLinesSecondaryText:[2,"max-lines-secondary-text"]}],[1,"limel-menu-surface",{open:[4],allowClicksElement:[16]}]]],["p-a5d5efc4",[[1,"limel-input-field",{disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],prefix:[513],suffix:[513],required:[516],value:[513],trailingIcon:[513,"trailing-icon"],leadingIcon:[513,"leading-icon"],pattern:[513],type:[513],formatNumber:[516,"format-number"],step:[520],max:[514],min:[514],maxlength:[514],minlength:[514],completions:[16],showLink:[516,"show-link"],isFocused:[32],isModified:[32],showCompletions:[32]}]]],["p-123f5fbb",[[1,"limel-icon-button",{icon:[513],elevated:[516],label:[513],disabled:[516]}]]],["p-10e259de",[[1,"limel-spinner",{size:[513],limeBranded:[4,"lime-branded"]}]]],["p-a030e9ab",[[1,"limel-menu",{items:[16],disabled:[516],openDirection:[513,"open-direction"],open:[1540],badgeIcons:[516,"badge-icons"],gridLayout:[516,"grid-layout"]}],[1,"limel-menu-list",{items:[16],badgeIcons:[4,"badge-icons"],iconSize:[1,"icon-size"],type:[1],maxLinesSecondaryText:[2,"max-lines-secondary-text"]}]]],["p-c823809f",[[1,"limel-popover",{open:[4],openDirection:[513,"open-direction"]}],[1,"limel-popover-surface",{contentCollection:[16]}]]],["p-803cc4b7",[[1,"limel-helper-line",{helperText:[513,"helper-text"],length:[514],maxLength:[514,"max-length"],invalid:[516],helperTextId:[513,"helper-text-id"]}]]],["p-3be2dfc7",[[1,"limel-portal",{openDirection:[1,"open-direction"],position:[1],containerId:[1,"container-id"],containerStyle:[16],parent:[16],inheritParentWidth:[4,"inherit-parent-width"],visible:[4]}]]],["p-3cdc210b",[[1,"limel-tooltip",{elementId:[513,"element-id"],label:[513],helperLabel:[513,"helper-label"],maxlength:[514],open:[32]}],[1,"limel-tooltip-content",{label:[513],helperLabel:[513,"helper-label"],maxlength:[514]}]]]],e)));
1
+ import{p as e,b as l}from"./p-d4e788e1.js";(()=>{const l=import.meta.url,i={};return""!==l&&(i.resourcesUrl=new URL(".",l).href),e(i)})().then((e=>l([["p-edbd8d62",[[1,"limel-color-picker",{value:[513],label:[513],helperText:[513,"helper-text"],tooltipLabel:[513,"tooltip-label"],required:[516],readonly:[516],isOpen:[32]}]]],["p-30f5cc4d",[[1,"limel-action-bar",{actions:[16],accessibleLabel:[513,"accessible-label"],layout:[513],openDirection:[513,"open-direction"],overflowCutoff:[32]}]]],["p-3618f8be",[[1,"limel-dock",{dockItems:[16],dockFooterItems:[16],accessibleLabel:[513,"accessible-label"],expanded:[516],allowResize:[516,"allow-resize"],mobileBreakPoint:[514,"mobile-break-point"],useMobileLayout:[32]}]]],["p-cb2c9562",[[1,"limel-picker",{disabled:[4],readonly:[516],label:[1],searchLabel:[1,"search-label"],helperText:[513,"helper-text"],leadingIcon:[1,"leading-icon"],emptyResultMessage:[1,"empty-result-message"],required:[4],value:[16],searcher:[16],multiple:[4],delimiter:[513],actions:[16],actionPosition:[1,"action-position"],actionScrollBehavior:[1,"action-scroll-behavior"],badgeIcons:[516,"badge-icons"],items:[32],textValue:[32],loading:[32],chips:[32]}]]],["p-46a76d55",[[1,"limel-split-button",{label:[513],primary:[516],icon:[513],disabled:[516],items:[16]}]]],["p-b40f37d7",[[1,"limel-date-picker",{disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[16],type:[513],format:[513],language:[513],formatter:[16],formattedValue:[32],internalFormat:[32],showPortal:[32]}]]],["p-4a62273c",[[1,"limel-button-group",{value:[16],disabled:[516],selectedButtonId:[32]}]]],["p-29350441",[[1,"limel-select",{disabled:[516],readonly:[516],invalid:[516],required:[516],label:[513],helperText:[513,"helper-text"],value:[16],options:[16],multiple:[4],menuOpen:[32]}]]],["p-4eeabc1f",[[1,"limel-file",{value:[16],label:[513],required:[516],disabled:[516],readonly:[516],accept:[513],language:[1],isDraggingOverDropZone:[32]}]]],["p-eda87f8c",[[1,"limel-info-tile",{value:[520],icon:[1],label:[513],prefix:[513],suffix:[513],disabled:[516],badge:[520],loading:[516],link:[16],progress:[16]}]]],["p-eb154600",[[1,"limel-snackbar",{message:[1],timeout:[2],actionText:[1,"action-text"],dismissible:[4],multiline:[4],language:[1],show:[64]}]]],["p-3fda3473",[[1,"limel-tab-panel",{tabs:[1040]}]]],["p-7d7d19de",[[1,"limel-table",{data:[16],columns:[16],mode:[1],layout:[1],pageSize:[2,"page-size"],totalRows:[2,"total-rows"],sorting:[16],activeRow:[1040],movableColumns:[4,"movable-columns"],loading:[4],page:[2],emptyMessage:[1,"empty-message"],aggregates:[16],selectable:[4],selection:[16]}]]],["p-f11e7ce1",[[1,"limel-collapsible-section",{isOpen:[1540,"is-open"],header:[513],actions:[16]}]]],["p-cc3529bb",[[1,"limel-dialog",{heading:[1],fullscreen:[516],open:[1540],closingActions:[16]}]]],["p-35a6ab13",[[1,"limel-progress-flow",{flowItems:[16],disabled:[4],readonly:[4]}]]],["p-7719a91d",[[1,"limel-shortcut",{icon:[513],label:[513],disabled:[516],badge:[520],link:[16]}]]],["p-bf3d6097",[[1,"limel-banner",{message:[513],icon:[513],isOpen:[32],open:[64],close:[64]}]]],["p-79049482",[[1,"limel-callout",{heading:[513],icon:[513],type:[513],language:[1]}]]],["p-8acabe02",[[1,"limel-slider",{disabled:[516],readonly:[516],factor:[514],label:[513],helperText:[513,"helper-text"],unit:[513],value:[514],valuemax:[514],valuemin:[514],step:[514],percentageClass:[32]}]]],["p-b80de0ea",[[1,"limel-code-editor",{value:[1],language:[1],readonly:[4],lineNumbers:[4,"line-numbers"],fold:[4],lint:[4],colorScheme:[1,"color-scheme"],random:[32]}]]],["p-6c38b505",[[1,"limel-config",{config:[16]}]]],["p-5338663b",[[1,"limel-flex-container",{direction:[513],justify:[513],align:[513],reverse:[516]}]]],["p-8a2d1761",[[1,"limel-form",{schema:[16],value:[16],disabled:[4],propsFactory:[16],transformErrors:[16],errors:[16]}]]],["p-82cd7bb6",[[1,"limel-grid"]]],["p-c6e913a4",[[1,"limel-switch",{label:[513],disabled:[516],readonly:[516],value:[516],fieldId:[32]}]]],["p-d55d88a5",[[1,"limel-icon",{size:[513],name:[513],badge:[516]}]]],["p-076de623",[[0,"limel-dock-button",{item:[16],expanded:[516],useMobileLayout:[516,"use-mobile-layout"],isOpen:[32]}]]],["p-f979c0f2",[[1,"limel-color-picker-palette",{value:[513],label:[513],helperText:[513,"helper-text"],required:[516]}]]],["p-ef93fd3e",[[1,"limel-badge",{label:[520]}]]],["p-55c8cb64",[[1,"limel-tab-bar",{tabs:[1040],canScrollLeft:[32],canScrollRight:[32]},[[9,"resize","handleWindowResize"]]]]],["p-6b8142ba",[[1,"limel-checkbox",{disabled:[516],readonly:[516],label:[513],helperText:[513,"helper-text"],checked:[516],indeterminate:[516],required:[516],modified:[32]}]]],["p-95cefb5f",[[1,"limel-header",{icon:[1],heading:[1],subheading:[1],supportingText:[1,"supporting-text"]}]]],["p-cfaa685f",[[0,"limel-progress-flow-item",{item:[16],disabled:[4],readonly:[4]}]]],["p-da4d1bc1",[[1,"limel-flatpickr-adapter",{value:[16],type:[1],format:[1],isOpen:[4,"is-open"],inputElement:[16],language:[1],formatter:[16]}]]],["p-b526ebd4",[[0,"limel-action-bar-overflow-menu",{items:[16],openDirection:[513,"open-direction"]}],[0,"limel-action-bar-item",{item:[16],isVisible:[516,"is-visible"]}]]],["p-094dd76a",[[1,"limel-chip-set",{value:[16],type:[513],label:[513],helperText:[513,"helper-text"],disabled:[516],readonly:[516],inputType:[513,"input-type"],maxItems:[514,"max-items"],required:[516],searchLabel:[513,"search-label"],emptyInputOnBlur:[516,"empty-input-on-blur"],clearAllButton:[4,"clear-all-button"],leadingIcon:[513,"leading-icon"],delimiter:[513],language:[1],editMode:[32],textValue:[32],blurred:[32],inputChipIndexSelected:[32],getEditMode:[64],setFocus:[64],emptyInput:[64]}]]],["p-9336fd7f",[[1,"limel-button",{label:[513],primary:[516],outlined:[516],icon:[513],disabled:[516],loading:[516],loadingFailed:[516,"loading-failed"],justLoaded:[32]}]]],["p-727fd4ea",[[1,"limel-circular-progress",{value:[2],maxValue:[2,"max-value"],prefix:[513],suffix:[1],displayPercentageColors:[4,"display-percentage-colors"],size:[513]}],[1,"limel-linear-progress",{value:[2],indeterminate:[4]}]]],["p-f1d963ec",[[1,"limel-list",{items:[16],badgeIcons:[4,"badge-icons"],iconSize:[1,"icon-size"],type:[1],maxLinesSecondaryText:[2,"max-lines-secondary-text"]}],[1,"limel-menu-surface",{open:[4],allowClicksElement:[16]}]]],["p-a5d5efc4",[[1,"limel-input-field",{disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],prefix:[513],suffix:[513],required:[516],value:[513],trailingIcon:[513,"trailing-icon"],leadingIcon:[513,"leading-icon"],pattern:[513],type:[513],formatNumber:[516,"format-number"],step:[520],max:[514],min:[514],maxlength:[514],minlength:[514],completions:[16],showLink:[516,"show-link"],isFocused:[32],isModified:[32],showCompletions:[32]}]]],["p-123f5fbb",[[1,"limel-icon-button",{icon:[513],elevated:[516],label:[513],disabled:[516]}]]],["p-10e259de",[[1,"limel-spinner",{size:[513],limeBranded:[4,"lime-branded"]}]]],["p-a030e9ab",[[1,"limel-menu",{items:[16],disabled:[516],openDirection:[513,"open-direction"],open:[1540],badgeIcons:[516,"badge-icons"],gridLayout:[516,"grid-layout"]}],[1,"limel-menu-list",{items:[16],badgeIcons:[4,"badge-icons"],iconSize:[1,"icon-size"],type:[1],maxLinesSecondaryText:[2,"max-lines-secondary-text"]}]]],["p-c823809f",[[1,"limel-popover",{open:[4],openDirection:[513,"open-direction"]}],[1,"limel-popover-surface",{contentCollection:[16]}]]],["p-803cc4b7",[[1,"limel-helper-line",{helperText:[513,"helper-text"],length:[514],maxLength:[514,"max-length"],invalid:[516],helperTextId:[513,"helper-text-id"]}]]],["p-3be2dfc7",[[1,"limel-portal",{openDirection:[1,"open-direction"],position:[1],containerId:[1,"container-id"],containerStyle:[16],parent:[16],inheritParentWidth:[4,"inherit-parent-width"],visible:[4]}]]],["p-3cdc210b",[[1,"limel-tooltip",{elementId:[513,"element-id"],label:[513],helperLabel:[513,"helper-label"],maxlength:[514],open:[32]}],[1,"limel-tooltip-content",{label:[513],helperLabel:[513,"helper-label"],maxlength:[514]}]]]],e)));
@@ -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
9
  * @returns {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.6",
4
4
  "description": "Lime Elements",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -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}