erudit 3.0.0-dev.8 → 4.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +25 -185
- package/app/assets/icons/array-check.svg +3 -0
- package/app/assets/icons/array-lines.svg +3 -0
- package/app/assets/icons/array-star.svg +3 -0
- package/app/assets/icons/arrow/from-circle.svg +3 -0
- package/app/assets/icons/arrow/left.svg +3 -0
- package/app/assets/icons/arrow/outward-box.svg +3 -0
- package/app/assets/icons/arrow/outward.svg +3 -0
- package/app/assets/icons/arrow/to-circle.svg +3 -0
- package/app/assets/icons/arrow/up-to-right.svg +3 -0
- package/app/assets/icons/aside-open.svg +2 -2
- package/app/assets/icons/asterisk.svg +2 -2
- package/app/assets/icons/bell.svg +3 -0
- package/app/assets/icons/book-outline.svg +3 -0
- package/app/assets/icons/book-question.svg +2 -2
- package/app/assets/icons/book.svg +2 -2
- package/app/assets/icons/box.svg +3 -0
- package/app/assets/icons/bug.svg +2 -2
- package/app/assets/icons/chevron-right.svg +3 -0
- package/app/assets/icons/cog.svg +3 -0
- package/app/assets/icons/construction.svg +2 -2
- package/app/assets/icons/diamond.svg +3 -0
- package/app/assets/icons/draw.svg +2 -2
- package/app/assets/icons/erudit.svg +3 -0
- package/app/assets/icons/file-lines.svg +2 -2
- package/app/assets/icons/files.svg +3 -0
- package/app/assets/icons/flame.svg +3 -0
- package/app/assets/icons/folder-open.svg +2 -2
- package/app/assets/icons/folder.svg +2 -2
- package/app/assets/icons/globe.svg +2 -2
- package/app/assets/icons/graduation.svg +3 -0
- package/app/assets/icons/handshake.svg +3 -0
- package/app/assets/icons/house.svg +2 -2
- package/app/assets/icons/lines.svg +3 -0
- package/app/assets/icons/moon.svg +2 -2
- package/app/assets/icons/plus-circle.svg +2 -2
- package/app/assets/icons/plus.svg +2 -2
- package/app/assets/icons/puzzle.svg +2 -2
- package/app/assets/icons/question-circle.svg +3 -0
- package/app/assets/icons/rocket.svg +3 -0
- package/app/assets/icons/search/check.svg +3 -0
- package/app/assets/icons/search/dead.svg +3 -0
- package/app/assets/icons/search/glass.svg +3 -0
- package/app/assets/icons/search/wtf.svg +3 -0
- package/app/assets/icons/sun-moon.svg +2 -2
- package/app/assets/icons/sun.svg +2 -2
- package/app/assets/icons/translate.svg +3 -0
- package/app/assets/icons/user.svg +2 -2
- package/app/assets/icons/users.svg +2 -2
- package/app/assets/icons/warning.svg +3 -0
- package/app/components/EruditLink.ts +9 -0
- package/app/components/FancyBold.vue +17 -0
- package/app/components/FancyCard.vue +59 -0
- package/app/components/FancyCardTag.vue +16 -0
- package/app/components/Prose.vue +51 -0
- package/app/components/ScrollHolder.vue +20 -0
- package/app/components/SmartMedia.vue +112 -0
- package/app/components/ads/Ads.vue +39 -0
- package/app/components/ads/AdsBannerAside.vue +46 -0
- package/app/components/ads/AdsBannerBottom.vue +17 -0
- package/app/components/ads/AdsReplacer.vue +28 -0
- package/app/components/ads/provider/Custom.vue +19 -0
- package/app/components/ads/provider/Yandex.vue +84 -0
- package/app/components/aside/AsideListItem.vue +66 -74
- package/app/components/aside/AsideMajor.vue +8 -56
- package/app/components/aside/AsideMinor.vue +76 -71
- package/app/components/aside/AsidePlainMessage.vue +9 -0
- package/app/components/aside/AsideSwitch.vue +67 -0
- package/app/components/aside/major/PaneHolder.vue +106 -0
- package/app/components/aside/major/PaneSwitcher.vue +73 -0
- package/app/components/aside/major/PaneSwitcherButton.vue +38 -0
- package/app/components/aside/major/PaneTemplate.vue +5 -0
- package/app/components/aside/major/SiteInfo.vue +68 -85
- package/app/components/aside/major/contentNav/PaneBookNav.vue +116 -0
- package/app/components/aside/major/contentNav/PaneGlobalNav.vue +19 -0
- package/app/components/aside/major/contentNav/items/ContentNavBook.vue +21 -0
- package/app/components/aside/major/contentNav/items/ContentNavFolder.vue +92 -0
- package/app/components/aside/major/contentNav/items/ContentNavItem.vue +33 -0
- package/app/components/aside/major/contentNav/items/ContentNavPage.vue +18 -0
- package/app/components/aside/major/contentNav/items/ContentNavSeparator.vue +62 -0
- package/app/components/aside/major/contentNav/items/ContentNavTopic.vue +18 -0
- package/app/components/aside/major/contentNav/items/Flags.vue +52 -0
- package/app/components/aside/major/contentNav/items/ItemTemplate.vue +27 -0
- package/app/components/aside/major/languages/PaneLanguages.vue +55 -0
- package/app/components/aside/major/pages/PanePages.vue +60 -0
- package/app/components/aside/major/search/PaneSearch.vue +145 -0
- package/app/components/aside/major/search/SearchInput.vue +104 -0
- package/app/components/aside/major/search/SearchResult.vue +103 -0
- package/app/components/aside/major/search/SearchStatus.vue +48 -0
- package/app/components/aside/major/search/search.worker.ts +164 -0
- package/app/components/aside/major/settings/BuildTime.vue +25 -0
- package/app/components/aside/major/settings/EngineVersion.vue +13 -0
- package/app/components/aside/major/settings/PaneSettings.vue +17 -0
- package/app/components/aside/major/settings/ThemeSwitcher.vue +53 -0
- package/app/components/aside/major/settings/repository/Repository.vue +33 -0
- package/app/components/aside/major/settings/repository/SecondaryGitHub.vue +71 -0
- package/app/components/aside/minor/AsideMinorPane.vue +1 -11
- package/app/components/aside/minor/AsideMinorPlainHeader.vue +21 -0
- package/app/components/aside/minor/content/AsideMinorContentContributions.vue +51 -0
- package/app/components/aside/minor/content/AsideMinorContentPage.vue +37 -0
- package/app/components/aside/minor/content/AsideMinorContentTopic.vue +69 -0
- package/app/components/aside/minor/content/ButtonPaneContributions.vue +116 -0
- package/app/components/aside/minor/content/ButtonPaneImprove.vue +121 -0
- package/app/components/aside/minor/content/Contribution.vue +36 -0
- package/app/components/aside/minor/content/Toc.vue +163 -0
- package/app/components/aside/minor/content/TocItem.vue +77 -0
- package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
- package/app/components/aside/minor/contributor/AsideMinorContributor.vue +39 -0
- package/app/components/aside/minor/contributor/ItemBook.vue +39 -0
- package/app/components/aside/minor/contributor/ItemContent.vue +17 -0
- package/app/components/aside/minor/news/AsideMinorNews.vue +133 -0
- package/app/components/aside/minor/news/NewsItem.vue +69 -0
- package/app/components/aside/minor/news/RenderNewsElement.vue +42 -0
- package/app/components/aside/minor/news/elements/Mix.vue +11 -0
- package/app/components/aside/minor/news/elements/P.vue +14 -0
- package/app/components/aside/minor/news/elements/Ref.vue +58 -0
- package/app/components/aside/minor/news/elements/Text.vue +18 -0
- package/app/components/indexPage/IndexPagePersons.vue +117 -0
- package/app/components/main/MainAction.vue +20 -0
- package/app/components/main/MainBreadcrumbs.vue +28 -0
- package/app/components/main/MainContentChild.vue +48 -0
- package/app/components/main/MainContentChildren.vue +14 -0
- package/app/components/main/MainDecoration.vue +15 -0
- package/app/components/main/MainDescription.vue +13 -0
- package/app/components/main/MainFlag.vue +133 -0
- package/app/components/main/MainFlags.vue +17 -0
- package/app/components/main/MainGlow.vue +12 -0
- package/app/components/main/MainQuickLink.vue +76 -0
- package/app/components/main/MainQuickLinks.vue +42 -0
- package/app/components/main/MainQuote.vue +162 -0
- package/app/components/main/MainQuoteLoader.vue +86 -0
- package/app/components/main/MainSection.vue +59 -0
- package/app/components/main/MainSectionPreamble.vue +5 -0
- package/app/components/main/MainSubTitle.vue +12 -0
- package/app/components/main/MainTitle.vue +33 -0
- package/app/components/main/MainTopicPartPage.vue +88 -0
- package/app/components/main/MainTopicPartSwitch.vue +71 -0
- package/app/components/main/connections/Deps.vue +34 -0
- package/app/components/main/connections/Externals.vue +46 -0
- package/app/components/main/connections/MainConnections.vue +41 -0
- package/app/components/main/connections/MainConnectionsButton.vue +80 -0
- package/app/components/main/connections/ScrollPane.vue +11 -0
- package/app/components/main/contentStats/Item.vue +35 -0
- package/app/components/main/contentStats/ItemElement.vue +19 -0
- package/app/components/main/contentStats/ItemMaterials.vue +11 -0
- package/app/components/main/contentStats/MainContentStats.vue +50 -0
- package/app/components/preview/Preview.vue +173 -186
- package/app/components/preview/PreviewError.vue +10 -0
- package/app/components/preview/PreviewLoading.vue +5 -14
- package/app/components/preview/PreviewScreen.vue +65 -141
- package/app/components/preview/PreviewScreenButton.vue +39 -0
- package/app/components/preview/screen/ContentPage.vue +50 -0
- package/app/components/preview/screen/DirectLink.vue +23 -0
- package/app/components/preview/screen/Unique.vue +54 -0
- package/app/components/site/SiteAside.vue +70 -0
- package/app/components/site/SiteAsideOverlay.vue +21 -0
- package/app/components/site/SiteMain.vue +16 -0
- package/app/components/transition/Fade.vue +30 -19
- package/app/components/transition/Slide.vue +47 -0
- package/app/components/tree/TreeContainer.vue +5 -11
- package/app/components/tree/TreeItem.vue +40 -89
- package/app/composables/ads.ts +23 -0
- package/app/composables/analytics.ts +102 -0
- package/app/composables/appElements.ts +40 -0
- package/app/composables/aside.ts +28 -0
- package/app/composables/asideMajorPane.ts +135 -0
- package/app/composables/asideMinor.ts +109 -0
- package/app/composables/contentNav.ts +7 -0
- package/app/composables/favicon.ts +104 -4
- package/app/composables/file.ts +3 -0
- package/app/composables/formatText.ts +85 -71
- package/app/composables/loading.ts +2 -0
- package/app/composables/mainContent.ts +31 -0
- package/app/composables/og.ts +165 -0
- package/app/composables/phrases.ts +126 -81
- package/app/composables/preview.ts +53 -0
- package/app/composables/route.ts +4 -0
- package/app/composables/theme.ts +71 -29
- package/app/composables/url.ts +22 -33
- package/app/formatters/ru.ts +14 -0
- package/app/pages/article/[...articleId].vue +10 -1
- package/app/pages/book/[...bookId].vue +52 -43
- package/app/pages/contributor/[contributorId].vue +151 -0
- package/app/pages/contributors.vue +99 -0
- package/app/pages/group/[...groupId].vue +53 -59
- package/app/pages/index.vue +114 -26
- package/app/pages/page/[...pageId].vue +60 -0
- package/app/pages/practice/[...practiceId].vue +12 -0
- package/app/pages/sponsors.vue +91 -0
- package/app/pages/summary/[...summaryId].vue +10 -1
- package/app/plugins/appSetup/client/htmlBranding.ts +6 -0
- package/app/plugins/appSetup/client/welcome.ts +35 -0
- package/app/plugins/appSetup/config.ts +6 -0
- package/app/plugins/appSetup/global.ts +3 -0
- package/app/plugins/appSetup/index.ts +28 -0
- package/app/plugins/prerender.server.ts +40 -0
- package/app/router.options.ts +5 -0
- package/app/scripts/theme.js +33 -0
- package/app/styles/main.css +173 -0
- package/bin/erudit.mjs +2 -2
- package/modules/erudit/globals/content.ts +4 -0
- package/modules/erudit/globals/contributor.ts +1 -0
- package/modules/erudit/globals/eruditConfig.ts +10 -0
- package/modules/erudit/globals/problem.ts +1 -0
- package/modules/erudit/globals/prose.ts +1 -0
- package/modules/erudit/globals/public.ts +18 -0
- package/modules/erudit/index.ts +60 -0
- package/{module → modules/erudit}/logger.ts +2 -2
- package/modules/erudit/setup/aliases.ts +17 -0
- package/modules/erudit/setup/baseUrl.ts +19 -0
- package/modules/erudit/setup/elements/appTemplate.ts +45 -0
- package/modules/erudit/setup/elements/globalTemplate.ts +82 -0
- package/modules/erudit/setup/elements/globalTypes.ts +273 -0
- package/modules/erudit/setup/elements/setup.ts +167 -0
- package/modules/erudit/setup/elements/shared.ts +10 -0
- package/modules/erudit/setup/elements/tagsTable.ts +28 -0
- package/modules/erudit/setup/fullRestart.ts +71 -0
- package/modules/erudit/setup/globals.ts +196 -0
- package/modules/erudit/setup/nuxtConfig.ts +62 -0
- package/modules/erudit/setup/projectConfig.ts +114 -0
- package/modules/erudit/setup/publicAssets.ts +52 -0
- package/modules/erudit/setup/runtimeConfig.ts +58 -0
- package/modules/erudit/watcher.ts +27 -0
- package/nuxt.config.ts +66 -87
- package/package.json +38 -19
- package/proxy/prose.app.ts +1 -0
- package/proxy/prose.ts +1 -0
- package/public/favicons/default.svg +1 -0
- package/{app/public → public}/logotype.svg +1 -1
- package/public/og.png +0 -0
- package/server/api/aside/major/frontNav/book/[...shortId].ts +10 -0
- package/server/api/aside/major/frontNav/global.ts +5 -0
- package/server/api/aside/major/pages.ts +6 -0
- package/server/api/contributor/list.ts +61 -0
- package/server/api/contributor/page/[contributorId].ts +68 -0
- package/server/api/indexPage.ts +81 -0
- package/server/api/language/functions.ts +6 -7
- package/server/api/language/phrase/[phraseKey].ts +32 -0
- package/server/api/main/content/[...contentTypePath].ts +153 -0
- package/server/api/news/batch/[batchIndex].ts +5 -0
- package/server/api/pageSponsors.ts +58 -0
- package/server/api/prerender/content.ts +82 -0
- package/server/api/prerender/default.ts +35 -0
- package/server/api/prerender/files.ts +10 -0
- package/server/api/prerender/frontNav.ts +13 -0
- package/server/api/prerender/language.ts +7 -0
- package/server/api/prerender/news.ts +8 -0
- package/server/api/prerender/quotes.ts +15 -0
- package/server/api/preview/contentPage/[...contentTypePath].ts +63 -0
- package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +81 -0
- package/server/api/problemScript/[...problemScriptPath].ts +92 -0
- package/server/api/quote/data/[quoteId].ts +87 -0
- package/server/api/quote/ids.ts +3 -0
- package/server/erudit/build.ts +137 -0
- package/server/erudit/cameos/build.ts +111 -0
- package/server/erudit/config.ts +13 -0
- package/server/erudit/content/global/build.ts +271 -0
- package/server/erudit/content/global/singleton.ts +5 -0
- package/server/erudit/content/nav/build.ts +431 -0
- package/server/erudit/content/nav/front.ts +127 -0
- package/server/erudit/content/nav/repository/books.ts +40 -0
- package/server/erudit/content/nav/repository/get.ts +33 -0
- package/server/erudit/content/nav/repository/hasChildren.ts +5 -0
- package/server/erudit/content/nav/repository/hasNav.ts +3 -0
- package/server/erudit/content/nav/repository/hasParent.ts +5 -0
- package/server/erudit/content/nav/repository/id.ts +9 -0
- package/server/erudit/content/nav/repository/index.ts +9 -0
- package/server/erudit/content/nav/repository/order.ts +14 -0
- package/server/erudit/content/nav/repository/previousNext.ts +35 -0
- package/server/erudit/content/nav/repository/walk.ts +127 -0
- package/server/erudit/content/nav/setup.ts +13 -0
- package/server/erudit/content/nav/types.ts +24 -0
- package/server/erudit/content/repository/breadcrumbs.ts +24 -0
- package/server/erudit/content/repository/children.ts +47 -0
- package/server/erudit/content/repository/connections.ts +35 -0
- package/server/erudit/content/repository/contentLink.ts +16 -0
- package/server/erudit/content/repository/decoration.ts +23 -0
- package/server/erudit/content/repository/deps.ts +84 -0
- package/server/erudit/content/repository/description.ts +11 -0
- package/server/erudit/content/repository/elementSnippets.ts +65 -0
- package/server/erudit/content/repository/externals.ts +21 -0
- package/server/erudit/content/repository/flags.ts +33 -0
- package/server/erudit/content/repository/seo.ts +12 -0
- package/server/erudit/content/repository/stats.ts +97 -0
- package/server/erudit/content/repository/title.ts +27 -0
- package/server/erudit/content/repository/topicParts.ts +39 -0
- package/server/erudit/content/repository/unique.ts +76 -0
- package/server/erudit/content/resolve/book.ts +32 -0
- package/server/erudit/content/resolve/group.ts +39 -0
- package/server/erudit/content/resolve/index.ts +139 -0
- package/server/erudit/content/resolve/page.ts +87 -0
- package/server/erudit/content/resolve/topic.ts +185 -0
- package/server/erudit/content/resolve/utils/contentError.ts +10 -0
- package/server/erudit/content/resolve/utils/insertContentItem.ts +122 -0
- package/server/erudit/content/resolve/utils/insertContentResolved.ts +93 -0
- package/server/erudit/content/search.ts +135 -0
- package/server/erudit/contributors/build.ts +111 -0
- package/server/erudit/contributors/global.ts +3 -0
- package/server/erudit/contributors/repository/avatarUrl.ts +10 -0
- package/server/erudit/contributors/repository/contributions.ts +178 -0
- package/server/erudit/contributors/repository/count.ts +3 -0
- package/server/erudit/contributors/search.ts +34 -0
- package/server/erudit/db/repository/pushFile.ts +23 -0
- package/server/erudit/db/repository/pushProblemScript.ts +19 -0
- package/server/erudit/db/repository/pushProseLink.ts +40 -0
- package/server/erudit/db/schema/cameos.ts +7 -0
- package/server/erudit/db/schema/content.ts +18 -0
- package/server/erudit/db/schema/contentContributions.ts +15 -0
- package/server/erudit/db/schema/contentDeps.ts +21 -0
- package/server/erudit/db/schema/contentElementStats.ts +20 -0
- package/server/erudit/db/schema/contentProseLinks.ts +23 -0
- package/server/erudit/db/schema/contentSnippets.ts +16 -0
- package/server/erudit/db/schema/contentToc.ts +16 -0
- package/server/erudit/db/schema/contentUniques.ts +25 -0
- package/server/erudit/db/schema/contributors.ts +12 -0
- package/server/erudit/db/schema/files.ts +11 -0
- package/server/erudit/db/schema/groups.ts +6 -0
- package/server/erudit/db/schema/index.ts +17 -0
- package/server/erudit/db/schema/news.ts +7 -0
- package/server/erudit/db/schema/pages.ts +7 -0
- package/server/erudit/db/schema/problemScripts.ts +14 -0
- package/server/erudit/db/schema/sponsors.ts +9 -0
- package/server/erudit/db/schema/topics.ts +9 -0
- package/server/erudit/db/setup.ts +62 -0
- package/server/erudit/db/types.ts +10 -0
- package/server/erudit/global.ts +33 -0
- package/server/erudit/importer.ts +97 -0
- package/server/erudit/index.ts +90 -0
- package/server/erudit/language/list/en.ts +209 -0
- package/server/erudit/language/list/ru.ts +214 -0
- package/server/erudit/language/list.ts +6 -0
- package/server/erudit/language/setup.ts +36 -0
- package/server/erudit/language/types.ts +16 -0
- package/server/erudit/logger.ts +77 -0
- package/server/erudit/news/build.ts +77 -0
- package/server/erudit/news/repository/batch.ts +61 -0
- package/server/erudit/prose/repository/finalize.ts +68 -0
- package/server/erudit/prose/repository/get.ts +54 -0
- package/server/erudit/prose/repository/resolve.ts +17 -0
- package/server/erudit/prose/storage/callout.ts +14 -0
- package/server/erudit/prose/storage/image.ts +20 -0
- package/server/erudit/prose/storage/link.ts +226 -0
- package/server/erudit/prose/storage/problemScript.ts +21 -0
- package/server/erudit/prose/storage/video.ts +14 -0
- package/server/erudit/prose/transform/bundleProblemScript.ts +6 -0
- package/server/erudit/prose/transform/extensions.ts +15 -0
- package/server/erudit/quote/repository/ids.ts +31 -0
- package/server/erudit/repository.ts +96 -0
- package/server/erudit/sponsors/build.ts +114 -0
- package/server/erudit/sponsors/repository/avatarUrl.ts +10 -0
- package/server/erudit/sponsors/repository/count.ts +4 -0
- package/server/erudit/staticFile.ts +28 -0
- package/server/plugins/augmentCss.ts +17 -0
- package/server/plugins/lang.ts +7 -0
- package/server/plugins/metaViewport.ts +15 -0
- package/server/plugins/theme.ts +13 -0
- package/server/routes/file/[...path].ts +18 -0
- package/server/routes/robots.txt.ts +9 -0
- package/server/routes/search.json.gz.ts +73 -0
- package/server/routes/sitemap.xml.ts +81 -0
- package/shared/search/encoders.ts +20 -0
- package/shared/types/asideMajorPages.ts +4 -0
- package/shared/types/breadcrumbs.ts +9 -0
- package/shared/types/contentChildren.ts +10 -0
- package/shared/types/contentConnections.ts +27 -0
- package/shared/types/contentStats.ts +6 -0
- package/shared/types/elementSnippet.ts +8 -0
- package/shared/types/frontContentNav.ts +38 -0
- package/shared/types/indexPage.ts +20 -0
- package/shared/types/language.ts +189 -75
- package/shared/types/mainContent.ts +69 -0
- package/shared/types/news.ts +13 -0
- package/shared/types/preview.ts +28 -0
- package/shared/types/runtimeConfig.ts +64 -0
- package/shared/types/search.ts +79 -0
- package/shared/utils/contentTypePath.ts +63 -0
- package/shared/utils/icons.ts +11 -0
- package/shared/utils/pages.ts +24 -0
- package/shared/utils/slasher.ts +64 -0
- package/shared/utils/stringColor.ts +13 -9
- package/shared/utils/toStringEqual.ts +21 -0
- package/shared/utils/zip.ts +64 -0
- package/test/shared/utils/slasher.test.ts +75 -0
- package/test/shared/utils/zip.test.ts +8 -0
- package/tsconfig.json +17 -8
- package/app/assets/icons/alert.svg +0 -3
- package/app/assets/icons/angle-right.svg +0 -3
- package/app/assets/icons/arrow-in-text.svg +0 -3
- package/app/assets/icons/arrow-left.svg +0 -3
- package/app/assets/icons/arrow-up-to-right.svg +0 -3
- package/app/assets/icons/chip.svg +0 -3
- package/app/assets/icons/circle-help.svg +0 -3
- package/app/assets/icons/cross.svg +0 -3
- package/app/assets/icons/ellipsis-vertical.svg +0 -3
- package/app/assets/icons/file-check.svg +0 -3
- package/app/assets/icons/file-star.svg +0 -3
- package/app/assets/icons/link-external.svg +0 -3
- package/app/assets/icons/link.svg +0 -3
- package/app/assets/icons/outline/book.svg +0 -3
- package/app/assets/icons/outline/file-lines.svg +0 -3
- package/app/assets/icons/pirate.svg +0 -3
- package/app/assets/icons/search.svg +0 -3
- package/app/assets/icons/shuffle.svg +0 -3
- package/app/assets/icons/star.svg +0 -3
- package/app/components/Loading.vue +0 -23
- package/app/components/SiteAside.vue +0 -393
- package/app/components/SiteMain.vue +0 -34
- package/app/components/ads/BannerTemplate.vue +0 -51
- package/app/components/ads/BottomBanner.vue +0 -45
- package/app/components/ads/LeftBanner.vue +0 -50
- package/app/components/aside/major/PaneContentScroll.vue +0 -23
- package/app/components/aside/major/PaneSwitch.vue +0 -54
- package/app/components/aside/major/PaneSwitchButton.vue +0 -63
- package/app/components/aside/major/panes/Language.vue +0 -79
- package/app/components/aside/major/panes/Pages.vue +0 -34
- package/app/components/aside/major/panes/Search.vue +0 -11
- package/app/components/aside/major/panes/nav/Nav.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBook.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBookLoading.vue +0 -24
- package/app/components/aside/major/panes/nav/NavGlobal.vue +0 -16
- package/app/components/aside/major/panes/nav/fnav/FNav.vue +0 -105
- package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +0 -32
- package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +0 -40
- package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +0 -60
- package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +0 -34
- package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +0 -80
- package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +0 -24
- package/app/components/aside/major/panes/other/ItemContent.vue +0 -29
- package/app/components/aside/major/panes/other/ItemGenerator.vue +0 -15
- package/app/components/aside/major/panes/other/ItemTheme.vue +0 -54
- package/app/components/aside/major/panes/other/Other.vue +0 -16
- package/app/components/aside/minor/AsideMinorContributor.vue +0 -5
- package/app/components/aside/minor/AsideMinorNews.vue +0 -11
- package/app/components/aside/minor/AsideMinorTopLink.vue +0 -67
- package/app/components/aside/minor/Contribute.vue +0 -145
- package/app/components/aside/minor/content/AsideMinorContent.vue +0 -92
- package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -32
- package/app/components/aside/minor/topic/TopicContributors.vue +0 -177
- package/app/components/aside/minor/topic/TopicNav.vue +0 -49
- package/app/components/aside/minor/topic/TopicToc.vue +0 -219
- package/app/components/aside/minor/topic/TopicTocItem.vue +0 -30
- package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
- package/app/components/bitran/BitranContent.vue +0 -77
- package/app/components/bitran/RenderWrapper.vue +0 -10
- package/app/components/contributor/ContributorAvatar.vue +0 -43
- package/app/components/contributor/ContributorListItem.vue +0 -35
- package/app/components/main/topic/MainTopic.vue +0 -78
- package/app/components/main/topic/TopicPartSwitch.vue +0 -118
- package/app/components/main/utils/Breadcrumb.vue +0 -70
- package/app/components/main/utils/ContentDecoration.vue +0 -29
- package/app/components/main/utils/ContentDescription.vue +0 -19
- package/app/components/main/utils/ContentPopover.vue +0 -188
- package/app/components/main/utils/ContentPopovers.vue +0 -111
- package/app/components/main/utils/ContentReferences.vue +0 -70
- package/app/components/main/utils/ContentSection.vue +0 -45
- package/app/components/main/utils/ContentTitle.vue +0 -63
- package/app/components/main/utils/reference/ReferenceGroup.vue +0 -38
- package/app/components/main/utils/reference/ReferenceItem.vue +0 -68
- package/app/components/main/utils/reference/ReferenceSource.vue +0 -116
- package/app/components/preview/PreviewDisplay.vue +0 -139
- package/app/components/preview/PreviewFooterAction.vue +0 -73
- package/app/components/preview/display/Alert.vue +0 -50
- package/app/components/preview/display/Custom.vue +0 -18
- package/app/components/preview/display/GenericLink.vue +0 -48
- package/app/components/preview/display/PageLink.vue +0 -20
- package/app/components/preview/display/Unique.vue +0 -55
- package/app/composables/bitran.ts +0 -105
- package/app/composables/bitranContent.ts +0 -51
- package/app/composables/bitranLocation.ts +0 -7
- package/app/composables/contentData.ts +0 -36
- package/app/composables/contentPage.ts +0 -157
- package/app/composables/contentRoute.ts +0 -45
- package/app/composables/darkMagic.ts +0 -24
- package/app/composables/externalApi.ts +0 -63
- package/app/composables/majorPane.ts +0 -60
- package/app/pages/_test/preview.vue +0 -110
- package/app/pages/members.vue +0 -6
- package/app/pages/practice/[...practice].vue +0 -3
- package/app/public/favicon/article.svg +0 -10
- package/app/public/favicon/default.svg +0 -10
- package/app/public/favicon/practice.svg +0 -10
- package/app/public/favicon/summary.svg +0 -10
- package/app/public/og-default.png +0 -0
- package/app/public/user.svg +0 -10
- package/app/scripts/_immediate.js +0 -9
- package/app/scripts/aside/index.ts +0 -59
- package/app/scripts/aside/major/nav.ts +0 -26
- package/app/scripts/aside/minor/state.ts +0 -37
- package/app/scripts/aside/minor/topic.ts +0 -3
- package/app/scripts/flag.ts +0 -28
- package/app/scripts/og.ts +0 -27
- package/app/scripts/preview/build.ts +0 -73
- package/app/scripts/preview/data/alert.ts +0 -19
- package/app/scripts/preview/data/custom.ts +0 -8
- package/app/scripts/preview/data/genericLink.ts +0 -24
- package/app/scripts/preview/data/pageLink.ts +0 -22
- package/app/scripts/preview/data/unique.ts +0 -72
- package/app/scripts/preview/data.ts +0 -24
- package/app/scripts/preview/display.ts +0 -37
- package/app/scripts/preview/footer.ts +0 -9
- package/app/scripts/preview/request.ts +0 -51
- package/app/scripts/preview/state.ts +0 -63
- package/app/styles/_immediate.css +0 -7
- package/app/styles/_util.scss +0 -43
- package/app/styles/_utils.scss +0 -44
- package/app/styles/app.scss +0 -91
- package/app/styles/def/_bp.scss +0 -27
- package/app/styles/def/_size.scss +0 -7
- package/app/styles/def/_z.scss +0 -5
- package/app/styles/normalize.scss +0 -63
- package/app/styles/partials/_darkMagic.scss +0 -5
- package/app/styles/partials/_fnav.scss +0 -15
- package/app/styles/partials/_preview.scss +0 -5
- package/globalPath.ts +0 -21
- package/globals/bitran.ts +0 -2
- package/globals/content.ts +0 -22
- package/globals/contributor.ts +0 -5
- package/globals/erudit.ts +0 -5
- package/globals/register.ts +0 -18
- package/languages/en.ts +0 -95
- package/languages/ru.ts +0 -99
- package/module/bitran.ts +0 -36
- package/module/config.ts +0 -35
- package/module/imports.ts +0 -50
- package/module/index.ts +0 -47
- package/module/paths.ts +0 -22
- package/module/restart.ts +0 -61
- package/server/api/aside/major/nav/bookIds.ts +0 -5
- package/server/api/aside/major/nav/bookNav/[...bookId].ts +0 -20
- package/server/api/aside/major/nav/global.ts +0 -7
- package/server/api/aside/minor/news.ts +0 -7
- package/server/api/aside/minor/path.ts +0 -77
- package/server/api/bitran/content/[location].ts +0 -8
- package/server/api/bitran/toc/[location].ts +0 -7
- package/server/api/content/data.ts +0 -72
- package/server/api/contributor/count.ts +0 -6
- package/server/api/fake/content.ts +0 -11
- package/server/api/fake/shared/languages.ts +0 -12
- package/server/api/language/phrase/[phraseId].ts +0 -19
- package/server/api/language/phraseIds.ts +0 -8
- package/server/api/preview/page/[...parts].ts +0 -52
- package/server/api/preview/unique/[location].ts +0 -60
- package/server/plugin/bitran/content.ts +0 -194
- package/server/plugin/bitran/location.ts +0 -25
- package/server/plugin/bitran/products/include.ts +0 -228
- package/server/plugin/bitran/products/link.ts +0 -116
- package/server/plugin/bitran/setup.ts +0 -11
- package/server/plugin/bitran/toc.ts +0 -75
- package/server/plugin/bitran/transpiler.ts +0 -30
- package/server/plugin/build/close.ts +0 -10
- package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
- package/server/plugin/build/jobs/content/generic.ts +0 -176
- package/server/plugin/build/jobs/content/parse.ts +0 -109
- package/server/plugin/build/jobs/content/path.ts +0 -6
- package/server/plugin/build/jobs/content/type/book.ts +0 -9
- package/server/plugin/build/jobs/content/type/group.ts +0 -37
- package/server/plugin/build/jobs/content/type/topic.ts +0 -36
- package/server/plugin/build/jobs/contributors.ts +0 -66
- package/server/plugin/build/jobs/language.ts +0 -36
- package/server/plugin/build/jobs/nav.ts +0 -214
- package/server/plugin/build/process.ts +0 -25
- package/server/plugin/build/rebuild.ts +0 -55
- package/server/plugin/build/setup.ts +0 -22
- package/server/plugin/content/absoluteId.ts +0 -94
- package/server/plugin/content/context.ts +0 -116
- package/server/plugin/db/entities/Book.ts +0 -7
- package/server/plugin/db/entities/Content.ts +0 -49
- package/server/plugin/db/entities/Contribution.ts +0 -10
- package/server/plugin/db/entities/Contributor.ts +0 -16
- package/server/plugin/db/entities/Group.ts +0 -14
- package/server/plugin/db/entities/Hash.ts +0 -15
- package/server/plugin/db/entities/Topic.ts +0 -20
- package/server/plugin/db/entities/Unique.ts +0 -21
- package/server/plugin/db/setup.ts +0 -34
- package/server/plugin/global.ts +0 -17
- package/server/plugin/importer.ts +0 -12
- package/server/plugin/index.ts +0 -9
- package/server/plugin/logger.ts +0 -23
- package/server/plugin/nav/node.ts +0 -26
- package/server/plugin/nav/utils.ts +0 -129
- package/server/plugin/repository/book.ts +0 -21
- package/server/plugin/repository/content.ts +0 -238
- package/server/plugin/repository/contributor.ts +0 -8
- package/server/plugin/repository/frontNav.ts +0 -148
- package/server/plugin/repository/topic.ts +0 -32
- package/server/tsconfig.json +0 -9
- package/shared/aside/minor.ts +0 -51
- package/shared/asset.ts +0 -15
- package/shared/bitran/stringContent.ts +0 -6
- package/shared/bitran/toc.ts +0 -8
- package/shared/content/context.ts +0 -9
- package/shared/content/data/base.ts +0 -32
- package/shared/content/data/index.ts +0 -5
- package/shared/content/data/type/book.ts +0 -5
- package/shared/content/data/type/group.ts +0 -6
- package/shared/content/data/type/topic.ts +0 -11
- package/shared/content/previousNext.ts +0 -9
- package/shared/contributor.ts +0 -5
- package/shared/frontNav.ts +0 -41
- package/shared/icons.ts +0 -38
- package/shared/image.ts +0 -5
- package/shared/link.ts +0 -28
- package/shared/popover.ts +0 -8
- package/shared/utils/objectsEqual.ts +0 -4
- package/utils/stress.ts +0 -9
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { globSync } from 'glob';
|
|
2
|
+
import { isContentItem, type ContentItem } from '@erudit-js/core/content/item';
|
|
3
|
+
import {
|
|
4
|
+
getGlobalContentPath,
|
|
5
|
+
type GlobalContentItem,
|
|
6
|
+
} from '@erudit-js/core/content/global';
|
|
7
|
+
|
|
8
|
+
import type { ContentNavNode } from '../../nav/types';
|
|
9
|
+
import type { TopicContentItem } from '@erudit-js/core/content/topic';
|
|
10
|
+
import type { PageContentItem } from '@erudit-js/core/content/page';
|
|
11
|
+
|
|
12
|
+
export async function insertContentItem(
|
|
13
|
+
navNode: ContentNavNode,
|
|
14
|
+
contentItem: ContentItem,
|
|
15
|
+
) {
|
|
16
|
+
if (
|
|
17
|
+
isContentItem<TopicContentItem>(contentItem, 'topic') ||
|
|
18
|
+
isContentItem<PageContentItem>(contentItem, 'page')
|
|
19
|
+
) {
|
|
20
|
+
await resolveContributions(navNode.fullId, contentItem);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const decorationExtension = await resolveDecorationExtension(navNode);
|
|
24
|
+
await resolveHardDependencies(navNode.fullId, contentItem);
|
|
25
|
+
|
|
26
|
+
await ERUDIT.db.insert(ERUDIT.db.schema.content).values({
|
|
27
|
+
fullId: navNode.fullId,
|
|
28
|
+
type: navNode.type,
|
|
29
|
+
title: contentItem.title || navNode.fullId.split('/').pop()!,
|
|
30
|
+
navTitle: contentItem.navTitle,
|
|
31
|
+
description: contentItem.description,
|
|
32
|
+
hidden: Boolean(contentItem.hidden) || false,
|
|
33
|
+
flags: contentItem.flags,
|
|
34
|
+
decorationExtension,
|
|
35
|
+
externals: contentItem.externals,
|
|
36
|
+
seo: contentItem.seo,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function resolveContributions(
|
|
41
|
+
fullId: string,
|
|
42
|
+
contentItem: TopicContentItem | PageContentItem,
|
|
43
|
+
) {
|
|
44
|
+
if (contentItem.contributions) {
|
|
45
|
+
const seenContributors = new Set<string>();
|
|
46
|
+
|
|
47
|
+
for (const contribution of contentItem.contributions as any) {
|
|
48
|
+
const contributorId: string =
|
|
49
|
+
typeof contribution === 'string'
|
|
50
|
+
? contribution
|
|
51
|
+
: contribution.contributor;
|
|
52
|
+
|
|
53
|
+
const description: string | undefined =
|
|
54
|
+
typeof contribution === 'string'
|
|
55
|
+
? undefined
|
|
56
|
+
: contribution.description;
|
|
57
|
+
|
|
58
|
+
if (seenContributors.has(contributorId)) {
|
|
59
|
+
ERUDIT.log.warn(
|
|
60
|
+
`Duplicate contributor "${contributorId}" in content item "${fullId}"!`,
|
|
61
|
+
);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
seenContributors.add(contributorId);
|
|
66
|
+
|
|
67
|
+
await ERUDIT.db
|
|
68
|
+
.insert(ERUDIT.db.schema.contentContributions)
|
|
69
|
+
.values({
|
|
70
|
+
contentFullId: fullId,
|
|
71
|
+
contributorId,
|
|
72
|
+
description,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function resolveHardDependencies(
|
|
79
|
+
fullId: string,
|
|
80
|
+
contentItem: ContentItem,
|
|
81
|
+
) {
|
|
82
|
+
if (contentItem.dependencies) {
|
|
83
|
+
for (const dependency of contentItem.dependencies) {
|
|
84
|
+
await ERUDIT.db.insert(ERUDIT.db.schema.contentDeps).values({
|
|
85
|
+
fromFullId: getGlobalContentPath(
|
|
86
|
+
dependency.dependency as any as GlobalContentItem,
|
|
87
|
+
),
|
|
88
|
+
toFullId: fullId,
|
|
89
|
+
hard: true,
|
|
90
|
+
reason: dependency.reason,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function resolveDecorationExtension(navNode: ContentNavNode) {
|
|
97
|
+
const decorationExtension = globSync(
|
|
98
|
+
ERUDIT.config.paths.project +
|
|
99
|
+
'/content/' +
|
|
100
|
+
navNode.contentRelPath +
|
|
101
|
+
'/decoration.*',
|
|
102
|
+
{
|
|
103
|
+
posix: true,
|
|
104
|
+
},
|
|
105
|
+
)
|
|
106
|
+
.shift()
|
|
107
|
+
?.split('.')
|
|
108
|
+
?.pop();
|
|
109
|
+
|
|
110
|
+
if (decorationExtension) {
|
|
111
|
+
await ERUDIT.repository.db.pushFile(
|
|
112
|
+
ERUDIT.config.paths.project +
|
|
113
|
+
'/content/' +
|
|
114
|
+
navNode.contentRelPath +
|
|
115
|
+
'/decoration.' +
|
|
116
|
+
decorationExtension,
|
|
117
|
+
'content-decoration:' + navNode.fullId,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return decorationExtension;
|
|
122
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type ResolvedRawElement } from '@jsprose/core';
|
|
2
|
+
import type { ContentProseType } from '@erudit-js/core/content/prose';
|
|
3
|
+
import type { ResolvedEruditRawElement } from '@erudit-js/prose';
|
|
4
|
+
|
|
5
|
+
export async function insertContentResolved(
|
|
6
|
+
contentFullId: string,
|
|
7
|
+
contentProseType: ContentProseType,
|
|
8
|
+
resolveResult: ResolvedRawElement & ResolvedEruditRawElement,
|
|
9
|
+
) {
|
|
10
|
+
for (const file of resolveResult.files) {
|
|
11
|
+
await ERUDIT.repository.db.pushFile(
|
|
12
|
+
file,
|
|
13
|
+
`content-item:${contentFullId}`,
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
for (const [uniqueName, unique] of Object.entries(resolveResult.uniques)) {
|
|
18
|
+
await ERUDIT.db.insert(ERUDIT.db.schema.contentUniques).values({
|
|
19
|
+
contentFullId,
|
|
20
|
+
contentProseType,
|
|
21
|
+
uniqueName,
|
|
22
|
+
title: resolveResult.uniqueTitles[uniqueName],
|
|
23
|
+
prose: unique,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
for (const snippet of resolveResult.snippets) {
|
|
28
|
+
await ERUDIT.db.insert(ERUDIT.db.schema.contentSnippets).values({
|
|
29
|
+
contentFullId,
|
|
30
|
+
contentProseType,
|
|
31
|
+
elementId: snippet.elementId,
|
|
32
|
+
schemaName: snippet.schemaName,
|
|
33
|
+
title: snippet.title!,
|
|
34
|
+
description: snippet.description,
|
|
35
|
+
search: Boolean(snippet.search),
|
|
36
|
+
searchSynonyms:
|
|
37
|
+
typeof snippet.search === 'object'
|
|
38
|
+
? snippet.search.synonyms
|
|
39
|
+
: undefined,
|
|
40
|
+
quick: Boolean(snippet.quick),
|
|
41
|
+
seo: Boolean(snippet.seo),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const problemScript of resolveResult.problemScripts) {
|
|
46
|
+
await ERUDIT.repository.db.pushProblemScript(
|
|
47
|
+
problemScript,
|
|
48
|
+
contentFullId,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fromFullIds = new Set(
|
|
53
|
+
Array.from(resolveResult.dependencies)
|
|
54
|
+
.map((dependency) => {
|
|
55
|
+
if (dependency.startsWith('<link:')) {
|
|
56
|
+
const navNode = globalContentToNavNode(
|
|
57
|
+
dependency.replace(/^<link:.+>\//, ''),
|
|
58
|
+
);
|
|
59
|
+
return navNode.fullId;
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
.filter((id): id is string => id !== undefined),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const contentDeps = Array.from(fromFullIds)
|
|
66
|
+
.filter((fromFullId) => fromFullId !== contentFullId)
|
|
67
|
+
.map((fromFullId) => ({
|
|
68
|
+
fromFullId,
|
|
69
|
+
toFullId: contentFullId,
|
|
70
|
+
hard: false,
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
if (contentDeps.length > 0) {
|
|
74
|
+
await ERUDIT.db
|
|
75
|
+
.insert(ERUDIT.db.schema.contentDeps)
|
|
76
|
+
.values(contentDeps)
|
|
77
|
+
.onConflictDoNothing();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function globalContentToNavNode(globalContentPath: string) {
|
|
82
|
+
const parts = globalContentPath.split('/');
|
|
83
|
+
|
|
84
|
+
if (parts.at(-1)?.startsWith('$')) {
|
|
85
|
+
parts.pop();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const navNode =
|
|
89
|
+
ERUDIT.contentNav.getNode(parts.join('/')) ??
|
|
90
|
+
ERUDIT.contentNav.getNodeOrThrow(parts.slice(0, -1).join('/'));
|
|
91
|
+
|
|
92
|
+
return navNode;
|
|
93
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import { contentTypes } from '@erudit-js/core/content/type';
|
|
3
|
+
import { headingSchema } from '@erudit-js/prose/elements/heading/core';
|
|
4
|
+
import type { TopicPart } from '@erudit-js/core/content/topic';
|
|
5
|
+
|
|
6
|
+
export async function searchIndexContentTypes(): Promise<SearchEntriesList[]> {
|
|
7
|
+
const entryLists: SearchEntriesList[] = [];
|
|
8
|
+
|
|
9
|
+
for (const contentType of contentTypes) {
|
|
10
|
+
const dbContentItems = await ERUDIT.db.query.content.findMany({
|
|
11
|
+
columns: {
|
|
12
|
+
fullId: true,
|
|
13
|
+
title: true,
|
|
14
|
+
description: true,
|
|
15
|
+
type: true,
|
|
16
|
+
},
|
|
17
|
+
where: (fields) => eq(fields.type, contentType),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
entryLists.push({
|
|
21
|
+
category: {
|
|
22
|
+
id: contentType,
|
|
23
|
+
priority: 200,
|
|
24
|
+
},
|
|
25
|
+
entries: await Promise.all(
|
|
26
|
+
dbContentItems.map(async (dbContentItem) => {
|
|
27
|
+
const bookTitle: string | undefined = await (async () => {
|
|
28
|
+
if (dbContentItem.type === 'book') {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const itemBook = ERUDIT.contentNav.getBookFor(
|
|
33
|
+
dbContentItem.fullId,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (itemBook) {
|
|
37
|
+
const bookId = itemBook.fullId;
|
|
38
|
+
const dbBook =
|
|
39
|
+
await ERUDIT.db.query.content.findFirst({
|
|
40
|
+
columns: { title: true },
|
|
41
|
+
where: eq(
|
|
42
|
+
ERUDIT.db.schema.content.fullId,
|
|
43
|
+
bookId,
|
|
44
|
+
),
|
|
45
|
+
});
|
|
46
|
+
return dbBook?.title;
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
category: contentType,
|
|
52
|
+
title: dbContentItem.title,
|
|
53
|
+
description: dbContentItem.description || undefined,
|
|
54
|
+
link: await ERUDIT.repository.content.link(
|
|
55
|
+
dbContentItem.fullId,
|
|
56
|
+
),
|
|
57
|
+
location: bookTitle,
|
|
58
|
+
} satisfies SearchEntry;
|
|
59
|
+
}),
|
|
60
|
+
),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return entryLists;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function searchIndexSnippets(): Promise<SearchEntriesList[]> {
|
|
68
|
+
const entryLists: Map<string, SearchEntriesList> = new Map();
|
|
69
|
+
|
|
70
|
+
const dbSnippets = await ERUDIT.db.query.contentSnippets.findMany({
|
|
71
|
+
where: eq(ERUDIT.db.schema.contentSnippets.search, true),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
for (const dbSnippet of dbSnippets) {
|
|
75
|
+
if (!entryLists.has(dbSnippet.schemaName)) {
|
|
76
|
+
entryLists.set(dbSnippet.schemaName, {
|
|
77
|
+
category: {
|
|
78
|
+
id: 'element:' + dbSnippet.schemaName,
|
|
79
|
+
priority:
|
|
80
|
+
dbSnippet.schemaName === headingSchema.name ? 325 : 350,
|
|
81
|
+
},
|
|
82
|
+
entries: [],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(
|
|
87
|
+
dbSnippet.contentFullId,
|
|
88
|
+
);
|
|
89
|
+
let link: string;
|
|
90
|
+
|
|
91
|
+
const locationTitle = await (async () => {
|
|
92
|
+
const dbContentItem = await ERUDIT.db.query.content.findFirst({
|
|
93
|
+
columns: { title: true },
|
|
94
|
+
where: eq(
|
|
95
|
+
ERUDIT.db.schema.content.fullId,
|
|
96
|
+
dbSnippet.contentFullId,
|
|
97
|
+
),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return dbContentItem?.title;
|
|
101
|
+
})();
|
|
102
|
+
|
|
103
|
+
switch (navNode.type) {
|
|
104
|
+
case 'page':
|
|
105
|
+
link = PAGES[navNode.type](
|
|
106
|
+
navNode.shortId,
|
|
107
|
+
dbSnippet.elementId,
|
|
108
|
+
);
|
|
109
|
+
break;
|
|
110
|
+
case 'topic':
|
|
111
|
+
link = PAGES['topic'](
|
|
112
|
+
dbSnippet.contentProseType as TopicPart,
|
|
113
|
+
navNode.shortId,
|
|
114
|
+
dbSnippet.elementId,
|
|
115
|
+
);
|
|
116
|
+
break;
|
|
117
|
+
default:
|
|
118
|
+
throw createError({
|
|
119
|
+
statusCode: 500,
|
|
120
|
+
statusMessage: `Cannot create search snippet link for content type "${navNode.type}"!`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
entryLists.get(dbSnippet.schemaName)!.entries.push({
|
|
125
|
+
category: 'element:' + dbSnippet.schemaName,
|
|
126
|
+
title: dbSnippet.title,
|
|
127
|
+
description: dbSnippet.description || undefined,
|
|
128
|
+
link,
|
|
129
|
+
location: locationTitle,
|
|
130
|
+
synonyms: dbSnippet.searchSynonyms || undefined,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return Array.from(entryLists.values());
|
|
135
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { readdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { like } from 'drizzle-orm';
|
|
3
|
+
import { globSync } from 'glob';
|
|
4
|
+
import { isRawElement, type AnySchema, type ProseElement } from '@jsprose/core';
|
|
5
|
+
import {
|
|
6
|
+
globalContributorsObject,
|
|
7
|
+
globalContributorsTypes,
|
|
8
|
+
type ContributorDefinition,
|
|
9
|
+
} from '@erudit-js/core/contributor';
|
|
10
|
+
|
|
11
|
+
// Trigger globalThis update
|
|
12
|
+
$CONTRIBUTOR;
|
|
13
|
+
|
|
14
|
+
export async function buildContributors() {
|
|
15
|
+
if (!ERUDIT.config.public.project.contributors?.enabled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
ERUDIT.log.debug.start('Building contributors...');
|
|
20
|
+
|
|
21
|
+
await ERUDIT.db.delete(ERUDIT.db.schema.contributors);
|
|
22
|
+
await ERUDIT.db
|
|
23
|
+
.delete(ERUDIT.db.schema.files)
|
|
24
|
+
.where(like(ERUDIT.db.schema.files.role, 'contributor:%'));
|
|
25
|
+
|
|
26
|
+
const contributorIds = globSync(
|
|
27
|
+
`${ERUDIT.config.paths.project}/contributors/*/`,
|
|
28
|
+
{ posix: true },
|
|
29
|
+
).map((dirPath) => dirPath.split('/').pop() as string);
|
|
30
|
+
|
|
31
|
+
for (const key in $CONTRIBUTOR) {
|
|
32
|
+
delete $CONTRIBUTOR[key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Object.assign($CONTRIBUTOR, globalContributorsObject(contributorIds));
|
|
36
|
+
|
|
37
|
+
writeFileSync(
|
|
38
|
+
`${ERUDIT.config.paths.build}/types/contributors.d.ts`,
|
|
39
|
+
globalContributorsTypes($CONTRIBUTOR),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
for (const contributorId of contributorIds) {
|
|
43
|
+
await buildContributor(contributorId);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ERUDIT.log.success(
|
|
47
|
+
`Contributors build complete! (${ERUDIT.log.stress(contributorIds.length)})`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function buildContributor(contributorId: string) {
|
|
52
|
+
ERUDIT.log.debug.start(
|
|
53
|
+
`Building contributor ${ERUDIT.log.stress(contributorId)}...`,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const directory = `${ERUDIT.config.paths.project}/contributors/${contributorId}`;
|
|
57
|
+
const files = readdirSync(directory);
|
|
58
|
+
|
|
59
|
+
const avatarExtension = files
|
|
60
|
+
.find((file) => file.startsWith('avatar.'))
|
|
61
|
+
?.split('.')
|
|
62
|
+
.pop();
|
|
63
|
+
|
|
64
|
+
if (avatarExtension) {
|
|
65
|
+
await ERUDIT.repository.db.pushFile(
|
|
66
|
+
`${directory}/avatar.${avatarExtension}`,
|
|
67
|
+
`contributor:${contributorId}`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let moduleDefault: ContributorDefinition | undefined;
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
moduleDefault = await ERUDIT.import(`${directory}/contributor`);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (!String(error).includes('Cannot find module')) {
|
|
77
|
+
ERUDIT.log.error(
|
|
78
|
+
`Failed to load contributor ${ERUDIT.log.stress(contributorId)} module:\n`,
|
|
79
|
+
);
|
|
80
|
+
console.log(error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let description: ProseElement<AnySchema> | undefined;
|
|
85
|
+
|
|
86
|
+
if (isRawElement(moduleDefault?.description)) {
|
|
87
|
+
const resolveResult = await ERUDIT.repository.prose.resolve(
|
|
88
|
+
moduleDefault.description,
|
|
89
|
+
false,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
for (const file of resolveResult.files) {
|
|
93
|
+
await ERUDIT.repository.db.pushFile(
|
|
94
|
+
file,
|
|
95
|
+
`contributor:${contributorId}`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
description = resolveResult.proseElement;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
await ERUDIT.db.insert(ERUDIT.db.schema.contributors).values({
|
|
103
|
+
contributorId,
|
|
104
|
+
avatarExtension,
|
|
105
|
+
displayName: moduleDefault?.displayName,
|
|
106
|
+
short: moduleDefault?.short,
|
|
107
|
+
links: moduleDefault?.links,
|
|
108
|
+
editor: moduleDefault?.editor,
|
|
109
|
+
description: description,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function getContributorAvatarUrl(
|
|
2
|
+
contributorId: string,
|
|
3
|
+
avatarExtension: string | undefined,
|
|
4
|
+
): string | undefined {
|
|
5
|
+
if (!avatarExtension) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return '/file/contributors/' + contributorId + '/avatar.' + avatarExtension;
|
|
10
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { eq, count } from 'drizzle-orm';
|
|
2
|
+
import type {
|
|
3
|
+
ContentContribution,
|
|
4
|
+
ContributorContribution,
|
|
5
|
+
} from '@erudit-js/core/content/contributions';
|
|
6
|
+
|
|
7
|
+
export async function countContributions(
|
|
8
|
+
contributorId: string,
|
|
9
|
+
): Promise<number> {
|
|
10
|
+
const result = await ERUDIT.db
|
|
11
|
+
.select({ count: count() })
|
|
12
|
+
.from(ERUDIT.db.schema.contentContributions)
|
|
13
|
+
.where(
|
|
14
|
+
eq(
|
|
15
|
+
ERUDIT.db.schema.contentContributions.contributorId,
|
|
16
|
+
contributorId,
|
|
17
|
+
),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return result[0].count;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function getContributorContributions(
|
|
24
|
+
contributorId: string,
|
|
25
|
+
): Promise<ContributorContribution[] | undefined> {
|
|
26
|
+
const contributions: ContributorContribution[] = [];
|
|
27
|
+
|
|
28
|
+
const dbContributions = await ERUDIT.db.query.contentContributions.findMany(
|
|
29
|
+
{
|
|
30
|
+
columns: { contentFullId: true },
|
|
31
|
+
where: eq(
|
|
32
|
+
ERUDIT.db.schema.contentContributions.contributorId,
|
|
33
|
+
contributorId,
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const contentFullIds = ERUDIT.contentNav.orderIds(
|
|
39
|
+
dbContributions.map((c) => c.contentFullId),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const seenBookTitles = new Set<string>();
|
|
43
|
+
let currentBookId: string | undefined;
|
|
44
|
+
|
|
45
|
+
for (const contentFullId of contentFullIds) {
|
|
46
|
+
const currentNode = ERUDIT.contentNav.getNodeOrThrow(contentFullId);
|
|
47
|
+
const title = await ERUDIT.repository.content.title(
|
|
48
|
+
contentFullId,
|
|
49
|
+
'normal',
|
|
50
|
+
);
|
|
51
|
+
const link = await ERUDIT.repository.content.link(contentFullId);
|
|
52
|
+
const book = ERUDIT.contentNav.getBookFor(contentFullId);
|
|
53
|
+
|
|
54
|
+
const contributionItem = {
|
|
55
|
+
type: currentNode.type as 'topic' | 'page',
|
|
56
|
+
title,
|
|
57
|
+
link,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (book && book.fullId === currentBookId) {
|
|
61
|
+
// Add to existing book group
|
|
62
|
+
const lastContribution = contributions.at(-1);
|
|
63
|
+
if (lastContribution && lastContribution.type === 'book') {
|
|
64
|
+
lastContribution.items.push(contributionItem);
|
|
65
|
+
}
|
|
66
|
+
} else if (book) {
|
|
67
|
+
// Start a new book group
|
|
68
|
+
|
|
69
|
+
currentBookId = book.fullId;
|
|
70
|
+
const bookNode = ERUDIT.contentNav.getNodeOrThrow(book.fullId);
|
|
71
|
+
|
|
72
|
+
const baseBookTitle = await ERUDIT.repository.content.title(
|
|
73
|
+
book.fullId,
|
|
74
|
+
'normal',
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
let bookTitle = baseBookTitle;
|
|
78
|
+
|
|
79
|
+
// Only include parent title if we've already seen a book with this title
|
|
80
|
+
if (seenBookTitles.has(baseBookTitle) && bookNode.parent) {
|
|
81
|
+
const parentTitle = await ERUDIT.repository.content.title(
|
|
82
|
+
bookNode.parent.fullId,
|
|
83
|
+
'normal',
|
|
84
|
+
);
|
|
85
|
+
bookTitle = `${parentTitle} / ${baseBookTitle}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Track this title for future duplicates
|
|
89
|
+
seenBookTitles.add(baseBookTitle);
|
|
90
|
+
|
|
91
|
+
contributions.push({
|
|
92
|
+
type: 'book',
|
|
93
|
+
title: bookTitle,
|
|
94
|
+
items: [contributionItem],
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
// Standalone contribution (not part of a book)
|
|
98
|
+
currentBookId = undefined;
|
|
99
|
+
contributions.push(contributionItem);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return contributions.length > 0 ? contributions : undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export async function getContentContributions(
|
|
107
|
+
contentFullId: string,
|
|
108
|
+
withDescription: boolean,
|
|
109
|
+
): Promise<ContentContribution[] | undefined> {
|
|
110
|
+
const contributions: ContentContribution[] = [];
|
|
111
|
+
const seenContributors = new Set<string>();
|
|
112
|
+
|
|
113
|
+
const dbContributions = await ERUDIT.db.query.contentContributions.findMany(
|
|
114
|
+
{
|
|
115
|
+
columns: {
|
|
116
|
+
contributorId: true,
|
|
117
|
+
description: true,
|
|
118
|
+
contentFullId: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const relevantContributions = dbContributions.filter(
|
|
124
|
+
(dbContribution) =>
|
|
125
|
+
dbContribution.contentFullId === contentFullId ||
|
|
126
|
+
dbContribution.contentFullId.startsWith(`${contentFullId}/`),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
for (const dbContribution of relevantContributions) {
|
|
130
|
+
if (seenContributors.has(dbContribution.contributorId)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
seenContributors.add(dbContribution.contributorId);
|
|
135
|
+
|
|
136
|
+
const dbContributor = await ERUDIT.db.query.contributors.findFirst({
|
|
137
|
+
columns: {
|
|
138
|
+
displayName: true,
|
|
139
|
+
avatarExtension: true,
|
|
140
|
+
},
|
|
141
|
+
where: eq(
|
|
142
|
+
ERUDIT.db.schema.contributors.contributorId,
|
|
143
|
+
dbContribution.contributorId,
|
|
144
|
+
),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const name = dbContributor?.displayName || dbContribution.contributorId;
|
|
148
|
+
|
|
149
|
+
const avatarUrl = ERUDIT.repository.contributors.avatarUrl(
|
|
150
|
+
dbContribution.contributorId,
|
|
151
|
+
dbContributor?.avatarExtension || undefined,
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const description = withDescription
|
|
155
|
+
? dbContribution.description || undefined
|
|
156
|
+
: undefined;
|
|
157
|
+
|
|
158
|
+
const contribution: ContentContribution = {
|
|
159
|
+
contributorId: dbContribution.contributorId,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
if (name) {
|
|
163
|
+
contribution.name = name;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (avatarUrl) {
|
|
167
|
+
contribution.avatarUrl = avatarUrl;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (description) {
|
|
171
|
+
contribution.description = description;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
contributions.push(contribution);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return contributions.length > 0 ? contributions : undefined;
|
|
178
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const searchCategoryContributors: SearchEntryCategory = {
|
|
2
|
+
id: 'contributors',
|
|
3
|
+
priority: 100,
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export async function searchIndexContributors(): Promise<SearchEntriesList> {
|
|
7
|
+
const dbContributors = await ERUDIT.db.query.contributors.findMany({
|
|
8
|
+
columns: {
|
|
9
|
+
contributorId: true,
|
|
10
|
+
displayName: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
category: searchCategoryContributors,
|
|
16
|
+
entries: dbContributors.map((dbContributor) => {
|
|
17
|
+
const entry: SearchEntry = {
|
|
18
|
+
category: searchCategoryContributors.id,
|
|
19
|
+
title: dbContributor.displayName || dbContributor.contributorId,
|
|
20
|
+
link: PAGES.contributor(dbContributor.contributorId),
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const hasDisplayName = !!dbContributor.displayName;
|
|
24
|
+
const displaySameAsId =
|
|
25
|
+
dbContributor.displayName === dbContributor.contributorId;
|
|
26
|
+
|
|
27
|
+
if (hasDisplayName && !displaySameAsId) {
|
|
28
|
+
entry.synonyms = [dbContributor.contributorId];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return entry;
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|