kempo-ui 0.0.41 → 0.0.42

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.
Files changed (56) hide show
  1. package/dist/components/Icon.js +1 -1
  2. package/docs/components/accordion.html +0 -1
  3. package/docs/components/card.html +0 -1
  4. package/docs/components/content-slider.html +0 -1
  5. package/docs/components/dialog.html +0 -1
  6. package/docs/components/dropdown.html +0 -1
  7. package/docs/components/focus-capture.html +0 -1
  8. package/docs/components/hybrid-component.html +0 -1
  9. package/docs/components/import.html +0 -1
  10. package/docs/components/light-component.html +0 -1
  11. package/docs/components/photo-viewer.html +0 -1
  12. package/docs/components/resize.html +0 -1
  13. package/docs/components/shadow-component.html +0 -1
  14. package/docs/components/show-more.html +0 -1
  15. package/docs/components/side-menu.html +0 -1
  16. package/docs/components/sortable.html +0 -1
  17. package/docs/components/spinner.html +0 -1
  18. package/docs/components/split.html +0 -1
  19. package/docs/components/table.html +0 -1
  20. package/docs/components/tableControls.html +0 -1
  21. package/docs/components/tableCustomFields.html +0 -1
  22. package/docs/components/tableFetchRecords.html +0 -1
  23. package/docs/components/tableFieldSortHide.html +0 -1
  24. package/docs/components/tablePagination.html +0 -1
  25. package/docs/components/tableRecordEditing.html +0 -1
  26. package/docs/components/tableRecordFiltering.html +0 -1
  27. package/docs/components/tableRecordHiding.html +0 -1
  28. package/docs/components/tableRecordSearching.html +0 -1
  29. package/docs/components/tableRecordSelection.html +0 -1
  30. package/docs/components/tableRowControls.html +0 -1
  31. package/docs/components/tableSorting.html +0 -1
  32. package/docs/components/tabs.html +0 -1
  33. package/docs/components/tags.html +0 -1
  34. package/docs/components/theme-switcher.html +0 -1
  35. package/docs/components/timestamp.html +0 -1
  36. package/docs/components/toast.html +0 -1
  37. package/docs/components/toggle.html +0 -1
  38. package/docs/components/tree.html +0 -1
  39. package/docs/dev.config.json +0 -1
  40. package/docs/index.html +0 -1
  41. package/docs/src/components/Icon.js +1 -1
  42. package/docs/utils/context.html +0 -1
  43. package/docs/utils/debounce.html +0 -1
  44. package/docs/utils/drag.html +0 -1
  45. package/docs/utils/formatTimestamp.html +0 -1
  46. package/docs/utils/object.html +0 -1
  47. package/docs/utils/propConverters.html +0 -1
  48. package/docs/utils/string.html +0 -1
  49. package/docs/utils/theme.html +0 -1
  50. package/docs/utils/toTitleCase.html +0 -1
  51. package/docs/utils/type.html +0 -1
  52. package/docs/utils/wait.html +0 -1
  53. package/package.json +1 -1
  54. package/src/components/Icon.js +6 -2
  55. package/docs/init-1.js +0 -4
  56. package/docs/init.js +0 -4
@@ -1,4 +1,4 @@
1
- import ShadowComponent from"./ShadowComponent.js";import{html,css,unsafeHTML}from"../lit-all.min.js";const cache={},getIconByPath=async t=>(cache[t]||(cache[t]=new Promise(async(e,n)=>{const o=(new AbortController).signal;try{const n=await fetch(t,{signal:o});200===n.status?e(await n.text()):404===n.status&&e(null)}catch(t){"AbortError"!==t.name&&n(t)}}).catch(()=>null)),await cache[t]),getIconByName=t=>{const e=async e=>getIconByPath(`${e}/${t}.svg`);return new Promise(async(t,n)=>{let o;const s=window.kempo?.pathsToIcons||["/icons"];for(let t=0;t<s.length&&!o;t++)try{o=await e(s[t])}catch(t){}t(o||null)})};export default class Icon extends ShadowComponent{static properties={src:{type:String,reflect:!0},name:{type:String,reflect:!0},iconContent:{type:String}};constructor(t=""){super(),this.src="",this.name=t,this.iconContent=""}updated(t){super.updated(),(t.has("src")||t.has("name"))&&this.loadIcon()}async loadIcon(){let t;if(this.src?t=await getIconByPath(this.src):this.name&&(t=await getIconByName(this.name)),t)this.iconContent=this.fixSVG(t);else{const t=this.innerHTML.trim();this.iconContent=t?this.fixSVG(t):window.kempo?.fallbackIcon||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M480-79q-16 0-30.5-6T423-102L102-423q-11-12-17-26.5T79-480q0-16 6-31t17-26l321-321q12-12 26.5-17.5T480-881q16 0 31 5.5t26 17.5l321 321q12 11 17.5 26t5.5 31q0 16-5.5 30.5T858-423L537-102q-11 11-26 17t-31 6Zm0-80 321-321-321-321-321 321 321 321Zm-40-281h80v-240h-80v240Zm40 120q17 0 28.5-11.5T520-360q0-17-11.5-28.5T480-400q-17 0-28.5 11.5T440-360q0 17 11.5 28.5T480-320Zm0-160Z"/></svg>'}}fixSVG(t){if(!t)return t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");return e?(e.removeAttribute("width"),e.removeAttribute("height"),e.querySelectorAll("path, rect, circle").forEach(t=>{t.setAttribute("fill","currentColor")}),(new XMLSerializer).serializeToString(e)):t}static styles=css`
1
+ import ShadowComponent from"./ShadowComponent.js";import{html,css,unsafeHTML}from"../lit-all.min.js";const cache={},getIconByPath=async t=>(cache[t]||(cache[t]=new Promise(async(e,n)=>{const s=(new AbortController).signal;try{const n=await fetch(t,{signal:s});200===n.status?e(await n.text()):404===n.status&&e(null)}catch(t){"AbortError"!==t.name&&n(t)}}).catch(()=>null)),await cache[t]),getIconByName=t=>{const e=async e=>{const n=e.endsWith("/")?e.slice(0,-1):e;return getIconByPath(`${n}/${t}.svg`)};return new Promise(async(t,n)=>{let s;const o=window.kempo?.pathsToIcons||["/icons","../../icons","https://cdn.jsdelivr.net/npm/kempo-ui@0.0.32/icons/"];for(let t=0;t<o.length&&!s;t++)try{s=await e(o[t])}catch(t){}t(s||null)})};export default class Icon extends ShadowComponent{static properties={src:{type:String,reflect:!0},name:{type:String,reflect:!0},iconContent:{type:String}};constructor(t=""){super(),this.src="",this.name=t,this.iconContent=""}updated(t){super.updated(),(t.has("src")||t.has("name"))&&this.loadIcon()}async loadIcon(){let t;if(this.src?t=await getIconByPath(this.src):this.name&&(t=await getIconByName(this.name)),t)this.iconContent=this.fixSVG(t);else{const t=this.innerHTML.trim();this.iconContent=t?this.fixSVG(t):window.kempo?.fallbackIcon||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M480-79q-16 0-30.5-6T423-102L102-423q-11-12-17-26.5T79-480q0-16 6-31t17-26l321-321q12-12 26.5-17.5T480-881q16 0 31 5.5t26 17.5l321 321q12 11 17.5 26t5.5 31q0 16-5.5 30.5T858-423L537-102q-11 11-26 17t-31 6Zm0-80 321-321-321-321-321 321 321 321Zm-40-281h80v-240h-80v240Zm40 120q17 0 28.5-11.5T520-360q0-17-11.5-28.5T480-400q-17 0-28.5 11.5T440-360q0 17 11.5 28.5T480-320Zm0-160Z"/></svg>'}}fixSVG(t){if(!t)return t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");return e?(e.removeAttribute("width"),e.removeAttribute("height"),e.querySelectorAll("path, rect, circle").forEach(t=>{t.setAttribute("fill","currentColor")}),(new XMLSerializer).serializeToString(e)):t}static styles=css`
2
2
  :host {
3
3
  display: inline-block;
4
4
  vertical-align: bottom;
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -12,7 +12,6 @@
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script type="module" src="../src/components/Table.js"></script>
14
14
  <script>window.litDisableBundleWarning = true;</script>
15
- <script src="../init-1.js" type="module"></script>
16
15
  <script>
17
16
  window.contacts = [];
18
17
  function generateContact(){
@@ -12,7 +12,6 @@
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script type="module" src="../src/components/Table.js"></script>
14
14
  <script>window.litDisableBundleWarning = true;</script>
15
- <script src="../init-1.js" type="module"></script>
16
15
  <script>
17
16
  window.contacts = [];
18
17
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -12,7 +12,6 @@
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script type="module" src="../src/components/Table.js"></script>
14
14
  <script>window.litDisableBundleWarning = true;</script>
15
- <script src="../init-1.js" type="module"></script>
16
15
  <script>
17
16
  window.contacts = [];
18
17
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -12,7 +12,6 @@
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script type="module" src="../src/components/Table.js"></script>
14
14
  <script>window.litDisableBundleWarning = true;</script>
15
- <script src="../init-1.js" type="module"></script>
16
15
  <script>
17
16
  window.contacts = [];
18
17
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  <script>
16
15
  window.contacts = [];
17
16
  function generateContact(){
@@ -12,7 +12,6 @@
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script type="module" src="../src/components/Table.js"></script>
14
14
  <script>window.litDisableBundleWarning = true;</script>
15
- <script src="../init-1.js" type="module"></script>
16
15
  <script>
17
16
  window.contacts = [];
18
17
  function generateContact(){
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -12,7 +12,6 @@
12
12
  <link rel="stylesheet" href="../kempo-hljs.css" />
13
13
  <link rel="stylesheet" href="../styles.css" />
14
14
  <script>window.litDisableBundleWarning = true;</script>
15
- <script src="../init-1.js" type="module"></script>
16
15
  </head>
17
16
 
18
17
  <body>
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "customRoutes": {
3
- "/kempo-vars.css": "../src/kempo-vars.css",
4
3
  "/icons/**": "../icons/**",
5
4
  "/src/**": "../src/**"
6
5
  },
package/docs/index.html CHANGED
@@ -10,7 +10,6 @@
10
10
  <link rel="stylesheet" href="./kempo-hljs.css">
11
11
  <link rel="stylesheet" href="./kempo-vars.css">
12
12
  <script>window.litDisableBundleWarning = true;</script>
13
- <script src="./init.js" type="module"></script>
14
13
  </head>
15
14
  <body>
16
15
  <k-import src="nav.inc.html"></k-import>
@@ -1,4 +1,4 @@
1
- import ShadowComponent from"./ShadowComponent.js";import{html,css,unsafeHTML}from"../lit-all.min.js";const cache={},getIconByPath=async t=>(cache[t]||(cache[t]=new Promise(async(e,n)=>{const o=(new AbortController).signal;try{const n=await fetch(t,{signal:o});200===n.status?e(await n.text()):404===n.status&&e(null)}catch(t){"AbortError"!==t.name&&n(t)}}).catch(()=>null)),await cache[t]),getIconByName=t=>{const e=async e=>getIconByPath(`${e}/${t}.svg`);return new Promise(async(t,n)=>{let o;const s=window.kempo?.pathsToIcons||["/icons"];for(let t=0;t<s.length&&!o;t++)try{o=await e(s[t])}catch(t){}t(o||null)})};export default class Icon extends ShadowComponent{static properties={src:{type:String,reflect:!0},name:{type:String,reflect:!0},iconContent:{type:String}};constructor(t=""){super(),this.src="",this.name=t,this.iconContent=""}updated(t){super.updated(),(t.has("src")||t.has("name"))&&this.loadIcon()}async loadIcon(){let t;if(this.src?t=await getIconByPath(this.src):this.name&&(t=await getIconByName(this.name)),t)this.iconContent=this.fixSVG(t);else{const t=this.innerHTML.trim();this.iconContent=t?this.fixSVG(t):window.kempo?.fallbackIcon||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M480-79q-16 0-30.5-6T423-102L102-423q-11-12-17-26.5T79-480q0-16 6-31t17-26l321-321q12-12 26.5-17.5T480-881q16 0 31 5.5t26 17.5l321 321q12 11 17.5 26t5.5 31q0 16-5.5 30.5T858-423L537-102q-11 11-26 17t-31 6Zm0-80 321-321-321-321-321 321 321 321Zm-40-281h80v-240h-80v240Zm40 120q17 0 28.5-11.5T520-360q0-17-11.5-28.5T480-400q-17 0-28.5 11.5T440-360q0 17 11.5 28.5T480-320Zm0-160Z"/></svg>'}}fixSVG(t){if(!t)return t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");return e?(e.removeAttribute("width"),e.removeAttribute("height"),e.querySelectorAll("path, rect, circle").forEach(t=>{t.setAttribute("fill","currentColor")}),(new XMLSerializer).serializeToString(e)):t}static styles=css`
1
+ import ShadowComponent from"./ShadowComponent.js";import{html,css,unsafeHTML}from"../lit-all.min.js";const cache={},getIconByPath=async t=>(cache[t]||(cache[t]=new Promise(async(e,n)=>{const s=(new AbortController).signal;try{const n=await fetch(t,{signal:s});200===n.status?e(await n.text()):404===n.status&&e(null)}catch(t){"AbortError"!==t.name&&n(t)}}).catch(()=>null)),await cache[t]),getIconByName=t=>{const e=async e=>{const n=e.endsWith("/")?e.slice(0,-1):e;return getIconByPath(`${n}/${t}.svg`)};return new Promise(async(t,n)=>{let s;const o=window.kempo?.pathsToIcons||["/icons","../../icons","https://cdn.jsdelivr.net/npm/kempo-ui@0.0.32/icons/"];for(let t=0;t<o.length&&!s;t++)try{s=await e(o[t])}catch(t){}t(s||null)})};export default class Icon extends ShadowComponent{static properties={src:{type:String,reflect:!0},name:{type:String,reflect:!0},iconContent:{type:String}};constructor(t=""){super(),this.src="",this.name=t,this.iconContent=""}updated(t){super.updated(),(t.has("src")||t.has("name"))&&this.loadIcon()}async loadIcon(){let t;if(this.src?t=await getIconByPath(this.src):this.name&&(t=await getIconByName(this.name)),t)this.iconContent=this.fixSVG(t);else{const t=this.innerHTML.trim();this.iconContent=t?this.fixSVG(t):window.kempo?.fallbackIcon||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="currentColor" d="M480-79q-16 0-30.5-6T423-102L102-423q-11-12-17-26.5T79-480q0-16 6-31t17-26l321-321q12-12 26.5-17.5T480-881q16 0 31 5.5t26 17.5l321 321q12 11 17.5 26t5.5 31q0 16-5.5 30.5T858-423L537-102q-11 11-26 17t-31 6Zm0-80 321-321-321-321-321 321 321 321Zm-40-281h80v-240h-80v240Zm40 120q17 0 28.5-11.5T520-360q0-17-11.5-28.5T480-400q-17 0-28.5 11.5T440-360q0 17 11.5 28.5T480-320Zm0-160Z"/></svg>'}}fixSVG(t){if(!t)return t;const e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");return e?(e.removeAttribute("width"),e.removeAttribute("height"),e.querySelectorAll("path, rect, circle").forEach(t=>{t.setAttribute("fill","currentColor")}),(new XMLSerializer).serializeToString(e)):t}static styles=css`
2
2
  :host {
3
3
  display: inline-block;
4
4
  vertical-align: bottom;
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
@@ -11,7 +11,6 @@
11
11
  <link rel="stylesheet" href="../kempo-hljs.css" />
12
12
  <link rel="stylesheet" href="../styles.css" />
13
13
  <script>window.litDisableBundleWarning = true;</script>
14
- <script src="../init-1.js" type="module"></script>
15
14
  </head>
16
15
  <body>
17
16
  <k-import src="../nav-1.inc.html"></k-import>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kempo-ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "type": "module",
5
5
  "description": "A Lit based web-component library",
6
6
  "main": "index.js",
@@ -26,11 +26,15 @@ const getIconByPath = async (path) => {
26
26
  };
27
27
 
28
28
  const getIconByName = (name) => {
29
- const tryDir = async (dir) => getIconByPath(`${dir}/${name}.svg`);
29
+ const tryDir = async (dir) => {
30
+ // Ensure single slash between dir and filename
31
+ const normalizedDir = dir.endsWith('/') ? dir.slice(0, -1) : dir;
32
+ return getIconByPath(`${normalizedDir}/${name}.svg`);
33
+ };
30
34
 
31
35
  return new Promise(async (resolve, reject) => {
32
36
  let svg;
33
- const pathsToCheck = window.kempo?.pathsToIcons || ['/icons'];
37
+ const pathsToCheck = window.kempo?.pathsToIcons || ['/icons', '../../icons', 'https://cdn.jsdelivr.net/npm/kempo-ui@0.0.32/icons/'];
34
38
  for(let i = 0; i < pathsToCheck.length && !svg; i++){
35
39
  try {
36
40
  svg = await tryDir(pathsToCheck[i]);
package/docs/init-1.js DELETED
@@ -1,4 +0,0 @@
1
- window.kempo = {
2
- pathToStylesheet: '../kempo.min.css',
3
- pathsToIcons: ['../icons']
4
- };
package/docs/init.js DELETED
@@ -1,4 +0,0 @@
1
- window.kempo = {
2
- pathToStylesheet: './kempo.min.css',
3
- pathsToIcons: ['./icons']
4
- };