erudit 3.0.0-dev.9 → 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,35 @@
|
|
|
1
|
+
import type { ContentNavNode } from '../types';
|
|
2
|
+
|
|
3
|
+
export function getPreviousNext(node: ContentNavNode) {
|
|
4
|
+
const currentFullId = node.fullId;
|
|
5
|
+
|
|
6
|
+
let previous: ContentNavNode | undefined;
|
|
7
|
+
let next: ContentNavNode | undefined;
|
|
8
|
+
let currentFound = false;
|
|
9
|
+
|
|
10
|
+
for (const navNode of ERUDIT.contentNav.id2Node.values()) {
|
|
11
|
+
if (currentFound) {
|
|
12
|
+
next = navNode;
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (navNode.fullId === currentFullId) {
|
|
17
|
+
currentFound = true;
|
|
18
|
+
} else {
|
|
19
|
+
previous = navNode;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// If current inside book then next can't point outside of book
|
|
24
|
+
if (next) {
|
|
25
|
+
const currentBook = ERUDIT.contentNav.getBookFor(node);
|
|
26
|
+
if (currentBook) {
|
|
27
|
+
const nextBook = ERUDIT.contentNav.getBookFor(next);
|
|
28
|
+
if (!nextBook || nextBook.fullId !== currentBook.fullId) {
|
|
29
|
+
next = undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return { previous, next };
|
|
35
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { ContentNavNode } from '../types';
|
|
2
|
+
|
|
3
|
+
export enum WalkStop {
|
|
4
|
+
NoDeeper,
|
|
5
|
+
Exit,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type WalkStepReturnSync = void | WalkStop;
|
|
9
|
+
type WalkStepReturn = WalkStepReturnSync | Promise<WalkStepReturnSync>;
|
|
10
|
+
|
|
11
|
+
function shouldExit(result: WalkStepReturnSync): boolean {
|
|
12
|
+
return result === WalkStop.Exit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function shouldSkipChildren(result: WalkStepReturnSync): boolean {
|
|
16
|
+
return result === WalkStop.NoDeeper;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getRoots() {
|
|
20
|
+
return ERUDIT.contentNav.id2Root.values();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function hasChildren(node: ContentNavNode): boolean {
|
|
24
|
+
return ERUDIT.contentNav.hasChildren(node);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function walkSync(
|
|
28
|
+
step: (node: ContentNavNode) => WalkStepReturnSync,
|
|
29
|
+
from?: ContentNavNode,
|
|
30
|
+
) {
|
|
31
|
+
function _walk(node: ContentNavNode): boolean {
|
|
32
|
+
const stepResult = step(node);
|
|
33
|
+
|
|
34
|
+
if (shouldExit(stepResult)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!shouldSkipChildren(stepResult) && hasChildren(node)) {
|
|
39
|
+
for (const child of node.children!) {
|
|
40
|
+
if (_walk(child)) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!from) {
|
|
50
|
+
for (const root of getRoots()) {
|
|
51
|
+
if (_walk(root)) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
_walk(from);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function walk(
|
|
62
|
+
step: (node: ContentNavNode) => WalkStepReturn,
|
|
63
|
+
from?: ContentNavNode,
|
|
64
|
+
) {
|
|
65
|
+
async function _walk(node: ContentNavNode): Promise<boolean> {
|
|
66
|
+
const stepResult = await step(node);
|
|
67
|
+
|
|
68
|
+
if (shouldExit(stepResult)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!shouldSkipChildren(stepResult) && hasChildren(node)) {
|
|
73
|
+
for (const child of node.children!) {
|
|
74
|
+
if (await _walk(child)) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!from) {
|
|
84
|
+
for (const root of getRoots()) {
|
|
85
|
+
if (await _walk(root)) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
await _walk(from);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function walkUpSync(
|
|
96
|
+
step: (node: ContentNavNode) => void | false,
|
|
97
|
+
from: ContentNavNode,
|
|
98
|
+
) {
|
|
99
|
+
let cursor: ContentNavNode | undefined = from;
|
|
100
|
+
|
|
101
|
+
while (cursor) {
|
|
102
|
+
const result = step(cursor);
|
|
103
|
+
|
|
104
|
+
if (result === false) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
cursor = cursor.parent;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function walkUp(
|
|
113
|
+
step: (node: ContentNavNode) => Promise<void | false> | void | false,
|
|
114
|
+
from: ContentNavNode,
|
|
115
|
+
) {
|
|
116
|
+
let cursor: ContentNavNode | undefined = from;
|
|
117
|
+
|
|
118
|
+
while (cursor) {
|
|
119
|
+
const result = await step(cursor);
|
|
120
|
+
|
|
121
|
+
if (result === false) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
cursor = cursor.parent;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as repository from './repository';
|
|
2
|
+
|
|
3
|
+
export async function setupServerContentNav() {
|
|
4
|
+
ERUDIT.contentNav = {
|
|
5
|
+
id2Node: new Map(),
|
|
6
|
+
id2Books: new Map(),
|
|
7
|
+
id2Root: new Map(),
|
|
8
|
+
short2Full: new Map(),
|
|
9
|
+
...repository,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
ERUDIT.log.success('Content navigation setup complete!');
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ContentType } from '@erudit-js/core/content/type';
|
|
2
|
+
import * as repository from './repository';
|
|
3
|
+
|
|
4
|
+
export type ContentNavMap = Map<string, ContentNavNode>;
|
|
5
|
+
export type Id2Id = Map<string, string>;
|
|
6
|
+
|
|
7
|
+
export type EruditServerContentNav = {
|
|
8
|
+
id2Node: ContentNavMap;
|
|
9
|
+
id2Root: ContentNavMap;
|
|
10
|
+
id2Books: ContentNavMap;
|
|
11
|
+
short2Full: Id2Id;
|
|
12
|
+
} & typeof repository;
|
|
13
|
+
|
|
14
|
+
export interface ContentNavNode {
|
|
15
|
+
idPart: string;
|
|
16
|
+
fullId: string;
|
|
17
|
+
shortId: string;
|
|
18
|
+
contentRelPath: string;
|
|
19
|
+
position: number;
|
|
20
|
+
skip: boolean;
|
|
21
|
+
type: ContentType;
|
|
22
|
+
parent?: ContentNavNode;
|
|
23
|
+
children?: ContentNavNode[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function getContentBreadcrumbs(fullId: string) {
|
|
4
|
+
const breadcrumbs: Breadcrumbs = [];
|
|
5
|
+
|
|
6
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(fullId);
|
|
7
|
+
await ERUDIT.contentNav.walkUp(async (stepNode) => {
|
|
8
|
+
const dbContent = (await ERUDIT.db.query.content.findFirst({
|
|
9
|
+
columns: {
|
|
10
|
+
title: true,
|
|
11
|
+
navTitle: true,
|
|
12
|
+
},
|
|
13
|
+
where: eq(ERUDIT.db.schema.content.fullId, stepNode.fullId),
|
|
14
|
+
}))!;
|
|
15
|
+
|
|
16
|
+
breadcrumbs.push({
|
|
17
|
+
icon: ICONS[stepNode.type],
|
|
18
|
+
title: dbContent.navTitle ?? dbContent.title,
|
|
19
|
+
link: await ERUDIT.repository.content.link(stepNode.fullId),
|
|
20
|
+
});
|
|
21
|
+
}, navNode);
|
|
22
|
+
|
|
23
|
+
return breadcrumbs.slice(1).reverse();
|
|
24
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getContentDescription } from './description';
|
|
2
|
+
|
|
3
|
+
export async function getContentChildren(
|
|
4
|
+
fullContentId?: string,
|
|
5
|
+
): Promise<MainContentChildrenItem[]> {
|
|
6
|
+
const navNode = fullContentId
|
|
7
|
+
? ERUDIT.contentNav.getNodeOrThrow(fullContentId)
|
|
8
|
+
: { children: Array.from(ERUDIT.contentNav.id2Root.values()) };
|
|
9
|
+
const children: MainContentChildrenItem[] = [];
|
|
10
|
+
|
|
11
|
+
for (const childNode of navNode.children ?? []) {
|
|
12
|
+
const type = childNode.type;
|
|
13
|
+
const link = await ERUDIT.repository.content.link(childNode.fullId);
|
|
14
|
+
const title = await ERUDIT.repository.content.title(
|
|
15
|
+
childNode.fullId,
|
|
16
|
+
'nav',
|
|
17
|
+
);
|
|
18
|
+
const description = await getContentDescription(childNode.fullId);
|
|
19
|
+
const elementSnippets = await ERUDIT.repository.content.elementSnippets(
|
|
20
|
+
childNode.fullId,
|
|
21
|
+
);
|
|
22
|
+
const quickLinks = elementSnippets?.filter((snippet) => snippet.quick);
|
|
23
|
+
const stats = await ERUDIT.repository.content.stats(childNode.fullId);
|
|
24
|
+
|
|
25
|
+
const child: MainContentChildrenItem = {
|
|
26
|
+
type,
|
|
27
|
+
link,
|
|
28
|
+
title,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (description) {
|
|
32
|
+
child.description = description;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (quickLinks && quickLinks.length > 0) {
|
|
36
|
+
child.quickLinks = quickLinks;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (stats) {
|
|
40
|
+
child.stats = stats;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
children.push(child);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return children;
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getContentDependencies, getContentDependents } from './deps';
|
|
2
|
+
import { getContentExternals } from './externals';
|
|
3
|
+
|
|
4
|
+
export async function getContentConnections(
|
|
5
|
+
fullId: string,
|
|
6
|
+
): Promise<ContentConnections | undefined> {
|
|
7
|
+
const { hardDependencies, autoDependencies } =
|
|
8
|
+
await getContentDependencies(fullId);
|
|
9
|
+
const dependents = await getContentDependents(fullId);
|
|
10
|
+
const externals = await getContentExternals(fullId);
|
|
11
|
+
|
|
12
|
+
const connections: ContentConnections = {};
|
|
13
|
+
|
|
14
|
+
if (hardDependencies.length > 0) {
|
|
15
|
+
connections.hardDependencies = hardDependencies;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (autoDependencies.length > 0) {
|
|
19
|
+
connections.autoDependencies = autoDependencies;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (dependents.length > 0) {
|
|
23
|
+
connections.dependents = dependents;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (externals.length > 0) {
|
|
27
|
+
connections.externals = externals;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (Object.keys(connections).length === 0) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return connections;
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getDefaultTopicPart, getTopicParts } from './topicParts';
|
|
2
|
+
|
|
3
|
+
export async function getContentLink(fullId: string): Promise<string> {
|
|
4
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(fullId);
|
|
5
|
+
|
|
6
|
+
switch (navNode.type) {
|
|
7
|
+
case 'book':
|
|
8
|
+
case 'group':
|
|
9
|
+
case 'page':
|
|
10
|
+
return PAGES[navNode.type](navNode.shortId);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const defaultTopicPart = await getDefaultTopicPart(fullId);
|
|
14
|
+
|
|
15
|
+
return PAGES.topic(defaultTopicPart, navNode.shortId);
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function getContentDecoration(fullId: string) {
|
|
4
|
+
const parts = fullId.split('/');
|
|
5
|
+
for (let i = parts.length; i > 0; i--) {
|
|
6
|
+
const trimmedId = parts.slice(0, i).join('/');
|
|
7
|
+
|
|
8
|
+
const dbContent = await ERUDIT.db.query.content.findFirst({
|
|
9
|
+
columns: { decorationExtension: true },
|
|
10
|
+
where: eq(ERUDIT.db.schema.content.fullId, trimmedId),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (dbContent?.decorationExtension) {
|
|
14
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(trimmedId);
|
|
15
|
+
return (
|
|
16
|
+
'content/' +
|
|
17
|
+
navNode.contentRelPath +
|
|
18
|
+
'/decoration.' +
|
|
19
|
+
dbContent.decorationExtension
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { eq, like, or } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function getContentDependencies(fullId: string): Promise<{
|
|
4
|
+
hardDependencies: ContentHardDep[];
|
|
5
|
+
autoDependencies: ContentAutoDep[];
|
|
6
|
+
}> {
|
|
7
|
+
const hardDependencies: ContentHardDep[] = [];
|
|
8
|
+
const autoDependencies: ContentAutoDep[] = [];
|
|
9
|
+
|
|
10
|
+
const dbContents = await ERUDIT.db.query.contentDeps.findMany({
|
|
11
|
+
columns: { fromFullId: true, toFullId: true, hard: true, reason: true },
|
|
12
|
+
where: or(
|
|
13
|
+
eq(ERUDIT.db.schema.contentDeps.toFullId, fullId),
|
|
14
|
+
like(ERUDIT.db.schema.contentDeps.toFullId, `${fullId}/%`),
|
|
15
|
+
),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
for (const dbContent of dbContents) {
|
|
19
|
+
// Skip child-only self-references
|
|
20
|
+
const isToChild = dbContent.toFullId.startsWith(`${fullId}/`);
|
|
21
|
+
const isFromChild = dbContent.fromFullId.startsWith(`${fullId}/`);
|
|
22
|
+
if (isToChild && isFromChild) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const dep = await getContentAutoDep(dbContent.fromFullId);
|
|
27
|
+
|
|
28
|
+
if (dbContent.hard && fullId === dbContent.toFullId) {
|
|
29
|
+
hardDependencies.push({
|
|
30
|
+
...dep,
|
|
31
|
+
type: 'hard',
|
|
32
|
+
reason: dbContent.reason!,
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
autoDependencies.push(dep);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { hardDependencies, autoDependencies };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function getContentDependents(
|
|
43
|
+
fullId: string,
|
|
44
|
+
): Promise<ContentAutoDep[]> {
|
|
45
|
+
const dependents: ContentAutoDep[] = [];
|
|
46
|
+
|
|
47
|
+
const dbContents = await ERUDIT.db.query.contentDeps.findMany({
|
|
48
|
+
columns: { fromFullId: true, toFullId: true },
|
|
49
|
+
where: or(
|
|
50
|
+
eq(ERUDIT.db.schema.contentDeps.fromFullId, fullId),
|
|
51
|
+
like(ERUDIT.db.schema.contentDeps.fromFullId, `${fullId}/%`),
|
|
52
|
+
),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
for (const dbContent of dbContents) {
|
|
56
|
+
// Skip child-only self-references
|
|
57
|
+
const isFromChild = dbContent.fromFullId.startsWith(`${fullId}/`);
|
|
58
|
+
const isToChild = dbContent.toFullId.startsWith(`${fullId}/`);
|
|
59
|
+
if (isFromChild && isToChild) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const dep = await getContentAutoDep(dbContent.toFullId);
|
|
64
|
+
dependents.push(dep);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return dependents;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function getContentAutoDep(
|
|
71
|
+
fullId: string,
|
|
72
|
+
): Promise<ContentAutoDep> {
|
|
73
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(fullId);
|
|
74
|
+
const contentType = navNode.type;
|
|
75
|
+
const title = await ERUDIT.repository.content.title(fullId);
|
|
76
|
+
const link = await ERUDIT.repository.content.link(fullId);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
type: 'auto',
|
|
80
|
+
contentType,
|
|
81
|
+
title,
|
|
82
|
+
link,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function getContentDescription(
|
|
4
|
+
fullContentId: string,
|
|
5
|
+
): Promise<string | undefined> {
|
|
6
|
+
const dbContentItem = (await ERUDIT.db.query.content.findFirst({
|
|
7
|
+
where: eq(ERUDIT.db.schema.content.fullId, fullContentId),
|
|
8
|
+
}))!;
|
|
9
|
+
|
|
10
|
+
return dbContentItem.description || undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { and, asc, eq, or } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function getContentElementSnippets(
|
|
4
|
+
fullId: string,
|
|
5
|
+
): Promise<ElementSnippet[] | undefined> {
|
|
6
|
+
const snippets: ElementSnippet[] = [];
|
|
7
|
+
|
|
8
|
+
const dbSnippets = await ERUDIT.db.query.contentSnippets.findMany({
|
|
9
|
+
columns: {
|
|
10
|
+
contentProseType: true,
|
|
11
|
+
schemaName: true,
|
|
12
|
+
elementId: true,
|
|
13
|
+
title: true,
|
|
14
|
+
description: true,
|
|
15
|
+
quick: true,
|
|
16
|
+
seo: true,
|
|
17
|
+
},
|
|
18
|
+
where: and(
|
|
19
|
+
eq(ERUDIT.db.schema.contentSnippets.contentFullId, fullId),
|
|
20
|
+
or(
|
|
21
|
+
eq(ERUDIT.db.schema.contentSnippets.quick, true),
|
|
22
|
+
eq(ERUDIT.db.schema.contentSnippets.seo, true),
|
|
23
|
+
),
|
|
24
|
+
),
|
|
25
|
+
orderBy: (snippets) => asc(snippets.snippetId),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(fullId);
|
|
29
|
+
|
|
30
|
+
for (const dbSnippet of dbSnippets) {
|
|
31
|
+
const link = (() => {
|
|
32
|
+
if (dbSnippet.contentProseType === 'page') {
|
|
33
|
+
return PAGES.page(navNode.shortId, dbSnippet.elementId);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return PAGES.topic(
|
|
37
|
+
dbSnippet.contentProseType,
|
|
38
|
+
navNode.shortId,
|
|
39
|
+
dbSnippet.elementId,
|
|
40
|
+
);
|
|
41
|
+
})();
|
|
42
|
+
|
|
43
|
+
const snippet: ElementSnippet = {
|
|
44
|
+
link,
|
|
45
|
+
schemaName: dbSnippet.schemaName,
|
|
46
|
+
title: dbSnippet.title,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (dbSnippet.quick) {
|
|
50
|
+
snippet.quick = true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (dbSnippet.seo) {
|
|
54
|
+
snippet.seo = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (dbSnippet.description) {
|
|
58
|
+
snippet.description = dbSnippet.description;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
snippets.push(snippet);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return snippets.length > 0 ? snippets : undefined;
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContentExternal } from '@erudit-js/core/content/externals';
|
|
2
|
+
import { eq } from 'drizzle-orm';
|
|
3
|
+
|
|
4
|
+
export async function getContentExternals(
|
|
5
|
+
fullId: string,
|
|
6
|
+
): Promise<ContentExternal[]> {
|
|
7
|
+
const externals: ContentExternal[] = [];
|
|
8
|
+
|
|
9
|
+
const dbContentItems = await ERUDIT.db.query.content.findMany({
|
|
10
|
+
columns: { fullId: true, type: true, externals: true },
|
|
11
|
+
where: eq(ERUDIT.db.schema.content.fullId, fullId),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
for (const dbContentItem of dbContentItems) {
|
|
15
|
+
if (dbContentItem?.externals) {
|
|
16
|
+
externals.push(...dbContentItem.externals);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return externals;
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import type { ContentFlags } from '@erudit-js/core/content/flags';
|
|
3
|
+
|
|
4
|
+
export async function getContentFlags(
|
|
5
|
+
fullId: string,
|
|
6
|
+
): Promise<ContentFlags | undefined> {
|
|
7
|
+
const flags: ContentFlags = {};
|
|
8
|
+
|
|
9
|
+
const parts = fullId.split('/');
|
|
10
|
+
for (let i = 1; i <= parts.length; i++) {
|
|
11
|
+
const trimmedId = parts.slice(0, i).join('/');
|
|
12
|
+
|
|
13
|
+
const dbContent = await ERUDIT.db.query.content.findFirst({
|
|
14
|
+
columns: { flags: true },
|
|
15
|
+
where: eq(ERUDIT.db.schema.content.fullId, trimmedId),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const dbFlags = dbContent?.flags || {};
|
|
19
|
+
|
|
20
|
+
for (const [key, value] of Object.entries(dbFlags) as [
|
|
21
|
+
keyof ContentFlags,
|
|
22
|
+
boolean,
|
|
23
|
+
][]) {
|
|
24
|
+
if (value === false) {
|
|
25
|
+
delete flags[key];
|
|
26
|
+
} else {
|
|
27
|
+
flags[key] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return Object.keys(flags).length > 0 ? flags : undefined;
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function getContentSeo(fullContentId: string) {
|
|
4
|
+
const dbContentItem = await ERUDIT.db.query.content.findFirst({
|
|
5
|
+
columns: {
|
|
6
|
+
seo: true,
|
|
7
|
+
},
|
|
8
|
+
where: eq(ERUDIT.db.schema.content.fullId, fullContentId),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
return dbContentItem?.seo || undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { and, eq, sql } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
export async function addContentElementCount(
|
|
4
|
+
fullId: string,
|
|
5
|
+
schemaName: string,
|
|
6
|
+
amount: number,
|
|
7
|
+
): Promise<void> {
|
|
8
|
+
await ERUDIT.db
|
|
9
|
+
.insert(ERUDIT.db.schema.contentElementStats)
|
|
10
|
+
.values({
|
|
11
|
+
fullId,
|
|
12
|
+
schemaName,
|
|
13
|
+
count: 0,
|
|
14
|
+
})
|
|
15
|
+
.onConflictDoNothing();
|
|
16
|
+
|
|
17
|
+
await ERUDIT.db
|
|
18
|
+
.update(ERUDIT.db.schema.contentElementStats)
|
|
19
|
+
.set({
|
|
20
|
+
count: sql`${ERUDIT.db.schema.contentElementStats.count} + ${amount}`,
|
|
21
|
+
})
|
|
22
|
+
.where(
|
|
23
|
+
and(
|
|
24
|
+
eq(ERUDIT.db.schema.contentElementStats.fullId, fullId),
|
|
25
|
+
eq(ERUDIT.db.schema.contentElementStats.schemaName, schemaName),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function getContentStats(
|
|
31
|
+
fullContentId?: string,
|
|
32
|
+
): Promise<ContentStats | undefined> {
|
|
33
|
+
const stats: ContentStats = {};
|
|
34
|
+
|
|
35
|
+
const rootNavNode = fullContentId
|
|
36
|
+
? ERUDIT.contentNav.getNodeOrThrow(fullContentId)
|
|
37
|
+
: ({
|
|
38
|
+
type: '_root',
|
|
39
|
+
children: Array.from(ERUDIT.contentNav.id2Root.values()),
|
|
40
|
+
} as const);
|
|
41
|
+
|
|
42
|
+
if (rootNavNode.type !== 'topic' && rootNavNode.type !== 'page') {
|
|
43
|
+
// Container node, so look for materials inside it
|
|
44
|
+
let materialCount = 0;
|
|
45
|
+
await ERUDIT.contentNav.walk((navNode) => {
|
|
46
|
+
if (navNode.type === 'topic' || navNode.type === 'page') {
|
|
47
|
+
materialCount++;
|
|
48
|
+
}
|
|
49
|
+
}, rootNavNode as any);
|
|
50
|
+
|
|
51
|
+
if (materialCount > 0) {
|
|
52
|
+
stats.materials = materialCount;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const schema2Count: Record<string, number> = {};
|
|
57
|
+
|
|
58
|
+
const rows = await ERUDIT.db.query.contentElementStats.findMany({
|
|
59
|
+
where: fullContentId
|
|
60
|
+
? sql`${ERUDIT.db.schema.contentElementStats.fullId} = ${fullContentId} OR ${ERUDIT.db.schema.contentElementStats.fullId} LIKE ${fullContentId + '/%'}`
|
|
61
|
+
: sql`1=1`,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
for (const row of rows) {
|
|
65
|
+
if (row.count > 0) {
|
|
66
|
+
schema2Count[row.schemaName] =
|
|
67
|
+
(schema2Count[row.schemaName] || 0) + row.count;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Possible merge arrays of schema names into single stats entry
|
|
72
|
+
const actualElementStats = ERUDIT.config.project.countElements.reduce<
|
|
73
|
+
Record<string, number>
|
|
74
|
+
>((acc, current) => {
|
|
75
|
+
if (Array.isArray(current)) {
|
|
76
|
+
const firstKey = current[0]!;
|
|
77
|
+
const sum = current.reduce((sum, name) => {
|
|
78
|
+
return sum + (schema2Count[name] || 0);
|
|
79
|
+
}, 0);
|
|
80
|
+
if (sum > 0) {
|
|
81
|
+
acc[firstKey] = sum;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
const count = schema2Count[current] || 0;
|
|
85
|
+
if (count > 0) {
|
|
86
|
+
acc[current] = count;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return acc;
|
|
90
|
+
}, {});
|
|
91
|
+
|
|
92
|
+
if (Object.keys(actualElementStats).length > 0) {
|
|
93
|
+
stats.elements = actualElementStats;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return Object.keys(stats).length > 0 ? stats : undefined;
|
|
97
|
+
}
|