From c71411465a03499caf98937857e95ec489e865b4 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 24 Sep 2024 15:17:35 +0100 Subject: [PATCH 01/17] First pass at better-handling those annoying Rollbars we keep getting --- .../Controllers/Assets/AssetsController.php | 34 ++++++++++++++----- .../lang/en-US/admin/hardware/message.php | 3 ++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index dceaa9b08a..315c86f725 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -112,8 +112,10 @@ class AssetsController extends Controller $settings = Setting::getSettings(); - $success = false; + $successes = 0; + $failures = 0; $serials = $request->input('serials'); + $last_succesful_asset = null; for ($a = 1; $a <= count($asset_tags); $a++) { $asset = new Asset(); @@ -200,20 +202,36 @@ class AssetsController extends Controller $asset->checkOut($target, auth()->user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location); } - $success = true; - + $last_succesful_asset = $asset; + $successes++; + + } else { + $failures++; } } session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]); - if ($success) { + if ($successes > 0) { + if ($failures > 0) { + //some succeeded, some failed + return redirect()->to(Helper::getRedirectOption($request, $last_succesful_asset->id, 'Assets')) + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['link' => route('hardware.show', ['hardware' => $last_succesful_asset->id]), 'id', 'tag' => e($last_succesful_asset->asset_tag)])) + ->with('warning', trans_choice('admin/hardware/message.create.partial_failure', $failures)); + } else { + if ($successes == 1) { + //the most common case, keeping it so we don't have to make every use of that translation string be trans_choice'ed + //and re-translated + return redirect()->to(Helper::getRedirectOption($request, $last_succesful_asset->id, 'Assets')) + ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $last_succesful_asset->id]), 'id', 'tag' => e($last_succesful_asset->asset_tag)])); + } else { + //multi-success + return redirect()->to(Helper::getRedirectOption($request, $last_succesful_asset->id, 'Assets')) + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['link' => route('hardware.show', ['hardware' => $last_succesful_asset->id]), 'id', 'tag' => e($last_succesful_asset->asset_tag)])); + } + } - return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) - ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $asset->id]), 'id', 'tag' => e($asset->asset_tag)])); - - } return redirect()->back()->withInput()->withErrors($asset->getErrors()); diff --git a/resources/lang/en-US/admin/hardware/message.php b/resources/lang/en-US/admin/hardware/message.php index 041d32f56c..a33aea1813 100644 --- a/resources/lang/en-US/admin/hardware/message.php +++ b/resources/lang/en-US/admin/hardware/message.php @@ -14,6 +14,9 @@ return [ 'error' => 'Asset was not created, please try again. :(', 'success' => 'Asset created successfully. :)', 'success_linked' => 'Asset with tag :tag was created successfully. Click here to view.', + 'multi_success_linked' => 'Asset with tag :tag was created successfully. Click here to view.|:count assets were created succesfully. The last one was :tag. Click here to view.', + 'partial_success_linked' => 'Asset with tag :tag was created successfully. Click here to view.', + 'partial_failure' => 'An asset was unable to be created.|:count assets were unable to be created.' ], 'update' => [ From b6340532d7e34c31d65999e55440241935c6db60 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 24 Sep 2024 17:15:39 +0100 Subject: [PATCH 02/17] Improve the error and success messages and linking --- .../Controllers/Assets/AssetsController.php | 31 +++++++++---------- .../lang/en-US/admin/hardware/message.php | 5 ++- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 315c86f725..e37d7c59b3 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -112,10 +112,10 @@ class AssetsController extends Controller $settings = Setting::getSettings(); - $successes = 0; - $failures = 0; + $successes = []; + $failures = []; $serials = $request->input('serials'); - $last_succesful_asset = null; + $asset = null; for ($a = 1; $a <= count($asset_tags); $a++) { $asset = new Asset(); @@ -202,33 +202,32 @@ class AssetsController extends Controller $asset->checkOut($target, auth()->user(), date('Y-m-d H:i:s'), $request->input('expected_checkin', null), 'Checked out on asset creation', $request->get('name'), $location); } - $last_succesful_asset = $asset; - $successes++; + $successes[] = " $asset->id]) . "' style='color: white;'>" . e($asset->asset_tag) . ""; } else { - $failures++; + $failures[] = join(",", $asset->getErrors()->all()); } } session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]); - if ($successes > 0) { - if ($failures > 0) { + if ($successes) { + if ($failures) { //some succeeded, some failed - return redirect()->to(Helper::getRedirectOption($request, $last_succesful_asset->id, 'Assets')) - ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['link' => route('hardware.show', ['hardware' => $last_succesful_asset->id]), 'id', 'tag' => e($last_succesful_asset->asset_tag)])) - ->with('warning', trans_choice('admin/hardware/message.create.partial_failure', $failures)); + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) //FIXME - not tested + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['links' => join(", ", $successes)])) + ->with('warning', trans_choice('admin/hardware/message.create.partial_failure', $failures, ['failures' => join("; ", $failures)])); } else { - if ($successes == 1) { + if (count($successes) == 1) { //the most common case, keeping it so we don't have to make every use of that translation string be trans_choice'ed //and re-translated - return redirect()->to(Helper::getRedirectOption($request, $last_succesful_asset->id, 'Assets')) - ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $last_succesful_asset->id]), 'id', 'tag' => e($last_succesful_asset->asset_tag)])); + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) + ->with('success-unescaped', trans('admin/hardware/message.create.success_linked', ['link' => route('hardware.show', ['hardware' => $asset->id]), 'id', 'tag' => e($asset->asset_tag)])); } else { //multi-success - return redirect()->to(Helper::getRedirectOption($request, $last_succesful_asset->id, 'Assets')) - ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['link' => route('hardware.show', ['hardware' => $last_succesful_asset->id]), 'id', 'tag' => e($last_succesful_asset->asset_tag)])); + return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) + ->with('success-unescaped', trans_choice('admin/hardware/message.create.multi_success_linked', $successes, ['links' => join(", ", $successes)])); } } diff --git a/resources/lang/en-US/admin/hardware/message.php b/resources/lang/en-US/admin/hardware/message.php index a33aea1813..874888de9d 100644 --- a/resources/lang/en-US/admin/hardware/message.php +++ b/resources/lang/en-US/admin/hardware/message.php @@ -14,9 +14,8 @@ return [ 'error' => 'Asset was not created, please try again. :(', 'success' => 'Asset created successfully. :)', 'success_linked' => 'Asset with tag :tag was created successfully. Click here to view.', - 'multi_success_linked' => 'Asset with tag :tag was created successfully. Click here to view.|:count assets were created succesfully. The last one was :tag. Click here to view.', - 'partial_success_linked' => 'Asset with tag :tag was created successfully. Click here to view.', - 'partial_failure' => 'An asset was unable to be created.|:count assets were unable to be created.' + 'multi_success_linked' => 'Asset with tag :links was created successfully.|:count assets were created succesfully. :links.', + 'partial_failure' => 'An asset was unable to be created. Reason: :failures|:count assets were unable to be created. Reasons: :failures', ], 'update' => [ From 0d59ccd6a66cf15a55afc1b92be8ab5e2a3679cb Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 22 Oct 2024 14:23:26 -0700 Subject: [PATCH 03/17] upgraded livewire v3.5.9 => v3.5.12 --- .../Api/StatuslabelsController.php | 2 +- composer.lock | 14 +-- public/vendor/livewire/livewire.esm.js | 86 +++++++++++++----- public/vendor/livewire/livewire.js | 89 ++++++++++++++----- public/vendor/livewire/livewire.min.js | 12 +-- public/vendor/livewire/livewire.min.js.map | 6 +- public/vendor/livewire/manifest.json | 2 +- .../lang/en-US/admin/statuslabels/message.php | 2 +- 8 files changed, 152 insertions(+), 61 deletions(-) diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index 7e4851ff5a..0d7d46cd0f 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -96,7 +96,7 @@ class StatuslabelsController extends Controller if (! $request->filled('type')) { - return response()->json(Helper::formatStandardApiResponse('error', null, ['type' => ['Status label type is required.']])); + return response()->json(Helper::formatStandardApiResponse('error', null, ['type' => [trans('admin/statuslabels/message.require_status_label')]])); } $statuslabel = new Statuslabel; diff --git a/composer.lock b/composer.lock index 0631fc275e..5850996b11 100644 --- a/composer.lock +++ b/composer.lock @@ -4461,16 +4461,16 @@ }, { "name": "livewire/livewire", - "version": "v3.5.9", + "version": "v3.5.12", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "d04a229058afa76116d0e39209943a8ea3a7f888" + "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/d04a229058afa76116d0e39209943a8ea3a7f888", - "reference": "d04a229058afa76116d0e39209943a8ea3a7f888", + "url": "https://api.github.com/repos/livewire/livewire/zipball/3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d", + "reference": "3c8d1f9d7d9098aaea663093ae168f2d5d2ae73d", "shasum": "" }, "require": { @@ -4525,7 +4525,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v3.5.9" + "source": "https://github.com/livewire/livewire/tree/v3.5.12" }, "funding": [ { @@ -4533,7 +4533,7 @@ "type": "github" } ], - "time": "2024-10-01T12:40:06+00:00" + "time": "2024-10-15T19:35:06+00:00" }, { "name": "masterminds/html5", @@ -16504,5 +16504,5 @@ "ext-pdo": "*" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/public/vendor/livewire/livewire.esm.js b/public/vendor/livewire/livewire.esm.js index ae4bb2cb78..2d7ef4791c 100644 --- a/public/vendor/livewire/livewire.esm.js +++ b/public/vendor/livewire/livewire.esm.js @@ -2557,7 +2557,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } } function bindInputValue(el, value) { - if (el.type === "radio") { + if (isRadio(el)) { if (el.attributes.value === void 0) { el.value = value; } @@ -2568,7 +2568,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); el.checked = checkedAttrLooseCompare(el.value, value); } } - } else if (el.type === "checkbox") { + } else if (isCheckbox(el)) { if (Number.isInteger(value)) { el.value = value; } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { @@ -2707,6 +2707,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } return attr; } + function isCheckbox(el) { + return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; + } + function isRadio(el) { + return el.type === "radio" || el.localName === "ui-radio"; + } function debounce2(func, wait) { var timeout; return function() { @@ -2860,7 +2866,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); get raw() { return raw; }, - version: "3.14.1", + version: "3.14.3", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, @@ -3296,7 +3302,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); setValue(getInputValue(el, modifiers, e, getValue())); }); if (modifiers.includes("fill")) { - if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { + if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { setValue(getInputValue(el, modifiers, { target: el }, getValue())); } } @@ -3336,7 +3342,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); return mutateDom(() => { if (event instanceof CustomEvent && event.detail !== void 0) return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; - else if (el.type === "checkbox") { + else if (isCheckbox(el)) { if (Array.isArray(currentValue)) { let newValue = null; if (modifiers.includes("number")) { @@ -3367,7 +3373,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); } else { let newValue; - if (el.type === "radio") { + if (isRadio(el)) { if (event.target.checked) { newValue = event.target.value; } else { @@ -6820,8 +6826,6 @@ var require_module_cjs8 = __commonJS({ let toAttributes = Array.from(to.attributes); for (let i = domAttributes.length - 1; i >= 0; i--) { let name = domAttributes[i].name; - if (name === "style") - continue; if (!to.hasAttribute(name)) { from2.removeAttribute(name); } @@ -6829,8 +6833,6 @@ var require_module_cjs8 = __commonJS({ for (let i = toAttributes.length - 1; i >= 0; i--) { let name = toAttributes[i].name; let value = toAttributes[i].value; - if (name === "style") - continue; if (from2.getAttribute(name) !== value) { from2.setAttribute(name, value); } @@ -9015,6 +9017,44 @@ function injectStyles() { document.head.appendChild(style); } +// js/plugins/navigate/popover.js +function packUpPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll(":popover-open").forEach((el) => { + el.setAttribute("data-navigate-popover-open", ""); + let animations = el.getAnimations(); + el._pausedAnimations = animations.map((animation) => ({ + keyframes: animation.effect.getKeyframes(), + options: { + duration: animation.effect.getTiming().duration, + easing: animation.effect.getTiming().easing, + fill: animation.effect.getTiming().fill, + iterations: animation.effect.getTiming().iterations + }, + currentTime: animation.currentTime, + playState: animation.playState + })); + animations.forEach((i) => i.pause()); + }); +} +function unPackPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { + el.removeAttribute("data-navigate-popover-open"); + queueMicrotask(() => { + if (!el.isConnected) + return; + el.showPopover(); + el.getAnimations().forEach((i) => i.finish()); + if (el._pausedAnimations) { + el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { + let animation = el.animate(keyframes, options); + animation.currentTime = currentTime; + }); + delete el._pausedAnimations; + } + }); + }); +} + // js/plugins/navigate/page.js var oldBodyScriptTagHashes = []; var attributesExemptFromScriptTagHashing = [ @@ -9153,7 +9193,7 @@ var autofocus = false; function navigate_default(Alpine19) { Alpine19.navigate = (url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -9184,7 +9224,7 @@ function navigate_default(Alpine19) { storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); }); whenItIsReleased(() => { - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -9198,7 +9238,7 @@ function navigate_default(Alpine19) { function navigateTo(destination, shouldPushToHistoryState = true) { showProgressBar && showAndStartProgressBar(); fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); showProgressBar && finishAndHideProgressBar(); cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); @@ -9206,6 +9246,7 @@ function navigate_default(Alpine19) { preventAlpineFromPickingUpDomChanges(Alpine19, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); if (shouldPushToHistoryState) { updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); @@ -9216,6 +9257,7 @@ function navigate_default(Alpine19) { removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); afterNewScriptsAreDoneLoading(() => { @@ -9224,7 +9266,7 @@ function navigate_default(Alpine19) { autofocus && autofocusElementsWithTheAutofocusAttribute(); }); nowInitializeAlpineOnTheNewPage(Alpine19); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); @@ -9234,7 +9276,7 @@ function navigate_default(Alpine19) { whenTheBackOrForwardButtonIsClicked((ifThePageBeingVisitedHasntBeenCached) => { ifThePageBeingVisitedHasntBeenCached((url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: false @@ -9246,7 +9288,7 @@ function navigate_default(Alpine19) { }); }, (html, url, currentPageUrl, currentPageKey) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: true @@ -9254,29 +9296,31 @@ function navigate_default(Alpine19) { if (prevented) return; storeScrollInformationInHtmlBeforeNavigatingAway(); - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageUrl, currentPageKey); preventAlpineFromPickingUpDomChanges(Alpine19, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); swapCurrentPageWithNewHtml(html, () => { removeAnyLeftOverStaleProgressBars(); removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); andAfterAllThis(() => { autofocus && autofocusElementsWithTheAutofocusAttribute(); nowInitializeAlpineOnTheNewPage(Alpine19); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); }); setTimeout(() => { - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); } function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback) { @@ -9293,7 +9337,7 @@ function preventAlpineFromPickingUpDomChanges(Alpine19, callback) { }); }); } -function fireEventForOtherLibariesToHookInto(name, detail) { +function fireEventForOtherLibrariesToHookInto(name, detail) { let event = new CustomEvent(name, { cancelable: true, bubbles: true, @@ -9809,6 +9853,7 @@ function morph2(component, el, html) { }, lookahead: false }); + trigger("morphed", { el, component }); } function isntElement(el) { return typeof el.hasAttribute !== "function"; @@ -10878,3 +10923,4 @@ focus-trap/dist/focus-trap.js: * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE *) */ +//# sourceMappingURL=livewire.esm.js.map diff --git a/public/vendor/livewire/livewire.js b/public/vendor/livewire/livewire.js index 687180f6b1..670591055f 100644 --- a/public/vendor/livewire/livewire.js +++ b/public/vendor/livewire/livewire.js @@ -1975,7 +1975,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } } function bindInputValue(el, value) { - if (el.type === "radio") { + if (isRadio(el)) { if (el.attributes.value === void 0) { el.value = value; } @@ -1986,7 +1986,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); el.checked = checkedAttrLooseCompare(el.value, value); } } - } else if (el.type === "checkbox") { + } else if (isCheckbox(el)) { if (Number.isInteger(value)) { el.value = value; } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { @@ -2125,6 +2125,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); } return attr; } + function isCheckbox(el) { + return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; + } + function isRadio(el) { + return el.type === "radio" || el.localName === "ui-radio"; + } function debounce(func, wait) { var timeout; return function() { @@ -2278,7 +2284,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); get raw() { return raw; }, - version: "3.14.1", + version: "3.14.3", flushAndStopDeferringMutations, dontAutoEvaluateFunctions, disableEffectScheduling, @@ -3361,7 +3367,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); setValue(getInputValue(el, modifiers, e, getValue())); }); if (modifiers.includes("fill")) { - if ([void 0, null, ""].includes(getValue()) || el.type === "checkbox" && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { + if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { setValue(getInputValue(el, modifiers, { target: el }, getValue())); } } @@ -3401,7 +3407,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); return mutateDom(() => { if (event instanceof CustomEvent && event.detail !== void 0) return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; - else if (el.type === "checkbox") { + else if (isCheckbox(el)) { if (Array.isArray(currentValue)) { let newValue = null; if (modifiers.includes("number")) { @@ -3432,7 +3438,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); } else { let newValue; - if (el.type === "radio") { + if (isRadio(el)) { if (event.target.checked) { newValue = event.target.value; } else { @@ -4971,11 +4977,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); var checked = getCheckedRadio(radioSet, node.form); return !checked || checked === node; }; - var isRadio = function isRadio2(node) { + var isRadio2 = function isRadio22(node) { return isInput(node) && node.type === "radio"; }; var isNonTabbableRadio = function isNonTabbableRadio2(node) { - return isRadio(node) && !isTabbableRadio(node); + return isRadio2(node) && !isTabbableRadio(node); }; var isZeroArea = function isZeroArea2(node) { var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; @@ -7625,6 +7631,44 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); document.head.appendChild(style); } + // js/plugins/navigate/popover.js + function packUpPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll(":popover-open").forEach((el) => { + el.setAttribute("data-navigate-popover-open", ""); + let animations = el.getAnimations(); + el._pausedAnimations = animations.map((animation) => ({ + keyframes: animation.effect.getKeyframes(), + options: { + duration: animation.effect.getTiming().duration, + easing: animation.effect.getTiming().easing, + fill: animation.effect.getTiming().fill, + iterations: animation.effect.getTiming().iterations + }, + currentTime: animation.currentTime, + playState: animation.playState + })); + animations.forEach((i) => i.pause()); + }); + } + function unPackPersistedPopovers(persistedEl) { + persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { + el.removeAttribute("data-navigate-popover-open"); + queueMicrotask(() => { + if (!el.isConnected) + return; + el.showPopover(); + el.getAnimations().forEach((i) => i.finish()); + if (el._pausedAnimations) { + el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { + let animation = el.animate(keyframes, options); + animation.currentTime = currentTime; + }); + delete el._pausedAnimations; + } + }); + }); + } + // js/plugins/navigate/page.js var oldBodyScriptTagHashes = []; var attributesExemptFromScriptTagHashing = [ @@ -7763,7 +7807,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function navigate_default(Alpine3) { Alpine3.navigate = (url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -7794,7 +7838,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); }); whenItIsReleased(() => { - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: false, cached: false @@ -7808,7 +7852,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); function navigateTo(destination, shouldPushToHistoryState = true) { showProgressBar && showAndStartProgressBar(); fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); showProgressBar && finishAndHideProgressBar(); cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); @@ -7816,6 +7860,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); if (shouldPushToHistoryState) { updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); @@ -7826,6 +7871,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); afterNewScriptsAreDoneLoading(() => { @@ -7834,7 +7880,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); autofocus && autofocusElementsWithTheAutofocusAttribute(); }); nowInitializeAlpineOnTheNewPage(Alpine3); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); @@ -7844,7 +7890,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); whenTheBackOrForwardButtonIsClicked((ifThePageBeingVisitedHasntBeenCached) => { ifThePageBeingVisitedHasntBeenCached((url) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: false @@ -7856,7 +7902,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); }, (html, url, currentPageUrl, currentPageKey) => { let destination = createUrlObjectFromString(url); - let prevented = fireEventForOtherLibariesToHookInto("alpine:navigate", { + let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { url: destination, history: true, cached: true @@ -7864,29 +7910,31 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); if (prevented) return; storeScrollInformationInHtmlBeforeNavigatingAway(); - fireEventForOtherLibariesToHookInto("alpine:navigating"); + fireEventForOtherLibrariesToHookInto("alpine:navigating"); updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageUrl, currentPageKey); preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { enablePersist && storePersistantElementsForLater((persistedEl) => { packUpPersistedTeleports(persistedEl); + packUpPersistedPopovers(persistedEl); }); swapCurrentPageWithNewHtml(html, () => { removeAnyLeftOverStaleProgressBars(); removeAnyLeftOverStaleTeleportTargets(document.body); enablePersist && putPersistantElementsBack((persistedEl, newStub) => { unPackPersistedTeleports(persistedEl); + unPackPersistedPopovers(persistedEl); }); restoreScrollPositionOrScrollToTop(); andAfterAllThis(() => { autofocus && autofocusElementsWithTheAutofocusAttribute(); nowInitializeAlpineOnTheNewPage(Alpine3); - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); }); }); }); setTimeout(() => { - fireEventForOtherLibariesToHookInto("alpine:navigated"); + fireEventForOtherLibrariesToHookInto("alpine:navigated"); }); } function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback) { @@ -7903,7 +7951,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }); }); } - function fireEventForOtherLibariesToHookInto(name, detail) { + function fireEventForOtherLibrariesToHookInto(name, detail) { let event = new CustomEvent(name, { cancelable: true, bubbles: true, @@ -8212,8 +8260,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); let toAttributes = Array.from(to.attributes); for (let i = domAttributes.length - 1; i >= 0; i--) { let name = domAttributes[i].name; - if (name === "style") - continue; if (!to.hasAttribute(name)) { from2.removeAttribute(name); } @@ -8221,8 +8267,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); for (let i = toAttributes.length - 1; i >= 0; i--) { let name = toAttributes[i].name; let value = toAttributes[i].value; - if (name === "style") - continue; if (from2.getAttribute(name) !== value) { from2.setAttribute(name, value); } @@ -8914,6 +8958,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); }, lookahead: false }); + trigger2("morphed", { el, component }); } function isntElement(el) { return typeof el.hasAttribute !== "function"; diff --git a/public/vendor/livewire/livewire.min.js b/public/vendor/livewire/livewire.min.js index 90a91971d8..32197b3ebf 100644 --- a/public/vendor/livewire/livewire.min.js +++ b/public/vendor/livewire/livewire.min.js @@ -1,14 +1,14 @@ -(()=>{var nl=Object.create;var ii=Object.defineProperty;var il=Object.getOwnPropertyDescriptor;var ol=Object.getOwnPropertyNames;var sl=Object.getPrototypeOf,al=Object.prototype.hasOwnProperty;var ll=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ul=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ol(t))!al.call(e,i)&&i!==r&&ii(e,i,{get:()=>t[i],enumerable:!(n=il(t,i))||n.enumerable});return e};var cl=(e,t,r)=>(r=e!=null?nl(sl(e)):{},ul(t||!e||!e.__esModule?ii(r,"default",{value:e,enumerable:!0}):r,e));var da=ll((Hn,fa)=>{(function(e,t){typeof define=="function"&&define.amd?define(t):typeof Hn=="object"?fa.exports=t():e.NProgress=t()})(Hn,function(){var e={};e.version="0.2.0";var t=e.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};e.configure=function(c){var d,m;for(d in c)m=c[d],m!==void 0&&c.hasOwnProperty(d)&&(t[d]=m);return this},e.status=null,e.set=function(c){var d=e.isStarted();c=r(c,t.minimum,1),e.status=c===1?null:c;var m=e.render(!d),b=m.querySelector(t.barSelector),g=t.speed,y=t.easing;return m.offsetWidth,o(function(v){t.positionUsing===""&&(t.positionUsing=e.getPositioningCSS()),s(b,i(c,g,y)),c===1?(s(m,{transition:"none",opacity:1}),m.offsetWidth,setTimeout(function(){s(m,{transition:"all "+g+"ms linear",opacity:0}),setTimeout(function(){e.remove(),v()},g)},g)):setTimeout(v,g)}),this},e.isStarted=function(){return typeof e.status=="number"},e.start=function(){e.status||e.set(0);var c=function(){setTimeout(function(){!e.status||(e.trickle(),c())},t.trickleSpeed)};return t.trickle&&c(),this},e.done=function(c){return!c&&!e.status?this:e.inc(.3+.5*Math.random()).set(1)},e.inc=function(c){var d=e.status;return d?(typeof c!="number"&&(c=(1-d)*r(Math.random()*d,.1,.95)),d=r(d+c,0,.994),e.set(d)):e.start()},e.trickle=function(){return e.inc(Math.random()*t.trickleRate)},function(){var c=0,d=0;e.promise=function(m){return!m||m.state()==="resolved"?this:(d===0&&e.start(),c++,d++,m.always(function(){d--,d===0?(c=0,e.done()):e.set((c-d)/c)}),this)}}(),e.render=function(c){if(e.isRendered())return document.getElementById("nprogress");l(document.documentElement,"nprogress-busy");var d=document.createElement("div");d.id="nprogress",d.innerHTML=t.template;var m=d.querySelector(t.barSelector),b=c?"-100":n(e.status||0),g=document.querySelector(t.parent),y;return s(m,{transition:"all 0 linear",transform:"translate3d("+b+"%,0,0)"}),t.showSpinner||(y=d.querySelector(t.spinnerSelector),y&&p(y)),g!=document.body&&l(g,"nprogress-custom-parent"),g.appendChild(d),d},e.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(t.parent),"nprogress-custom-parent");var c=document.getElementById("nprogress");c&&p(c)},e.isRendered=function(){return!!document.getElementById("nprogress")},e.getPositioningCSS=function(){var c=document.body.style,d="WebkitTransform"in c?"Webkit":"MozTransform"in c?"Moz":"msTransform"in c?"ms":"OTransform"in c?"O":"";return d+"Perspective"in c?"translate3d":d+"Transform"in c?"translate":"margin"};function r(c,d,m){return cm?m:c}function n(c){return(-1+c)*100}function i(c,d,m){var b;return t.positionUsing==="translate3d"?b={transform:"translate3d("+n(c)+"%,0,0)"}:t.positionUsing==="translate"?b={transform:"translate("+n(c)+"%,0)"}:b={"margin-left":n(c)+"%"},b.transition="all "+d+"ms "+m,b}var o=function(){var c=[];function d(){var m=c.shift();m&&m(d)}return function(m){c.push(m),c.length==1&&d()}}(),s=function(){var c=["Webkit","O","Moz","ms"],d={};function m(v){return v.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(_,T){return T.toUpperCase()})}function b(v){var _=document.body.style;if(v in _)return v;for(var T=c.length,A=v.charAt(0).toUpperCase()+v.slice(1),w;T--;)if(w=c[T]+A,w in _)return w;return v}function g(v){return v=m(v),d[v]||(d[v]=b(v))}function y(v,_,T){_=g(_),v.style[_]=T}return function(v,_){var T=arguments,A,w;if(T.length==2)for(A in _)w=_[A],w!==void 0&&_.hasOwnProperty(A)&&y(v,A,w);else y(v,T[1],T[2])}}();function a(c,d){var m=typeof c=="string"?c:f(c);return m.indexOf(" "+d+" ")>=0}function l(c,d){var m=f(c),b=m+d;a(m,d)||(c.className=b.substring(1))}function u(c,d){var m=f(c),b;!a(c,d)||(b=m.replace(" "+d+" "," "),c.className=b.substring(1,b.length-1))}function f(c){return(" "+(c.className||"")+" ").replace(/\s+/gi," ")}function p(c){c&&c.parentNode&&c.parentNode.removeChild(c)}return e})});var yt=class{constructor(){this.arrays={}}add(t,r){this.arrays[t]||(this.arrays[t]=[]),this.arrays[t].push(r)}remove(t){this.arrays[t]&&delete this.arrays[t]}get(t){return this.arrays[t]||[]}each(t,r){return this.get(t).forEach(r)}},Fe=class{constructor(){this.arrays=new WeakMap}add(t,r){this.arrays.has(t)||this.arrays.set(t,[]),this.arrays.get(t).push(r)}remove(t){this.arrays.has(t)&&this.arrays.delete(t,[])}get(t){return this.arrays.has(t)?this.arrays.get(t):[]}each(t,r){return this.get(t).forEach(r)}};function xt(e,t,r={},n=!0){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:n,composed:!0,cancelable:!0}))}function _t(e,t,r){return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}function St(e){return typeof e=="object"&&e!==null}function oi(e){return St(e)&&!br(e)}function br(e){return Array.isArray(e)}function wr(e){return typeof e=="function"}function si(e){return typeof e!="object"||e===null}function ce(e){return JSON.parse(JSON.stringify(e))}function W(e,t){return t===""?e:t.split(".").reduce((r,n)=>{if(r!==void 0)return r[n]},e)}function we(e,t,r){let n=t.split(".");if(n.length===1)return e[t]=r;let i=n.shift(),o=n.join(".");e[i]===void 0&&(e[i]={}),we(e[i],o,r)}function Ze(e,t,r={},n=""){if(e===t)return r;if(typeof e!=typeof t||oi(e)&&br(t)||br(e)&&oi(t)||si(e)||si(t))return r[n]=t,r;let i=Object.keys(e);return Object.entries(t).forEach(([o,s])=>{r={...r,...Ze(e[o],t[o],r,n===""?o:`${n}.${o}`)},i=i.filter(a=>a!==o)}),i.forEach(o=>{r[`${n}.${o}`]="__rm__"}),r}function ye(e){let t=ai(e)?e[0]:e,r=ai(e)?e[1]:void 0;return St(t)&&Object.entries(t).forEach(([n,i])=>{t[n]=ye(i)}),t}function ai(e){return Array.isArray(e)&&e.length===2&&typeof e[1]=="object"&&Object.keys(e[1]).includes("s")}function Et(){if(document.querySelector('meta[name="csrf-token"]'))return document.querySelector('meta[name="csrf-token"]').getAttribute("content");if(document.querySelector("[data-csrf]"))return document.querySelector("[data-csrf]").getAttribute("data-csrf");if(window.livewireScriptConfig.csrf??!1)return window.livewireScriptConfig.csrf;throw"Livewire: No CSRF token detected"}var Ie;function li(){if(Ie)return Ie;if(window.livewireScriptConfig&&(window.livewireScriptConfig.nonce??!1))return Ie=window.livewireScriptConfig.nonce,Ie;let e=document.querySelector("style[data-livewire-style][nonce]");return e?(Ie=e.nonce,Ie):null}function ui(){return document.querySelector("[data-update-uri]")?.getAttribute("data-update-uri")??window.livewireScriptConfig.uri??null}function At(e){return!!e.match(/