@@ -234,18 +234,6 @@ export function registerStyles(themeFor, styles, options = {}) {
234234 }
235235}
236236
237- /**
238- * Returns all registered themes. By default the themeRegistry is returned as is.
239- * In case the style-modules adapter is imported, the themes are obtained from there instead
240- * @returns {Theme[] }
241- */
242- function getAllThemes ( ) {
243- if ( window . Vaadin && window . Vaadin . styleModules ) {
244- return window . Vaadin . styleModules . getAllThemes ( ) ;
245- }
246- return themeRegistry ;
247- }
248-
249237/**
250238 * Maps the moduleName to an include priority number which is used for
251239 * determining the order in which styles are applied.
@@ -271,7 +259,7 @@ function getIncludedStyles(theme) {
271259 const includedStyles = [ ] ;
272260 if ( theme . include ) {
273261 [ ] . concat ( theme . include ) . forEach ( ( includeModuleId ) => {
274- const includedTheme = getAllThemes ( ) . find ( ( s ) => s . moduleId === includeModuleId ) ;
262+ const includedTheme = themeRegistry . find ( ( s ) => s . moduleId === includeModuleId ) ;
275263 if ( includedTheme ) {
276264 includedStyles . push ( ...getIncludedStyles ( includedTheme ) , ...includedTheme . styles ) ;
277265 } else {
@@ -291,7 +279,7 @@ function getIncludedStyles(theme) {
291279function getThemes ( tagName ) {
292280 const defaultModuleName = `${ tagName } -default-theme` ;
293281
294- const themes = getAllThemes ( )
282+ const themes = themeRegistry
295283 // Filter by matching themeFor properties
296284 . filter ( ( theme ) => theme . moduleId !== defaultModuleName && matchesThemeFor ( theme . themeFor , tagName ) )
297285 . map ( ( theme ) => ( {
@@ -308,7 +296,7 @@ function getThemes(tagName) {
308296 return themes ;
309297 }
310298 // No theme modules found, return the default module if it exists
311- return getAllThemes ( ) . filter ( ( theme ) => theme . moduleId === defaultModuleName ) ;
299+ return themeRegistry . filter ( ( theme ) => theme . moduleId === defaultModuleName ) ;
312300}
313301
314302/**
@@ -380,5 +368,3 @@ export const ThemableMixin = (superClass) =>
380368 return themeStyles . filter ( ( style , index ) => index === themeStyles . lastIndexOf ( style ) ) ;
381369 }
382370 } ;
383-
384- export { themeRegistry as __themeRegistry } ;
0 commit comments