@lukso/web-components 1.49.1 → 1.49.2

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.
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const shared_tailwindElement_index = require('../../index-c04e4744.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
+ require('../lukso-share/index.cjs');
7
8
 
8
9
  var __defProp = Object.defineProperty;
9
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -19,7 +20,8 @@ var __decorateClass = (decorators, target, key, kind) => {
19
20
  exports.LuksoFooter = class LuksoFooter extends shared_tailwindElement_index.TailwindElement {
20
21
  constructor() {
21
22
  super(...arguments);
22
- this.providers = [
23
+ this.providers = "";
24
+ this.defaultProviders = [
23
25
  "twitter",
24
26
  "instagram",
25
27
  "linkedin",
@@ -31,6 +33,11 @@ exports.LuksoFooter = class LuksoFooter extends shared_tailwindElement_index.Tai
31
33
  ];
32
34
  }
33
35
  render() {
36
+ let providers = this.defaultProviders;
37
+ try {
38
+ providers = JSON.parse(this.providers);
39
+ } catch (error) {
40
+ }
34
41
  return shared_tailwindElement_index.x`
35
42
  <footer class="bg-neutral-100">
36
43
  <div
@@ -38,9 +45,7 @@ exports.LuksoFooter = class LuksoFooter extends shared_tailwindElement_index.Tai
38
45
  >
39
46
  <slot name="links"></slot>
40
47
  <div class="flex gap-5 flex-col sm:flex-row sm:justify-between">
41
- <lukso-share
42
- providers=${JSON.stringify(this.providers)}
43
- ></lukso-share>
48
+ <lukso-share providers=${JSON.stringify(providers)}></lukso-share>
44
49
  <div class="flex sm:ml-8 sm:justify-end">
45
50
  <a
46
51
  href="https://lukso.network/"
@@ -65,7 +70,7 @@ exports.LuksoFooter = class LuksoFooter extends shared_tailwindElement_index.Tai
65
70
  }
66
71
  };
67
72
  __decorateClass([
68
- queryAssignedElements.n({ type: Array })
73
+ queryAssignedElements.n({ type: String })
69
74
  ], exports.LuksoFooter.prototype, "providers", 2);
70
75
  exports.LuksoFooter = __decorateClass([
71
76
  queryAssignedElements.e("lukso-footer")
@@ -1,7 +1,7 @@
1
1
  import { TailwindElement } from '../../shared/tailwind-element';
2
- import { ProviderName, ProviderObject } from '../../components/lukso-share';
3
2
  export declare class LuksoFooter extends TailwindElement {
4
- providers: ProviderName[] | ProviderObject[];
3
+ providers: string;
4
+ private defaultProviders;
5
5
  render(): import("lit-html").TemplateResult<1>;
6
6
  }
7
7
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-footer/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEvE,qBACa,WAAY,SAAQ,eAAe;IAE9C,SAAS,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAS3C;IAED,MAAM;CAiCP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAA;KAC5B;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-footer/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,0BAA0B,CAAA;AAEjC,qBACa,WAAY,SAAQ,eAAe;IAE9C,SAAS,SAAK;IAEd,OAAO,CAAC,gBAAgB,CASvB;IAED,MAAM;CAuCP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAA;KAC5B;CACF"}
@@ -1,5 +1,6 @@
1
1
  import { a as TailwindElement, x } from '../../index-cfea1b58.js';
2
2
  import { n, e } from '../../query-assigned-elements-5d94572f.js';
3
+ import '../lukso-share/index.js';
3
4
 
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -15,7 +16,8 @@ var __decorateClass = (decorators, target, key, kind) => {
15
16
  let LuksoFooter = class extends TailwindElement {
16
17
  constructor() {
17
18
  super(...arguments);
18
- this.providers = [
19
+ this.providers = "";
20
+ this.defaultProviders = [
19
21
  "twitter",
20
22
  "instagram",
21
23
  "linkedin",
@@ -27,6 +29,11 @@ let LuksoFooter = class extends TailwindElement {
27
29
  ];
28
30
  }
29
31
  render() {
32
+ let providers = this.defaultProviders;
33
+ try {
34
+ providers = JSON.parse(this.providers);
35
+ } catch (error) {
36
+ }
30
37
  return x`
31
38
  <footer class="bg-neutral-100">
32
39
  <div
@@ -34,9 +41,7 @@ let LuksoFooter = class extends TailwindElement {
34
41
  >
35
42
  <slot name="links"></slot>
36
43
  <div class="flex gap-5 flex-col sm:flex-row sm:justify-between">
37
- <lukso-share
38
- providers=${JSON.stringify(this.providers)}
39
- ></lukso-share>
44
+ <lukso-share providers=${JSON.stringify(providers)}></lukso-share>
40
45
  <div class="flex sm:ml-8 sm:justify-end">
41
46
  <a
42
47
  href="https://lukso.network/"
@@ -61,7 +66,7 @@ let LuksoFooter = class extends TailwindElement {
61
66
  }
62
67
  };
63
68
  __decorateClass([
64
- n({ type: Array })
69
+ n({ type: String })
65
70
  ], LuksoFooter.prototype, "providers", 2);
66
71
  LuksoFooter = __decorateClass([
67
72
  e("lukso-footer")
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-footer.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-footer/lukso-footer.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAEhD,OAAO,SAAS,CAAA;AAEhB,8HAA8H;AAC9H,QAAA,MAAM,IAAI,EAAE,IAyBX,CAAA;AAED,eAAe,IAAI,CAAA;AAqCnB,kCAAkC;AAClC,eAAO,MAAM,aAAa,KAAoB,CAAA;AAE9C,iJAAiJ;AACjJ,eAAO,MAAM,cAAc,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-footer.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-footer/lukso-footer.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAEhD,OAAO,SAAS,CAAA;AAEhB,8HAA8H;AAC9H,QAAA,MAAM,IAAI,EAAE,IA0BX,CAAA;AAED,eAAe,IAAI,CAAA;AAqCnB,kCAAkC;AAClC,eAAO,MAAM,aAAa,KAAoB,CAAA;AAE9C,iJAAiJ;AACjJ,eAAO,MAAM,cAAc,KAAoB,CAAA"}
@@ -22,7 +22,8 @@ exports.LuksoShare = class LuksoShare extends shared_tailwindElement_index.Tailw
22
22
  constructor() {
23
23
  super(...arguments);
24
24
  this.customStyle = "";
25
- this.providers = [
25
+ this.providers = "";
26
+ this.defaultProviders = [
26
27
  "twitter",
27
28
  "instagram",
28
29
  "linkedin",
@@ -53,7 +54,12 @@ exports.LuksoShare = class LuksoShare extends shared_tailwindElement_index.Tailw
53
54
  }
54
55
  render() {
55
56
  const linkTemplates = [];
56
- for (const provider of this.providers) {
57
+ let providers = this.defaultProviders;
58
+ try {
59
+ providers = JSON.parse(this.providers);
60
+ } catch (error) {
61
+ }
62
+ for (const provider of providers) {
57
63
  if (typeof provider === "string") {
58
64
  linkTemplates.push(
59
65
  this.linkTemplate(provider, this.defaultProviderLinks[provider])
@@ -64,7 +70,7 @@ exports.LuksoShare = class LuksoShare extends shared_tailwindElement_index.Tailw
64
70
  }
65
71
  return shared_tailwindElement_index.x`<div
66
72
  class="grid gap-2 sm:gap-4"
67
- style="grid-template-columns: repeat(${this.providers.length}, max-content); ${this.customStyle}"
73
+ style="grid-template-columns: repeat(${providers.length}, max-content); ${this.customStyle}"
68
74
  >
69
75
  ${linkTemplates}
70
76
  </div>`;
@@ -74,7 +80,7 @@ __decorateClass([
74
80
  queryAssignedElements.n({ type: String, attribute: "custom-style" })
75
81
  ], exports.LuksoShare.prototype, "customStyle", 2);
76
82
  __decorateClass([
77
- queryAssignedElements.n({ type: Array })
83
+ queryAssignedElements.n({ type: String })
78
84
  ], exports.LuksoShare.prototype, "providers", 2);
79
85
  exports.LuksoShare = __decorateClass([
80
86
  queryAssignedElements.e("lukso-share")
@@ -10,7 +10,8 @@ export type ProviderObject = {
10
10
  declare const LuksoShare_base: typeof import("lit").LitElement;
11
11
  export declare class LuksoShare extends LuksoShare_base {
12
12
  customStyle: string;
13
- providers: ProviderName[] | ProviderObject[];
13
+ providers: string;
14
+ private defaultProviders;
14
15
  private defaultProviderLinks;
15
16
  linkTemplate(name: ProviderName, url: Url): import("lit-html").TemplateResult<1>;
16
17
  render(): import("lit-html").TemplateResult<1>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-share/index.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,MAAM,GAAG,GAAG,WAAW,MAAM,EAAE,CAAA;AAErC,MAAM,MAAM,aAAa,GAAG;KACzB,GAAG,IAAI,YAAY,GAAG,GAAG;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,GAAG,EAAE,GAAG,CAAA;CACT,CAAA;;AAED,qBACa,UAAW,SAAQ,eAA4B;IAE1D,WAAW,SAAK;IAGhB,SAAS,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAS3C;IAED,OAAO,CAAC,oBAAoB,CAS3B;IAED,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG;IASzC,MAAM;CAqBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAA;KAC1B;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-share/index.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,MAAM,GAAG,GAAG,WAAW,MAAM,EAAE,CAAA;AAErC,MAAM,MAAM,aAAa,GAAG;KACzB,GAAG,IAAI,YAAY,GAAG,GAAG;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,YAAY,CAAA;IAClB,GAAG,EAAE,GAAG,CAAA;CACT,CAAA;;AAED,qBACa,UAAW,SAAQ,eAA4B;IAE1D,WAAW,SAAK;IAGhB,SAAS,SAAK;IAEd,OAAO,CAAC,gBAAgB,CASvB;IAED,OAAO,CAAC,oBAAoB,CAS3B;IAED,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG;IASzC,MAAM;CA4BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAA;KAC1B;CACF"}
@@ -18,7 +18,8 @@ let LuksoShare = class extends TailwindStyledElement(style) {
18
18
  constructor() {
19
19
  super(...arguments);
20
20
  this.customStyle = "";
21
- this.providers = [
21
+ this.providers = "";
22
+ this.defaultProviders = [
22
23
  "twitter",
23
24
  "instagram",
24
25
  "linkedin",
@@ -49,7 +50,12 @@ let LuksoShare = class extends TailwindStyledElement(style) {
49
50
  }
50
51
  render() {
51
52
  const linkTemplates = [];
52
- for (const provider of this.providers) {
53
+ let providers = this.defaultProviders;
54
+ try {
55
+ providers = JSON.parse(this.providers);
56
+ } catch (error) {
57
+ }
58
+ for (const provider of providers) {
53
59
  if (typeof provider === "string") {
54
60
  linkTemplates.push(
55
61
  this.linkTemplate(provider, this.defaultProviderLinks[provider])
@@ -60,7 +66,7 @@ let LuksoShare = class extends TailwindStyledElement(style) {
60
66
  }
61
67
  return x`<div
62
68
  class="grid gap-2 sm:gap-4"
63
- style="grid-template-columns: repeat(${this.providers.length}, max-content); ${this.customStyle}"
69
+ style="grid-template-columns: repeat(${providers.length}, max-content); ${this.customStyle}"
64
70
  >
65
71
  ${linkTemplates}
66
72
  </div>`;
@@ -70,7 +76,7 @@ __decorateClass([
70
76
  n({ type: String, attribute: "custom-style" })
71
77
  ], LuksoShare.prototype, "customStyle", 2);
72
78
  __decorateClass([
73
- n({ type: Array })
79
+ n({ type: String })
74
80
  ], LuksoShare.prototype, "providers", 2);
75
81
  LuksoShare = __decorateClass([
76
82
  e("lukso-share")
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-share.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-share/lukso-share.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAEhD,OAAO,SAAS,CAAA;AAEhB,8DAA8D;AAC9D,QAAA,MAAM,IAAI,EAAE,IAyCX,CAAA;AAED,eAAe,IAAI,CAAA;AAQnB,iDAAiD;AACjD,eAAO,MAAM,OAAO,KAAoB,CAAA;AAExC,2EAA2E;AAC3E,eAAO,MAAM,WAAW,KAAoB,CAAA;AAK5C,iJAAiJ;AACjJ,eAAO,MAAM,cAAc,KAAoB,CAAA;AAK/C;;;;;;;;EAQE;AACF,eAAO,MAAM,kBAAkB,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-share.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-share/lukso-share.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAEhD,OAAO,SAAS,CAAA;AAEhB,8DAA8D;AAC9D,QAAA,MAAM,IAAI,EAAE,IA0CX,CAAA;AAED,eAAe,IAAI,CAAA;AAQnB,iDAAiD;AACjD,eAAO,MAAM,OAAO,KAAoB,CAAA;AAExC,2EAA2E;AAC3E,eAAO,MAAM,WAAW,KAAoB,CAAA;AAK5C,iJAAiJ;AACjJ,eAAO,MAAM,cAAc,KAAoB,CAAA;AAK/C;;;;;;;;EAQE;AACF,eAAO,MAAM,kBAAkB,KAAoB,CAAA"}
@@ -4,9 +4,27 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const shared_tailwindElement_index = require('../../index-c04e4744.cjs');
6
6
  const queryAssignedElements = require('../../query-assigned-elements-1d5d9d4c.cjs');
7
- const styleMap = require('../../style-map-ea2513e4.cjs');
8
7
  const index = require('../../index-e9668573.cjs');
9
- require('../../directive-8278ab14.cjs');
8
+ const directive = require('../../directive-8278ab14.cjs');
9
+
10
+ class CustomStyleMapDirective extends directive.i {
11
+ constructor(partInfo) {
12
+ super(partInfo);
13
+ if (partInfo.type !== directive.t.ATTRIBUTE || partInfo.name !== "style" || partInfo.strings?.length > 2) {
14
+ throw new Error(
15
+ "`customStyleMap()` can only be used in the `style` attribute and must be the only part in the attribute."
16
+ );
17
+ }
18
+ }
19
+ render(styleInfoList) {
20
+ const styles = Object.keys(styleInfoList).filter((key) => styleInfoList[key]);
21
+ if (styles.length === 0) {
22
+ return shared_tailwindElement_index.A;
23
+ }
24
+ return ` ${styles.join("; ")} `;
25
+ }
26
+ }
27
+ const customStyleMap = directive.e(CustomStyleMapDirective);
10
28
 
11
29
  const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
12
30
  if (!address) {
@@ -50,43 +68,33 @@ exports.LuksoUsername = class LuksoUsername extends shared_tailwindElement_index
50
68
  /** Width of the first 4 bytes of the address */
51
69
  this.bytesWidth = 52;
52
70
  }
53
- /**
54
- * Template for 4byte address
55
- * e.g: #1234
56
- */
57
71
  addressBytesTemplate() {
58
72
  return shared_tailwindElement_index.x`<div
59
73
  class="inline-block ${index.customClassMap({
60
- ["text-" + this.addressColor]: this.addressColor !== "",
61
74
  ["text-neutral-60"]: this.addressColor === ""
62
75
  })}"
76
+ style=${customStyleMap({
77
+ [`color: var(--${this.addressColor})`]: this.addressColor !== ""
78
+ })}
63
79
  >
64
80
  #${this.address.slice(2, 6)}
65
81
  </div>`;
66
82
  }
67
- /**
68
- * Template for name
69
- * e.g: @John
70
- */
71
83
  nameTemplate() {
72
84
  return shared_tailwindElement_index.x`<div
73
85
  class="inline-block whitespace-nowrap overflow-hidden text-ellipsis ${index.customClassMap(
74
86
  {
75
- ["text-transparent bg-clip-text bg-gradient-to-r from-gradient-1-start to-gradient-1-end"]: this.nameColor === "",
76
- ["text-" + this.nameColor]: this.nameColor !== ""
87
+ ["text-transparent bg-clip-text bg-gradient-to-r from-gradient-1-start to-gradient-1-end"]: this.nameColor === ""
77
88
  }
78
89
  )}"
79
- style=${styleMap.o({
80
- maxWidth: `${this.maxWidth - this.bytesWidth}px`
90
+ style=${customStyleMap({
91
+ [`max-width: ${this.maxWidth - this.bytesWidth}px`]: true,
92
+ [`color: var(--${this.nameColor})`]: this.nameColor !== ""
81
93
  })}
82
94
  >
83
95
  ${this.hidePrefix ? shared_tailwindElement_index.A : this.prefix}${this.name}
84
96
  </div>`;
85
97
  }
86
- /**
87
- * Template for address
88
- * e.g: 0x123...789
89
- */
90
98
  addressTemplate() {
91
99
  return shared_tailwindElement_index.x`<div
92
100
  class="inline-block ${index.customClassMap({
@@ -13,20 +13,8 @@ export declare class LuksoUsername extends LuksoUsername_base {
13
13
  prefix: string;
14
14
  /** Width of the first 4 bytes of the address */
15
15
  private bytesWidth;
16
- /**
17
- * Template for 4byte address
18
- * e.g: #1234
19
- */
20
16
  private addressBytesTemplate;
21
- /**
22
- * Template for name
23
- * e.g: @John
24
- */
25
17
  private nameTemplate;
26
- /**
27
- * Template for address
28
- * e.g: 0x123...789
29
- */
30
18
  private addressTemplate;
31
19
  render(): import("lit-html").TemplateResult<1>;
32
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-username/index.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;;AAEnE,qBACa,aAAc,SAAQ,kBAA4B;IAE7D,IAAI,SAAK;IAGT,OAAO,SAAK;IAGZ,QAAQ,SAAM;IAGd,IAAI,EAAE,YAAY,CAAU;IAG5B,OAAO,SAAI;IAGX,YAAY,SAAK;IAGjB,SAAS,SAAK;IAGd,WAAW,SAAK;IAGhB,UAAU,UAAQ;IAGlB,MAAM,SAAM;IAEZ,gDAAgD;IAChD,OAAO,CAAC,UAAU,CAAK;IAEvB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAiBpB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAWvB,MAAM;CA2BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAA;KAChC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-username/index.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;;AAEnE,qBACa,aAAc,SAAQ,kBAA4B;IAE7D,IAAI,SAAK;IAGT,OAAO,SAAK;IAGZ,QAAQ,SAAM;IAGd,IAAI,EAAE,YAAY,CAAU;IAG5B,OAAO,SAAI;IAGX,YAAY,SAAK;IAGjB,SAAS,SAAK;IAGd,WAAW,SAAK;IAGhB,UAAU,UAAQ;IAGlB,MAAM,SAAM;IAEZ,gDAAgD;IAChD,OAAO,CAAC,UAAU,CAAK;IAEvB,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,eAAe;IAWvB,MAAM;CA2BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAA;KAChC;CACF"}
@@ -1,8 +1,26 @@
1
- import { T as TailwindStyledElement, x, A } from '../../index-cfea1b58.js';
2
- import { n, e } from '../../query-assigned-elements-5d94572f.js';
3
- import { o } from '../../style-map-b2a337a1.js';
1
+ import { A, T as TailwindStyledElement, x } from '../../index-cfea1b58.js';
2
+ import { n, e as e$1 } from '../../query-assigned-elements-5d94572f.js';
4
3
  import { c as customClassMap } from '../../index-5e194caf.js';
5
- import '../../directive-2bb7789e.js';
4
+ import { e, i, t } from '../../directive-2bb7789e.js';
5
+
6
+ class CustomStyleMapDirective extends i {
7
+ constructor(partInfo) {
8
+ super(partInfo);
9
+ if (partInfo.type !== t.ATTRIBUTE || partInfo.name !== "style" || partInfo.strings?.length > 2) {
10
+ throw new Error(
11
+ "`customStyleMap()` can only be used in the `style` attribute and must be the only part in the attribute."
12
+ );
13
+ }
14
+ }
15
+ render(styleInfoList) {
16
+ const styles = Object.keys(styleInfoList).filter((key) => styleInfoList[key]);
17
+ if (styles.length === 0) {
18
+ return A;
19
+ }
20
+ return ` ${styles.join("; ")} `;
21
+ }
22
+ }
23
+ const customStyleMap = e(CustomStyleMapDirective);
6
24
 
7
25
  const sliceAddress = (address, startSliceBy = 6, endSliceBy) => {
8
26
  if (!address) {
@@ -46,43 +64,33 @@ let LuksoUsername = class extends TailwindStyledElement(style) {
46
64
  /** Width of the first 4 bytes of the address */
47
65
  this.bytesWidth = 52;
48
66
  }
49
- /**
50
- * Template for 4byte address
51
- * e.g: #1234
52
- */
53
67
  addressBytesTemplate() {
54
68
  return x`<div
55
69
  class="inline-block ${customClassMap({
56
- ["text-" + this.addressColor]: this.addressColor !== "",
57
70
  ["text-neutral-60"]: this.addressColor === ""
58
71
  })}"
72
+ style=${customStyleMap({
73
+ [`color: var(--${this.addressColor})`]: this.addressColor !== ""
74
+ })}
59
75
  >
60
76
  #${this.address.slice(2, 6)}
61
77
  </div>`;
62
78
  }
63
- /**
64
- * Template for name
65
- * e.g: @John
66
- */
67
79
  nameTemplate() {
68
80
  return x`<div
69
81
  class="inline-block whitespace-nowrap overflow-hidden text-ellipsis ${customClassMap(
70
82
  {
71
- ["text-transparent bg-clip-text bg-gradient-to-r from-gradient-1-start to-gradient-1-end"]: this.nameColor === "",
72
- ["text-" + this.nameColor]: this.nameColor !== ""
83
+ ["text-transparent bg-clip-text bg-gradient-to-r from-gradient-1-start to-gradient-1-end"]: this.nameColor === ""
73
84
  }
74
85
  )}"
75
- style=${o({
76
- maxWidth: `${this.maxWidth - this.bytesWidth}px`
86
+ style=${customStyleMap({
87
+ [`max-width: ${this.maxWidth - this.bytesWidth}px`]: true,
88
+ [`color: var(--${this.nameColor})`]: this.nameColor !== ""
77
89
  })}
78
90
  >
79
91
  ${this.hidePrefix ? A : this.prefix}${this.name}
80
92
  </div>`;
81
93
  }
82
- /**
83
- * Template for address
84
- * e.g: 0x123...789
85
- */
86
94
  addressTemplate() {
87
95
  return x`<div
88
96
  class="inline-block ${customClassMap({
@@ -149,7 +157,7 @@ __decorateClass([
149
157
  n({ type: String })
150
158
  ], LuksoUsername.prototype, "prefix", 2);
151
159
  LuksoUsername = __decorateClass([
152
- e("lukso-username")
160
+ e$1("lukso-username")
153
161
  ], LuksoUsername);
154
162
 
155
163
  export { LuksoUsername };
@@ -15,7 +15,7 @@ export declare const SliceAddressBy4: any;
15
15
  /** Color of the address and name can be changed via `name-color` and `address-color` attribute. */
16
16
  export declare const CustomColor: any;
17
17
  /** You can customize prefix with `prefix` attribute. */
18
- export declare const CustomPrefixColor: any;
18
+ export declare const CustomPrefix: any;
19
19
  /** You can hide prefix completely by adding `hide-prefix` attribute. */
20
20
  export declare const HidePrefix: any;
21
21
  //# sourceMappingURL=lukso-username.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lukso-username.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-username/lukso-username.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAEhD,OAAO,SAAS,CAAA;AAEhB,iIAAiI;AACjI,QAAA,MAAM,IAAI,EAAE,IA2HX,CAAA;AAED,eAAe,IAAI,CAAA;AA2BnB,uGAAuG;AACvG,eAAO,MAAM,eAAe,KAAoB,CAAA;AAEhD,mGAAmG;AACnG,eAAO,MAAM,QAAQ,KAAoB,CAAA;AAKzC,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,KAAoB,CAAA;AAKzC,+EAA+E;AAC/E,eAAO,MAAM,WAAW,KAAoB,CAAA;AAO5C,4FAA4F;AAC5F,eAAO,MAAM,eAAe,KAAoB,CAAA;AAOhD,mGAAmG;AACnG,eAAO,MAAM,WAAW,KAAoB,CAAA;AAM5C,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,KAAoB,CAAA;AAKlD,wEAAwE;AACxE,eAAO,MAAM,UAAU,KAAoB,CAAA"}
1
+ {"version":3,"file":"lukso-username.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/lukso-username/lukso-username.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAEhD,OAAO,SAAS,CAAA;AAEhB,iIAAiI;AACjI,QAAA,MAAM,IAAI,EAAE,IA2HX,CAAA;AAED,eAAe,IAAI,CAAA;AA2BnB,uGAAuG;AACvG,eAAO,MAAM,eAAe,KAAoB,CAAA;AAEhD,mGAAmG;AACnG,eAAO,MAAM,QAAQ,KAAoB,CAAA;AAKzC,2DAA2D;AAC3D,eAAO,MAAM,QAAQ,KAAoB,CAAA;AAKzC,+EAA+E;AAC/E,eAAO,MAAM,WAAW,KAAoB,CAAA;AAO5C,4FAA4F;AAC5F,eAAO,MAAM,eAAe,KAAoB,CAAA;AAOhD,mGAAmG;AACnG,eAAO,MAAM,WAAW,KAAoB,CAAA;AAM5C,wDAAwD;AACxD,eAAO,MAAM,YAAY,KAAoB,CAAA;AAK7C,wEAAwE;AACxE,eAAO,MAAM,UAAU,KAAoB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/web-components",
3
- "version": "1.49.1",
3
+ "version": "1.49.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",