adjust nav

This commit is contained in:
Pete Matsyburka committed 2026-09-23 10:59:54 +03:00
1 parent 44972fcc39
commit 073859a4b7
17 files changed
+287 -72

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ export default class extends HTMLElement {
title: this.dataset.label || target?.textContent.trim(),
icon: this.dataset.icon,
placement: this.dataset.placement || 'menu',
section: this.dataset.section,
native: this.dataset.native,
url: this.dataset.url,
accept: this.dataset.accept,
+35
View File
@@ -0,0 +1,35 @@
export default class extends HTMLElement {
connectedCallback () {
this.addEventListener('click', this.dispatch)
}
disconnectedCallback () {
this.removeEventListener('click', this.dispatch)
}
dispatch = async () => {
const bridge = window.webkit?.messageHandlers?.modal
if (!bridge || this.dataset.loading) return
let detail = this.dataset.detail || 'null'
if (this.dataset.src) {
this.dataset.loading = 'true'
try {
const response = await fetch(this.dataset.src, { headers: { Accept: 'application/json' } })
if (!response.ok) return
detail = await response.text()
} catch {
return
} finally {
delete this.dataset.loading
}
}
bridge.postMessage({ action: 'dispatch', name: this.dataset.name, detail })
}
}