@proximus/lavender-list 2.0.0-alpha.203 → 2.0.0-alpha.205

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/List.d.ts CHANGED
@@ -2,8 +2,8 @@ import { PxElement } from '@proximus/lavender-common';
2
2
  export declare const listVariantValues: string[];
3
3
  export declare class List extends PxElement<HTMLDivElement> {
4
4
  #private;
5
+ protected static readonly template: HTMLTemplateElement;
5
6
  static nativeName: string;
6
- private template;
7
7
  constructor();
8
8
  static get observedAttributes(): string[];
9
9
  connectedCallback(): void;
@@ -1,8 +1,8 @@
1
1
  import { PxElement } from '@proximus/lavender-common';
2
2
  export declare const LIST_ITEM_CONNECTED_EVENT = "px-list-item-connected";
3
3
  export declare class ListItem extends PxElement<HTMLDivElement> {
4
+ protected static readonly template: HTMLTemplateElement;
4
5
  static nativeName: string;
5
- private template;
6
6
  constructor();
7
7
  connectedCallback(): void;
8
8
  static get observedAttributes(): string[];
@@ -19,6 +19,13 @@
19
19
  "description": "",
20
20
  "name": "List",
21
21
  "members": [
22
+ {
23
+ "kind": "field",
24
+ "name": "template",
25
+ "privacy": "protected",
26
+ "static": true,
27
+ "readonly": true
28
+ },
22
29
  {
23
30
  "kind": "field",
24
31
  "name": "nativeName",
@@ -28,11 +35,6 @@
28
35
  "static": true,
29
36
  "default": "'div'"
30
37
  },
31
- {
32
- "kind": "method",
33
- "name": "template",
34
- "privacy": "private"
35
- },
36
38
  {
37
39
  "kind": "method",
38
40
  "name": "#syncChildren",
@@ -88,10 +90,6 @@
88
90
  {
89
91
  "kind": "field",
90
92
  "name": "variant"
91
- },
92
- {
93
- "kind": "field",
94
- "name": "innerHTML"
95
93
  }
96
94
  ],
97
95
  "attributes": [
@@ -154,6 +152,13 @@
154
152
  "description": "",
155
153
  "name": "ListItem",
156
154
  "members": [
155
+ {
156
+ "kind": "field",
157
+ "name": "template",
158
+ "privacy": "protected",
159
+ "static": true,
160
+ "readonly": true
161
+ },
157
162
  {
158
163
  "kind": "field",
159
164
  "name": "nativeName",
@@ -163,11 +168,6 @@
163
168
  "static": true,
164
169
  "default": "'div'"
165
170
  },
166
- {
167
- "kind": "method",
168
- "name": "template",
169
- "privacy": "private"
170
- },
171
171
  {
172
172
  "kind": "field",
173
173
  "name": "$children",
@@ -176,10 +176,6 @@
176
176
  {
177
177
  "kind": "field",
178
178
  "name": "inverted"
179
- },
180
- {
181
- "kind": "field",
182
- "name": "innerHTML"
183
179
  }
184
180
  ],
185
181
  "events": [
package/dist/index.es.js CHANGED
@@ -522,21 +522,39 @@ function y(e, t, n, r = "", i, a = e) {
522
522
  return o.replaceSync(s), o;
523
523
  }
524
524
  //#endregion
525
+ //#region ../common/src/template.ts
526
+ var b = /* @__PURE__ */ new Map(), x = 500;
527
+ function S(e) {
528
+ let t = document.createElement("template");
529
+ return t.innerHTML = e, t;
530
+ }
531
+ function C(e) {
532
+ return S(e);
533
+ }
534
+ function w(e) {
535
+ let t = b.get(e);
536
+ return t || (t = S(e), b.size < x && b.set(e, t)), t;
537
+ }
538
+ function T(e, t) {
539
+ let n = typeof t == "string" ? w(t) : t;
540
+ e.replaceChildren(document.importNode(n.content, !0));
541
+ }
542
+ //#endregion
525
543
  //#region src/listitem.css?inline
526
- var b = ".list-item{gap:var(--px-spacing-xs-mobile);font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-neutral-default);align-items:flex-start;display:flex}.list-item[inverted]{color:var(--px-color-text-neutral-inverted)}:is(:host([variant=ul]),:host([variant=ol])) .list-item{margin-left:var(--px-spacing-default-mobile);display:list-item}:host([variant=ul]) .list-item{list-style-type:disc}:host([variant=ol]) .list-item{counter-set:list-item var(--item-index,0);list-style-type:decimal}@media screen and (width>=48rem){.list-item{gap:var(--px-spacing-xs-tablet)}}@media screen and (width>=64.0625rem){.list-item{gap:var(--px-spacing-xs-laptop)}}@media screen and (width>=90.0625rem){.list-item{gap:var(--px-spacing-xs-desktop)}}", x = new CSSStyleSheet();
527
- x.replaceSync(b);
528
- var S = "px-list-item-connected", C = class extends u {
544
+ var E = ".list-item{gap:var(--px-spacing-xs-mobile);font-family:var(--px-font-family);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-neutral-default);align-items:flex-start;display:flex}.list-item[inverted]{color:var(--px-color-text-neutral-inverted)}:is(:host([variant=ul]),:host([variant=ol])) .list-item{margin-left:var(--px-spacing-default-mobile);display:list-item}:host([variant=ul]) .list-item{list-style-type:disc}:host([variant=ol]) .list-item{counter-set:list-item var(--item-index,0);list-style-type:decimal}@media screen and (width>=48rem){.list-item{gap:var(--px-spacing-xs-tablet)}}@media screen and (width>=64.0625rem){.list-item{gap:var(--px-spacing-xs-laptop)}}@media screen and (width>=90.0625rem){.list-item{gap:var(--px-spacing-xs-desktop)}}", D = new CSSStyleSheet();
545
+ D.replaceSync(E);
546
+ var O = "px-list-item-connected", k = class e extends u {
529
547
  static {
530
- this.nativeName = "div";
548
+ this.template = C("<div class=\"list-item\" role=\"listitem\"><slot name=\"icon\"></slot><slot name=\"label\"></slot></div>");
531
549
  }
532
- template() {
533
- return "\n <div class=\"list-item\" role=\"listitem\">\n <slot name=\"icon\"></slot>\n <slot name=\"label\"></slot>\n </div>\n ";
550
+ static {
551
+ this.nativeName = "div";
534
552
  }
535
553
  constructor() {
536
- super(x), this.shadowRoot.innerHTML = this.template();
554
+ super(D), T(this.shadowRoot, e.template);
537
555
  }
538
556
  connectedCallback() {
539
- this.dispatchEvent(new CustomEvent(S, {
557
+ this.dispatchEvent(new CustomEvent(O, {
540
558
  bubbles: !0,
541
559
  composed: !0
542
560
  }));
@@ -561,30 +579,30 @@ var S = "px-list-item-connected", C = class extends u {
561
579
  e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
562
580
  }
563
581
  };
564
- customElements.get("px-list-item") || customElements.define("px-list-item", C);
582
+ customElements.get("px-list-item") || customElements.define("px-list-item", k);
565
583
  //#endregion
566
584
  //#region src/List.ts
567
- var w = new CSSStyleSheet();
568
- w.replaceSync(e);
569
- var T = [
585
+ var A = new CSSStyleSheet();
586
+ A.replaceSync(e);
587
+ var j = [
570
588
  "",
571
589
  "ul",
572
590
  "ol"
573
- ], E = y("gap", (e, t, n) => `:host([${e}${n ? `--${n}` : ""}='${t}']) .list`, g, "px-spacing", "--list-gap"), D = class extends u {
591
+ ], M = y("gap", (e, t, n) => `:host([${e}${n ? `--${n}` : ""}='${t}']) .list`, g, "px-spacing", "--list-gap"), N = class e extends u {
574
592
  static {
575
- this.nativeName = "div";
593
+ this.template = C("<div class=\"list\" role=\"list\"><slot></slot></div>");
576
594
  }
577
- template() {
578
- return "\n <div class=\"list\" role=\"list\">\n <slot></slot>\n </div>\n ";
595
+ static {
596
+ this.nativeName = "div";
579
597
  }
580
598
  constructor() {
581
- super(w, E), this.shadowRoot.innerHTML = this.template();
599
+ super(A, M), T(this.shadowRoot, e.template);
582
600
  }
583
601
  static get observedAttributes() {
584
602
  return ["inverted", "variant"];
585
603
  }
586
604
  connectedCallback() {
587
- this.gap ||= "xs", this.addEventListener(S, () => {
605
+ this.gap ||= "xs", this.addEventListener(O, () => {
588
606
  this.#e();
589
607
  }), this.#e();
590
608
  }
@@ -608,7 +626,7 @@ var T = [
608
626
  this.isConnected && this.#t();
609
627
  break;
610
628
  case "variant":
611
- this.checkName(T, n) || c(`"${n}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${T.join("\", \"")}".`), this.isConnected && this.#n(n), super.attributeChangedCallback(e, t, n);
629
+ this.checkName(j, n) || c(`"${n}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${j.join("\", \"")}".`), this.isConnected && this.#n(n), super.attributeChangedCallback(e, t, n);
612
630
  break;
613
631
  default: super.attributeChangedCallback(e, t, n);
614
632
  }
@@ -659,6 +677,6 @@ var T = [
659
677
  this._updateAttribute("variant", e);
660
678
  }
661
679
  };
662
- customElements.get("px-list") || customElements.define("px-list", D);
680
+ customElements.get("px-list") || customElements.define("px-list", N);
663
681
  //#endregion
664
- export { S as LIST_ITEM_CONNECTED_EVENT, D as List, C as ListItem, T as listVariantValues };
682
+ export { O as LIST_ITEM_CONNECTED_EVENT, N as List, k as ListItem, j as listVariantValues };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@proximus/lavender-list",
4
- "version": "2.0.0-alpha.203",
4
+ "version": "2.0.0-alpha.205",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -24,8 +24,7 @@
24
24
  { "name": "gapTablet" },
25
25
  { "name": "gapLaptop" },
26
26
  { "name": "gapDesktop" },
27
- { "name": "variant" },
28
- { "name": "innerHTML" }
27
+ { "name": "variant" }
29
28
  ],
30
29
  "events": []
31
30
  }
@@ -39,11 +38,7 @@
39
38
  { "name": "LIST_ITEM_CONNECTED_EVENT", "type": "CustomEvent" }
40
39
  ],
41
40
  "js": {
42
- "properties": [
43
- { "name": "$children" },
44
- { "name": "inverted" },
45
- { "name": "innerHTML" }
46
- ],
41
+ "properties": [{ "name": "$children" }, { "name": "inverted" }],
47
42
  "events": [
48
43
  { "name": "LIST_ITEM_CONNECTED_EVENT", "type": "CustomEvent" }
49
44
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-list",
3
- "version": "2.0.0-alpha.203",
3
+ "version": "2.0.0-alpha.205",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",