erudit 3.0.0-dev.8 → 4.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +25 -185
- package/app/assets/icons/array-check.svg +3 -0
- package/app/assets/icons/array-lines.svg +3 -0
- package/app/assets/icons/array-star.svg +3 -0
- package/app/assets/icons/arrow/from-circle.svg +3 -0
- package/app/assets/icons/arrow/left.svg +3 -0
- package/app/assets/icons/arrow/outward-box.svg +3 -0
- package/app/assets/icons/arrow/outward.svg +3 -0
- package/app/assets/icons/arrow/to-circle.svg +3 -0
- package/app/assets/icons/arrow/up-to-right.svg +3 -0
- package/app/assets/icons/aside-open.svg +2 -2
- package/app/assets/icons/asterisk.svg +2 -2
- package/app/assets/icons/bell.svg +3 -0
- package/app/assets/icons/book-outline.svg +3 -0
- package/app/assets/icons/book-question.svg +2 -2
- package/app/assets/icons/book.svg +2 -2
- package/app/assets/icons/box.svg +3 -0
- package/app/assets/icons/bug.svg +2 -2
- package/app/assets/icons/chevron-right.svg +3 -0
- package/app/assets/icons/cog.svg +3 -0
- package/app/assets/icons/construction.svg +2 -2
- package/app/assets/icons/diamond.svg +3 -0
- package/app/assets/icons/draw.svg +2 -2
- package/app/assets/icons/erudit.svg +3 -0
- package/app/assets/icons/file-lines.svg +2 -2
- package/app/assets/icons/files.svg +3 -0
- package/app/assets/icons/flame.svg +3 -0
- package/app/assets/icons/folder-open.svg +2 -2
- package/app/assets/icons/folder.svg +2 -2
- package/app/assets/icons/globe.svg +2 -2
- package/app/assets/icons/graduation.svg +3 -0
- package/app/assets/icons/handshake.svg +3 -0
- package/app/assets/icons/house.svg +2 -2
- package/app/assets/icons/lines.svg +3 -0
- package/app/assets/icons/moon.svg +2 -2
- package/app/assets/icons/plus-circle.svg +2 -2
- package/app/assets/icons/plus.svg +2 -2
- package/app/assets/icons/puzzle.svg +2 -2
- package/app/assets/icons/question-circle.svg +3 -0
- package/app/assets/icons/rocket.svg +3 -0
- package/app/assets/icons/search/check.svg +3 -0
- package/app/assets/icons/search/dead.svg +3 -0
- package/app/assets/icons/search/glass.svg +3 -0
- package/app/assets/icons/search/wtf.svg +3 -0
- package/app/assets/icons/sun-moon.svg +2 -2
- package/app/assets/icons/sun.svg +2 -2
- package/app/assets/icons/translate.svg +3 -0
- package/app/assets/icons/user.svg +2 -2
- package/app/assets/icons/users.svg +2 -2
- package/app/assets/icons/warning.svg +3 -0
- package/app/components/EruditLink.ts +9 -0
- package/app/components/FancyBold.vue +17 -0
- package/app/components/FancyCard.vue +59 -0
- package/app/components/FancyCardTag.vue +16 -0
- package/app/components/Prose.vue +51 -0
- package/app/components/ScrollHolder.vue +20 -0
- package/app/components/SmartMedia.vue +112 -0
- package/app/components/ads/Ads.vue +39 -0
- package/app/components/ads/AdsBannerAside.vue +46 -0
- package/app/components/ads/AdsBannerBottom.vue +17 -0
- package/app/components/ads/AdsReplacer.vue +28 -0
- package/app/components/ads/provider/Custom.vue +19 -0
- package/app/components/ads/provider/Yandex.vue +84 -0
- package/app/components/aside/AsideListItem.vue +66 -74
- package/app/components/aside/AsideMajor.vue +8 -56
- package/app/components/aside/AsideMinor.vue +76 -71
- package/app/components/aside/AsidePlainMessage.vue +9 -0
- package/app/components/aside/AsideSwitch.vue +67 -0
- package/app/components/aside/major/PaneHolder.vue +106 -0
- package/app/components/aside/major/PaneSwitcher.vue +73 -0
- package/app/components/aside/major/PaneSwitcherButton.vue +38 -0
- package/app/components/aside/major/PaneTemplate.vue +5 -0
- package/app/components/aside/major/SiteInfo.vue +68 -85
- package/app/components/aside/major/contentNav/PaneBookNav.vue +116 -0
- package/app/components/aside/major/contentNav/PaneGlobalNav.vue +19 -0
- package/app/components/aside/major/contentNav/items/ContentNavBook.vue +21 -0
- package/app/components/aside/major/contentNav/items/ContentNavFolder.vue +92 -0
- package/app/components/aside/major/contentNav/items/ContentNavItem.vue +33 -0
- package/app/components/aside/major/contentNav/items/ContentNavPage.vue +18 -0
- package/app/components/aside/major/contentNav/items/ContentNavSeparator.vue +62 -0
- package/app/components/aside/major/contentNav/items/ContentNavTopic.vue +18 -0
- package/app/components/aside/major/contentNav/items/Flags.vue +52 -0
- package/app/components/aside/major/contentNav/items/ItemTemplate.vue +27 -0
- package/app/components/aside/major/languages/PaneLanguages.vue +55 -0
- package/app/components/aside/major/pages/PanePages.vue +60 -0
- package/app/components/aside/major/search/PaneSearch.vue +145 -0
- package/app/components/aside/major/search/SearchInput.vue +104 -0
- package/app/components/aside/major/search/SearchResult.vue +103 -0
- package/app/components/aside/major/search/SearchStatus.vue +48 -0
- package/app/components/aside/major/search/search.worker.ts +164 -0
- package/app/components/aside/major/settings/BuildTime.vue +25 -0
- package/app/components/aside/major/settings/EngineVersion.vue +13 -0
- package/app/components/aside/major/settings/PaneSettings.vue +17 -0
- package/app/components/aside/major/settings/ThemeSwitcher.vue +53 -0
- package/app/components/aside/major/settings/repository/Repository.vue +33 -0
- package/app/components/aside/major/settings/repository/SecondaryGitHub.vue +71 -0
- package/app/components/aside/minor/AsideMinorPane.vue +1 -11
- package/app/components/aside/minor/AsideMinorPlainHeader.vue +21 -0
- package/app/components/aside/minor/content/AsideMinorContentContributions.vue +51 -0
- package/app/components/aside/minor/content/AsideMinorContentPage.vue +37 -0
- package/app/components/aside/minor/content/AsideMinorContentTopic.vue +69 -0
- package/app/components/aside/minor/content/ButtonPaneContributions.vue +116 -0
- package/app/components/aside/minor/content/ButtonPaneImprove.vue +121 -0
- package/app/components/aside/minor/content/Contribution.vue +36 -0
- package/app/components/aside/minor/content/Toc.vue +163 -0
- package/app/components/aside/minor/content/TocItem.vue +77 -0
- package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
- package/app/components/aside/minor/contributor/AsideMinorContributor.vue +39 -0
- package/app/components/aside/minor/contributor/ItemBook.vue +39 -0
- package/app/components/aside/minor/contributor/ItemContent.vue +17 -0
- package/app/components/aside/minor/news/AsideMinorNews.vue +133 -0
- package/app/components/aside/minor/news/NewsItem.vue +69 -0
- package/app/components/aside/minor/news/RenderNewsElement.vue +42 -0
- package/app/components/aside/minor/news/elements/Mix.vue +11 -0
- package/app/components/aside/minor/news/elements/P.vue +14 -0
- package/app/components/aside/minor/news/elements/Ref.vue +58 -0
- package/app/components/aside/minor/news/elements/Text.vue +18 -0
- package/app/components/indexPage/IndexPagePersons.vue +117 -0
- package/app/components/main/MainAction.vue +20 -0
- package/app/components/main/MainBreadcrumbs.vue +28 -0
- package/app/components/main/MainContentChild.vue +48 -0
- package/app/components/main/MainContentChildren.vue +14 -0
- package/app/components/main/MainDecoration.vue +15 -0
- package/app/components/main/MainDescription.vue +13 -0
- package/app/components/main/MainFlag.vue +133 -0
- package/app/components/main/MainFlags.vue +17 -0
- package/app/components/main/MainGlow.vue +12 -0
- package/app/components/main/MainQuickLink.vue +76 -0
- package/app/components/main/MainQuickLinks.vue +42 -0
- package/app/components/main/MainQuote.vue +162 -0
- package/app/components/main/MainQuoteLoader.vue +86 -0
- package/app/components/main/MainSection.vue +59 -0
- package/app/components/main/MainSectionPreamble.vue +5 -0
- package/app/components/main/MainSubTitle.vue +12 -0
- package/app/components/main/MainTitle.vue +33 -0
- package/app/components/main/MainTopicPartPage.vue +88 -0
- package/app/components/main/MainTopicPartSwitch.vue +71 -0
- package/app/components/main/connections/Deps.vue +34 -0
- package/app/components/main/connections/Externals.vue +46 -0
- package/app/components/main/connections/MainConnections.vue +41 -0
- package/app/components/main/connections/MainConnectionsButton.vue +80 -0
- package/app/components/main/connections/ScrollPane.vue +11 -0
- package/app/components/main/contentStats/Item.vue +35 -0
- package/app/components/main/contentStats/ItemElement.vue +19 -0
- package/app/components/main/contentStats/ItemMaterials.vue +11 -0
- package/app/components/main/contentStats/MainContentStats.vue +50 -0
- package/app/components/preview/Preview.vue +173 -186
- package/app/components/preview/PreviewError.vue +10 -0
- package/app/components/preview/PreviewLoading.vue +5 -14
- package/app/components/preview/PreviewScreen.vue +65 -141
- package/app/components/preview/PreviewScreenButton.vue +39 -0
- package/app/components/preview/screen/ContentPage.vue +50 -0
- package/app/components/preview/screen/DirectLink.vue +23 -0
- package/app/components/preview/screen/Unique.vue +54 -0
- package/app/components/site/SiteAside.vue +70 -0
- package/app/components/site/SiteAsideOverlay.vue +21 -0
- package/app/components/site/SiteMain.vue +16 -0
- package/app/components/transition/Fade.vue +30 -19
- package/app/components/transition/Slide.vue +47 -0
- package/app/components/tree/TreeContainer.vue +5 -11
- package/app/components/tree/TreeItem.vue +40 -89
- package/app/composables/ads.ts +23 -0
- package/app/composables/analytics.ts +102 -0
- package/app/composables/appElements.ts +40 -0
- package/app/composables/aside.ts +28 -0
- package/app/composables/asideMajorPane.ts +135 -0
- package/app/composables/asideMinor.ts +109 -0
- package/app/composables/contentNav.ts +7 -0
- package/app/composables/favicon.ts +104 -4
- package/app/composables/file.ts +3 -0
- package/app/composables/formatText.ts +85 -71
- package/app/composables/loading.ts +2 -0
- package/app/composables/mainContent.ts +31 -0
- package/app/composables/og.ts +165 -0
- package/app/composables/phrases.ts +126 -81
- package/app/composables/preview.ts +53 -0
- package/app/composables/route.ts +4 -0
- package/app/composables/theme.ts +71 -29
- package/app/composables/url.ts +22 -33
- package/app/formatters/ru.ts +14 -0
- package/app/pages/article/[...articleId].vue +10 -1
- package/app/pages/book/[...bookId].vue +52 -43
- package/app/pages/contributor/[contributorId].vue +151 -0
- package/app/pages/contributors.vue +99 -0
- package/app/pages/group/[...groupId].vue +53 -59
- package/app/pages/index.vue +114 -26
- package/app/pages/page/[...pageId].vue +60 -0
- package/app/pages/practice/[...practiceId].vue +12 -0
- package/app/pages/sponsors.vue +91 -0
- package/app/pages/summary/[...summaryId].vue +10 -1
- package/app/plugins/appSetup/client/htmlBranding.ts +6 -0
- package/app/plugins/appSetup/client/welcome.ts +35 -0
- package/app/plugins/appSetup/config.ts +6 -0
- package/app/plugins/appSetup/global.ts +3 -0
- package/app/plugins/appSetup/index.ts +28 -0
- package/app/plugins/prerender.server.ts +40 -0
- package/app/router.options.ts +5 -0
- package/app/scripts/theme.js +33 -0
- package/app/styles/main.css +173 -0
- package/bin/erudit.mjs +2 -2
- package/modules/erudit/globals/content.ts +4 -0
- package/modules/erudit/globals/contributor.ts +1 -0
- package/modules/erudit/globals/eruditConfig.ts +10 -0
- package/modules/erudit/globals/problem.ts +1 -0
- package/modules/erudit/globals/prose.ts +1 -0
- package/modules/erudit/globals/public.ts +18 -0
- package/modules/erudit/index.ts +60 -0
- package/{module → modules/erudit}/logger.ts +2 -2
- package/modules/erudit/setup/aliases.ts +17 -0
- package/modules/erudit/setup/baseUrl.ts +19 -0
- package/modules/erudit/setup/elements/appTemplate.ts +45 -0
- package/modules/erudit/setup/elements/globalTemplate.ts +82 -0
- package/modules/erudit/setup/elements/globalTypes.ts +273 -0
- package/modules/erudit/setup/elements/setup.ts +167 -0
- package/modules/erudit/setup/elements/shared.ts +10 -0
- package/modules/erudit/setup/elements/tagsTable.ts +28 -0
- package/modules/erudit/setup/fullRestart.ts +71 -0
- package/modules/erudit/setup/globals.ts +196 -0
- package/modules/erudit/setup/nuxtConfig.ts +62 -0
- package/modules/erudit/setup/projectConfig.ts +114 -0
- package/modules/erudit/setup/publicAssets.ts +52 -0
- package/modules/erudit/setup/runtimeConfig.ts +58 -0
- package/modules/erudit/watcher.ts +27 -0
- package/nuxt.config.ts +66 -87
- package/package.json +38 -19
- package/proxy/prose.app.ts +1 -0
- package/proxy/prose.ts +1 -0
- package/public/favicons/default.svg +1 -0
- package/{app/public → public}/logotype.svg +1 -1
- package/public/og.png +0 -0
- package/server/api/aside/major/frontNav/book/[...shortId].ts +10 -0
- package/server/api/aside/major/frontNav/global.ts +5 -0
- package/server/api/aside/major/pages.ts +6 -0
- package/server/api/contributor/list.ts +61 -0
- package/server/api/contributor/page/[contributorId].ts +68 -0
- package/server/api/indexPage.ts +81 -0
- package/server/api/language/functions.ts +6 -7
- package/server/api/language/phrase/[phraseKey].ts +32 -0
- package/server/api/main/content/[...contentTypePath].ts +153 -0
- package/server/api/news/batch/[batchIndex].ts +5 -0
- package/server/api/pageSponsors.ts +58 -0
- package/server/api/prerender/content.ts +82 -0
- package/server/api/prerender/default.ts +35 -0
- package/server/api/prerender/files.ts +10 -0
- package/server/api/prerender/frontNav.ts +13 -0
- package/server/api/prerender/language.ts +7 -0
- package/server/api/prerender/news.ts +8 -0
- package/server/api/prerender/quotes.ts +15 -0
- package/server/api/preview/contentPage/[...contentTypePath].ts +63 -0
- package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +81 -0
- package/server/api/problemScript/[...problemScriptPath].ts +92 -0
- package/server/api/quote/data/[quoteId].ts +87 -0
- package/server/api/quote/ids.ts +3 -0
- package/server/erudit/build.ts +137 -0
- package/server/erudit/cameos/build.ts +111 -0
- package/server/erudit/config.ts +13 -0
- package/server/erudit/content/global/build.ts +271 -0
- package/server/erudit/content/global/singleton.ts +5 -0
- package/server/erudit/content/nav/build.ts +431 -0
- package/server/erudit/content/nav/front.ts +127 -0
- package/server/erudit/content/nav/repository/books.ts +40 -0
- package/server/erudit/content/nav/repository/get.ts +33 -0
- package/server/erudit/content/nav/repository/hasChildren.ts +5 -0
- package/server/erudit/content/nav/repository/hasNav.ts +3 -0
- package/server/erudit/content/nav/repository/hasParent.ts +5 -0
- package/server/erudit/content/nav/repository/id.ts +9 -0
- package/server/erudit/content/nav/repository/index.ts +9 -0
- package/server/erudit/content/nav/repository/order.ts +14 -0
- package/server/erudit/content/nav/repository/previousNext.ts +35 -0
- package/server/erudit/content/nav/repository/walk.ts +127 -0
- package/server/erudit/content/nav/setup.ts +13 -0
- package/server/erudit/content/nav/types.ts +24 -0
- package/server/erudit/content/repository/breadcrumbs.ts +24 -0
- package/server/erudit/content/repository/children.ts +47 -0
- package/server/erudit/content/repository/connections.ts +35 -0
- package/server/erudit/content/repository/contentLink.ts +16 -0
- package/server/erudit/content/repository/decoration.ts +23 -0
- package/server/erudit/content/repository/deps.ts +84 -0
- package/server/erudit/content/repository/description.ts +11 -0
- package/server/erudit/content/repository/elementSnippets.ts +65 -0
- package/server/erudit/content/repository/externals.ts +21 -0
- package/server/erudit/content/repository/flags.ts +33 -0
- package/server/erudit/content/repository/seo.ts +12 -0
- package/server/erudit/content/repository/stats.ts +97 -0
- package/server/erudit/content/repository/title.ts +27 -0
- package/server/erudit/content/repository/topicParts.ts +39 -0
- package/server/erudit/content/repository/unique.ts +76 -0
- package/server/erudit/content/resolve/book.ts +32 -0
- package/server/erudit/content/resolve/group.ts +39 -0
- package/server/erudit/content/resolve/index.ts +139 -0
- package/server/erudit/content/resolve/page.ts +87 -0
- package/server/erudit/content/resolve/topic.ts +185 -0
- package/server/erudit/content/resolve/utils/contentError.ts +10 -0
- package/server/erudit/content/resolve/utils/insertContentItem.ts +122 -0
- package/server/erudit/content/resolve/utils/insertContentResolved.ts +93 -0
- package/server/erudit/content/search.ts +135 -0
- package/server/erudit/contributors/build.ts +111 -0
- package/server/erudit/contributors/global.ts +3 -0
- package/server/erudit/contributors/repository/avatarUrl.ts +10 -0
- package/server/erudit/contributors/repository/contributions.ts +178 -0
- package/server/erudit/contributors/repository/count.ts +3 -0
- package/server/erudit/contributors/search.ts +34 -0
- package/server/erudit/db/repository/pushFile.ts +23 -0
- package/server/erudit/db/repository/pushProblemScript.ts +19 -0
- package/server/erudit/db/repository/pushProseLink.ts +40 -0
- package/server/erudit/db/schema/cameos.ts +7 -0
- package/server/erudit/db/schema/content.ts +18 -0
- package/server/erudit/db/schema/contentContributions.ts +15 -0
- package/server/erudit/db/schema/contentDeps.ts +21 -0
- package/server/erudit/db/schema/contentElementStats.ts +20 -0
- package/server/erudit/db/schema/contentProseLinks.ts +23 -0
- package/server/erudit/db/schema/contentSnippets.ts +16 -0
- package/server/erudit/db/schema/contentToc.ts +16 -0
- package/server/erudit/db/schema/contentUniques.ts +25 -0
- package/server/erudit/db/schema/contributors.ts +12 -0
- package/server/erudit/db/schema/files.ts +11 -0
- package/server/erudit/db/schema/groups.ts +6 -0
- package/server/erudit/db/schema/index.ts +17 -0
- package/server/erudit/db/schema/news.ts +7 -0
- package/server/erudit/db/schema/pages.ts +7 -0
- package/server/erudit/db/schema/problemScripts.ts +14 -0
- package/server/erudit/db/schema/sponsors.ts +9 -0
- package/server/erudit/db/schema/topics.ts +9 -0
- package/server/erudit/db/setup.ts +62 -0
- package/server/erudit/db/types.ts +10 -0
- package/server/erudit/global.ts +33 -0
- package/server/erudit/importer.ts +97 -0
- package/server/erudit/index.ts +90 -0
- package/server/erudit/language/list/en.ts +209 -0
- package/server/erudit/language/list/ru.ts +214 -0
- package/server/erudit/language/list.ts +6 -0
- package/server/erudit/language/setup.ts +36 -0
- package/server/erudit/language/types.ts +16 -0
- package/server/erudit/logger.ts +77 -0
- package/server/erudit/news/build.ts +77 -0
- package/server/erudit/news/repository/batch.ts +61 -0
- package/server/erudit/prose/repository/finalize.ts +68 -0
- package/server/erudit/prose/repository/get.ts +54 -0
- package/server/erudit/prose/repository/resolve.ts +17 -0
- package/server/erudit/prose/storage/callout.ts +14 -0
- package/server/erudit/prose/storage/image.ts +20 -0
- package/server/erudit/prose/storage/link.ts +226 -0
- package/server/erudit/prose/storage/problemScript.ts +21 -0
- package/server/erudit/prose/storage/video.ts +14 -0
- package/server/erudit/prose/transform/bundleProblemScript.ts +6 -0
- package/server/erudit/prose/transform/extensions.ts +15 -0
- package/server/erudit/quote/repository/ids.ts +31 -0
- package/server/erudit/repository.ts +96 -0
- package/server/erudit/sponsors/build.ts +114 -0
- package/server/erudit/sponsors/repository/avatarUrl.ts +10 -0
- package/server/erudit/sponsors/repository/count.ts +4 -0
- package/server/erudit/staticFile.ts +28 -0
- package/server/plugins/augmentCss.ts +17 -0
- package/server/plugins/lang.ts +7 -0
- package/server/plugins/metaViewport.ts +15 -0
- package/server/plugins/theme.ts +13 -0
- package/server/routes/file/[...path].ts +18 -0
- package/server/routes/robots.txt.ts +9 -0
- package/server/routes/search.json.gz.ts +73 -0
- package/server/routes/sitemap.xml.ts +81 -0
- package/shared/search/encoders.ts +20 -0
- package/shared/types/asideMajorPages.ts +4 -0
- package/shared/types/breadcrumbs.ts +9 -0
- package/shared/types/contentChildren.ts +10 -0
- package/shared/types/contentConnections.ts +27 -0
- package/shared/types/contentStats.ts +6 -0
- package/shared/types/elementSnippet.ts +8 -0
- package/shared/types/frontContentNav.ts +38 -0
- package/shared/types/indexPage.ts +20 -0
- package/shared/types/language.ts +189 -75
- package/shared/types/mainContent.ts +69 -0
- package/shared/types/news.ts +13 -0
- package/shared/types/preview.ts +28 -0
- package/shared/types/runtimeConfig.ts +64 -0
- package/shared/types/search.ts +79 -0
- package/shared/utils/contentTypePath.ts +63 -0
- package/shared/utils/icons.ts +11 -0
- package/shared/utils/pages.ts +24 -0
- package/shared/utils/slasher.ts +64 -0
- package/shared/utils/stringColor.ts +13 -9
- package/shared/utils/toStringEqual.ts +21 -0
- package/shared/utils/zip.ts +64 -0
- package/test/shared/utils/slasher.test.ts +75 -0
- package/test/shared/utils/zip.test.ts +8 -0
- package/tsconfig.json +17 -8
- package/app/assets/icons/alert.svg +0 -3
- package/app/assets/icons/angle-right.svg +0 -3
- package/app/assets/icons/arrow-in-text.svg +0 -3
- package/app/assets/icons/arrow-left.svg +0 -3
- package/app/assets/icons/arrow-up-to-right.svg +0 -3
- package/app/assets/icons/chip.svg +0 -3
- package/app/assets/icons/circle-help.svg +0 -3
- package/app/assets/icons/cross.svg +0 -3
- package/app/assets/icons/ellipsis-vertical.svg +0 -3
- package/app/assets/icons/file-check.svg +0 -3
- package/app/assets/icons/file-star.svg +0 -3
- package/app/assets/icons/link-external.svg +0 -3
- package/app/assets/icons/link.svg +0 -3
- package/app/assets/icons/outline/book.svg +0 -3
- package/app/assets/icons/outline/file-lines.svg +0 -3
- package/app/assets/icons/pirate.svg +0 -3
- package/app/assets/icons/search.svg +0 -3
- package/app/assets/icons/shuffle.svg +0 -3
- package/app/assets/icons/star.svg +0 -3
- package/app/components/Loading.vue +0 -23
- package/app/components/SiteAside.vue +0 -393
- package/app/components/SiteMain.vue +0 -34
- package/app/components/ads/BannerTemplate.vue +0 -51
- package/app/components/ads/BottomBanner.vue +0 -45
- package/app/components/ads/LeftBanner.vue +0 -50
- package/app/components/aside/major/PaneContentScroll.vue +0 -23
- package/app/components/aside/major/PaneSwitch.vue +0 -54
- package/app/components/aside/major/PaneSwitchButton.vue +0 -63
- package/app/components/aside/major/panes/Language.vue +0 -79
- package/app/components/aside/major/panes/Pages.vue +0 -34
- package/app/components/aside/major/panes/Search.vue +0 -11
- package/app/components/aside/major/panes/nav/Nav.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBook.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBookLoading.vue +0 -24
- package/app/components/aside/major/panes/nav/NavGlobal.vue +0 -16
- package/app/components/aside/major/panes/nav/fnav/FNav.vue +0 -105
- package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +0 -32
- package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +0 -40
- package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +0 -60
- package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +0 -34
- package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +0 -80
- package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +0 -24
- package/app/components/aside/major/panes/other/ItemContent.vue +0 -29
- package/app/components/aside/major/panes/other/ItemGenerator.vue +0 -15
- package/app/components/aside/major/panes/other/ItemTheme.vue +0 -54
- package/app/components/aside/major/panes/other/Other.vue +0 -16
- package/app/components/aside/minor/AsideMinorContributor.vue +0 -5
- package/app/components/aside/minor/AsideMinorNews.vue +0 -11
- package/app/components/aside/minor/AsideMinorTopLink.vue +0 -67
- package/app/components/aside/minor/Contribute.vue +0 -145
- package/app/components/aside/minor/content/AsideMinorContent.vue +0 -92
- package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -32
- package/app/components/aside/minor/topic/TopicContributors.vue +0 -177
- package/app/components/aside/minor/topic/TopicNav.vue +0 -49
- package/app/components/aside/minor/topic/TopicToc.vue +0 -219
- package/app/components/aside/minor/topic/TopicTocItem.vue +0 -30
- package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
- package/app/components/bitran/BitranContent.vue +0 -77
- package/app/components/bitran/RenderWrapper.vue +0 -10
- package/app/components/contributor/ContributorAvatar.vue +0 -43
- package/app/components/contributor/ContributorListItem.vue +0 -35
- package/app/components/main/topic/MainTopic.vue +0 -78
- package/app/components/main/topic/TopicPartSwitch.vue +0 -118
- package/app/components/main/utils/Breadcrumb.vue +0 -70
- package/app/components/main/utils/ContentDecoration.vue +0 -29
- package/app/components/main/utils/ContentDescription.vue +0 -19
- package/app/components/main/utils/ContentPopover.vue +0 -188
- package/app/components/main/utils/ContentPopovers.vue +0 -111
- package/app/components/main/utils/ContentReferences.vue +0 -70
- package/app/components/main/utils/ContentSection.vue +0 -45
- package/app/components/main/utils/ContentTitle.vue +0 -63
- package/app/components/main/utils/reference/ReferenceGroup.vue +0 -38
- package/app/components/main/utils/reference/ReferenceItem.vue +0 -68
- package/app/components/main/utils/reference/ReferenceSource.vue +0 -116
- package/app/components/preview/PreviewDisplay.vue +0 -139
- package/app/components/preview/PreviewFooterAction.vue +0 -73
- package/app/components/preview/display/Alert.vue +0 -50
- package/app/components/preview/display/Custom.vue +0 -18
- package/app/components/preview/display/GenericLink.vue +0 -48
- package/app/components/preview/display/PageLink.vue +0 -20
- package/app/components/preview/display/Unique.vue +0 -55
- package/app/composables/bitran.ts +0 -105
- package/app/composables/bitranContent.ts +0 -51
- package/app/composables/bitranLocation.ts +0 -7
- package/app/composables/contentData.ts +0 -36
- package/app/composables/contentPage.ts +0 -157
- package/app/composables/contentRoute.ts +0 -45
- package/app/composables/darkMagic.ts +0 -24
- package/app/composables/externalApi.ts +0 -63
- package/app/composables/majorPane.ts +0 -60
- package/app/pages/_test/preview.vue +0 -110
- package/app/pages/members.vue +0 -6
- package/app/pages/practice/[...practice].vue +0 -3
- package/app/public/favicon/article.svg +0 -10
- package/app/public/favicon/default.svg +0 -10
- package/app/public/favicon/practice.svg +0 -10
- package/app/public/favicon/summary.svg +0 -10
- package/app/public/og-default.png +0 -0
- package/app/public/user.svg +0 -10
- package/app/scripts/_immediate.js +0 -9
- package/app/scripts/aside/index.ts +0 -59
- package/app/scripts/aside/major/nav.ts +0 -26
- package/app/scripts/aside/minor/state.ts +0 -37
- package/app/scripts/aside/minor/topic.ts +0 -3
- package/app/scripts/flag.ts +0 -28
- package/app/scripts/og.ts +0 -27
- package/app/scripts/preview/build.ts +0 -73
- package/app/scripts/preview/data/alert.ts +0 -19
- package/app/scripts/preview/data/custom.ts +0 -8
- package/app/scripts/preview/data/genericLink.ts +0 -24
- package/app/scripts/preview/data/pageLink.ts +0 -22
- package/app/scripts/preview/data/unique.ts +0 -72
- package/app/scripts/preview/data.ts +0 -24
- package/app/scripts/preview/display.ts +0 -37
- package/app/scripts/preview/footer.ts +0 -9
- package/app/scripts/preview/request.ts +0 -51
- package/app/scripts/preview/state.ts +0 -63
- package/app/styles/_immediate.css +0 -7
- package/app/styles/_util.scss +0 -43
- package/app/styles/_utils.scss +0 -44
- package/app/styles/app.scss +0 -91
- package/app/styles/def/_bp.scss +0 -27
- package/app/styles/def/_size.scss +0 -7
- package/app/styles/def/_z.scss +0 -5
- package/app/styles/normalize.scss +0 -63
- package/app/styles/partials/_darkMagic.scss +0 -5
- package/app/styles/partials/_fnav.scss +0 -15
- package/app/styles/partials/_preview.scss +0 -5
- package/globalPath.ts +0 -21
- package/globals/bitran.ts +0 -2
- package/globals/content.ts +0 -22
- package/globals/contributor.ts +0 -5
- package/globals/erudit.ts +0 -5
- package/globals/register.ts +0 -18
- package/languages/en.ts +0 -95
- package/languages/ru.ts +0 -99
- package/module/bitran.ts +0 -36
- package/module/config.ts +0 -35
- package/module/imports.ts +0 -50
- package/module/index.ts +0 -47
- package/module/paths.ts +0 -22
- package/module/restart.ts +0 -61
- package/server/api/aside/major/nav/bookIds.ts +0 -5
- package/server/api/aside/major/nav/bookNav/[...bookId].ts +0 -20
- package/server/api/aside/major/nav/global.ts +0 -7
- package/server/api/aside/minor/news.ts +0 -7
- package/server/api/aside/minor/path.ts +0 -77
- package/server/api/bitran/content/[location].ts +0 -8
- package/server/api/bitran/toc/[location].ts +0 -7
- package/server/api/content/data.ts +0 -72
- package/server/api/contributor/count.ts +0 -6
- package/server/api/fake/content.ts +0 -11
- package/server/api/fake/shared/languages.ts +0 -12
- package/server/api/language/phrase/[phraseId].ts +0 -19
- package/server/api/language/phraseIds.ts +0 -8
- package/server/api/preview/page/[...parts].ts +0 -52
- package/server/api/preview/unique/[location].ts +0 -60
- package/server/plugin/bitran/content.ts +0 -194
- package/server/plugin/bitran/location.ts +0 -25
- package/server/plugin/bitran/products/include.ts +0 -228
- package/server/plugin/bitran/products/link.ts +0 -116
- package/server/plugin/bitran/setup.ts +0 -11
- package/server/plugin/bitran/toc.ts +0 -75
- package/server/plugin/bitran/transpiler.ts +0 -30
- package/server/plugin/build/close.ts +0 -10
- package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
- package/server/plugin/build/jobs/content/generic.ts +0 -176
- package/server/plugin/build/jobs/content/parse.ts +0 -109
- package/server/plugin/build/jobs/content/path.ts +0 -6
- package/server/plugin/build/jobs/content/type/book.ts +0 -9
- package/server/plugin/build/jobs/content/type/group.ts +0 -37
- package/server/plugin/build/jobs/content/type/topic.ts +0 -36
- package/server/plugin/build/jobs/contributors.ts +0 -66
- package/server/plugin/build/jobs/language.ts +0 -36
- package/server/plugin/build/jobs/nav.ts +0 -214
- package/server/plugin/build/process.ts +0 -25
- package/server/plugin/build/rebuild.ts +0 -55
- package/server/plugin/build/setup.ts +0 -22
- package/server/plugin/content/absoluteId.ts +0 -94
- package/server/plugin/content/context.ts +0 -116
- package/server/plugin/db/entities/Book.ts +0 -7
- package/server/plugin/db/entities/Content.ts +0 -49
- package/server/plugin/db/entities/Contribution.ts +0 -10
- package/server/plugin/db/entities/Contributor.ts +0 -16
- package/server/plugin/db/entities/Group.ts +0 -14
- package/server/plugin/db/entities/Hash.ts +0 -15
- package/server/plugin/db/entities/Topic.ts +0 -20
- package/server/plugin/db/entities/Unique.ts +0 -21
- package/server/plugin/db/setup.ts +0 -34
- package/server/plugin/global.ts +0 -17
- package/server/plugin/importer.ts +0 -12
- package/server/plugin/index.ts +0 -9
- package/server/plugin/logger.ts +0 -23
- package/server/plugin/nav/node.ts +0 -26
- package/server/plugin/nav/utils.ts +0 -129
- package/server/plugin/repository/book.ts +0 -21
- package/server/plugin/repository/content.ts +0 -238
- package/server/plugin/repository/contributor.ts +0 -8
- package/server/plugin/repository/frontNav.ts +0 -148
- package/server/plugin/repository/topic.ts +0 -32
- package/server/tsconfig.json +0 -9
- package/shared/aside/minor.ts +0 -51
- package/shared/asset.ts +0 -15
- package/shared/bitran/stringContent.ts +0 -6
- package/shared/bitran/toc.ts +0 -8
- package/shared/content/context.ts +0 -9
- package/shared/content/data/base.ts +0 -32
- package/shared/content/data/index.ts +0 -5
- package/shared/content/data/type/book.ts +0 -5
- package/shared/content/data/type/group.ts +0 -6
- package/shared/content/data/type/topic.ts +0 -11
- package/shared/content/previousNext.ts +0 -9
- package/shared/contributor.ts +0 -5
- package/shared/frontNav.ts +0 -41
- package/shared/icons.ts +0 -38
- package/shared/image.ts +0 -5
- package/shared/link.ts +0 -28
- package/shared/popover.ts +0 -8
- package/shared/utils/objectsEqual.ts +0 -4
- package/utils/stress.ts +0 -9
|
@@ -1,86 +1,100 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FormatTextState, FormatText } from '@erudit-js/core/formatText';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type LanguageFormatText = (text: string) => string;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return formatFunction;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type FormatFunction = (text: string) => string;
|
|
5
|
+
const formatTextLoaders: Partial<
|
|
6
|
+
Record<LanguageCode, () => Promise<{ default: LanguageFormatText }>>
|
|
7
|
+
> = {
|
|
8
|
+
ru: () => import('../formatters/ru'),
|
|
9
|
+
};
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
const formatters: FormatFunction[] = [];
|
|
11
|
+
export let formatText: FormatText;
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//
|
|
13
|
+
export async function initFormatText() {
|
|
14
|
+
const languageCode = ERUDIT.config.project.language.current;
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
const formatTextLoader =
|
|
17
|
+
languageCode in formatTextLoaders
|
|
18
|
+
? formatTextLoaders[languageCode]
|
|
19
|
+
: undefined;
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
const quoteSymbols: [string, string] = (() => {
|
|
31
|
-
switch (language) {
|
|
32
|
-
case 'ru':
|
|
33
|
-
return ['«', '»'];
|
|
34
|
-
default:
|
|
35
|
-
return ['“', '”'];
|
|
36
|
-
}
|
|
37
|
-
})();
|
|
38
|
-
|
|
39
|
-
formatters.push((text) => {
|
|
40
|
-
let open = false;
|
|
41
|
-
return text.replaceAll(/"/gm, () => {
|
|
42
|
-
return (open = !open) ? quoteSymbols[0] : quoteSymbols[1];
|
|
43
|
-
});
|
|
44
|
-
});
|
|
21
|
+
let languageFormatText: LanguageFormatText = (text) => text;
|
|
22
|
+
if (formatTextLoader) {
|
|
23
|
+
languageFormatText = (await formatTextLoader()).default;
|
|
45
24
|
}
|
|
46
25
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
26
|
+
function _formatText(text: string, state?: FormatTextState): string;
|
|
27
|
+
function _formatText(text: undefined, state?: FormatTextState): undefined;
|
|
28
|
+
function _formatText(
|
|
29
|
+
text?: string,
|
|
30
|
+
state?: FormatTextState,
|
|
31
|
+
): string | undefined;
|
|
32
|
+
function _formatText(
|
|
33
|
+
text?: string,
|
|
34
|
+
state?: FormatTextState,
|
|
35
|
+
): string | undefined {
|
|
36
|
+
if (text === undefined) {
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//
|
|
41
|
+
// Normalize spacing (new lines, spaces)
|
|
42
|
+
//
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
text = text
|
|
46
|
+
.trim()
|
|
47
|
+
.replace(/\r\n/gm, '\n')
|
|
48
|
+
.replace(/\n{3,}/gm, '\n\n')
|
|
49
|
+
.replace(/[ \t]+/gm, ' ');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//
|
|
53
|
+
// Normalize dashes
|
|
54
|
+
//
|
|
55
|
+
|
|
56
|
+
{
|
|
57
|
+
text = text.replace(/(^| )--($| )/gm, '$1—$2');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//
|
|
61
|
+
// Normalize quotes
|
|
62
|
+
//
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
const quoteSymbols: [string, string] = (() => {
|
|
66
|
+
switch (languageCode) {
|
|
67
|
+
case 'ru':
|
|
68
|
+
return ['«', '»'];
|
|
69
|
+
default:
|
|
70
|
+
return ['“', '”'];
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
|
|
74
|
+
let quoteOpen = state?.quote === 'opened';
|
|
75
|
+
text = text.replaceAll(/"/gm, () => {
|
|
76
|
+
quoteOpen = !quoteOpen;
|
|
77
|
+
if (state) {
|
|
78
|
+
state.quote = quoteOpen ? 'opened' : 'closed';
|
|
79
|
+
}
|
|
80
|
+
return quoteOpen ? quoteSymbols[0] : quoteSymbols[1];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
58
83
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
//
|
|
85
|
+
// Normalize ellipsis
|
|
86
|
+
//
|
|
62
87
|
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
{
|
|
89
|
+
text = text.replace(/\.{3}/gm, '…');
|
|
90
|
+
}
|
|
65
91
|
|
|
66
|
-
|
|
92
|
+
//
|
|
93
|
+
// Language-specific formatting
|
|
94
|
+
//
|
|
67
95
|
|
|
68
|
-
return text;
|
|
96
|
+
return languageFormatText(text);
|
|
69
97
|
}
|
|
70
98
|
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Formats prepositions in Russian text so that they are always adjacent to the next word and are not left hanging “in the air” when the line breaks.
|
|
80
|
-
*/
|
|
81
|
-
function ruStickyPrepositions(text: string): string {
|
|
82
|
-
return text.replace(
|
|
83
|
-
/ (в|не|без|для|до|за|из|к|на|над|о|об|от|по|под|при|про|с|у|через|вокруг|около|после|перед|между|внутри|вне|из-за|из-под|ради|сквозь|среди|насчёт|вследствие|благодаря|несмотря|наперекор|вопреки|подле|возле|рядом|навстречу) /gimu,
|
|
84
|
-
' $1\xa0',
|
|
85
|
-
);
|
|
99
|
+
formatText = _formatText;
|
|
86
100
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const loadingSvg =
|
|
2
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="10" height="10" x="1" y="1" fill="currentColor" rx="1"><animate id="svgSpinnersBlocksShuffle30" fill="freeze" attributeName="x" begin="0;svgSpinnersBlocksShuffle3b.end" dur="0.2s" values="1;13"/><animate id="svgSpinnersBlocksShuffle31" fill="freeze" attributeName="y" begin="svgSpinnersBlocksShuffle38.end" dur="0.2s" values="1;13"/><animate id="svgSpinnersBlocksShuffle32" fill="freeze" attributeName="x" begin="svgSpinnersBlocksShuffle39.end" dur="0.2s" values="13;1"/><animate id="svgSpinnersBlocksShuffle33" fill="freeze" attributeName="y" begin="svgSpinnersBlocksShuffle3a.end" dur="0.2s" values="13;1"/></rect><rect width="10" height="10" x="1" y="13" fill="currentColor" rx="1"><animate id="svgSpinnersBlocksShuffle34" fill="freeze" attributeName="y" begin="svgSpinnersBlocksShuffle30.end" dur="0.2s" values="13;1"/><animate id="svgSpinnersBlocksShuffle35" fill="freeze" attributeName="x" begin="svgSpinnersBlocksShuffle31.end" dur="0.2s" values="1;13"/><animate id="svgSpinnersBlocksShuffle36" fill="freeze" attributeName="y" begin="svgSpinnersBlocksShuffle32.end" dur="0.2s" values="1;13"/><animate id="svgSpinnersBlocksShuffle37" fill="freeze" attributeName="x" begin="svgSpinnersBlocksShuffle33.end" dur="0.2s" values="13;1"/></rect><rect width="10" height="10" x="13" y="13" fill="currentColor" rx="1"><animate id="svgSpinnersBlocksShuffle38" fill="freeze" attributeName="x" begin="svgSpinnersBlocksShuffle34.end" dur="0.2s" values="13;1"/><animate id="svgSpinnersBlocksShuffle39" fill="freeze" attributeName="y" begin="svgSpinnersBlocksShuffle35.end" dur="0.2s" values="13;1"/><animate id="svgSpinnersBlocksShuffle3a" fill="freeze" attributeName="x" begin="svgSpinnersBlocksShuffle36.end" dur="0.2s" values="1;13"/><animate id="svgSpinnersBlocksShuffle3b" fill="freeze" attributeName="y" begin="svgSpinnersBlocksShuffle37.end" dur="0.2s" values="1;13"/></rect></svg>';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type PayloadMainContent = {
|
|
2
|
+
contentPath: string;
|
|
3
|
+
mainContent: MainContent;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export async function useMainContent<TMainContent extends MainContent>(
|
|
7
|
+
contentTypePath: string,
|
|
8
|
+
) {
|
|
9
|
+
const nuxtApp = useNuxtApp();
|
|
10
|
+
const payloadKey = 'main-content';
|
|
11
|
+
const payloadMainContent: PayloadMainContent =
|
|
12
|
+
(nuxtApp.static.data[payloadKey] ||=
|
|
13
|
+
nuxtApp.payload.data[payloadKey] ||=
|
|
14
|
+
{});
|
|
15
|
+
|
|
16
|
+
let mainContentPromise = async () => {
|
|
17
|
+
if (payloadMainContent.contentPath !== contentTypePath) {
|
|
18
|
+
payloadMainContent.contentPath = contentTypePath;
|
|
19
|
+
payloadMainContent.mainContent = await $fetch<MainContent>(
|
|
20
|
+
'/api/main/content/' + contentTypePath,
|
|
21
|
+
{
|
|
22
|
+
responseType: 'json',
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return payloadMainContent.mainContent as TMainContent;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return mainContentPromise();
|
|
31
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { ContentSeo } from '@erudit-js/core/content/seo';
|
|
2
|
+
|
|
3
|
+
export function initOgImage() {
|
|
4
|
+
const fallbackOgImage = {
|
|
5
|
+
src: eruditPublic('og.png'),
|
|
6
|
+
width: 500,
|
|
7
|
+
height: 500,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const ogImage = ERUDIT.config.project.seo?.image || fallbackOgImage;
|
|
11
|
+
useSeoMeta({
|
|
12
|
+
ogImage: {
|
|
13
|
+
url: withFullUrl(ogImage.src),
|
|
14
|
+
width: ogImage.width,
|
|
15
|
+
height: ogImage.height,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function useIndexSeo(indexPage: IndexPage) {
|
|
21
|
+
setupSeo({
|
|
22
|
+
title: indexPage.seo?.title || indexPage.title,
|
|
23
|
+
description: indexPage.seo?.description || indexPage.description,
|
|
24
|
+
urlPath: '/',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useStandartSeo(args: {
|
|
29
|
+
title: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
urlPath: string;
|
|
32
|
+
}) {
|
|
33
|
+
const seoSiteTitle =
|
|
34
|
+
ERUDIT.config.project.seo?.siteTitle ||
|
|
35
|
+
ERUDIT.config.project.siteInfo.title ||
|
|
36
|
+
'Erudit';
|
|
37
|
+
|
|
38
|
+
const fullTitle = args.title + ' - ' + seoSiteTitle;
|
|
39
|
+
|
|
40
|
+
setupSeo({
|
|
41
|
+
title: fullTitle,
|
|
42
|
+
description: args.description,
|
|
43
|
+
urlPath: args.urlPath,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function useContentSeo(args: {
|
|
48
|
+
title: string;
|
|
49
|
+
bookTitle?: string;
|
|
50
|
+
contentTypeSuffix?: string;
|
|
51
|
+
contentTypePath: ContentTypePath;
|
|
52
|
+
description?: string;
|
|
53
|
+
seo?: ContentSeo;
|
|
54
|
+
snippets?: ElementSnippet[];
|
|
55
|
+
}) {
|
|
56
|
+
const canUseBookTitle = ERUDIT.config.project.seo?.useBookSiteTitle;
|
|
57
|
+
|
|
58
|
+
const seoSiteTitle =
|
|
59
|
+
canUseBookTitle && args.bookTitle
|
|
60
|
+
? args.bookTitle
|
|
61
|
+
: ERUDIT.config.project.seo?.siteTitle ||
|
|
62
|
+
ERUDIT.config.project.siteInfo.title ||
|
|
63
|
+
'Erudit';
|
|
64
|
+
|
|
65
|
+
const fullTitle =
|
|
66
|
+
(args.seo?.title || args.title) +
|
|
67
|
+
(args.contentTypeSuffix ? ' [' + args.contentTypeSuffix + ']' : '') +
|
|
68
|
+
' - ' +
|
|
69
|
+
seoSiteTitle;
|
|
70
|
+
|
|
71
|
+
const canonicalPath =
|
|
72
|
+
args.contentTypePath.type === 'topic'
|
|
73
|
+
? PAGES.topic(
|
|
74
|
+
args.contentTypePath.topicPart,
|
|
75
|
+
args.contentTypePath.contentId,
|
|
76
|
+
)
|
|
77
|
+
: PAGES[args.contentTypePath.type](args.contentTypePath.contentId);
|
|
78
|
+
|
|
79
|
+
const baseSeo = {
|
|
80
|
+
title: fullTitle,
|
|
81
|
+
description: args.seo?.description || args.description,
|
|
82
|
+
urlPath: canonicalPath,
|
|
83
|
+
} satisfies Parameters<typeof setupSeo>[0];
|
|
84
|
+
|
|
85
|
+
setupSeo(baseSeo);
|
|
86
|
+
|
|
87
|
+
//
|
|
88
|
+
// SEO snippets
|
|
89
|
+
//
|
|
90
|
+
|
|
91
|
+
const seoSnippets = args.snippets?.filter((snippet) => snippet.seo);
|
|
92
|
+
|
|
93
|
+
if (!import.meta.client || !seoSnippets || seoSnippets.length === 0) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const route = useRoute();
|
|
98
|
+
const anchor = computed(() => route.hash.replace('#', ''));
|
|
99
|
+
|
|
100
|
+
const stopWatch = watch(
|
|
101
|
+
anchor,
|
|
102
|
+
async (hash) => {
|
|
103
|
+
const snippet = hash
|
|
104
|
+
? seoSnippets.find((candidate) => {
|
|
105
|
+
const sameHash = candidate.link.split('#')[1] === hash;
|
|
106
|
+
const sameType =
|
|
107
|
+
candidate.link.split('/')[1] ===
|
|
108
|
+
(args.contentTypePath.type === 'topic'
|
|
109
|
+
? args.contentTypePath.topicPart
|
|
110
|
+
: args.contentTypePath.type);
|
|
111
|
+
return sameHash && sameType;
|
|
112
|
+
})
|
|
113
|
+
: undefined;
|
|
114
|
+
|
|
115
|
+
if (!snippet) {
|
|
116
|
+
setupSeo(baseSeo);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const elementPhrase = await getElementPhrase(snippet.schemaName);
|
|
121
|
+
setupSeo({
|
|
122
|
+
title: `${snippet.title} [${elementPhrase.element_name}] - ${seoSiteTitle}`,
|
|
123
|
+
description: snippet.description || '',
|
|
124
|
+
urlPath: snippet.link,
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
{ immediate: true },
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
onScopeDispose(() => stopWatch());
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function setupSeo(seo: {
|
|
134
|
+
title: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
urlPath: string;
|
|
137
|
+
}) {
|
|
138
|
+
function seoNormalize(text: string): string;
|
|
139
|
+
function seoNormalize(text: undefined): undefined;
|
|
140
|
+
function seoNormalize(text: string | undefined): string | undefined;
|
|
141
|
+
function seoNormalize(text?: string): string | undefined {
|
|
142
|
+
return text?.replace(/\s+/g, ' ').trim();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const title = seoNormalize(formatText(seo.title));
|
|
146
|
+
const description = seoNormalize(formatText(seo?.description));
|
|
147
|
+
|
|
148
|
+
useHead({
|
|
149
|
+
link: [
|
|
150
|
+
{
|
|
151
|
+
key: 'canonical',
|
|
152
|
+
rel: 'canonical',
|
|
153
|
+
href: withFullUrl(seo.urlPath),
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
useSeoMeta({
|
|
159
|
+
title,
|
|
160
|
+
description,
|
|
161
|
+
ogTitle: title,
|
|
162
|
+
ogDescription: description,
|
|
163
|
+
ogUrl: withFullUrl(seo.urlPath),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
@@ -1,81 +1,126 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
type PayloadLanguage = {
|
|
2
|
+
phrases: Partial<Record<LanguagePhraseKey, PayloadLanguagePhraseValue>>;
|
|
3
|
+
functions?: Record<string, string>;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type PhraseCaller<T extends readonly LanguagePhraseKey[]> = {
|
|
7
|
+
[K in T[number]]: LanguagePhrases[K];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const initialPayloadLanguage = {
|
|
11
|
+
phrases: {},
|
|
12
|
+
functions: undefined,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//
|
|
16
|
+
// "functions" and "phrases" exist both on server and client side
|
|
17
|
+
// On server side they serve as module-cache
|
|
18
|
+
// On client side they act as singletons for whole Nuxt App
|
|
19
|
+
// This is okay because language can't be changed after server initialization
|
|
20
|
+
//
|
|
21
|
+
|
|
22
|
+
let functions: Record<string, Function> | undefined = undefined;
|
|
23
|
+
const phrases: Partial<LanguagePhrases> = {};
|
|
24
|
+
|
|
25
|
+
export function usePhrases<const T extends readonly LanguagePhraseKey[]>(
|
|
26
|
+
...phraseKeys: T
|
|
27
|
+
): Promise<PhraseCaller<T>> {
|
|
28
|
+
const nuxtApp = useNuxtApp();
|
|
29
|
+
const payloadKey = 'raw-language';
|
|
30
|
+
const payloadLanguage: PayloadLanguage =
|
|
31
|
+
(nuxtApp.static.data[payloadKey] ||=
|
|
32
|
+
nuxtApp.payload.data[payloadKey] ||=
|
|
33
|
+
initialPayloadLanguage);
|
|
34
|
+
|
|
35
|
+
const ensureFunctionsInPayload = async () => {
|
|
36
|
+
if (payloadLanguage.functions) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const strFunctions = await $fetch<Record<string, string>>(
|
|
41
|
+
'/api/language/functions',
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
payloadLanguage.functions = strFunctions;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const restoreFunctionsFromPayload = async () => {
|
|
48
|
+
if (functions) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
functions = {};
|
|
53
|
+
for (const [funcName, funcBody] of Object.entries(
|
|
54
|
+
payloadLanguage.functions!,
|
|
55
|
+
)) {
|
|
56
|
+
functions[funcName] = new Function('return ' + funcBody)();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const processPhrase = async (phraseKey: LanguagePhraseKey) => {
|
|
61
|
+
const phraseInPayload = payloadLanguage.phrases[phraseKey];
|
|
62
|
+
const phraseRestored = phrases[phraseKey];
|
|
63
|
+
|
|
64
|
+
let payloadPhraseValue: PayloadLanguagePhraseValue;
|
|
65
|
+
|
|
66
|
+
if (phraseInPayload) {
|
|
67
|
+
payloadPhraseValue = phraseInPayload;
|
|
68
|
+
} else {
|
|
69
|
+
try {
|
|
70
|
+
payloadPhraseValue = await $fetch<PayloadLanguagePhraseValue>(
|
|
71
|
+
`/api/language/phrase/${phraseKey}`,
|
|
72
|
+
{
|
|
73
|
+
responseType: 'json',
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
payloadLanguage.phrases[phraseKey] = payloadPhraseValue;
|
|
78
|
+
} catch {
|
|
79
|
+
throw createError({
|
|
80
|
+
statusCode: 503,
|
|
81
|
+
statusMessage: 'Service Unavailable',
|
|
82
|
+
message: `Failed to fetch phrase "${phraseKey}"!`,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (payloadPhraseValue.type === 'missing') {
|
|
88
|
+
throw createError({
|
|
89
|
+
statusCode: 404,
|
|
90
|
+
statusMessage: 'Unknown phrase!',
|
|
91
|
+
message: `There is no phrase with key "${phraseKey}"!`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (phraseRestored) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
switch (payloadPhraseValue.type) {
|
|
100
|
+
case 'string':
|
|
101
|
+
phrases[phraseKey] = payloadPhraseValue.value as any;
|
|
102
|
+
break;
|
|
103
|
+
case 'function':
|
|
104
|
+
phrases[phraseKey] = new Function(
|
|
105
|
+
'funcs',
|
|
106
|
+
`
|
|
107
|
+
with (funcs) {
|
|
108
|
+
return ${payloadPhraseValue.value};
|
|
109
|
+
}
|
|
110
|
+
`,
|
|
111
|
+
)(functions!);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return Promise.resolve()
|
|
117
|
+
.then(ensureFunctionsInPayload)
|
|
118
|
+
.then(restoreFunctionsFromPayload)
|
|
119
|
+
.then(() =>
|
|
120
|
+
phraseKeys.reduce<Promise<void>>(
|
|
121
|
+
(p, key) => p.then(() => processPhrase(key)),
|
|
122
|
+
Promise.resolve(),
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
.then(() => phrases as PhraseCaller<T>);
|
|
126
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const usePreview = () => {
|
|
2
|
+
const previewState = useState<PreviewState>('preview', () => ({
|
|
3
|
+
opened: false,
|
|
4
|
+
request: undefined,
|
|
5
|
+
history: [],
|
|
6
|
+
blink: 0,
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
const hasPreviousRequest = computed(
|
|
10
|
+
() => previewState.value.history.length > 0,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
function setPreview(request: PreviewRequest) {
|
|
14
|
+
if (toStringEqual(request, previewState.value.request)) {
|
|
15
|
+
if (previewState.value.opened) {
|
|
16
|
+
previewState.value.blink += 1;
|
|
17
|
+
} else {
|
|
18
|
+
previewState.value.opened = true;
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (previewState.value.request) {
|
|
24
|
+
previewState.value.history.push(previewState.value.request);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
previewState.value.request = request;
|
|
28
|
+
previewState.value.opened = true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function setPreviousPreview() {
|
|
32
|
+
if (!hasPreviousRequest.value) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
previewState.value.request = previewState.value.history.pop();
|
|
37
|
+
previewState.value.opened = true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function closePreview() {
|
|
41
|
+
previewState.value.opened = false;
|
|
42
|
+
previewState.value.request = undefined;
|
|
43
|
+
previewState.value.history = [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
previewState,
|
|
48
|
+
hasPreviousRequest,
|
|
49
|
+
setPreview,
|
|
50
|
+
setPreviousPreview,
|
|
51
|
+
closePreview,
|
|
52
|
+
};
|
|
53
|
+
};
|