Skip to content

Commit

Permalink
feat: injectStyles and injectStylesUrls params
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 19, 2023
1 parent 4263ed1 commit 71b10b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components-shared/params-list.js
Expand Up @@ -106,6 +106,7 @@ const paramsList = [
'virtual',
'zoom',
'control',
'modulesStyles',
'injectStyles',
'injectStylesUrls',
];
export { paramsList };
4 changes: 2 additions & 2 deletions src/element/swiper-element.js
Expand Up @@ -52,12 +52,12 @@ class SwiperContainer extends ClassToExtend {
cssStyles() {
return [
globalInjectStyles ? SwiperCSS : '', // eslint-disable-line
...(this.modulesStyles && Array.isArray(this.modulesStyles) ? this.modulesStyles : []),
...(this.injectStyles && Array.isArray(this.injectStyles) ? this.injectStyles : []),
].join('\n');
}

cssLinks() {
return this.modulesStylesUrls || [];
return this.injectStylesUrls || [];
}

render() {
Expand Down
10 changes: 10 additions & 0 deletions src/types/swiper-options.d.ts
Expand Up @@ -38,6 +38,16 @@ export interface SwiperOptions {
* ```
*/
modules?: SwiperModule[];
/**
* Inject text styles to the shadow DOM. Only for usage with Swiper Element
*
*/
injectStyles?: string[];
/**
* Inject styles `<link>`s to the shadow DOM. Only for usage with Swiper Element
*
*/
injectStylesUrls?: string[];
/**
* Whether Swiper should be initialised automatically when you create an instance.
* If disabled, then you need to init it manually by calling `swiper.init()`
Expand Down

0 comments on commit 71b10b2

Please sign in to comment.