diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 9a799147fdb..d59a8c6b51d 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -46,7 +46,6 @@ import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to'; import { NgxMaskModule } from 'ngx-mask'; import { environment } from '../environments/environment'; -import { EagerThemesModule } from '../themes/eager-themes.module'; import { appEffects } from './app.effects'; import { MENUS } from './app.menus'; import { @@ -99,7 +98,6 @@ export const commonAppConfig: ApplicationConfig = { StoreModule.forRoot(appReducers, storeModuleConfig), StoreRouterConnectingModule.forRoot(), StoreDevModules, - EagerThemesModule, RootModule, ListableModule.withEntryComponents(), NgxMaskModule.forRoot(), diff --git a/src/app/root.module.ts b/src/app/root.module.ts index c511ae04a6a..cd0d17da7e3 100644 --- a/src/app/root.module.ts +++ b/src/app/root.module.ts @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { EAGER_THEME_COMPONENTS } from '../themes/eager-themes-components'; import { AdminSidebarComponent } from './admin/admin-sidebar/admin-sidebar.component'; import { AdminSidebarSectionComponent } from './admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component'; import { ExpandableAdminSidebarSectionComponent } from './admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component'; @@ -38,6 +39,7 @@ const PROVIDERS = [ ]; const DECLARATIONS = [ + ...EAGER_THEME_COMPONENTS, RootComponent, ThemedRootComponent, HeaderComponent, diff --git a/src/app/shared/listable.module.ts b/src/app/shared/listable.module.ts index b8fc11a86a3..cf417129e6b 100644 --- a/src/app/shared/listable.module.ts +++ b/src/app/shared/listable.module.ts @@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; +import { THEME_LISTABLE_COMPONENTS } from '../../themes/themes-listable-components'; import { CollectionAdminSearchResultGridElementComponent } from '../admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component'; import { CommunityAdminSearchResultGridElementComponent } from '../admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component'; import { ItemAdminSearchResultGridElementComponent } from '../admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component'; @@ -124,6 +125,7 @@ import { TruncatableComponent } from './truncatable/truncatable.component'; import { TruncatablePartComponent } from './truncatable/truncatable-part/truncatable-part.component'; const ENTRY_COMPONENTS = [ + ...THEME_LISTABLE_COMPONENTS, BitstreamListItemComponent, BrowseEntryListElementComponent, BundleListElementComponent, diff --git a/src/themes/custom/eager-theme-components.ts b/src/themes/custom/eager-theme-components.ts new file mode 100644 index 00000000000..7df0ca7f261 --- /dev/null +++ b/src/themes/custom/eager-theme-components.ts @@ -0,0 +1,32 @@ +/* eslint-disable dspace-angular-ts/themed-component-usages */ +import { FooterComponent } from './app/footer/footer.component'; +import { HeaderComponent } from './app/header/header.component'; +import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-navbar-wrapper.component'; +import { HomeNewsComponent } from './app/home-page/home-news/home-news.component'; +import { NavbarComponent } from './app/navbar/navbar.component'; +import { SearchNavbarComponent } from './app/search-navbar/search-navbar.component'; +import { CreateCollectionParentSelectorComponent } from './app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; +import { CreateCommunityParentSelectorComponent } from './app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; +import { CreateItemParentSelectorComponent } from './app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component'; +import { EditCollectionSelectorComponent } from './app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; +import { EditCommunitySelectorComponent } from './app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; +import { EditItemSelectorComponent } from './app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; +import { LangSwitchComponent } from './app/shared/lang-switch/lang-switch.component'; +import { LogInComponent } from './app/shared/log-in/log-in.component'; + +export const COMPONENTS = [ + HomeNewsComponent, + HeaderComponent, + HeaderNavbarWrapperComponent, + NavbarComponent, + SearchNavbarComponent, + FooterComponent, + CreateCollectionParentSelectorComponent, + CreateCommunityParentSelectorComponent, + CreateItemParentSelectorComponent, + EditCollectionSelectorComponent, + EditCommunitySelectorComponent, + EditItemSelectorComponent, + LogInComponent, + LangSwitchComponent, +]; diff --git a/src/themes/custom/eager-theme.module.ts b/src/themes/custom/eager-theme.module.ts deleted file mode 100644 index ecc88073a3c..00000000000 --- a/src/themes/custom/eager-theme.module.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; - -import { RootModule } from '../../app/root.module'; -import { JournalComponent } from './app/entity-groups/journal-entities/item-pages/journal/journal.component'; -import { JournalIssueComponent } from './app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component'; -import { JournalVolumeComponent } from './app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component'; -import { PersonComponent } from './app/entity-groups/research-entities/item-pages/person/person.component'; -import { FooterComponent } from './app/footer/footer.component'; -import { HeaderComponent } from './app/header/header.component'; -import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-navbar-wrapper.component'; -import { HomeNewsComponent } from './app/home-page/home-news/home-news.component'; -import { TopLevelCommunityListComponent } from './app/home-page/top-level-community-list/top-level-community-list.component'; -import { PublicationComponent } from './app/item-page/simple/item-types/publication/publication.component'; -import { UntypedItemComponent } from './app/item-page/simple/item-types/untyped-item/untyped-item.component'; -import { NavbarComponent } from './app/navbar/navbar.component'; -import { SearchNavbarComponent } from './app/search-navbar/search-navbar.component'; -import { CollectionDropdownComponent } from './app/shared/collection-dropdown/collection-dropdown.component'; -import { CreateCollectionParentSelectorComponent } from './app/shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; -import { CreateCommunityParentSelectorComponent } from './app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; -import { CreateItemParentSelectorComponent } from './app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component'; -import { EditCollectionSelectorComponent } from './app/shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; -import { EditCommunitySelectorComponent } from './app/shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; -import { EditItemSelectorComponent } from './app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; -import { FileDownloadLinkComponent } from './app/shared/file-download-link/file-download-link.component'; -import { LangSwitchComponent } from './app/shared/lang-switch/lang-switch.component'; -import { LogInComponent } from './app/shared/log-in/log-in.component'; -import { BrowseEntryListElementComponent } from './app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component'; -import { CollectionListElementComponent } from './app/shared/object-list/collection-list-element/collection-list-element.component'; -import { CommunityListElementComponent } from './app/shared/object-list/community-list-element/community-list-element.component'; -import { ItemSearchResultListElementComponent } from './app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component'; -import { PublicationSidebarSearchListElementComponent } from './app/shared/object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component'; -import { StartsWithDateComponent } from './app/shared/starts-with/date/starts-with-date.component'; -import { StartsWithTextComponent } from './app/shared/starts-with/text/starts-with-text.component'; - -/** - * Add components that use a custom decorator to ENTRY_COMPONENTS as well as DECLARATIONS. - * This will ensure that decorator gets picked up when the app loads - */ -const ENTRY_COMPONENTS = [ - JournalComponent, - JournalIssueComponent, - JournalVolumeComponent, - PersonComponent, - PublicationComponent, - UntypedItemComponent, - CommunityListElementComponent, - CollectionListElementComponent, - CollectionDropdownComponent, - FileDownloadLinkComponent, - StartsWithDateComponent, - StartsWithTextComponent, - PublicationSidebarSearchListElementComponent, - ItemSearchResultListElementComponent, - TopLevelCommunityListComponent, - BrowseEntryListElementComponent, -]; - -const DECLARATIONS = [ - ...ENTRY_COMPONENTS, - HomeNewsComponent, - HeaderComponent, - HeaderNavbarWrapperComponent, - NavbarComponent, - SearchNavbarComponent, - FooterComponent, - CreateCollectionParentSelectorComponent, - CreateCommunityParentSelectorComponent, - CreateItemParentSelectorComponent, - EditCollectionSelectorComponent, - EditCommunitySelectorComponent, - EditItemSelectorComponent, - LogInComponent, - LangSwitchComponent, -]; - -@NgModule({ - imports: [ - CommonModule, - RootModule, - ...DECLARATIONS, - ], - providers: [ - ...ENTRY_COMPONENTS.map((component) => ({ provide: component })), - ], -}) -/** - * This module is included in the main bundle that gets downloaded at first page load. So it should - * contain only the themed components that have to be available immediately for the first page load, - * and the minimal set of imports required to make them work. Anything you can cut from it will make - * the initial page load faster, but may cause the page to flicker as components that were already - * rendered server side need to be lazy-loaded again client side - * - * Themed EntryComponents should also be added here - */ -export class EagerThemeModule { -} diff --git a/src/themes/custom/lazy-listable-components.ts b/src/themes/custom/lazy-listable-components.ts new file mode 100644 index 00000000000..617f80f7ee3 --- /dev/null +++ b/src/themes/custom/lazy-listable-components.ts @@ -0,0 +1,29 @@ +import { JournalComponent } from './app/entity-groups/journal-entities/item-pages/journal/journal.component'; +import { JournalIssueComponent } from './app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component'; +import { JournalVolumeComponent } from './app/entity-groups/journal-entities/item-pages/journal-volume/journal-volume.component'; +import { PersonComponent } from './app/entity-groups/research-entities/item-pages/person/person.component'; +import { PublicationComponent } from './app/item-page/simple/item-types/publication/publication.component'; +import { UntypedItemComponent } from './app/item-page/simple/item-types/untyped-item/untyped-item.component'; +import { BrowseEntryListElementComponent } from './app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component'; +import { CollectionListElementComponent } from './app/shared/object-list/collection-list-element/collection-list-element.component'; +import { CommunityListElementComponent } from './app/shared/object-list/community-list-element/community-list-element.component'; +import { ItemSearchResultListElementComponent } from './app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component'; +import { PublicationSidebarSearchListElementComponent } from './app/shared/object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component'; + +/** + * Add components that use the @listableObjectComponent decorator here. + * This will ensure that the decorators get picked up when the app loads + */ +export const LISTABLE_COMPONENTS = [ + JournalComponent, + JournalIssueComponent, + JournalVolumeComponent, + PersonComponent, + PublicationComponent, + UntypedItemComponent, + CommunityListElementComponent, + CollectionListElementComponent, + PublicationSidebarSearchListElementComponent, + ItemSearchResultListElementComponent, + BrowseEntryListElementComponent, +]; diff --git a/src/themes/custom/lazy-theme.module.ts b/src/themes/custom/lazy-theme.module.ts deleted file mode 100644 index bc8e9ed07c7..00000000000 --- a/src/themes/custom/lazy-theme.module.ts +++ /dev/null @@ -1,241 +0,0 @@ -import { DragDropModule } from '@angular/cdk/drag-drop'; -import { CommonModule } from '@angular/common'; -import { - provideHttpClient, - withInterceptorsFromDi, -} from '@angular/common/http'; -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; -import { NgxGalleryModule } from '@kolkov/ngx-gallery'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; -import { StoreRouterConnectingModule } from '@ngrx/router-store'; -import { StoreModule } from '@ngrx/store'; -import { TranslateModule } from '@ngx-translate/core'; -import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to'; - -import { RootModule } from '../../app/root.module'; -import { SearchResultsSkeletonComponent } from '../../app/shared/search/search-results/search-results-skeleton/search-results-skeleton.component'; -import { MetadataImportPageComponent } from './app/admin/admin-import-metadata-page/metadata-import-page.component'; -import { AdminSearchPageComponent } from './app/admin/admin-search-page/admin-search-page.component'; -import { AdminSidebarComponent } from './app/admin/admin-sidebar/admin-sidebar.component'; -import { AdminWorkflowPageComponent } from './app/admin/admin-workflow-page/admin-workflow-page.component'; -import { EditBitstreamPageComponent } from './app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component'; -import { BreadcrumbsComponent } from './app/breadcrumbs/breadcrumbs.component'; -import { BrowseByDateComponent } from './app/browse-by/browse-by-date/browse-by-date.component'; -import { BrowseByMetadataComponent } from './app/browse-by/browse-by-metadata/browse-by-metadata.component'; -import { BrowseByTaxonomyComponent } from './app/browse-by/browse-by-taxonomy/browse-by-taxonomy.component'; -import { BrowseByTitleComponent } from './app/browse-by/browse-by-title/browse-by-title.component'; -import { CollectionPageComponent } from './app/collection-page/collection-page.component'; -import { EditItemTemplatePageComponent } from './app/collection-page/edit-item-template-page/edit-item-template-page.component'; -import { CommunityListComponent } from './app/community-list-page/community-list/community-list.component'; -import { CommunityListPageComponent } from './app/community-list-page/community-list-page.component'; -import { CommunityPageComponent } from './app/community-page/community-page.component'; -import { CommunityPageSubCollectionListComponent } from './app/community-page/sections/sub-com-col-section/sub-collection-list/community-page-sub-collection-list.component'; -import { CommunityPageSubCommunityListComponent } from './app/community-page/sections/sub-com-col-section/sub-community-list/community-page-sub-community-list.component'; -import { DsoEditMetadataComponent } from './app/dso-shared/dso-edit-metadata/dso-edit-metadata.component'; -import { ForbiddenComponent } from './app/forbidden/forbidden.component'; -import { ForgotEmailComponent } from './app/forgot-password/forgot-password-email/forgot-email.component'; -import { ForgotPasswordFormComponent } from './app/forgot-password/forgot-password-form/forgot-password-form.component'; -import { HomePageComponent } from './app/home-page/home-page.component'; -import { EndUserAgreementComponent } from './app/info/end-user-agreement/end-user-agreement.component'; -import { FeedbackComponent } from './app/info/feedback/feedback.component'; -import { FeedbackFormComponent } from './app/info/feedback/feedback-form/feedback-form.component'; -import { PrivacyComponent } from './app/info/privacy/privacy.component'; -import { ItemAlertsComponent } from './app/item-page/alerts/item-alerts.component'; -import { ItemStatusComponent } from './app/item-page/edit-item-page/item-status/item-status.component'; -import { FullFileSectionComponent } from './app/item-page/full/field-components/file-section/full-file-section.component'; -import { FullItemPageComponent } from './app/item-page/full/full-item-page.component'; -import { MediaViewerComponent } from './app/item-page/media-viewer/media-viewer.component'; -import { MediaViewerImageComponent } from './app/item-page/media-viewer/media-viewer-image/media-viewer-image.component'; -import { MediaViewerVideoComponent } from './app/item-page/media-viewer/media-viewer-video/media-viewer-video.component'; -import { FileSectionComponent } from './app/item-page/simple/field-components/file-section/file-section.component'; -import { ItemPageTitleFieldComponent } from './app/item-page/simple/field-components/specific-field/title/item-page-title-field.component'; -import { ItemPageComponent } from './app/item-page/simple/item-page.component'; -import { MetadataRepresentationListComponent } from './app/item-page/simple/metadata-representation-list/metadata-representation-list.component'; -import { LoginPageComponent } from './app/login-page/login-page.component'; -import { LogoutPageComponent } from './app/logout-page/logout-page.component'; -import { ObjectNotFoundComponent } from './app/lookup-by-id/objectnotfound/objectnotfound.component'; -import { MyDSpacePageComponent } from './app/my-dspace-page/my-dspace-page.component'; -import { ExpandableNavbarSectionComponent } from './app/navbar/expandable-navbar-section/expandable-navbar-section.component'; -import { PageNotFoundComponent } from './app/pagenotfound/pagenotfound.component'; -import { ProfilePageComponent } from './app/profile-page/profile-page.component'; -import { ProfilePageMetadataFormComponent } from './app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component'; -import { RegisterEmailFormComponent } from './app/register-email-form/register-email-form.component'; -import { CreateProfileComponent } from './app/register-page/create-profile/create-profile.component'; -import { RegisterEmailComponent } from './app/register-page/register-email/register-email.component'; -import { DenyRequestCopyComponent } from './app/request-copy/deny-request-copy/deny-request-copy.component'; -import { EmailRequestCopyComponent } from './app/request-copy/email-request-copy/email-request-copy.component'; -import { GrantRequestCopyComponent } from './app/request-copy/grant-request-copy/grant-request-copy.component'; -import { RootComponent } from './app/root/root.component'; -import { ConfigurationSearchPageComponent } from './app/search-page/configuration-search-page.component'; -import { SearchPageComponent } from './app/search-page/search-page.component'; -import { AuthNavMenuComponent } from './app/shared/auth-nav-menu/auth-nav-menu.component'; -import { UserMenuComponent } from './app/shared/auth-nav-menu/user-menu/user-menu.component'; -import { BrowseByComponent } from './app/shared/browse-by/browse-by.component'; -import { ComcolPageBrowseByComponent } from './app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component'; -import { ComcolPageContentComponent } from './app/shared/comcol/comcol-page-content/comcol-page-content.component'; -import { ComcolPageHandleComponent } from './app/shared/comcol/comcol-page-handle/comcol-page-handle.component'; -import { DsDynamicLookupRelationExternalSourceTabComponent } from './app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/dynamic-lookup-relation-external-source-tab.component'; -import { ExternalSourceEntryImportModalComponent } from './app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component'; -import { DsDynamicLookupRelationSearchTabComponent } from './app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component'; -import { LoadingComponent } from './app/shared/loading/loading.component'; -import { AccessStatusBadgeComponent } from './app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component'; -import { BadgesComponent } from './app/shared/object-collection/shared/badges/badges.component'; -import { MyDSpaceStatusBadgeComponent } from './app/shared/object-collection/shared/badges/my-dspace-status-badge/my-dspace-status-badge.component'; -import { StatusBadgeComponent } from './app/shared/object-collection/shared/badges/status-badge/status-badge.component'; -import { TypeBadgeComponent } from './app/shared/object-collection/shared/badges/type-badge/type-badge.component'; -import { ItemDetailPreviewFieldComponent } from './app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component'; -import { ItemListPreviewComponent } from './app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component'; -import { ObjectListComponent } from './app/shared/object-list/object-list.component'; -import { ResultsBackButtonComponent } from './app/shared/results-back-button/results-back-button.component'; -import { SearchComponent } from './app/shared/search/search.component'; -import { SearchFiltersComponent } from './app/shared/search/search-filters/search-filters.component'; -import { SearchResultsComponent } from './app/shared/search/search-results/search-results.component'; -import { SearchSettingsComponent } from './app/shared/search/search-settings/search-settings.component'; -import { SearchSidebarComponent } from './app/shared/search/search-sidebar/search-sidebar.component'; -import { SearchFormComponent } from './app/shared/search-form/search-form.component'; -import { CollectionStatisticsPageComponent } from './app/statistics-page/collection-statistics-page/collection-statistics-page.component'; -import { CommunityStatisticsPageComponent } from './app/statistics-page/community-statistics-page/community-statistics-page.component'; -import { ItemStatisticsPageComponent } from './app/statistics-page/item-statistics-page/item-statistics-page.component'; -import { SiteStatisticsPageComponent } from './app/statistics-page/site-statistics-page/site-statistics-page.component'; -import { SubmissionEditComponent } from './app/submission/edit/submission-edit.component'; -import { SubmissionFormFooterComponent } from './app/submission/form/footer/submission-form-footer.component'; -import { SubmissionFormComponent } from './app/submission/form/submission-form.component'; -import { SubmissionUploadFilesComponent } from './app/submission/form/submission-upload-files/submission-upload-files.component'; -import { SubmissionImportExternalComponent } from './app/submission/import-external/submission-import-external.component'; -import { SubmissionSectionContainerComponent } from './app/submission/sections/container/section-container.component'; -import { SubmissionSectionUploadFileComponent } from './app/submission/sections/upload/file/section-upload-file.component'; -import { SubmissionSubmitComponent } from './app/submission/submit/submission-submit.component'; -import { ThumbnailComponent } from './app/thumbnail/thumbnail.component'; -import { WorkflowItemDeleteComponent } from './app/workflowitems-edit-page/workflow-item-delete/workflow-item-delete.component'; -import { WorkflowItemSendBackComponent } from './app/workflowitems-edit-page/workflow-item-send-back/workflow-item-send-back.component'; -import { WorkspaceItemsDeletePageComponent } from './app/workspaceitems-edit-page/workspaceitems-delete-page/workspaceitems-delete-page.component'; - -const DECLARATIONS = [ - FileSectionComponent, - HomePageComponent, - RootComponent, - CommunityListPageComponent, - SearchPageComponent, - ConfigurationSearchPageComponent, - SearchFormComponent, - EndUserAgreementComponent, - PageNotFoundComponent, - ObjectNotFoundComponent, - ForbiddenComponent, - PrivacyComponent, - CollectionStatisticsPageComponent, - CommunityStatisticsPageComponent, - ItemStatisticsPageComponent, - SiteStatisticsPageComponent, - CommunityPageComponent, - CommunityPageSubCommunityListComponent, - CommunityPageSubCollectionListComponent, - CollectionPageComponent, - ItemPageComponent, - FullItemPageComponent, - LoginPageComponent, - LogoutPageComponent, - CreateProfileComponent, - ForgotEmailComponent, - ForgotPasswordFormComponent, - ProfilePageComponent, - RegisterEmailComponent, - MyDSpacePageComponent, - SubmissionEditComponent, - SubmissionImportExternalComponent, - SubmissionSubmitComponent, - WorkflowItemDeleteComponent, - WorkflowItemSendBackComponent, - BreadcrumbsComponent, - FeedbackComponent, - FeedbackFormComponent, - CommunityListComponent, - ComcolPageHandleComponent, - AuthNavMenuComponent, - ExpandableNavbarSectionComponent, - EditItemTemplatePageComponent, - LoadingComponent, - SearchResultsComponent, - AdminSidebarComponent, - SearchSettingsComponent, - ComcolPageBrowseByComponent, - ObjectListComponent, - BrowseByMetadataComponent, - BrowseByDateComponent, - BrowseByTitleComponent, - BrowseByTaxonomyComponent, - ExternalSourceEntryImportModalComponent, - SearchFiltersComponent, - SearchSidebarComponent, - BadgesComponent, - StatusBadgeComponent, - TypeBadgeComponent, - MyDSpaceStatusBadgeComponent, - AccessStatusBadgeComponent, - ResultsBackButtonComponent, - DsoEditMetadataComponent, - ItemAlertsComponent, - FullFileSectionComponent, - MetadataRepresentationListComponent, - DsDynamicLookupRelationSearchTabComponent, - DsDynamicLookupRelationExternalSourceTabComponent, - ItemPageTitleFieldComponent, - MediaViewerComponent, - MediaViewerImageComponent, - MediaViewerVideoComponent, - DenyRequestCopyComponent, - EmailRequestCopyComponent, - GrantRequestCopyComponent, - WorkspaceItemsDeletePageComponent, - ThumbnailComponent, - SubmissionSectionUploadFileComponent, - ItemStatusComponent, - EditBitstreamPageComponent, - UserMenuComponent, - BrowseByComponent, - RegisterEmailFormComponent, - SearchComponent, - ItemListPreviewComponent, - MetadataImportPageComponent, - ItemDetailPreviewFieldComponent, - ProfilePageMetadataFormComponent, - SubmissionUploadFilesComponent, - ComcolPageContentComponent, - AdminSearchPageComponent, - AdminWorkflowPageComponent, - SearchResultsSkeletonComponent, - SubmissionSectionContainerComponent, - SubmissionFormFooterComponent, - SubmissionFormComponent, -]; - -@NgModule({ - imports: [RootModule, - CommonModule, - DragDropModule, - FormsModule, - NgbModule, - RouterModule, - ScrollToModule, - StoreModule, - StoreRouterConnectingModule, - TranslateModule, - FormsModule, - NgxGalleryModule, - ...DECLARATIONS], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - ], -}) - -/** - * This module serves as an index for all the components in this theme. - * It should import all other modules, so the compiler knows where to find any components referenced - * from a component in this theme - * It is purposefully not exported, it should never be imported anywhere else, its only purpose is - * to give lazily loaded components a context in which they can be compiled successfully - */ -class LazyThemeModule { -} diff --git a/src/themes/dspace/eager-theme-components.ts b/src/themes/dspace/eager-theme-components.ts new file mode 100644 index 00000000000..145e87aee71 --- /dev/null +++ b/src/themes/dspace/eager-theme-components.ts @@ -0,0 +1,12 @@ +/* eslint-disable dspace-angular-ts/themed-component-usages */ +import { HeaderComponent } from './app/header/header.component'; +import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-navbar-wrapper.component'; +import { HomeNewsComponent } from './app/home-page/home-news/home-news.component'; +import { NavbarComponent } from './app/navbar/navbar.component'; + +export const COMPONENTS = [ + HomeNewsComponent, + HeaderComponent, + HeaderNavbarWrapperComponent, + NavbarComponent, +]; diff --git a/src/themes/dspace/eager-theme.module.ts b/src/themes/dspace/eager-theme.module.ts deleted file mode 100644 index 233b08c62ce..00000000000 --- a/src/themes/dspace/eager-theme.module.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; - -import { RootModule } from '../../app/root.module'; -import { HeaderComponent } from './app/header/header.component'; -import { HeaderNavbarWrapperComponent } from './app/header-nav-wrapper/header-navbar-wrapper.component'; -import { HomeNewsComponent } from './app/home-page/home-news/home-news.component'; -import { NavbarComponent } from './app/navbar/navbar.component'; - -/** - * Add components that use a custom decorator to ENTRY_COMPONENTS as well as DECLARATIONS. - * This will ensure that decorator gets picked up when the app loads - */ -const ENTRY_COMPONENTS = []; - -const DECLARATIONS = [ - ...ENTRY_COMPONENTS, - HomeNewsComponent, - HeaderComponent, - HeaderNavbarWrapperComponent, - NavbarComponent, -]; - -@NgModule({ - imports: [ - CommonModule, - RootModule, - ...DECLARATIONS, - ], - providers: [ - ...ENTRY_COMPONENTS.map((component) => ({ provide: component })), - ], -}) -/** - * This module is included in the main bundle that gets downloaded at first page load. So it should - * contain only the themed components that have to be available immediately for the first page load, - * and the minimal set of imports required to make them work. Anything you can cut from it will make - * the initial page load faster, but may cause the page to flicker as components that were already - * rendered server side need to be lazy-loaded again client side - * - * Themed EntryComponents should also be added here - */ -export class EagerThemeModule { -} diff --git a/src/themes/dspace/lazy-listable-components.ts b/src/themes/dspace/lazy-listable-components.ts new file mode 100644 index 00000000000..4b0eed6066a --- /dev/null +++ b/src/themes/dspace/lazy-listable-components.ts @@ -0,0 +1,6 @@ +/** + * Add components that use the @listableObjectComponent decorator here. + * This will ensure that the decorators get picked up when the app loads + */ +export const LISTABLE_COMPONENTS = [ +]; diff --git a/src/themes/dspace/lazy-theme.module.ts b/src/themes/dspace/lazy-theme.module.ts deleted file mode 100644 index 8de71d14c8a..00000000000 --- a/src/themes/dspace/lazy-theme.module.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { DragDropModule } from '@angular/cdk/drag-drop'; -import { CommonModule } from '@angular/common'; -import { - provideHttpClient, - withInterceptorsFromDi, -} from '@angular/common/http'; -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; -import { StoreRouterConnectingModule } from '@ngrx/router-store'; -import { StoreModule } from '@ngrx/store'; -import { TranslateModule } from '@ngx-translate/core'; -import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to'; - -import { RootModule } from '../../app/root.module'; - -const DECLARATIONS = [ -]; - -@NgModule({ - declarations: DECLARATIONS, - imports: [ - RootModule, - CommonModule, - DragDropModule, - FormsModule, - NgbModule, - RouterModule, - ScrollToModule, - StoreModule, - StoreRouterConnectingModule, - TranslateModule, - FormsModule, - ], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - ], -}) - -/** - * This module serves as an index for all the components in this theme. - * It should import all other modules, so the compiler knows where to find any components referenced - * from a component in this theme - * It is purposefully not exported, it should never be imported anywhere else, its only purpose is - * to give lazily loaded components a context in which they can be compiled successfully - */ -class LazyThemeModule { -} diff --git a/src/themes/eager-themes-components.ts b/src/themes/eager-themes-components.ts new file mode 100644 index 00000000000..1e634d47bc9 --- /dev/null +++ b/src/themes/eager-themes-components.ts @@ -0,0 +1,14 @@ +// import { COMPONENTS as CUSTOM_THEME_EAGER_COMPONENTS } from './custom/eager-theme-components'; +import { COMPONENTS as DSPACE_THEME_EAGER_COMPONENTS } from './dspace/eager-theme-components'; + +/** + * This list bundles the eager components from all the enable themes. + * Eager components are components that are present on every page (to speed up initial loading) + * and entry components (to ensure their decorators get picked up). + * + * Themes that aren't in use should not be imported here, so they don't take up unnecessary space in the main bundle. + */ +export const EAGER_THEME_COMPONENTS = [ + // ...CUSTOM_THEME_EAGER_COMPONENTS, + ...DSPACE_THEME_EAGER_COMPONENTS, +]; diff --git a/src/themes/eager-themes.module.ts b/src/themes/eager-themes.module.ts deleted file mode 100644 index c4db7b582a0..00000000000 --- a/src/themes/eager-themes.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { EagerThemeModule as DSpaceEagerThemeModule } from './dspace/eager-theme.module'; -// import { EagerThemeModule as CustomEagerThemeModule } from './custom/eager-theme.module'; - -/** - * This module bundles the eager theme modules for all available themes. - * Eager modules contain components that are present on every page (to speed up initial loading) - * and entry components (to ensure their decorators get picked up). - * - * Themes that aren't in use should not be imported here so they don't take up unnecessary space in the main bundle. - */ -@NgModule({ - imports: [ - DSpaceEagerThemeModule, - // CustomEagerThemeModule, - ], -}) -export class EagerThemesModule { -} diff --git a/src/themes/themes-listable-components.ts b/src/themes/themes-listable-components.ts new file mode 100644 index 00000000000..24815654002 --- /dev/null +++ b/src/themes/themes-listable-components.ts @@ -0,0 +1,13 @@ +// import { LISTABLE_COMPONENTS as CUSTOM_LISTABLE_COMPONENTS } from './custom/lazy-listable-components'; +import { LISTABLE_COMPONENTS as DSPACE_LISTABLE_COMPONENTS } from './dspace/lazy-listable-components'; + +/** + * This list bundles all the listable components from all the enabled themes. + * Listable components are components that use the @listableObjectComponent decorator + * + * Themes that aren't in use should not be imported here, so they don't take up unnecessary space in the main bundle. + */ +export const THEME_LISTABLE_COMPONENTS = [ + // ...CUSTOM_LISTABLE_COMPONENTS, + ...DSPACE_LISTABLE_COMPONENTS, +]; diff --git a/tsconfig.app.json b/tsconfig.app.json index c89834db4ab..5de11c43947 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -10,7 +10,7 @@ ], "include": [ "src/**/*.d.ts", - "src/themes/**/*.module.ts" + "src/themes/**/*.ts" ], "exclude": [ "src/test.ts", @@ -21,7 +21,4 @@ "src/**/testing/*", "src/**/mocks/*" ], - "angularCompilerOptions": { - "entryModule": "./src/modules/app/browser-app.module#BrowserAppModule" - } } diff --git a/tsconfig.server.json b/tsconfig.server.json index c2f4c06a23f..de4aff46a76 100644 --- a/tsconfig.server.json +++ b/tsconfig.server.json @@ -12,7 +12,4 @@ "src/main.server.ts", "server.ts" ], - "angularCompilerOptions": { - "entryModule": "./src/modules/app/server-app.module#ServerAppModule" - } } diff --git a/tsconfig.spec.json b/tsconfig.spec.json index 0d926775452..e574f753c9f 100644 --- a/tsconfig.spec.json +++ b/tsconfig.spec.json @@ -16,6 +16,6 @@ "include": [ "src/**/*.spec.ts", "src/**/*.d.ts", - "src/themes/**/*.module.ts" + "src/themes/**/*.ts" ], }