@vandeurenglenn/lite-elements 0.3.74 → 0.3.75

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.
@@ -1 +1 @@
1
- import{s as e}from"./dark-mode-BhSl3mXB.js";class SelectBase extends e{#e;currentSelected;connectedCallback(){this.selected=this.defaultSelected}get multi(){return this.hasAttribute("multi")}set multi(e){e?this.setAttribute("multi",""):this.removeAttribute("multi")}get defaultSelected(){return this.getAttribute("default-selected")||0}set selected(e){this.#e=e,this.#t()}get selected(){return this.#e}get slotted(){return this.shadowRoot?this.shadowRoot.querySelector("slot"):this}get#s(){const e="assignedNodes"in this.slotted?this.slotted.assignedNodes():this.children,t=[];for(var s=0;s<e.length;s++){const d=e[s];1===d.nodeType&&t.push(d)}return t}get attrForSelected(){return this.getAttribute("attr-for-selected")||"name"}set attrForSelected(e){this.setAttribute("attr-for-selected",e)}attributeChangedCallback(e,t,s){t!==s&&(isNaN(s)||(s=Number(s)),this[e]=s)}select(e){e&&(this.selected=e),this.multi&&this.#t()}next(){const e=this.getIndexFor(this.currentSelected);-1!==e&&e>=0&&this.#s.length>e&&e+1<=this.#s.length-1&&(this.selected=this.#s[e+1])}previous(){const e=this.getIndexFor(this.currentSelected);-1!==e&&e>=0&&this.#s.length>e&&e-1>=0&&(this.selected=this.#s[e-1])}getIndexFor(e){return this.#s.indexOf(e||this.selected)}#d(e,t){e.classList.add("custom-selected"),t&&t!==e&&t.classList.remove("custom-selected"),this.currentSelected=e}#i(e){for(const t of this.#s)e.includes(t.getAttribute(this.attrForSelected))?t.classList.add("custom-selected"):t.classList.remove("custom-selected")}#r(e){for(const t of this.#s)if(t.getAttribute(this.attrForSelected)===e)return this.#d(t,this.currentSelected)}#t(){if(void 0===this.selected)return void(this.currentSelected&&this.currentSelected.classList.remove("custom-selected"));const e=typeof this.selected;if(Array.isArray(this.selected))return this.#i(this.selected);if("object"===e)return this.#d(this.selected,this.currentSelected);if("string"===e)return this.#r(this.selected);const t=this.#s[this.selected];t&&this.#d(t,this.currentSelected)}}function t(e){return SelectBase}export{SelectBase,t as SelectMixin};
1
+ import{s as e}from"./dark-mode-BhSl3mXB.js";class SelectBase extends e{#e;currentSelected;beforeRender(){this.selected=this.defaultSelected}get multi(){return this.hasAttribute("multi")}set multi(e){e?this.setAttribute("multi",""):this.removeAttribute("multi")}get defaultSelected(){return this.getAttribute("default-selected")||0}set selected(e){this.#e=e,this.#t()}get selected(){return this.#e}get slotted(){return this.shadowRoot?this.shadowRoot.querySelector("slot"):this}get#s(){const e="assignedNodes"in this.slotted?this.slotted.assignedNodes():this.children,t=[];for(var s=0;s<e.length;s++){const d=e[s];1===d.nodeType&&t.push(d)}return t}get attrForSelected(){return this.getAttribute("attr-for-selected")||"name"}set attrForSelected(e){this.setAttribute("attr-for-selected",e)}attributeChangedCallback(e,t,s){t!==s&&(isNaN(s)||(s=Number(s)),this[e]=s)}select(e){e&&(this.selected=e),this.multi&&this.#t()}next(){const e=this.getIndexFor(this.currentSelected);-1!==e&&e>=0&&this.#s.length>e&&e+1<=this.#s.length-1&&(this.selected=this.#s[e+1])}previous(){const e=this.getIndexFor(this.currentSelected);-1!==e&&e>=0&&this.#s.length>e&&e-1>=0&&(this.selected=this.#s[e-1])}getIndexFor(e){return this.#s.indexOf(e||this.selected)}#d(e,t){e.classList.add("custom-selected"),t&&t!==e&&t.classList.remove("custom-selected"),this.currentSelected=e}#i(e){for(const t of this.#s)e.includes(t.getAttribute(this.attrForSelected))?t.classList.add("custom-selected"):t.classList.remove("custom-selected")}#r(e){for(const t of this.#s)if(t.getAttribute(this.attrForSelected)===e)return this.#d(t,this.currentSelected)}#t(){if(void 0===this.selected)return void(this.currentSelected&&this.currentSelected.classList.remove("custom-selected"));const e=typeof this.selected;if(Array.isArray(this.selected))return this.#i(this.selected);if("object"===e)return this.#d(this.selected,this.currentSelected);if("string"===e)return this.#r(this.selected);const t=this.#s[this.selected];t&&this.#d(t,this.currentSelected)}}function t(e){return SelectBase}export{SelectBase,t as SelectMixin};
@@ -1 +1 @@
1
- import{SelectBase as e}from"./select-mixin.js";import"./dark-mode-BhSl3mXB.js";class SelectorBase extends e{constructor(){super()}async connectedCallback(){super.connectedCallback&&await super.connectedCallback(),this.slotted.addEventListener("click",this.#e.bind(this))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this.slotted.removeEventListener("click",this.#e.bind(this))}#e(e){const t=e.composedPath()[0];if(t.localName===this.localName)return;const s=t.getAttribute(this.attrForSelected)||t;if(this.multi){const e=Array.isArray(this.selected)?this.selected:[],t=e.indexOf(s);-1===t?e.push(s):e.splice(t,1),this.selected=e}else this.selected=s;this.dispatchEvent(new CustomEvent("selected",{detail:s}))}}function t(e){return SelectorBase}export{SelectorBase,t as SelectorMixin};
1
+ import{SelectBase as e}from"./select-mixin.js";import"./dark-mode-BhSl3mXB.js";class SelectorBase extends e{constructor(){super()}firstRender(){super.firstRender?.(),this.slotted.addEventListener("click",this.#e.bind(this))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this.slotted.removeEventListener("click",this.#e.bind(this))}#e(e){const t=e.composedPath()[0];if(t.localName===this.localName)return;const s=t.getAttribute(this.attrForSelected)||t;if(this.multi){const e=Array.isArray(this.selected)?this.selected:[],t=e.indexOf(s);-1===t?e.push(s):e.splice(t,1),this.selected=e}else this.selected=s;this.dispatchEvent(new CustomEvent("selected",{detail:s}))}}function t(e){return SelectorBase}export{SelectorBase,t as SelectorMixin};
@@ -2,7 +2,7 @@ import { LiteElement } from '@vandeurenglenn/lite';
2
2
  export declare class SelectBase extends LiteElement {
3
3
  #private;
4
4
  currentSelected: HTMLElement;
5
- connectedCallback(): void;
5
+ beforeRender(): void;
6
6
  get multi(): boolean;
7
7
  set multi(value: boolean);
8
8
  get defaultSelected(): string | 0;
@@ -2,7 +2,7 @@ import { SelectBase } from './select-mixin.js';
2
2
  export declare class SelectorBase extends SelectBase {
3
3
  #private;
4
4
  constructor();
5
- connectedCallback(): Promise<void>;
5
+ firstRender(): void;
6
6
  disconnectedCallback(): void;
7
7
  }
8
8
  export declare function SelectorMixin<TBase extends CustomElementConstructor>(Base: TBase): typeof SelectorBase;
@@ -3,7 +3,7 @@ import { LiteElement } from '@vandeurenglenn/lite';
3
3
  class SelectBase extends LiteElement {
4
4
  #selected;
5
5
  currentSelected;
6
- connectedCallback() {
6
+ beforeRender() {
7
7
  this.selected = this.defaultSelected;
8
8
  }
9
9
  get multi() {
@@ -5,9 +5,8 @@ class SelectorBase extends SelectBase {
5
5
  constructor() {
6
6
  super();
7
7
  }
8
- async connectedCallback() {
9
- super.connectedCallback && (await super.connectedCallback());
10
- // this.updateComplete && await this.updateComplete
8
+ firstRender() {
9
+ super.firstRender?.();
11
10
  this.slotted.addEventListener('click', this.#onClick.bind(this));
12
11
  }
13
12
  disconnectedCallback() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vandeurenglenn/lite-elements",
3
- "version": "0.3.74",
3
+ "version": "0.3.75",
4
4
  "description": "set of lite elements following Material Design 3 spec",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
21
  "@material-design-icons/svg": "^0.14.15",
22
- "@material-symbols/svg-400": "^0.30.0",
22
+ "@material-symbols/svg-400": "^0.31.2",
23
23
  "@material/web": "^2.3.0",
24
24
  "@vandeurenglenn/custom-shared-styles": "^0.0.21",
25
25
  "@vandeurenglenn/flex-elements": "^1.3.2",
@@ -33,14 +33,14 @@
33
33
  "@rollup/plugin-terser": "^0.4.4",
34
34
  "@rollup/plugin-typescript": "^12.1.2",
35
35
  "@types/html": "^1.0.4",
36
- "@types/node": "^22.14.0",
36
+ "@types/node": "^22.14.1",
37
37
  "@web/rollup-plugin-html": "^2.3.0",
38
38
  "chrome-launcher": "^1.1.2",
39
39
  "globby": "^14.1.0",
40
40
  "lighthouse": "^12.5.1",
41
- "material-symbols": "^0.30.0",
41
+ "material-symbols": "^0.31.2",
42
42
  "rimraf": "^6.0.1",
43
- "rollup": "^4.39.0",
43
+ "rollup": "^4.40.0",
44
44
  "rollup-plugin-auto-exports": "^1.0.8",
45
45
  "rollup-plugin-material-symbols": "^2.1.6",
46
46
  "tslib": "^2.8.1",