-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add support for shadow DOM styling
Close #41
- Loading branch information
1 parent
9016d55
commit a314c8e
Showing
7 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/resources/META-INF/resources/frontend/paper-slider/fc-l2t-paper-slider.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*- | ||
* #%L | ||
* Granite Alert | ||
* %% | ||
* Copyright (C) 2024 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% | ||
*/ | ||
import {html} from '@polymer/polymer/lib/utils/html-tag.js'; | ||
|
||
import './l2t-paper-slider.js'; | ||
|
||
import {ThemableMixin} from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
class FCL2TPaperSlider extends ThemableMixin(customElements.get('l2t-paper-slider')) { | ||
static get is() { return 'fc-l2t-paper-slider'; } | ||
|
||
static get template() { | ||
return html`${super.template}`; | ||
} | ||
}; | ||
|
||
customElements.define(FCL2TPaperSlider.is, FCL2TPaperSlider); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/test/java/com/flowingcode/vaadin/addons/carousel/CustomThemeDemo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*- | ||
* #%L | ||
* Carousel Addon | ||
* %% | ||
* Copyright (C) 2018 - 2024 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.carousel; | ||
|
||
import com.flowingcode.vaadin.addons.demo.DemoSource; | ||
import com.vaadin.flow.component.dependency.CssImport; | ||
import com.vaadin.flow.component.orderedlayout.VerticalLayout; | ||
import com.vaadin.flow.router.PageTitle; | ||
import com.vaadin.flow.router.Route; | ||
|
||
@PageTitle("Styling") | ||
@DemoSource | ||
@DemoSource("src/test/resources/META-INF/resources/frontend/carousel-demo-styles.css") | ||
@Route(value = "carousel/custom-theme", layout = CarouselDemoView.class) | ||
@SuppressWarnings("serial") | ||
@CssImport(value = "./carousel-demo-styles.css", themeFor = "fc-l2t-paper-slider") | ||
public class CustomThemeDemo extends VerticalLayout { | ||
|
||
public CustomThemeDemo() { | ||
Slide s1 = | ||
new Slide( | ||
CarouselDemoView.createSlideContent( | ||
"Slide 1", | ||
"https://www.flowingcode.com/wp-content/uploads/2018/04/birthday-3021071_640.jpg")); | ||
Slide s2 = | ||
new Slide( | ||
CarouselDemoView.createSlideContent( | ||
"Slide 2", | ||
"https://2.bp.blogspot.com/-nvtIfgN8duc/XKUQh9VEyFI/AAAAAAAABT8/mE7P45E2uqwWlkKimAmes7fT2rdW9UDWwCEwYBhgL/s320/anniversary_1.jpg")); | ||
Slide s3 = | ||
new Slide( | ||
CarouselDemoView.createSlideContent( | ||
"Slide 3", | ||
"https://www.flowingcode.com/wp-content/uploads/2020/04/photo4blog-300x300.jpg")); | ||
Slide s4 = | ||
new Slide( | ||
CarouselDemoView.createSlideContent( | ||
"Slide 4", | ||
"https://www.flowingcode.com/wp-content/uploads/2021/03/happy_birthday_2.jpg")); | ||
|
||
Carousel c = new Carousel(s1, s2, s3, s4); | ||
c.setSizeFull(); | ||
c.setThemeName("custom-theme"); | ||
|
||
add(c); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/test/resources/META-INF/resources/frontend/carousel-demo-styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host([theme~="custom-theme"]) .slider__dots > span { | ||
background: purple; | ||
} |