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.
- package/dist/components/Icon.js +1 -1
- package/docs/components/accordion.html +0 -1
- package/docs/components/card.html +0 -1
- package/docs/components/content-slider.html +0 -1
- package/docs/components/dialog.html +0 -1
- package/docs/components/dropdown.html +0 -1
- package/docs/components/focus-capture.html +0 -1
- package/docs/components/hybrid-component.html +0 -1
- package/docs/components/import.html +0 -1
- package/docs/components/light-component.html +0 -1
- package/docs/components/photo-viewer.html +0 -1
- package/docs/components/resize.html +0 -1
- package/docs/components/shadow-component.html +0 -1
- package/docs/components/show-more.html +0 -1
- package/docs/components/side-menu.html +0 -1
- package/docs/components/sortable.html +0 -1
- package/docs/components/spinner.html +0 -1
- package/docs/components/split.html +0 -1
- package/docs/components/table.html +0 -1
- package/docs/components/tableControls.html +0 -1
- package/docs/components/tableCustomFields.html +0 -1
- package/docs/components/tableFetchRecords.html +0 -1
- package/docs/components/tableFieldSortHide.html +0 -1
- package/docs/components/tablePagination.html +0 -1
- package/docs/components/tableRecordEditing.html +0 -1
- package/docs/components/tableRecordFiltering.html +0 -1
- package/docs/components/tableRecordHiding.html +0 -1
- package/docs/components/tableRecordSearching.html +0 -1
- package/docs/components/tableRecordSelection.html +0 -1
- package/docs/components/tableRowControls.html +0 -1
- package/docs/components/tableSorting.html +0 -1
- package/docs/components/tabs.html +0 -1
- package/docs/components/tags.html +0 -1
- package/docs/components/theme-switcher.html +0 -1
- package/docs/components/timestamp.html +0 -1
- package/docs/components/toast.html +0 -1
- package/docs/components/toggle.html +0 -1
- package/docs/components/tree.html +0 -1
- package/docs/dev.config.json +0 -1
- package/docs/index.html +0 -1
- package/docs/src/components/Icon.js +1 -1
- package/docs/utils/context.html +0 -1
- package/docs/utils/debounce.html +0 -1
- package/docs/utils/drag.html +0 -1
- package/docs/utils/formatTimestamp.html +0 -1
- package/docs/utils/object.html +0 -1
- package/docs/utils/propConverters.html +0 -1
- package/docs/utils/string.html +0 -1
- package/docs/utils/theme.html +0 -1
- package/docs/utils/toTitleCase.html +0 -1
- package/docs/utils/type.html +0 -1
- package/docs/utils/wait.html +0 -1
- package/package.json +1 -1
- package/src/components/Icon.js +6 -2
- package/docs/init-1.js +0 -4
- package/docs/init.js +0 -4
package/dist/components/Icon.js
CHANGED
|
@@ -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
|
|
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>
|
package/docs/dev.config.json
CHANGED
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
|
|
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;
|
package/docs/utils/context.html
CHANGED
|
@@ -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/docs/utils/debounce.html
CHANGED
|
@@ -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/docs/utils/drag.html
CHANGED
|
@@ -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/docs/utils/object.html
CHANGED
|
@@ -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/docs/utils/string.html
CHANGED
|
@@ -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/docs/utils/theme.html
CHANGED
|
@@ -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/docs/utils/type.html
CHANGED
|
@@ -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/docs/utils/wait.html
CHANGED
|
@@ -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
package/src/components/Icon.js
CHANGED
|
@@ -26,11 +26,15 @@ const getIconByPath = async (path) => {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const getIconByName = (name) => {
|
|
29
|
-
const tryDir = async (dir) =>
|
|
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
package/docs/init.js
DELETED