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,61 @@
|
|
|
1
|
+
import { count } from 'drizzle-orm';
|
|
2
|
+
|
|
3
|
+
const newsNumberPerBatch = 20;
|
|
4
|
+
|
|
5
|
+
export async function countNewsBatches(): Promise<number> {
|
|
6
|
+
const newsTotal = await ERUDIT.db
|
|
7
|
+
.select({ count: count() })
|
|
8
|
+
.from(ERUDIT.db.schema.news)
|
|
9
|
+
.then((result) => result[0].count);
|
|
10
|
+
|
|
11
|
+
return Math.ceil(newsTotal / newsNumberPerBatch);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function getNewsNextBatch(index: number): Promise<NewsBatch> {
|
|
15
|
+
const newsTotal = await ERUDIT.db
|
|
16
|
+
.select({ count: count() })
|
|
17
|
+
.from(ERUDIT.db.schema.news)
|
|
18
|
+
.then((result) => result[0].count);
|
|
19
|
+
|
|
20
|
+
const dbNews = await ERUDIT.db.query.news.findMany({
|
|
21
|
+
columns: {
|
|
22
|
+
date: true,
|
|
23
|
+
prose: true,
|
|
24
|
+
},
|
|
25
|
+
orderBy: (news, { desc }) => [desc(news.date)],
|
|
26
|
+
limit: newsNumberPerBatch,
|
|
27
|
+
offset: index * newsNumberPerBatch,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const items: NewsItem[] = [];
|
|
31
|
+
|
|
32
|
+
for (const dbNewsItem of dbNews) {
|
|
33
|
+
const date = dbNewsItem.date;
|
|
34
|
+
const finalizedProse = await ERUDIT.repository.prose.finalize(
|
|
35
|
+
dbNewsItem.prose,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const item: NewsItem = {
|
|
39
|
+
date,
|
|
40
|
+
content: finalizedProse,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
items.push(item);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const hasNext = (index + 1) * newsNumberPerBatch < newsTotal;
|
|
47
|
+
|
|
48
|
+
const batch: NewsBatch = {
|
|
49
|
+
items,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (hasNext) {
|
|
53
|
+
batch.nextIndex = index + 1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (index === 0) {
|
|
57
|
+
batch.total = newsTotal;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return batch;
|
|
61
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fillStorage,
|
|
3
|
+
isProseElement,
|
|
4
|
+
PROSE_REGISTRY,
|
|
5
|
+
type AnySchema,
|
|
6
|
+
type FinalizedProse,
|
|
7
|
+
type GenericStorage,
|
|
8
|
+
type ProseElement,
|
|
9
|
+
} from '@jsprose/core';
|
|
10
|
+
import { imageSchema } from '@erudit-js/prose/elements/image/core';
|
|
11
|
+
import { videoSchema } from '@erudit-js/prose/elements/video/core';
|
|
12
|
+
import { calloutSchema } from '@erudit-js/prose/elements/callout/core';
|
|
13
|
+
import {
|
|
14
|
+
referenceSchema,
|
|
15
|
+
refSchema,
|
|
16
|
+
} from '@erudit-js/prose/elements/link/reference/core';
|
|
17
|
+
import {
|
|
18
|
+
dependencySchema,
|
|
19
|
+
depSchema,
|
|
20
|
+
} from '@erudit-js/prose/elements/link/dependency/core';
|
|
21
|
+
import { problemSchema } from '@erudit-js/prose/elements/problem/problem';
|
|
22
|
+
import { subProblemSchema } from '@erudit-js/prose/elements/problem/problems';
|
|
23
|
+
|
|
24
|
+
import { createImageStorage } from '../storage/image';
|
|
25
|
+
import { createVideoStorage } from '../storage/video';
|
|
26
|
+
import { createCalloutStorage } from '../storage/callout';
|
|
27
|
+
import { createLinkStorage } from '../storage/link';
|
|
28
|
+
import { createProblemScriptStorage } from '../storage/problemScript';
|
|
29
|
+
|
|
30
|
+
export async function finalizeProse(
|
|
31
|
+
proseElement: ProseElement<AnySchema>,
|
|
32
|
+
): Promise<FinalizedProse> {
|
|
33
|
+
const storage: GenericStorage = {};
|
|
34
|
+
|
|
35
|
+
await fillStorage({
|
|
36
|
+
storage,
|
|
37
|
+
proseElement,
|
|
38
|
+
storageCreators: PROSE_REGISTRY.getStorageCreators(),
|
|
39
|
+
step: async (element) => {
|
|
40
|
+
switch (true) {
|
|
41
|
+
case isProseElement(element, imageSchema):
|
|
42
|
+
await createImageStorage(element, storage);
|
|
43
|
+
break;
|
|
44
|
+
case isProseElement(element, videoSchema):
|
|
45
|
+
await createVideoStorage(element, storage);
|
|
46
|
+
break;
|
|
47
|
+
case isProseElement(element, calloutSchema):
|
|
48
|
+
await createCalloutStorage(element, storage);
|
|
49
|
+
break;
|
|
50
|
+
case isProseElement(element, refSchema):
|
|
51
|
+
case isProseElement(element, referenceSchema):
|
|
52
|
+
case isProseElement(element, depSchema):
|
|
53
|
+
case isProseElement(element, dependencySchema):
|
|
54
|
+
await createLinkStorage(element, storage);
|
|
55
|
+
break;
|
|
56
|
+
case isProseElement(element, problemSchema):
|
|
57
|
+
case isProseElement(element, subProblemSchema):
|
|
58
|
+
await createProblemScriptStorage(element, storage);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
proseElement,
|
|
66
|
+
storage,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { eq } from 'drizzle-orm';
|
|
2
|
+
import type { AnySchema, ProseElement } from '@jsprose/core';
|
|
3
|
+
import type { ContentProseType } from '@erudit-js/core/content/prose';
|
|
4
|
+
import { isTopicPart } from '@erudit-js/core/content/topic';
|
|
5
|
+
|
|
6
|
+
export async function getContentProse(
|
|
7
|
+
contentType: ContentProseType,
|
|
8
|
+
contentId: string,
|
|
9
|
+
): Promise<ProseElement<AnySchema>> {
|
|
10
|
+
const navNode = ERUDIT.contentNav.getNodeOrThrow(contentId);
|
|
11
|
+
const fullContentId = navNode.fullId;
|
|
12
|
+
|
|
13
|
+
if (isTopicPart(contentType)) {
|
|
14
|
+
const dbTopic = (await ERUDIT.db.query.topics.findFirst({
|
|
15
|
+
columns: {
|
|
16
|
+
[contentType]: true,
|
|
17
|
+
},
|
|
18
|
+
where: eq(ERUDIT.db.schema.topics.fullId, fullContentId),
|
|
19
|
+
}))!;
|
|
20
|
+
|
|
21
|
+
// @ts-expect-error we know that contentType is a valid key here
|
|
22
|
+
return dbTopic[contentType]!;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (contentType === 'page') {
|
|
26
|
+
const dbPage = (await ERUDIT.db.query.pages.findFirst({
|
|
27
|
+
columns: {
|
|
28
|
+
prose: true,
|
|
29
|
+
},
|
|
30
|
+
where: eq(ERUDIT.db.schema.pages.fullId, fullContentId),
|
|
31
|
+
}))!;
|
|
32
|
+
return dbPage.prose;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
throw createError({
|
|
36
|
+
statusCode: 400,
|
|
37
|
+
statusMessage: `Unable to get prose for content ${contentType} "${contentId}"!`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function getContributorProse(
|
|
42
|
+
contributorId: string,
|
|
43
|
+
): Promise<ProseElement<AnySchema> | undefined> {
|
|
44
|
+
const dbContributor = await ERUDIT.db.query.contributors.findFirst({
|
|
45
|
+
columns: {
|
|
46
|
+
description: true,
|
|
47
|
+
},
|
|
48
|
+
where: eq(ERUDIT.db.schema.contributors.contributorId, contributorId),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return dbContributor?.description || undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// @TODO: Get news item prose
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AnySchema, RawElement } from '@jsprose/core';
|
|
2
|
+
import { resolveEruditRawElement, type ResolveStep } from '@erudit-js/prose';
|
|
3
|
+
|
|
4
|
+
export async function resolveEruditProse(
|
|
5
|
+
rawElement: RawElement<AnySchema>,
|
|
6
|
+
linkable: boolean,
|
|
7
|
+
step?: ResolveStep,
|
|
8
|
+
) {
|
|
9
|
+
return await resolveEruditRawElement({
|
|
10
|
+
context: {
|
|
11
|
+
language: ERUDIT.config.public.project.language.current,
|
|
12
|
+
linkable,
|
|
13
|
+
},
|
|
14
|
+
rawElement,
|
|
15
|
+
step,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ProseElement, GenericStorage } from '@jsprose/core';
|
|
2
|
+
import type { calloutSchema } from '@erudit-js/prose/elements/callout/core';
|
|
3
|
+
import { createCalloutStorage as _createCalloutStorage } from '@erudit-js/prose/elements/callout/storage';
|
|
4
|
+
|
|
5
|
+
export async function createCalloutStorage(
|
|
6
|
+
element: ProseElement<typeof calloutSchema>,
|
|
7
|
+
storage: GenericStorage,
|
|
8
|
+
) {
|
|
9
|
+
storage[element.storageKey!] = _createCalloutStorage(
|
|
10
|
+
ERUDIT.config.paths.project,
|
|
11
|
+
ERUDIT.config.public.project.baseUrl,
|
|
12
|
+
element.data.iconSrc,
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GenericStorage, ProseElement } from '@jsprose/core';
|
|
2
|
+
import type {
|
|
3
|
+
imageSchema,
|
|
4
|
+
ImageStorage,
|
|
5
|
+
} from '@erudit-js/prose/elements/image/core';
|
|
6
|
+
import { createImageStorage as _createImageStorage } from '@erudit-js/prose/elements/image/storage';
|
|
7
|
+
|
|
8
|
+
export async function createImageStorage(
|
|
9
|
+
element: ProseElement<typeof imageSchema>,
|
|
10
|
+
storage: GenericStorage,
|
|
11
|
+
) {
|
|
12
|
+
const imageAbsPath = element.data.src;
|
|
13
|
+
const imageStorage = await _createImageStorage(
|
|
14
|
+
ERUDIT.config.paths.project,
|
|
15
|
+
ERUDIT.config.public.project.baseUrl,
|
|
16
|
+
imageAbsPath,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
storage[element.storageKey!] = imageStorage satisfies ImageStorage;
|
|
20
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProseError,
|
|
3
|
+
uniqueName2Id,
|
|
4
|
+
type GenericStorage,
|
|
5
|
+
type ProseElement,
|
|
6
|
+
} from '@jsprose/core';
|
|
7
|
+
|
|
8
|
+
import { isTopicPart } from '@erudit-js/core/content/topic';
|
|
9
|
+
import type { ContentPointer } from '@erudit-js/core/content/pointer';
|
|
10
|
+
import type {
|
|
11
|
+
referenceSchema,
|
|
12
|
+
refSchema,
|
|
13
|
+
} from '@erudit-js/prose/elements/link/reference/core';
|
|
14
|
+
import type {
|
|
15
|
+
dependencySchema,
|
|
16
|
+
depSchema,
|
|
17
|
+
} from '@erudit-js/prose/elements/link/dependency/core';
|
|
18
|
+
import type { LinkStorage } from '@erudit-js/prose/elements/link/storage';
|
|
19
|
+
|
|
20
|
+
export async function createLinkStorage(
|
|
21
|
+
element:
|
|
22
|
+
| ProseElement<typeof refSchema>
|
|
23
|
+
| ProseElement<typeof referenceSchema>
|
|
24
|
+
| ProseElement<typeof depSchema>
|
|
25
|
+
| ProseElement<typeof dependencySchema>,
|
|
26
|
+
storage: GenericStorage,
|
|
27
|
+
) {
|
|
28
|
+
let linkStorage: LinkStorage | undefined;
|
|
29
|
+
|
|
30
|
+
const storageKeyParts = element.storageKey!.split('/');
|
|
31
|
+
const linkType = storageKeyParts[0];
|
|
32
|
+
const strProseLink = storageKeyParts.slice(1).join('/');
|
|
33
|
+
|
|
34
|
+
if (linkType === '<link:direct>') {
|
|
35
|
+
linkStorage = {
|
|
36
|
+
type: 'direct',
|
|
37
|
+
resolvedHref: strProseLink,
|
|
38
|
+
previewRequest: {
|
|
39
|
+
type: 'direct-link',
|
|
40
|
+
href: strProseLink,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
} else if (linkType === '<link:global>') {
|
|
44
|
+
const proseLinkParts = strProseLink.split('/');
|
|
45
|
+
const uniquePart = proseLinkParts.pop();
|
|
46
|
+
|
|
47
|
+
if (uniquePart?.startsWith('$')) {
|
|
48
|
+
//
|
|
49
|
+
// Unique link
|
|
50
|
+
//
|
|
51
|
+
|
|
52
|
+
const contentPointer = await getContentPointerFor(
|
|
53
|
+
proseLinkParts.join('/'),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const shortId = ERUDIT.contentNav.getNodeOrThrow(
|
|
57
|
+
contentPointer.id,
|
|
58
|
+
).shortId;
|
|
59
|
+
|
|
60
|
+
const contentTitle = await ERUDIT.repository.content.title(
|
|
61
|
+
contentPointer.id,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const uniqueName = uniquePart.slice(1);
|
|
65
|
+
const unique = await ERUDIT.repository.content.unique(
|
|
66
|
+
contentPointer.id,
|
|
67
|
+
contentPointer.type === 'topic' ? contentPointer.part : 'page',
|
|
68
|
+
uniqueName,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
if (contentPointer.type === 'topic') {
|
|
72
|
+
linkStorage = {
|
|
73
|
+
type: 'unique',
|
|
74
|
+
schemaName: unique.prose.schemaName,
|
|
75
|
+
elementTitle: unique.title || undefined,
|
|
76
|
+
content: {
|
|
77
|
+
contentType: 'topic',
|
|
78
|
+
contentTitle,
|
|
79
|
+
topicPart: contentPointer.part,
|
|
80
|
+
},
|
|
81
|
+
resolvedHref: PAGES.topic(
|
|
82
|
+
contentPointer.part,
|
|
83
|
+
shortId,
|
|
84
|
+
uniqueName2Id(uniqueName),
|
|
85
|
+
),
|
|
86
|
+
previewRequest: {
|
|
87
|
+
type: 'unique',
|
|
88
|
+
contentFullId: contentPointer.id,
|
|
89
|
+
contentType: 'topic',
|
|
90
|
+
topicPart: contentPointer.part,
|
|
91
|
+
uniqueName: uniqueName,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
linkStorage = {
|
|
96
|
+
type: 'unique',
|
|
97
|
+
schemaName: unique.prose.schemaName,
|
|
98
|
+
elementTitle: unique.title || undefined,
|
|
99
|
+
content: {
|
|
100
|
+
contentType: contentPointer.type,
|
|
101
|
+
contentTitle,
|
|
102
|
+
},
|
|
103
|
+
resolvedHref: PAGES.page(
|
|
104
|
+
shortId,
|
|
105
|
+
uniqueName2Id(uniqueName),
|
|
106
|
+
),
|
|
107
|
+
previewRequest: {
|
|
108
|
+
type: 'unique',
|
|
109
|
+
contentFullId: contentPointer.id,
|
|
110
|
+
contentType: 'page',
|
|
111
|
+
uniqueName: uniqueName,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
//
|
|
117
|
+
// Content item link
|
|
118
|
+
//
|
|
119
|
+
|
|
120
|
+
const contentPointer = await getContentPointerFor(strProseLink);
|
|
121
|
+
|
|
122
|
+
const shortId = ERUDIT.contentNav.getNodeOrThrow(
|
|
123
|
+
contentPointer.id,
|
|
124
|
+
).shortId;
|
|
125
|
+
|
|
126
|
+
const contentTitle = await ERUDIT.repository.content.title(
|
|
127
|
+
contentPointer.id,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
if (contentPointer.type === 'topic') {
|
|
131
|
+
linkStorage = {
|
|
132
|
+
type: 'contentItem',
|
|
133
|
+
content: {
|
|
134
|
+
contentType: 'topic',
|
|
135
|
+
contentTitle,
|
|
136
|
+
topicPart: contentPointer.part,
|
|
137
|
+
},
|
|
138
|
+
resolvedHref: PAGES.topic(contentPointer.part, shortId),
|
|
139
|
+
previewRequest: {
|
|
140
|
+
type: 'content-page',
|
|
141
|
+
contentType: 'topic',
|
|
142
|
+
topicPart: contentPointer.part,
|
|
143
|
+
fullId: contentPointer.id,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
} else {
|
|
147
|
+
linkStorage = {
|
|
148
|
+
type: 'contentItem',
|
|
149
|
+
content: {
|
|
150
|
+
contentType: contentPointer.type,
|
|
151
|
+
contentTitle,
|
|
152
|
+
},
|
|
153
|
+
resolvedHref: PAGES[contentPointer.type](shortId),
|
|
154
|
+
previewRequest: {
|
|
155
|
+
type: 'content-page',
|
|
156
|
+
contentType: contentPointer.type,
|
|
157
|
+
fullId: contentPointer.id,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!linkStorage) {
|
|
165
|
+
throw new ProseError(
|
|
166
|
+
`Unable to create prose link storage for link: ${element.storageKey}`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
storage[element.storageKey!] = linkStorage;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async function getContentPointerFor(
|
|
174
|
+
contentId: string,
|
|
175
|
+
): Promise<ContentPointer> {
|
|
176
|
+
if (!contentId) {
|
|
177
|
+
throw new ProseError(`Invalid content ID: "${contentId}"!`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const contentNavNode = ERUDIT.contentNav.getNode(contentId);
|
|
181
|
+
|
|
182
|
+
if (contentNavNode) {
|
|
183
|
+
if (contentNavNode.type === 'topic') {
|
|
184
|
+
const defaultTopicPart =
|
|
185
|
+
await ERUDIT.repository.content.defaultTopicPart(
|
|
186
|
+
contentNavNode.fullId,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
type: 'topic',
|
|
191
|
+
id: contentNavNode.fullId,
|
|
192
|
+
part: defaultTopicPart,
|
|
193
|
+
};
|
|
194
|
+
} else {
|
|
195
|
+
return {
|
|
196
|
+
type: contentNavNode.type,
|
|
197
|
+
id: contentNavNode.fullId,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const contentIdParts = contentId.split('/');
|
|
203
|
+
const maybeTopicPart = contentIdParts.pop()!;
|
|
204
|
+
|
|
205
|
+
if (!isTopicPart(maybeTopicPart)) {
|
|
206
|
+
throw new ProseError(
|
|
207
|
+
`Prose link part "${contentId}" must be a valid topic part!`,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const shortenedContentNavNode = ERUDIT.contentNav.getNode(
|
|
212
|
+
contentIdParts.join('/'),
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
if (shortenedContentNavNode) {
|
|
216
|
+
return {
|
|
217
|
+
type: 'topic',
|
|
218
|
+
id: shortenedContentNavNode.fullId,
|
|
219
|
+
part: maybeTopicPart,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
throw new ProseError(
|
|
224
|
+
`Unable to find content for prose link: "${contentId}"!`,
|
|
225
|
+
);
|
|
226
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GenericStorage, ProseElement } from '@jsprose/core';
|
|
2
|
+
import type { problemSchema } from '@erudit-js/prose/elements/problem/problem';
|
|
3
|
+
import type { subProblemSchema } from '@erudit-js/prose/elements/problem/problems';
|
|
4
|
+
import { createProblemScriptStorage as _createProblemScriptStorage } from '@erudit-js/prose/elements/problem/storage';
|
|
5
|
+
|
|
6
|
+
export async function createProblemScriptStorage(
|
|
7
|
+
element:
|
|
8
|
+
| ProseElement<typeof problemSchema>
|
|
9
|
+
| ProseElement<typeof subProblemSchema>,
|
|
10
|
+
storage: GenericStorage,
|
|
11
|
+
) {
|
|
12
|
+
if (!element.storageKey) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
storage[element.storageKey!] = _createProblemScriptStorage(
|
|
17
|
+
ERUDIT.config.paths.project,
|
|
18
|
+
ERUDIT.config.public.project.baseUrl,
|
|
19
|
+
element.storageKey.replace('problemScript:', ''),
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GenericStorage, ProseElement } from '@jsprose/core';
|
|
2
|
+
import type { videoSchema } from '@erudit-js/prose/elements/video/core';
|
|
3
|
+
import { createVideoStorage as _createVideoStorage } from '@erudit-js/prose/elements/video/storage';
|
|
4
|
+
|
|
5
|
+
export async function createVideoStorage(
|
|
6
|
+
element: ProseElement<typeof videoSchema>,
|
|
7
|
+
storage: GenericStorage,
|
|
8
|
+
) {
|
|
9
|
+
storage[element.storageKey!] = _createVideoStorage(
|
|
10
|
+
ERUDIT.config.paths.project,
|
|
11
|
+
ERUDIT.config.public.project.baseUrl,
|
|
12
|
+
element.data.src,
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export async function bundleProblemScript(problemId: string) {
|
|
2
|
+
// Создаем фейковый stdin для esbuild, в котором импортирует требуемый скрипт из файла, где он объявлен
|
|
3
|
+
// Так на выходе получим только бандл скрипта, без лишних зависимостей
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// Функция для вызова ESBuild бандлера, чтобы собирать problem скрипты и прочее
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const CODE_EXTENSIONS = ['json', 'ts', 'tsx', 'js', 'jsx'];
|
|
2
|
+
|
|
3
|
+
export const STATIC_ASSET_EXTENSIONS = [
|
|
4
|
+
'png',
|
|
5
|
+
'jpg',
|
|
6
|
+
'jpeg',
|
|
7
|
+
'gif',
|
|
8
|
+
'bmp',
|
|
9
|
+
'webp',
|
|
10
|
+
'svg',
|
|
11
|
+
'mp4',
|
|
12
|
+
'webm',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export const EXTENSIONS = [...CODE_EXTENSIONS, ...STATIC_ASSET_EXTENSIONS];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createQuoteId, type QuoteIds } from '@erudit-js/core/quote';
|
|
2
|
+
import { eq } from 'drizzle-orm';
|
|
3
|
+
|
|
4
|
+
export async function getQuoteIds(): Promise<QuoteIds> {
|
|
5
|
+
const ids: QuoteIds = {};
|
|
6
|
+
|
|
7
|
+
const dbCameos = await ERUDIT.db.query.cameos.findMany({
|
|
8
|
+
columns: { cameoId: true },
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
if (dbCameos.length > 0) {
|
|
12
|
+
ids.cameo = dbCameos.map((dbCameo) =>
|
|
13
|
+
createQuoteId('cameo', dbCameo.cameoId),
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (ERUDIT.config.public.project.sponsors?.enabled) {
|
|
18
|
+
const dbSponsors = await ERUDIT.db.query.sponsors.findMany({
|
|
19
|
+
columns: { sponsorId: true },
|
|
20
|
+
where: eq(ERUDIT.db.schema.sponsors.hasMessages, true),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (dbSponsors.length > 0) {
|
|
24
|
+
ids.sponsor = dbSponsors.map((dbSponsor) =>
|
|
25
|
+
createQuoteId('sponsor', dbSponsor.sponsorId),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return ids;
|
|
31
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { getContentBreadcrumbs } from './content/repository/breadcrumbs';
|
|
2
|
+
import { getContentLink } from './content/repository/contentLink';
|
|
3
|
+
import {
|
|
4
|
+
getDefaultTopicPart,
|
|
5
|
+
getTopicParts,
|
|
6
|
+
} from './content/repository/topicParts';
|
|
7
|
+
import { countContributors } from './contributors/repository/count';
|
|
8
|
+
import { countSponsors } from './sponsors/repository/count';
|
|
9
|
+
import { resolveEruditProse } from './prose/repository/resolve';
|
|
10
|
+
import { pushFile } from './db/repository/pushFile';
|
|
11
|
+
import { pushProblemScript } from './db/repository/pushProblemScript';
|
|
12
|
+
import { pushProseLink } from './db/repository/pushProseLink';
|
|
13
|
+
import { getContentProse, getContributorProse } from './prose/repository/get';
|
|
14
|
+
import { finalizeProse } from './prose/repository/finalize';
|
|
15
|
+
import { getContentTitle } from './content/repository/title';
|
|
16
|
+
import {
|
|
17
|
+
getContentHeadingUnique,
|
|
18
|
+
getContentUnique,
|
|
19
|
+
} from './content/repository/unique';
|
|
20
|
+
import { getContentDecoration } from './content/repository/decoration';
|
|
21
|
+
import { getContentFlags } from './content/repository/flags';
|
|
22
|
+
import { getContentConnections } from './content/repository/connections';
|
|
23
|
+
import { getQuoteIds } from './quote/repository/ids';
|
|
24
|
+
import { getContributorAvatarUrl } from './contributors/repository/avatarUrl';
|
|
25
|
+
import { getSponsorAvatarUrl } from './sponsors/repository/avatarUrl';
|
|
26
|
+
import { getContentDescription } from './content/repository/description';
|
|
27
|
+
import { getContentChildren } from './content/repository/children';
|
|
28
|
+
import {
|
|
29
|
+
addContentElementCount,
|
|
30
|
+
getContentStats,
|
|
31
|
+
} from './content/repository/stats';
|
|
32
|
+
import { countNewsBatches, getNewsNextBatch } from './news/repository/batch';
|
|
33
|
+
import {
|
|
34
|
+
countContributions,
|
|
35
|
+
getContentContributions,
|
|
36
|
+
getContributorContributions,
|
|
37
|
+
} from './contributors/repository/contributions';
|
|
38
|
+
import { getContentSeo } from './content/repository/seo';
|
|
39
|
+
import { getContentElementSnippets } from './content/repository/elementSnippets';
|
|
40
|
+
|
|
41
|
+
export const repository = {
|
|
42
|
+
db: {
|
|
43
|
+
pushFile: pushFile,
|
|
44
|
+
pushProblemScript: pushProblemScript,
|
|
45
|
+
pushProseLink: pushProseLink,
|
|
46
|
+
},
|
|
47
|
+
contributors: {
|
|
48
|
+
count: countContributors,
|
|
49
|
+
countContributions,
|
|
50
|
+
contributorContributions: getContributorContributions,
|
|
51
|
+
avatarUrl: getContributorAvatarUrl,
|
|
52
|
+
},
|
|
53
|
+
quotes: {
|
|
54
|
+
ids: getQuoteIds,
|
|
55
|
+
},
|
|
56
|
+
sponsors: {
|
|
57
|
+
count: countSponsors,
|
|
58
|
+
avatarUrl: getSponsorAvatarUrl,
|
|
59
|
+
},
|
|
60
|
+
content: {
|
|
61
|
+
topicParts: getTopicParts,
|
|
62
|
+
defaultTopicPart: getDefaultTopicPart,
|
|
63
|
+
unique: getContentUnique,
|
|
64
|
+
uniqueHeading: getContentHeadingUnique,
|
|
65
|
+
link: getContentLink,
|
|
66
|
+
breadcrumbs: getContentBreadcrumbs,
|
|
67
|
+
title: getContentTitle,
|
|
68
|
+
description: getContentDescription,
|
|
69
|
+
decoration: getContentDecoration,
|
|
70
|
+
elementSnippets: getContentElementSnippets,
|
|
71
|
+
flags: getContentFlags,
|
|
72
|
+
connections: getContentConnections,
|
|
73
|
+
children: getContentChildren,
|
|
74
|
+
stats: getContentStats,
|
|
75
|
+
addElementCount: addContentElementCount,
|
|
76
|
+
contentContributions: getContentContributions,
|
|
77
|
+
seo: getContentSeo,
|
|
78
|
+
},
|
|
79
|
+
prose: {
|
|
80
|
+
resolve: resolveEruditProse,
|
|
81
|
+
getContent: getContentProse,
|
|
82
|
+
getContributor: getContributorProse,
|
|
83
|
+
finalize: finalizeProse,
|
|
84
|
+
},
|
|
85
|
+
news: {
|
|
86
|
+
countBatches: countNewsBatches,
|
|
87
|
+
batch: getNewsNextBatch,
|
|
88
|
+
},
|
|
89
|
+
} as const;
|
|
90
|
+
|
|
91
|
+
export type EruditServerRepository = typeof repository;
|
|
92
|
+
|
|
93
|
+
export async function setupServerRepository() {
|
|
94
|
+
ERUDIT.repository = repository;
|
|
95
|
+
ERUDIT.log.success('Repository setup complete!');
|
|
96
|
+
}
|