@lukso/web-components 1.172.13 → 1.172.14
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/chunks/cn-LM_JlZIN.js +36 -0
- package/dist/chunks/cn-zamUNFMe.js +39 -0
- package/dist/chunks/directive-CY66atYi.js +22 -0
- package/dist/chunks/directive-DUHAbymA.js +15 -0
- package/dist/chunks/index-BNt_JinF.js +212 -0
- package/dist/chunks/{index-DG4rMUh3.js → index-BOEPqh0N.js} +1 -1
- package/dist/chunks/{index-F8ll4iy2.js → index-C5S-_QDF.js} +1 -1
- package/dist/chunks/{index-B_H2eYG_.js → index-CA6SrfZ-.js} +9 -8
- package/dist/chunks/{index-CZGvLdJ0.js → index-CqZm8OfY.js} +1 -2
- package/dist/chunks/index-Cy2_2lFt.js +214 -0
- package/dist/chunks/{index-Dn2DJhID.js → index-Ds-r8fCt.js} +77 -74
- package/dist/chunks/{index-C5YyB6ug.js → index-DvLZWpq9.js} +2 -3
- package/dist/chunks/{index-D_5wz2k1.js → index-UVrFZqIM.js} +79 -76
- package/dist/chunks/{index-BHAtoIlu.js → index-cakeic-M.js} +9 -8
- package/dist/chunks/{style-map-B7XFhSOK.js → style-map-AEeBQfPb.js} +2 -3
- package/dist/chunks/{style-map-BPljJihp.js → style-map-auscxO0L.js} +1 -2
- package/dist/components/index.cjs +4 -5
- package/dist/components/index.js +4 -5
- package/dist/components/lukso-alert/index.cjs +16 -15
- package/dist/components/lukso-alert/index.js +16 -15
- package/dist/components/lukso-button/index.cjs +42 -40
- package/dist/components/lukso-button/index.js +39 -37
- package/dist/components/lukso-card/index.cjs +66 -71
- package/dist/components/lukso-card/index.js +48 -53
- package/dist/components/lukso-checkbox/index.cjs +27 -26
- package/dist/components/lukso-checkbox/index.js +27 -26
- package/dist/components/lukso-collapse/index.cjs +27 -26
- package/dist/components/lukso-collapse/index.js +26 -25
- package/dist/components/lukso-color-picker/index.cjs +33 -31
- package/dist/components/lukso-color-picker/index.js +32 -30
- package/dist/components/lukso-dropdown/index.cjs +20 -19
- package/dist/components/lukso-dropdown/index.js +20 -19
- package/dist/components/lukso-dropdown-option/index.cjs +12 -11
- package/dist/components/lukso-dropdown-option/index.js +12 -11
- package/dist/components/lukso-footer/index.cjs +5 -4
- package/dist/components/lukso-footer/index.js +5 -4
- package/dist/components/lukso-form-description/index.cjs +7 -6
- package/dist/components/lukso-form-description/index.js +7 -6
- package/dist/components/lukso-form-error/index.cjs +7 -6
- package/dist/components/lukso-form-error/index.js +7 -6
- package/dist/components/lukso-form-label/index.cjs +8 -7
- package/dist/components/lukso-form-label/index.js +8 -7
- package/dist/components/lukso-icon/index.cjs +268 -267
- package/dist/components/lukso-icon/index.js +268 -267
- package/dist/components/lukso-image/index.cjs +12 -12
- package/dist/components/lukso-image/index.js +12 -12
- package/dist/components/lukso-input/index.cjs +49 -47
- package/dist/components/lukso-input/index.js +48 -46
- package/dist/components/lukso-markdown/index.cjs +13 -83
- package/dist/components/lukso-markdown/index.js +13 -83
- package/dist/components/lukso-markdown-editor/index.cjs +68 -67
- package/dist/components/lukso-markdown-editor/index.js +67 -66
- package/dist/components/lukso-modal/index.cjs +12 -11
- package/dist/components/lukso-modal/index.js +11 -10
- package/dist/components/lukso-navbar/index.cjs +30 -30
- package/dist/components/lukso-navbar/index.js +30 -30
- package/dist/components/lukso-pagination/index.cjs +16 -16
- package/dist/components/lukso-pagination/index.js +16 -16
- package/dist/components/lukso-profile/index.cjs +162 -11
- package/dist/components/lukso-profile/index.js +165 -5
- package/dist/components/lukso-progress/index.cjs +16 -13
- package/dist/components/lukso-progress/index.js +13 -10
- package/dist/components/lukso-qr-code/index.cjs +17 -34
- package/dist/components/lukso-qr-code/index.js +16 -33
- package/dist/components/lukso-radio/index.cjs +27 -25
- package/dist/components/lukso-radio/index.js +25 -23
- package/dist/components/lukso-radio-group/index.cjs +9 -9
- package/dist/components/lukso-radio-group/index.js +9 -9
- package/dist/components/lukso-sanitize/index.cjs +5 -4
- package/dist/components/lukso-sanitize/index.js +5 -4
- package/dist/components/lukso-search/index.cjs +11 -8
- package/dist/components/lukso-search/index.js +11 -8
- package/dist/components/lukso-select/index.cjs +47 -46
- package/dist/components/lukso-select/index.js +46 -45
- package/dist/components/lukso-share/index.cjs +7 -6
- package/dist/components/lukso-share/index.js +7 -6
- package/dist/components/lukso-switch/index.cjs +16 -15
- package/dist/components/lukso-switch/index.js +16 -15
- package/dist/components/lukso-tag/index.cjs +13 -12
- package/dist/components/lukso-tag/index.js +12 -11
- package/dist/components/lukso-terms/index.cjs +9 -8
- package/dist/components/lukso-terms/index.js +9 -8
- package/dist/components/lukso-textarea/index.cjs +36 -34
- package/dist/components/lukso-textarea/index.js +35 -33
- package/dist/components/lukso-tooltip/index.cjs +27 -3461
- package/dist/components/lukso-tooltip/index.js +27 -3461
- package/dist/components/lukso-username/index.cjs +11 -7
- package/dist/components/lukso-username/index.js +11 -7
- package/dist/components/lukso-wizard/index.cjs +13 -12
- package/dist/components/lukso-wizard/index.js +11 -10
- package/dist/index.cjs +6 -6
- package/dist/index.js +5 -5
- package/dist/shared/tailwind-element/index.cjs +15 -3
- package/dist/shared/tailwind-element/index.js +17 -1
- package/dist/vite.full.config.d.ts.map +1 -1
- package/package.json +7 -1
- package/dist/chunks/_commonjsHelpers-B85MJLTf.js +0 -5
- package/dist/chunks/_commonjsHelpers-CFO10eej.js +0 -7
- package/dist/chunks/axe-DJKac19y.js +0 -35093
- package/dist/chunks/axe-MHuN9KU0.js +0 -35097
- package/dist/chunks/base-Bn-zDNuZ.js +0 -93
- package/dist/chunks/base-Cl6v8-BZ.js +0 -8
- package/dist/chunks/base-KJhhKWYy.js +0 -91
- package/dist/chunks/base-NFGX42U4.js +0 -10
- package/dist/chunks/chunk-LQIOVPBE-CGhQ79Di.js +0 -370
- package/dist/chunks/chunk-LQIOVPBE-kQFZF_OS.js +0 -372
- package/dist/chunks/directive-BKuZRRPO.js +0 -8
- package/dist/chunks/directive-DT5Y-Nw0.js +0 -12
- package/dist/chunks/index-5X9ujrWL.js +0 -41
- package/dist/chunks/index-B9iart53.js +0 -2545
- package/dist/chunks/index-BAf8Hzhe.js +0 -611
- package/dist/chunks/index-BBFSnMaE.js +0 -1345
- package/dist/chunks/index-BDyLu6M0.js +0 -609
- package/dist/chunks/index-BxQ_0s_1.js +0 -50
- package/dist/chunks/index-CaJky2qL.js +0 -2547
- package/dist/chunks/index-glHBylgQ.js +0 -1347
- package/dist/chunks/isAddress-B1R_6-uN.js +0 -745
- package/dist/chunks/isAddress-BUdSrCaY.js +0 -743
- package/dist/chunks/property-D6IL6zax.js +0 -11
- package/dist/chunks/property-DfumgIL6.js +0 -9
- package/dist/chunks/query-CHb9Ft_d.js +0 -9
- package/dist/chunks/query-D3HF7Pde.js +0 -11
- package/dist/chunks/state-CFjY89m3.js +0 -11
- package/dist/chunks/state-CaelFSbE.js +0 -9
- package/dist/chunks/unsafe-html-BHBLEMoa.js +0 -10
- package/dist/chunks/unsafe-html-DiwkOQlV.js +0 -12
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { lineHeights, heights, scales, fontWeights, fontSizes, boxShadows, borderRadius, colorPalette } from '../tailwind-config.js';
|
|
4
|
+
|
|
5
|
+
import.meta.url.replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
|
|
6
|
+
|
|
7
|
+
import.meta.url.replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
|
|
8
|
+
|
|
9
|
+
import.meta.url.replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
|
|
10
|
+
|
|
11
|
+
const customTwMerge = extendTailwindMerge({
|
|
12
|
+
extend: {
|
|
13
|
+
theme: {
|
|
14
|
+
colors: Object.entries(colorPalette).reduce((acc, currentVal) => {
|
|
15
|
+
const colors = Object.keys(currentVal[1]).map(
|
|
16
|
+
(c) => `text-${currentVal[0]}-${c}`
|
|
17
|
+
);
|
|
18
|
+
return acc.concat(colors);
|
|
19
|
+
}, []),
|
|
20
|
+
borderRadius: Object.keys(borderRadius).map((s) => `rounded-${s}`)
|
|
21
|
+
},
|
|
22
|
+
classGroups: {
|
|
23
|
+
shadow: [{ shadow: Object.keys(boxShadows).map((s) => `shadow-${s}`) }],
|
|
24
|
+
"font-size": Object.keys(fontSizes).map((s) => `text-${s}`),
|
|
25
|
+
"font-weight": Object.keys(fontWeights).map((s) => `font-${s}`),
|
|
26
|
+
scale: Object.keys(scales).map((s) => `scale-${s}`),
|
|
27
|
+
h: Object.keys(heights).map((s) => `h-${s}`),
|
|
28
|
+
leading: Object.keys(lineHeights).map((s) => `leading-${s}`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const cn = (...inputs) => {
|
|
33
|
+
return customTwMerge(clsx(inputs));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { cn as c };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const tailwindMerge = require('tailwind-merge');
|
|
4
|
+
const clsx = require('clsx');
|
|
5
|
+
const tailwindConfig = require('../tailwind-config.cjs');
|
|
6
|
+
|
|
7
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunks/cn-zamUNFMe.js', document.baseURI).href)).replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
|
|
9
|
+
|
|
10
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunks/cn-zamUNFMe.js', document.baseURI).href)).replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
|
|
11
|
+
|
|
12
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunks/cn-zamUNFMe.js', document.baseURI).href)).replace(/^file:\/\/|\/\w+\.?[jt]s$/g, "").replace(/\/index\.[a-z]+$/g, "");
|
|
13
|
+
|
|
14
|
+
const customTwMerge = tailwindMerge.extendTailwindMerge({
|
|
15
|
+
extend: {
|
|
16
|
+
theme: {
|
|
17
|
+
colors: Object.entries(tailwindConfig.colorPalette).reduce((acc, currentVal) => {
|
|
18
|
+
const colors = Object.keys(currentVal[1]).map(
|
|
19
|
+
(c) => `text-${currentVal[0]}-${c}`
|
|
20
|
+
);
|
|
21
|
+
return acc.concat(colors);
|
|
22
|
+
}, []),
|
|
23
|
+
borderRadius: Object.keys(tailwindConfig.borderRadius).map((s) => `rounded-${s}`)
|
|
24
|
+
},
|
|
25
|
+
classGroups: {
|
|
26
|
+
shadow: [{ shadow: Object.keys(tailwindConfig.boxShadows).map((s) => `shadow-${s}`) }],
|
|
27
|
+
"font-size": Object.keys(tailwindConfig.fontSizes).map((s) => `text-${s}`),
|
|
28
|
+
"font-weight": Object.keys(tailwindConfig.fontWeights).map((s) => `font-${s}`),
|
|
29
|
+
scale: Object.keys(tailwindConfig.scales).map((s) => `scale-${s}`),
|
|
30
|
+
h: Object.keys(tailwindConfig.heights).map((s) => `h-${s}`),
|
|
31
|
+
leading: Object.keys(tailwindConfig.lineHeights).map((s) => `leading-${s}`)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const cn = (...inputs) => {
|
|
36
|
+
return customTwMerge(clsx.clsx(inputs));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.cn = cn;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2017 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
const t$1=globalThis,i$1=t$1.trustedTypes,s=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$1="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+h,n=`<${o}>`,r=document,l=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e$1+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$1)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const Z={I:R},j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.1");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright 2017 Google LLC
|
|
13
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
|
+
*/
|
|
15
|
+
const t={ATTRIBUTE:1,CHILD:2},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
16
|
+
|
|
17
|
+
exports.E = E;
|
|
18
|
+
exports.T = T;
|
|
19
|
+
exports.Z = Z;
|
|
20
|
+
exports.e = e;
|
|
21
|
+
exports.i = i;
|
|
22
|
+
exports.t = t;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t$1=globalThis,i$1=t$1.trustedTypes,s=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$1="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+h,n=`<${o}>`,r=document,l=()=>r.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e$1+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$1)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const Z={I:R},j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.3.1");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2017 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/
|
|
13
|
+
const t={ATTRIBUTE:1,CHILD:2},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
14
|
+
|
|
15
|
+
export { E, T, Z, e, i, t };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { E } from './directive-DUHAbymA.js';
|
|
4
|
+
import { tv } from 'tailwind-variants';
|
|
5
|
+
import { toChecksumAddress } from 'web3-utils';
|
|
6
|
+
import { isAddress } from 'viem';
|
|
7
|
+
import { s as safeCustomElement } from './safe-custom-element-qdGIR_v6.js';
|
|
8
|
+
import { TailwindStyledElement } from '../shared/tailwind-element/index.js';
|
|
9
|
+
import { c as customStyleMap } from './index-CqZm8OfY.js';
|
|
10
|
+
import '../tailwind-config.js';
|
|
11
|
+
import { c as cn } from './cn-LM_JlZIN.js';
|
|
12
|
+
import 'axe-core';
|
|
13
|
+
|
|
14
|
+
const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
|
|
15
|
+
if (!address || typeof address !== "string") {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
let sliceAddress2 = "";
|
|
19
|
+
const effectiveEndSliceBy = endSliceBy || startSliceBy;
|
|
20
|
+
if (address.length < startSliceBy + effectiveEndSliceBy) {
|
|
21
|
+
return address;
|
|
22
|
+
}
|
|
23
|
+
sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(
|
|
24
|
+
-effectiveEndSliceBy
|
|
25
|
+
)}` : address;
|
|
26
|
+
return sliceAddress2;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const style = ":host {\n display: inline-flex\n}";
|
|
30
|
+
|
|
31
|
+
var __defProp = Object.defineProperty;
|
|
32
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
33
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
34
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
35
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
36
|
+
if (decorator = decorators[i])
|
|
37
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
38
|
+
if (kind && result) __defProp(target, key, result);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
let LuksoUsername = class extends TailwindStyledElement(style) {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
this.name = "";
|
|
45
|
+
this.address = "";
|
|
46
|
+
this.maxWidth = 200;
|
|
47
|
+
this.size = "large";
|
|
48
|
+
this.sliceBy = 8;
|
|
49
|
+
this.addressColor = "";
|
|
50
|
+
this.nameColor = "";
|
|
51
|
+
this.customClass = "";
|
|
52
|
+
this.hidePrefix = false;
|
|
53
|
+
this.prefix = "@";
|
|
54
|
+
this.noTransform = false;
|
|
55
|
+
/** Width of the first 4 bytes of the address */
|
|
56
|
+
this.bytesWidth = 52;
|
|
57
|
+
this.styles = tv({
|
|
58
|
+
slots: {
|
|
59
|
+
wrapper: "inline-flex",
|
|
60
|
+
name: "inline-block whitespace-nowrap overflow-hidden text-ellipsis",
|
|
61
|
+
address: "inline-block",
|
|
62
|
+
bytes: "inline-block"
|
|
63
|
+
},
|
|
64
|
+
variants: {
|
|
65
|
+
size: {
|
|
66
|
+
"2x-small": {
|
|
67
|
+
wrapper: "paragraph-ptmono-10-bold"
|
|
68
|
+
},
|
|
69
|
+
"x-small": {
|
|
70
|
+
wrapper: "paragraph-ptmono-10-bold"
|
|
71
|
+
},
|
|
72
|
+
small: {
|
|
73
|
+
wrapper: "paragraph-ptmono-12-bold"
|
|
74
|
+
},
|
|
75
|
+
medium: {
|
|
76
|
+
wrapper: "paragraph-ptmono-14-bold"
|
|
77
|
+
},
|
|
78
|
+
large: {
|
|
79
|
+
wrapper: "paragraph-ptmono-16-bold"
|
|
80
|
+
},
|
|
81
|
+
"x-large": {
|
|
82
|
+
wrapper: "paragraph-ptmono-24-bold"
|
|
83
|
+
},
|
|
84
|
+
"2x-large": {
|
|
85
|
+
wrapper: "paragraph-ptmono-24-bold"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
hasNameColor: {
|
|
89
|
+
false: {
|
|
90
|
+
name: "text-transparent bg-clip-text bg-gradient-to-r from-gradient-1-start to-gradient-1-end"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
hasAddressColor: {
|
|
94
|
+
false: {
|
|
95
|
+
address: "text-neutral-20",
|
|
96
|
+
bytes: "text-neutral-60"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
transformName(name) {
|
|
103
|
+
if (this.noTransform) {
|
|
104
|
+
return name;
|
|
105
|
+
}
|
|
106
|
+
return name?.toLowerCase();
|
|
107
|
+
}
|
|
108
|
+
transformAddress(address) {
|
|
109
|
+
if (this.noTransform || !isAddress(address)) {
|
|
110
|
+
return address;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
return toChecksumAddress(address);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.warn(error);
|
|
116
|
+
return address;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
addressBytesTemplate(styles) {
|
|
120
|
+
const address = this.transformAddress(this.address);
|
|
121
|
+
return html`<div
|
|
122
|
+
class=${styles}
|
|
123
|
+
style=${customStyleMap({
|
|
124
|
+
[`color: var(--${this.addressColor})`]: this.addressColor !== ""
|
|
125
|
+
})}
|
|
126
|
+
>
|
|
127
|
+
#${address.slice(2, 6)}
|
|
128
|
+
</div>`;
|
|
129
|
+
}
|
|
130
|
+
nameTemplate(styles) {
|
|
131
|
+
const name = this.transformName(this.name);
|
|
132
|
+
return html`<div
|
|
133
|
+
class=${styles}
|
|
134
|
+
style=${customStyleMap({
|
|
135
|
+
[`max-width: ${this.maxWidth - (this.address ? this.bytesWidth : 0)}px`]: true,
|
|
136
|
+
[`color: var(--${this.nameColor})`]: this.nameColor !== ""
|
|
137
|
+
})}
|
|
138
|
+
>
|
|
139
|
+
${this.hidePrefix ? E : this.prefix}${name}
|
|
140
|
+
</div>`;
|
|
141
|
+
}
|
|
142
|
+
addressTemplate(styles) {
|
|
143
|
+
const address = this.transformAddress(this.address);
|
|
144
|
+
return html`<div
|
|
145
|
+
class=${styles}
|
|
146
|
+
style=${customStyleMap({
|
|
147
|
+
[`color: var(--${this.addressColor})`]: this.addressColor !== ""
|
|
148
|
+
})}
|
|
149
|
+
>
|
|
150
|
+
${sliceAddress(address, this.sliceBy, this.sliceBy)}
|
|
151
|
+
</div>`;
|
|
152
|
+
}
|
|
153
|
+
render() {
|
|
154
|
+
const { wrapper, name, address, bytes } = this.styles({
|
|
155
|
+
size: this.size,
|
|
156
|
+
hasNameColor: this.nameColor !== "",
|
|
157
|
+
hasAddressColor: this.addressColor !== ""
|
|
158
|
+
});
|
|
159
|
+
const template = (() => {
|
|
160
|
+
if (this.name && this.address) {
|
|
161
|
+
return html`${this.nameTemplate(name())}${this.addressBytesTemplate(
|
|
162
|
+
bytes()
|
|
163
|
+
)}`;
|
|
164
|
+
}
|
|
165
|
+
if (this.name) {
|
|
166
|
+
return this.nameTemplate(name());
|
|
167
|
+
}
|
|
168
|
+
if (this.address) {
|
|
169
|
+
return this.addressTemplate(address());
|
|
170
|
+
}
|
|
171
|
+
})();
|
|
172
|
+
return html`<div class=${cn(wrapper(), this.customClass)}>${template}</div>`;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
__decorateClass([
|
|
176
|
+
property({ type: String })
|
|
177
|
+
], LuksoUsername.prototype, "name", 2);
|
|
178
|
+
__decorateClass([
|
|
179
|
+
property({ type: String })
|
|
180
|
+
], LuksoUsername.prototype, "address", 2);
|
|
181
|
+
__decorateClass([
|
|
182
|
+
property({ type: Number, attribute: "max-width" })
|
|
183
|
+
], LuksoUsername.prototype, "maxWidth", 2);
|
|
184
|
+
__decorateClass([
|
|
185
|
+
property({ type: "string" })
|
|
186
|
+
], LuksoUsername.prototype, "size", 2);
|
|
187
|
+
__decorateClass([
|
|
188
|
+
property({ type: Number, attribute: "slice-by" })
|
|
189
|
+
], LuksoUsername.prototype, "sliceBy", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
property({ type: String, attribute: "address-color" })
|
|
192
|
+
], LuksoUsername.prototype, "addressColor", 2);
|
|
193
|
+
__decorateClass([
|
|
194
|
+
property({ type: String, attribute: "name-color" })
|
|
195
|
+
], LuksoUsername.prototype, "nameColor", 2);
|
|
196
|
+
__decorateClass([
|
|
197
|
+
property({ type: String, attribute: "custom-class" })
|
|
198
|
+
], LuksoUsername.prototype, "customClass", 2);
|
|
199
|
+
__decorateClass([
|
|
200
|
+
property({ type: Boolean, attribute: "hide-prefix" })
|
|
201
|
+
], LuksoUsername.prototype, "hidePrefix", 2);
|
|
202
|
+
__decorateClass([
|
|
203
|
+
property({ type: String })
|
|
204
|
+
], LuksoUsername.prototype, "prefix", 2);
|
|
205
|
+
__decorateClass([
|
|
206
|
+
property({ type: Boolean, attribute: "no-transform" })
|
|
207
|
+
], LuksoUsername.prototype, "noTransform", 2);
|
|
208
|
+
LuksoUsername = __decorateClass([
|
|
209
|
+
safeCustomElement("lukso-username")
|
|
210
|
+
], LuksoUsername);
|
|
211
|
+
|
|
212
|
+
export { LuksoUsername as L, sliceAddress as s };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { html as html$2 } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
4
4
|
import { s as safeCustomElement } from './safe-custom-element-qdGIR_v6.js';
|
|
5
|
+
import { TailwindStyledElement } from '../shared/tailwind-element/index.js';
|
|
5
6
|
|
|
6
7
|
/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
|
|
7
8
|
|
|
@@ -1386,19 +1387,19 @@ let LuksoSanitize = class extends TailwindStyledElement(style) {
|
|
|
1386
1387
|
// in order to show HTML we need to use unsafeHTML directive.
|
|
1387
1388
|
// This is safe since we already sanitized content
|
|
1388
1389
|
render() {
|
|
1389
|
-
return this.isPre ?
|
|
1390
|
+
return this.isPre ? html$2`<!-- prettier-ignore -->
|
|
1390
1391
|
<div
|
|
1391
|
-
class='whitespace-pre-wrap'>${
|
|
1392
|
+
class='whitespace-pre-wrap'>${unsafeHTML(this.sanitize())}</div>` : html$2`${unsafeHTML(this.sanitize())}`;
|
|
1392
1393
|
}
|
|
1393
1394
|
};
|
|
1394
1395
|
__decorateClass([
|
|
1395
|
-
|
|
1396
|
+
property({ type: String, attribute: "html-content" })
|
|
1396
1397
|
], LuksoSanitize.prototype, "htmlContent", 2);
|
|
1397
1398
|
__decorateClass([
|
|
1398
|
-
|
|
1399
|
+
property({ type: Boolean, attribute: "is-pre" })
|
|
1399
1400
|
], LuksoSanitize.prototype, "isPre", 2);
|
|
1400
1401
|
__decorateClass([
|
|
1401
|
-
|
|
1402
|
+
property({ type: Boolean, attribute: "strip-html-tags" })
|
|
1402
1403
|
], LuksoSanitize.prototype, "stripHtmlTags", 2);
|
|
1403
1404
|
LuksoSanitize = __decorateClass([
|
|
1404
1405
|
safeCustomElement("lukso-sanitize")
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const lit = require('lit');
|
|
4
|
+
const decorators_js = require('lit/decorators.js');
|
|
5
|
+
const directive = require('./directive-CY66atYi.js');
|
|
6
|
+
const tailwindVariants = require('tailwind-variants');
|
|
7
|
+
const web3Utils = require('web3-utils');
|
|
8
|
+
const viem = require('viem');
|
|
9
|
+
const safeCustomElement = require('./safe-custom-element-tQ-epw6h.js');
|
|
10
|
+
const shared_tailwindElement_index = require('../shared/tailwind-element/index.cjs');
|
|
11
|
+
const index = require('./index-DvLZWpq9.js');
|
|
12
|
+
require('../tailwind-config.cjs');
|
|
13
|
+
const cn = require('./cn-zamUNFMe.js');
|
|
14
|
+
require('axe-core');
|
|
15
|
+
|
|
16
|
+
const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
|
|
17
|
+
if (!address || typeof address !== "string") {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
let sliceAddress2 = "";
|
|
21
|
+
const effectiveEndSliceBy = endSliceBy || startSliceBy;
|
|
22
|
+
if (address.length < startSliceBy + effectiveEndSliceBy) {
|
|
23
|
+
return address;
|
|
24
|
+
}
|
|
25
|
+
sliceAddress2 = address.length > startSliceBy + 2 ? `${address.slice(0, startSliceBy + 2)}...${address.slice(
|
|
26
|
+
-effectiveEndSliceBy
|
|
27
|
+
)}` : address;
|
|
28
|
+
return sliceAddress2;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const style = ":host {\n display: inline-flex\n}";
|
|
32
|
+
|
|
33
|
+
var __defProp = Object.defineProperty;
|
|
34
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
35
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
36
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
37
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
38
|
+
if (decorator = decorators[i])
|
|
39
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
40
|
+
if (kind && result) __defProp(target, key, result);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
exports.LuksoUsername = class LuksoUsername extends shared_tailwindElement_index.TailwindStyledElement(style) {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
this.name = "";
|
|
47
|
+
this.address = "";
|
|
48
|
+
this.maxWidth = 200;
|
|
49
|
+
this.size = "large";
|
|
50
|
+
this.sliceBy = 8;
|
|
51
|
+
this.addressColor = "";
|
|
52
|
+
this.nameColor = "";
|
|
53
|
+
this.customClass = "";
|
|
54
|
+
this.hidePrefix = false;
|
|
55
|
+
this.prefix = "@";
|
|
56
|
+
this.noTransform = false;
|
|
57
|
+
/** Width of the first 4 bytes of the address */
|
|
58
|
+
this.bytesWidth = 52;
|
|
59
|
+
this.styles = tailwindVariants.tv({
|
|
60
|
+
slots: {
|
|
61
|
+
wrapper: "inline-flex",
|
|
62
|
+
name: "inline-block whitespace-nowrap overflow-hidden text-ellipsis",
|
|
63
|
+
address: "inline-block",
|
|
64
|
+
bytes: "inline-block"
|
|
65
|
+
},
|
|
66
|
+
variants: {
|
|
67
|
+
size: {
|
|
68
|
+
"2x-small": {
|
|
69
|
+
wrapper: "paragraph-ptmono-10-bold"
|
|
70
|
+
},
|
|
71
|
+
"x-small": {
|
|
72
|
+
wrapper: "paragraph-ptmono-10-bold"
|
|
73
|
+
},
|
|
74
|
+
small: {
|
|
75
|
+
wrapper: "paragraph-ptmono-12-bold"
|
|
76
|
+
},
|
|
77
|
+
medium: {
|
|
78
|
+
wrapper: "paragraph-ptmono-14-bold"
|
|
79
|
+
},
|
|
80
|
+
large: {
|
|
81
|
+
wrapper: "paragraph-ptmono-16-bold"
|
|
82
|
+
},
|
|
83
|
+
"x-large": {
|
|
84
|
+
wrapper: "paragraph-ptmono-24-bold"
|
|
85
|
+
},
|
|
86
|
+
"2x-large": {
|
|
87
|
+
wrapper: "paragraph-ptmono-24-bold"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
hasNameColor: {
|
|
91
|
+
false: {
|
|
92
|
+
name: "text-transparent bg-clip-text bg-gradient-to-r from-gradient-1-start to-gradient-1-end"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
hasAddressColor: {
|
|
96
|
+
false: {
|
|
97
|
+
address: "text-neutral-20",
|
|
98
|
+
bytes: "text-neutral-60"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
transformName(name) {
|
|
105
|
+
if (this.noTransform) {
|
|
106
|
+
return name;
|
|
107
|
+
}
|
|
108
|
+
return name?.toLowerCase();
|
|
109
|
+
}
|
|
110
|
+
transformAddress(address) {
|
|
111
|
+
if (this.noTransform || !viem.isAddress(address)) {
|
|
112
|
+
return address;
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
return web3Utils.toChecksumAddress(address);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.warn(error);
|
|
118
|
+
return address;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
addressBytesTemplate(styles) {
|
|
122
|
+
const address = this.transformAddress(this.address);
|
|
123
|
+
return lit.html`<div
|
|
124
|
+
class=${styles}
|
|
125
|
+
style=${index.customStyleMap({
|
|
126
|
+
[`color: var(--${this.addressColor})`]: this.addressColor !== ""
|
|
127
|
+
})}
|
|
128
|
+
>
|
|
129
|
+
#${address.slice(2, 6)}
|
|
130
|
+
</div>`;
|
|
131
|
+
}
|
|
132
|
+
nameTemplate(styles) {
|
|
133
|
+
const name = this.transformName(this.name);
|
|
134
|
+
return lit.html`<div
|
|
135
|
+
class=${styles}
|
|
136
|
+
style=${index.customStyleMap({
|
|
137
|
+
[`max-width: ${this.maxWidth - (this.address ? this.bytesWidth : 0)}px`]: true,
|
|
138
|
+
[`color: var(--${this.nameColor})`]: this.nameColor !== ""
|
|
139
|
+
})}
|
|
140
|
+
>
|
|
141
|
+
${this.hidePrefix ? directive.E : this.prefix}${name}
|
|
142
|
+
</div>`;
|
|
143
|
+
}
|
|
144
|
+
addressTemplate(styles) {
|
|
145
|
+
const address = this.transformAddress(this.address);
|
|
146
|
+
return lit.html`<div
|
|
147
|
+
class=${styles}
|
|
148
|
+
style=${index.customStyleMap({
|
|
149
|
+
[`color: var(--${this.addressColor})`]: this.addressColor !== ""
|
|
150
|
+
})}
|
|
151
|
+
>
|
|
152
|
+
${sliceAddress(address, this.sliceBy, this.sliceBy)}
|
|
153
|
+
</div>`;
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
const { wrapper, name, address, bytes } = this.styles({
|
|
157
|
+
size: this.size,
|
|
158
|
+
hasNameColor: this.nameColor !== "",
|
|
159
|
+
hasAddressColor: this.addressColor !== ""
|
|
160
|
+
});
|
|
161
|
+
const template = (() => {
|
|
162
|
+
if (this.name && this.address) {
|
|
163
|
+
return lit.html`${this.nameTemplate(name())}${this.addressBytesTemplate(
|
|
164
|
+
bytes()
|
|
165
|
+
)}`;
|
|
166
|
+
}
|
|
167
|
+
if (this.name) {
|
|
168
|
+
return this.nameTemplate(name());
|
|
169
|
+
}
|
|
170
|
+
if (this.address) {
|
|
171
|
+
return this.addressTemplate(address());
|
|
172
|
+
}
|
|
173
|
+
})();
|
|
174
|
+
return lit.html`<div class=${cn.cn(wrapper(), this.customClass)}>${template}</div>`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
__decorateClass([
|
|
178
|
+
decorators_js.property({ type: String })
|
|
179
|
+
], exports.LuksoUsername.prototype, "name", 2);
|
|
180
|
+
__decorateClass([
|
|
181
|
+
decorators_js.property({ type: String })
|
|
182
|
+
], exports.LuksoUsername.prototype, "address", 2);
|
|
183
|
+
__decorateClass([
|
|
184
|
+
decorators_js.property({ type: Number, attribute: "max-width" })
|
|
185
|
+
], exports.LuksoUsername.prototype, "maxWidth", 2);
|
|
186
|
+
__decorateClass([
|
|
187
|
+
decorators_js.property({ type: "string" })
|
|
188
|
+
], exports.LuksoUsername.prototype, "size", 2);
|
|
189
|
+
__decorateClass([
|
|
190
|
+
decorators_js.property({ type: Number, attribute: "slice-by" })
|
|
191
|
+
], exports.LuksoUsername.prototype, "sliceBy", 2);
|
|
192
|
+
__decorateClass([
|
|
193
|
+
decorators_js.property({ type: String, attribute: "address-color" })
|
|
194
|
+
], exports.LuksoUsername.prototype, "addressColor", 2);
|
|
195
|
+
__decorateClass([
|
|
196
|
+
decorators_js.property({ type: String, attribute: "name-color" })
|
|
197
|
+
], exports.LuksoUsername.prototype, "nameColor", 2);
|
|
198
|
+
__decorateClass([
|
|
199
|
+
decorators_js.property({ type: String, attribute: "custom-class" })
|
|
200
|
+
], exports.LuksoUsername.prototype, "customClass", 2);
|
|
201
|
+
__decorateClass([
|
|
202
|
+
decorators_js.property({ type: Boolean, attribute: "hide-prefix" })
|
|
203
|
+
], exports.LuksoUsername.prototype, "hidePrefix", 2);
|
|
204
|
+
__decorateClass([
|
|
205
|
+
decorators_js.property({ type: String })
|
|
206
|
+
], exports.LuksoUsername.prototype, "prefix", 2);
|
|
207
|
+
__decorateClass([
|
|
208
|
+
decorators_js.property({ type: Boolean, attribute: "no-transform" })
|
|
209
|
+
], exports.LuksoUsername.prototype, "noTransform", 2);
|
|
210
|
+
exports.LuksoUsername = __decorateClass([
|
|
211
|
+
safeCustomElement.safeCustomElement("lukso-username")
|
|
212
|
+
], exports.LuksoUsername);
|
|
213
|
+
|
|
214
|
+
exports.sliceAddress = sliceAddress;
|