Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
141 lines
4.8 KiB
JavaScript
141 lines
4.8 KiB
JavaScript
document.addEventListener('livewire:init', () => {
|
|
const findClosestLivewireComponent = (el) => {
|
|
let closestRoot = Alpine.findClosest(el, (i) => i.__livewire)
|
|
|
|
if (!closestRoot) {
|
|
throw 'Could not find Livewire component in DOM tree.'
|
|
}
|
|
|
|
return closestRoot.__livewire
|
|
}
|
|
|
|
Livewire.interceptMessage(({ message, onSuccess }) => {
|
|
onSuccess(({ payload }) => {
|
|
queueMicrotask(() => {
|
|
if (payload.effects?.html) {
|
|
return
|
|
}
|
|
|
|
for (const [name, html] of Object.entries(
|
|
payload.effects?.partials ?? {},
|
|
)) {
|
|
let els = Array.from(
|
|
message.component.el.querySelectorAll(
|
|
`[wire\\:partial="${name}"]`,
|
|
),
|
|
).filter(
|
|
(el) =>
|
|
findClosestLivewireComponent(el) ===
|
|
message.component,
|
|
)
|
|
|
|
if (!els.length) {
|
|
continue
|
|
}
|
|
|
|
if (els.length > 1) {
|
|
throw `Multiple elements found for partial [${name}].`
|
|
}
|
|
|
|
let el = els[0]
|
|
|
|
let wrapperTag = el.parentElement
|
|
? // If the root element is a "tr", we need the wrapper to be a "table"...
|
|
el.parentElement.tagName.toLowerCase()
|
|
: 'div'
|
|
|
|
let wrapper = document.createElement(wrapperTag)
|
|
|
|
wrapper.innerHTML = html
|
|
wrapper.__livewire = message.component
|
|
|
|
let to = wrapper.firstElementChild
|
|
|
|
to.__livewire = message.component
|
|
|
|
let existingComponentsMap = {}
|
|
|
|
el.querySelectorAll('[wire\\:id]').forEach((comp) => {
|
|
existingComponentsMap[comp.getAttribute('wire:id')] =
|
|
comp
|
|
})
|
|
|
|
to.querySelectorAll('[wire\\:id]').forEach((child) => {
|
|
if (child.hasAttribute('wire:snapshot')) return
|
|
|
|
let wireId = child.getAttribute('wire:id')
|
|
let existingComponent = existingComponentsMap[wireId]
|
|
|
|
if (existingComponent) {
|
|
child.replaceWith(existingComponent.cloneNode(true))
|
|
}
|
|
})
|
|
|
|
window.Alpine.morph(el, to, {
|
|
updating: (el, toEl, childrenOnly, skip) => {
|
|
if (isntElement(el)) {
|
|
return
|
|
}
|
|
|
|
if (el.__livewire_replace === true) {
|
|
el.innerHTML = toEl.innerHTML
|
|
}
|
|
|
|
if (el.__livewire_replace_self === true) {
|
|
el.outerHTML = toEl.outerHTML
|
|
|
|
return skip()
|
|
}
|
|
|
|
if (el.__livewire_ignore === true) {
|
|
return skip()
|
|
}
|
|
|
|
if (el.__livewire_ignore_self === true) {
|
|
childrenOnly()
|
|
}
|
|
|
|
if (
|
|
isComponentRootEl(el) &&
|
|
el.getAttribute('wire:id') !==
|
|
message.component.id
|
|
) {
|
|
return skip()
|
|
}
|
|
|
|
if (isComponentRootEl(el)) {
|
|
toEl.__livewire = message.component
|
|
}
|
|
},
|
|
|
|
key: (el) => {
|
|
if (isntElement(el)) {
|
|
return
|
|
}
|
|
|
|
if (el.hasAttribute(`wire:key`)) {
|
|
return el.getAttribute(`wire:key`)
|
|
}
|
|
|
|
if (el.hasAttribute(`wire:id`)) {
|
|
return el.getAttribute(`wire:id`)
|
|
}
|
|
|
|
return el.id
|
|
},
|
|
|
|
lookahead: false,
|
|
})
|
|
}
|
|
})
|
|
})
|
|
|
|
function isntElement(el) {
|
|
return typeof el.hasAttribute !== 'function'
|
|
}
|
|
|
|
function isComponentRootEl(el) {
|
|
return el.hasAttribute('wire:id')
|
|
}
|
|
})
|
|
})
|