-
Notifications
You must be signed in to change notification settings - Fork 0
Add Vaadin 25 support while maintaining Vaadin 24 compatibility #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d127e3c
31f4e45
409a750
bfc6605
3a38f11
3be3245
59d544c
06b372c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /*- | ||
| * #%L | ||
| * Extended Login Add-on | ||
| * %% | ||
| * Copyright (C) 2023 - 2026 Flowing Code | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * #L% | ||
| */ | ||
| package com.flowingcode.vaadin.addons.extendedlogin; | ||
|
|
||
| /** | ||
| * Utility class for LoginOverlay. | ||
| */ | ||
| class LoginOverlayUtils { | ||
|
Check warning on line 25 in src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.java
|
||
|
|
||
| /** | ||
| * Generates a JavaScript snippet that finds the overlay wrapper element. | ||
| * Handles both Vaadin 24 and Vaadin 25+ compatibility. | ||
| * | ||
| * @param action the JavaScript code to execute on the overlay wrapper | ||
| * @return the complete JavaScript string with the overlay wrapper lookup and | ||
| * the provided action | ||
| */ | ||
| static String getOverlayWrapperScript(String action) { | ||
| return """ | ||
| setTimeout(() => { | ||
| var overlayWrapper = document.getElementById('vaadinLoginOverlayWrapper'); | ||
| if (!overlayWrapper) { | ||
| var loginOverlay = document.querySelector('vaadin-login-overlay'); | ||
| if (loginOverlay && loginOverlay.shadowRoot) { | ||
| overlayWrapper = loginOverlay.shadowRoot | ||
| .querySelector('vaadin-login-overlay-wrapper'); | ||
| } | ||
| } | ||
| if (!overlayWrapper) return; | ||
| %s | ||
| }); | ||
| """.formatted(action); | ||
| } | ||
|
|
||
| /** | ||
| * Generates a JavaScript snippet that finds the form element. Handles both | ||
| * Vaadin 24 and Vaadin | ||
| * 25+ compatibility. | ||
| * | ||
| * @param action the JavaScript code to execute on the form | ||
| * @return the complete JavaScript string with the form lookup and the provided | ||
| * action | ||
| */ | ||
| static String getFormWrapperScript(String action) { | ||
| return """ | ||
| setTimeout(() => { | ||
| var overlayFormWrapper = document.getElementById('vaadinLoginOverlayWrapper'); | ||
| if (!overlayFormWrapper) { | ||
| overlayFormWrapper = document.querySelector('vaadin-login-overlay'); | ||
| } | ||
| if (!overlayFormWrapper) return; | ||
| var form = overlayFormWrapper.querySelector('form'); | ||
| if (form) { | ||
| %s | ||
| } | ||
| }); | ||
| """.formatted(action); | ||
| } | ||
|
Comment on lines
+61
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In Vaadin 25, the
However, the actual Practical DOM “where is the form?” pointers
Citations:
🏁 Script executed: cat -n src/main/java/com/flowingcode/vaadin/addons/extendedlogin/LoginOverlayUtils.javaRepository: FlowingCode/ExtendedLoginAddon Length of output: 4432 Inconsistent shadow DOM traversal in This method does not check the To match the pattern used in the other methods, check 🤖 Prompt for AI Agents |
||
|
|
||
| /** | ||
| * Generates a JavaScript snippet that finds the form wrapper containing form | ||
| * elements. Handles | ||
| * both Vaadin 24 and Vaadin 25+ compatibility. | ||
| * | ||
| * @param action the JavaScript code to execute on the form wrapper | ||
| * @return the complete JavaScript string with the form wrapper lookup and the | ||
| * provided action | ||
| */ | ||
| static String getLoginFormWrapperScript(String action) { | ||
| return """ | ||
| setTimeout(() => { | ||
| var overlayWrapper = document.getElementById('vaadinLoginOverlayWrapper'); | ||
| if (!overlayWrapper) { | ||
| var loginOverlay = document.querySelector('vaadin-login-overlay'); | ||
| if (loginOverlay && loginOverlay.shadowRoot) { | ||
| overlayWrapper = loginOverlay.shadowRoot | ||
| .querySelector('vaadin-login-overlay-wrapper'); | ||
| } | ||
| } | ||
| if (!overlayWrapper) return; | ||
| var formWrapper = overlayWrapper.querySelector('vaadin-login-form-wrapper'); | ||
| if (!formWrapper) return; | ||
| %s | ||
| }); | ||
| """.formatted(action); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /*- | ||
| * #%L | ||
| * Extended Login Add-on | ||
| * %% | ||
| * Copyright (C) 2023 - 2026 Flowing Code | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * #L% | ||
| */ | ||
| package com.flowingcode.vaadin.addons; | ||
|
|
||
| import com.vaadin.flow.component.page.AppShellConfigurator; | ||
| import com.vaadin.flow.theme.Theme; | ||
|
|
||
| @Theme | ||
| public class AppShellConfiguratorImpl implements AppShellConfigurator { | ||
|
|
||
| } |
Uh oh!
There was an error while loading. Please reload this page.