@damienmortini/damdom-gallery
Advanced tools
Comparing version 0.0.5 to 0.0.6
13
index.js
@@ -5,2 +5,3 @@ class DamdomGalleryElement extends HTMLElement { | ||
#grid | ||
#highlightedElement | ||
@@ -151,8 +152,8 @@ constructor() { | ||
set highlightedIndex(value) { | ||
const element = this.querySelector(`[slot=element${value}]`) | ||
if (!element) value = -1 | ||
this.#highlightedElement = this.querySelector(`[slot=element${value}]`) | ||
if (!this.#highlightedElement) value = -1 | ||
if (value === this.#highlightedIndex) return | ||
if (value !== -1) { | ||
element.slot = 'highlight' | ||
element.toggleAttribute('highlighted', true) | ||
this.#highlightedElement.slot = 'highlight' | ||
this.#highlightedElement.toggleAttribute('highlighted', true) | ||
this.#highlight.classList.remove('hide') | ||
@@ -171,4 +172,8 @@ this.#grid.classList.add('hide') | ||
} | ||
get highlightedElement() { | ||
return this.#highlightedElement | ||
} | ||
} | ||
window.customElements.define('damdom-gallery', DamdomGalleryElement) |
{ | ||
"name": "@damienmortini/damdom-gallery", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "<damdom-gallery> custom element.", | ||
@@ -22,3 +22,3 @@ "publishConfig": { | ||
"homepage": "https://github.com/damienmortini/lib/tree/main/damdom/damdom-gallery", | ||
"gitHead": "741b4c10e156ed006c9b089d2ed8d4fb61976aaa" | ||
"gitHead": "ade945458d4e28b5eecafafea7d75ba4edc20ed8" | ||
} |
8140
157