erudit 2.0.0-dev.7

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.
Files changed (314) hide show
  1. package/.nuxtrc +1 -0
  2. package/app/app.vue +172 -0
  3. package/app/assets/icons/alert.svg +3 -0
  4. package/app/assets/icons/angle-right.svg +3 -0
  5. package/app/assets/icons/arrow-in-text.svg +3 -0
  6. package/app/assets/icons/arrow-left.svg +3 -0
  7. package/app/assets/icons/arrow-up-to-right.svg +3 -0
  8. package/app/assets/icons/aside-open.svg +3 -0
  9. package/app/assets/icons/asterisk.svg +3 -0
  10. package/app/assets/icons/book-question.svg +3 -0
  11. package/app/assets/icons/book.svg +3 -0
  12. package/app/assets/icons/bug.svg +3 -0
  13. package/app/assets/icons/chip.svg +3 -0
  14. package/app/assets/icons/circle-help.svg +3 -0
  15. package/app/assets/icons/construction.svg +3 -0
  16. package/app/assets/icons/cross.svg +3 -0
  17. package/app/assets/icons/draw.svg +3 -0
  18. package/app/assets/icons/ellipsis-vertical.svg +3 -0
  19. package/app/assets/icons/file-check.svg +3 -0
  20. package/app/assets/icons/file-lines.svg +3 -0
  21. package/app/assets/icons/file-star.svg +3 -0
  22. package/app/assets/icons/folder-open.svg +3 -0
  23. package/app/assets/icons/folder.svg +3 -0
  24. package/app/assets/icons/globe.svg +3 -0
  25. package/app/assets/icons/house.svg +3 -0
  26. package/app/assets/icons/link-external.svg +3 -0
  27. package/app/assets/icons/link.svg +3 -0
  28. package/app/assets/icons/moon.svg +3 -0
  29. package/app/assets/icons/outline/book.svg +3 -0
  30. package/app/assets/icons/outline/file-lines.svg +3 -0
  31. package/app/assets/icons/pirate.svg +3 -0
  32. package/app/assets/icons/plus-circle.svg +3 -0
  33. package/app/assets/icons/plus.svg +3 -0
  34. package/app/assets/icons/puzzle.svg +3 -0
  35. package/app/assets/icons/search.svg +3 -0
  36. package/app/assets/icons/shuffle.svg +3 -0
  37. package/app/assets/icons/star.svg +3 -0
  38. package/app/assets/icons/sun-moon.svg +3 -0
  39. package/app/assets/icons/sun.svg +3 -0
  40. package/app/assets/icons/user.svg +3 -0
  41. package/app/assets/icons/users.svg +3 -0
  42. package/app/components/Loading.vue +23 -0
  43. package/app/components/SiteAside.vue +382 -0
  44. package/app/components/SiteMain.vue +35 -0
  45. package/app/components/ads/BannerTemplate.vue +51 -0
  46. package/app/components/ads/BottomBanner.vue +45 -0
  47. package/app/components/ads/LeftBanner.vue +50 -0
  48. package/app/components/aside/AsideListItem.vue +74 -0
  49. package/app/components/aside/AsideMajor.vue +56 -0
  50. package/app/components/aside/AsideMinor.vue +71 -0
  51. package/app/components/aside/major/PaneContentScroll.vue +23 -0
  52. package/app/components/aside/major/PaneSwitch.vue +54 -0
  53. package/app/components/aside/major/PaneSwitchButton.vue +63 -0
  54. package/app/components/aside/major/SiteInfo.vue +85 -0
  55. package/app/components/aside/major/panes/Language.vue +79 -0
  56. package/app/components/aside/major/panes/Pages.vue +34 -0
  57. package/app/components/aside/major/panes/Search.vue +3 -0
  58. package/app/components/aside/major/panes/nav/Nav.vue +91 -0
  59. package/app/components/aside/major/panes/nav/NavBook.vue +86 -0
  60. package/app/components/aside/major/panes/nav/NavBookLoading.vue +24 -0
  61. package/app/components/aside/major/panes/nav/NavGlobal.vue +16 -0
  62. package/app/components/aside/major/panes/nav/fnav/FNav.vue +105 -0
  63. package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +32 -0
  64. package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +40 -0
  65. package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +60 -0
  66. package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +34 -0
  67. package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +80 -0
  68. package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +24 -0
  69. package/app/components/aside/major/panes/other/ItemContent.vue +29 -0
  70. package/app/components/aside/major/panes/other/ItemGenerator.vue +15 -0
  71. package/app/components/aside/major/panes/other/ItemTheme.vue +54 -0
  72. package/app/components/aside/major/panes/other/Other.vue +16 -0
  73. package/app/components/aside/minor/AsideMinorContributor.vue +5 -0
  74. package/app/components/aside/minor/AsideMinorNews.vue +11 -0
  75. package/app/components/aside/minor/AsideMinorPane.vue +16 -0
  76. package/app/components/aside/minor/AsideMinorTopLink.vue +67 -0
  77. package/app/components/aside/minor/Contribute.vue +145 -0
  78. package/app/components/aside/minor/content/AsideMinorContent.vue +92 -0
  79. package/app/components/aside/minor/topic/AsideMinorTopic.vue +32 -0
  80. package/app/components/aside/minor/topic/TopicContributors.vue +177 -0
  81. package/app/components/aside/minor/topic/TopicNav.vue +49 -0
  82. package/app/components/aside/minor/topic/TopicToc.vue +202 -0
  83. package/app/components/aside/minor/topic/TopicTocItem.vue +31 -0
  84. package/app/components/aside/utils/AsideOverlayPane.vue +40 -0
  85. package/app/components/bitran/BitranContent.vue +64 -0
  86. package/app/components/bitran/RenderWrapper.vue +12 -0
  87. package/app/components/contributor/ContributorAvatar.vue +43 -0
  88. package/app/components/contributor/ContributorListItem.vue +35 -0
  89. package/app/components/main/topic/MainTopic.vue +79 -0
  90. package/app/components/main/topic/TopicPartSwitch.vue +118 -0
  91. package/app/components/main/utils/Breadcrumb.vue +75 -0
  92. package/app/components/main/utils/ContentDecoration.vue +29 -0
  93. package/app/components/main/utils/ContentDescription.vue +20 -0
  94. package/app/components/main/utils/ContentFlag.vue +16 -0
  95. package/app/components/main/utils/ContentPopover.vue +176 -0
  96. package/app/components/main/utils/ContentPopovers.vue +105 -0
  97. package/app/components/main/utils/ContentReferences.vue +76 -0
  98. package/app/components/main/utils/ContentSection.vue +42 -0
  99. package/app/components/main/utils/ContentTitle.vue +37 -0
  100. package/app/components/main/utils/reference/ReferenceGroup.vue +41 -0
  101. package/app/components/main/utils/reference/ReferenceItem.vue +64 -0
  102. package/app/components/main/utils/reference/ReferenceSource.vue +110 -0
  103. package/app/components/preview/Preview.vue +177 -0
  104. package/app/components/preview/PreviewDisplay.vue +139 -0
  105. package/app/components/preview/PreviewFooterAction.vue +73 -0
  106. package/app/components/preview/PreviewLoading.vue +15 -0
  107. package/app/components/preview/PreviewScreen.vue +99 -0
  108. package/app/components/preview/display/Alert.vue +50 -0
  109. package/app/components/preview/display/Custom.vue +18 -0
  110. package/app/components/preview/display/GenericLink.vue +48 -0
  111. package/app/components/preview/display/PageLink.vue +20 -0
  112. package/app/components/preview/display/Unique.vue +49 -0
  113. package/app/components/transition/Fade.vue +22 -0
  114. package/app/components/tree/TreeContainer.vue +12 -0
  115. package/app/components/tree/TreeItem.vue +89 -0
  116. package/app/composables/bitran.ts +132 -0
  117. package/app/composables/bitranContent.ts +36 -0
  118. package/app/composables/bitranLocation.ts +7 -0
  119. package/app/composables/contentData.ts +36 -0
  120. package/app/composables/contentPage.ts +156 -0
  121. package/app/composables/contentRoute.ts +45 -0
  122. package/app/composables/darkMagic.ts +24 -0
  123. package/app/composables/externalApi.ts +63 -0
  124. package/app/composables/favicon.ts +8 -0
  125. package/app/composables/formatText.ts +86 -0
  126. package/app/composables/majorPane.ts +60 -0
  127. package/app/composables/phrases.ts +80 -0
  128. package/app/composables/theme.ts +29 -0
  129. package/app/composables/url.ts +33 -0
  130. package/app/pages/_test/preview.vue +110 -0
  131. package/app/pages/article/[...articleId].vue +3 -0
  132. package/app/pages/book/[...bookId].vue +47 -0
  133. package/app/pages/group/[...groupId].vue +64 -0
  134. package/app/pages/index.vue +32 -0
  135. package/app/pages/members.vue +7 -0
  136. package/app/pages/practice/[...practice].vue +3 -0
  137. package/app/pages/summary/[...summaryId].vue +3 -0
  138. package/app/public/favicon/article.svg +10 -0
  139. package/app/public/favicon/default.svg +10 -0
  140. package/app/public/favicon/practice.svg +10 -0
  141. package/app/public/favicon/summary.svg +10 -0
  142. package/app/public/logotype.svg +17 -0
  143. package/app/public/og-default.png +0 -0
  144. package/app/public/user.svg +10 -0
  145. package/app/scripts/_immediate.js +4 -0
  146. package/app/scripts/aside/index.ts +59 -0
  147. package/app/scripts/aside/major/nav.ts +26 -0
  148. package/app/scripts/aside/minor/state.ts +37 -0
  149. package/app/scripts/aside/minor/topic.ts +3 -0
  150. package/app/scripts/flag.ts +28 -0
  151. package/app/scripts/og.ts +27 -0
  152. package/app/scripts/preview/build.ts +84 -0
  153. package/app/scripts/preview/data/alert.ts +19 -0
  154. package/app/scripts/preview/data/custom.ts +8 -0
  155. package/app/scripts/preview/data/genericLink.ts +24 -0
  156. package/app/scripts/preview/data/pageLink.ts +20 -0
  157. package/app/scripts/preview/data/unique.ts +70 -0
  158. package/app/scripts/preview/data.ts +26 -0
  159. package/app/scripts/preview/display.ts +39 -0
  160. package/app/scripts/preview/footer.ts +9 -0
  161. package/app/scripts/preview/request.ts +51 -0
  162. package/app/scripts/preview/state.ts +63 -0
  163. package/app/styles/_immediate.css +3 -0
  164. package/app/styles/_util.scss +50 -0
  165. package/app/styles/_utils.scss +44 -0
  166. package/app/styles/app.scss +91 -0
  167. package/app/styles/def/_bp.scss +24 -0
  168. package/app/styles/def/_size.scss +7 -0
  169. package/app/styles/def/_z.scss +5 -0
  170. package/app/styles/default.scss +85 -0
  171. package/app/styles/normalize.scss +63 -0
  172. package/app/styles/partials/_darkMagic.scss +7 -0
  173. package/app/styles/partials/_fnav.scss +18 -0
  174. package/app/styles/partials/_preview.scss +7 -0
  175. package/globalPath.ts +24 -0
  176. package/globals/bitran.ts +39 -0
  177. package/globals/content.ts +22 -0
  178. package/globals/contributor.ts +5 -0
  179. package/globals/erudit.ts +5 -0
  180. package/globals/register.ts +18 -0
  181. package/languages/en.ts +95 -0
  182. package/languages/ru.ts +99 -0
  183. package/module/bitran.ts +34 -0
  184. package/module/config.ts +34 -0
  185. package/module/imports.ts +46 -0
  186. package/module/index.ts +35 -0
  187. package/module/logger.ts +10 -0
  188. package/module/paths.ts +22 -0
  189. package/module/restart.ts +61 -0
  190. package/nuxt.config.ts +96 -0
  191. package/package.json +32 -0
  192. package/server/api/aside/major/nav/bookIds.ts +5 -0
  193. package/server/api/aside/major/nav/bookNav/[...bookId].ts +20 -0
  194. package/server/api/aside/major/nav/global.ts +7 -0
  195. package/server/api/aside/minor/news.ts +7 -0
  196. package/server/api/aside/minor/path.ts +78 -0
  197. package/server/api/bitran/content/[location].ts +7 -0
  198. package/server/api/bitran/toc/[location].ts +7 -0
  199. package/server/api/content/data.ts +72 -0
  200. package/server/api/contributor/count.ts +6 -0
  201. package/server/api/fake/content.ts +11 -0
  202. package/server/api/fake/shared/languages.ts +12 -0
  203. package/server/api/language/functions.ts +12 -0
  204. package/server/api/language/phrase/[phraseId].ts +19 -0
  205. package/server/api/language/phraseIds.ts +8 -0
  206. package/server/api/preview/page/[...parts].ts +51 -0
  207. package/server/api/preview/unique/[location].ts +55 -0
  208. package/server/plugin/bitran/content.ts +176 -0
  209. package/server/plugin/bitran/core.ts +51 -0
  210. package/server/plugin/bitran/location.ts +25 -0
  211. package/server/plugin/bitran/products/include.ts +229 -0
  212. package/server/plugin/bitran/products/link.ts +114 -0
  213. package/server/plugin/bitran/setup.ts +10 -0
  214. package/server/plugin/bitran/toc.ts +82 -0
  215. package/server/plugin/build/close.ts +10 -0
  216. package/server/plugin/build/jobs/content/builderArgs.ts +8 -0
  217. package/server/plugin/build/jobs/content/generic.ts +176 -0
  218. package/server/plugin/build/jobs/content/parse.ts +90 -0
  219. package/server/plugin/build/jobs/content/path.ts +6 -0
  220. package/server/plugin/build/jobs/content/type/book.ts +9 -0
  221. package/server/plugin/build/jobs/content/type/group.ts +37 -0
  222. package/server/plugin/build/jobs/content/type/topic.ts +36 -0
  223. package/server/plugin/build/jobs/contributors.ts +66 -0
  224. package/server/plugin/build/jobs/language.ts +36 -0
  225. package/server/plugin/build/jobs/nav.ts +209 -0
  226. package/server/plugin/build/process.ts +25 -0
  227. package/server/plugin/build/rebuild.ts +55 -0
  228. package/server/plugin/build/setup.ts +21 -0
  229. package/server/plugin/content/absoluteId.ts +94 -0
  230. package/server/plugin/content/context.ts +112 -0
  231. package/server/plugin/db/entities/Book.ts +7 -0
  232. package/server/plugin/db/entities/Content.ts +49 -0
  233. package/server/plugin/db/entities/Contribution.ts +10 -0
  234. package/server/plugin/db/entities/Contributor.ts +16 -0
  235. package/server/plugin/db/entities/Group.ts +14 -0
  236. package/server/plugin/db/entities/Hash.ts +15 -0
  237. package/server/plugin/db/entities/Topic.ts +20 -0
  238. package/server/plugin/db/entities/Unique.ts +21 -0
  239. package/server/plugin/db/setup.ts +34 -0
  240. package/server/plugin/global.ts +18 -0
  241. package/server/plugin/importer.ts +12 -0
  242. package/server/plugin/index.ts +9 -0
  243. package/server/plugin/logger.ts +23 -0
  244. package/server/plugin/nav/node.ts +26 -0
  245. package/server/plugin/nav/utils.ts +129 -0
  246. package/server/plugin/repository/book.ts +21 -0
  247. package/server/plugin/repository/content.ts +238 -0
  248. package/server/plugin/repository/contributor.ts +8 -0
  249. package/server/plugin/repository/frontNav.ts +148 -0
  250. package/server/plugin/repository/topic.ts +32 -0
  251. package/server/tsconfig.json +7 -0
  252. package/shared/aside/minor.ts +50 -0
  253. package/shared/asset.ts +15 -0
  254. package/shared/bitran/alias.ts +17 -0
  255. package/shared/bitran/context.ts +7 -0
  256. package/shared/bitran/location.ts +166 -0
  257. package/shared/bitran/products/alias/core/factory.ts +46 -0
  258. package/shared/bitran/products/alias/core/index.ts +13 -0
  259. package/shared/bitran/products/alias/render/Alias.vue +10 -0
  260. package/shared/bitran/products/alias/render/icon.svg +3 -0
  261. package/shared/bitran/products/alias/render/index.ts +17 -0
  262. package/shared/bitran/products/alias/render/languages/en.ts +5 -0
  263. package/shared/bitran/products/alias/render/languages/ru.ts +5 -0
  264. package/shared/bitran/products/alias/shared.ts +11 -0
  265. package/shared/bitran/products/heading/core/factory.ts +53 -0
  266. package/shared/bitran/products/heading/core/index.ts +19 -0
  267. package/shared/bitran/products/heading/render/Heading.vue +47 -0
  268. package/shared/bitran/products/heading/render/icon.svg +3 -0
  269. package/shared/bitran/products/heading/render/index.ts +17 -0
  270. package/shared/bitran/products/heading/render/languages/en.ts +5 -0
  271. package/shared/bitran/products/heading/render/languages/ru.ts +5 -0
  272. package/shared/bitran/products/heading/shared.ts +13 -0
  273. package/shared/bitran/products/include/core/factory.ts +61 -0
  274. package/shared/bitran/products/include/core/index.ts +13 -0
  275. package/shared/bitran/products/include/render/Include.vue +13 -0
  276. package/shared/bitran/products/include/render/icon.svg +3 -0
  277. package/shared/bitran/products/include/render/index.ts +18 -0
  278. package/shared/bitran/products/include/render/languages/en.ts +5 -0
  279. package/shared/bitran/products/include/render/languages/ru.ts +5 -0
  280. package/shared/bitran/products/include/shared.ts +15 -0
  281. package/shared/bitran/products/link/core/factory.ts +20 -0
  282. package/shared/bitran/products/link/core/index.ts +17 -0
  283. package/shared/bitran/products/link/render/Link.vue +174 -0
  284. package/shared/bitran/products/link/render/icon.svg +3 -0
  285. package/shared/bitran/products/link/render/index.ts +17 -0
  286. package/shared/bitran/products/link/render/languages/en.ts +5 -0
  287. package/shared/bitran/products/link/render/languages/ru.ts +5 -0
  288. package/shared/bitran/products/link/shared.ts +15 -0
  289. package/shared/bitran/products/link/target.ts +134 -0
  290. package/shared/bitran/toc.ts +8 -0
  291. package/shared/content/context.ts +9 -0
  292. package/shared/content/data/base.ts +32 -0
  293. package/shared/content/data/index.ts +5 -0
  294. package/shared/content/data/type/book.ts +5 -0
  295. package/shared/content/data/type/group.ts +6 -0
  296. package/shared/content/data/type/topic.ts +11 -0
  297. package/shared/content/previousNext.ts +9 -0
  298. package/shared/contributor.ts +5 -0
  299. package/shared/frontNav.ts +41 -0
  300. package/shared/icons.ts +38 -0
  301. package/shared/image.ts +5 -0
  302. package/shared/link.ts +25 -0
  303. package/shared/types/language.ts +75 -0
  304. package/shared/utils/objectsEqual.ts +4 -0
  305. package/shared/utils/stringColor.ts +9 -0
  306. package/test/bitran/alias.test.ts +44 -0
  307. package/test/bitran/location.test.ts +143 -0
  308. package/test/bitran/products/alias.test.ts +83 -0
  309. package/test/bitran/products/heading.test.ts +119 -0
  310. package/test/bitran/products/include.test.ts +77 -0
  311. package/test/bitran/products/link/factory.test.ts +30 -0
  312. package/test/bitran/products/link/target.test.ts +138 -0
  313. package/tsconfig.json +8 -0
  314. package/utils/stress.ts +9 -0
@@ -0,0 +1,145 @@
1
+ <script lang="ts" setup>
2
+ import eruditConfig from '#erudit/config';
3
+
4
+ import AsideOverlayPane from '../utils/AsideOverlayPane.vue';
5
+
6
+ const props = defineProps<{ fullContentId: string }>();
7
+ const phrase = await usePhrases(
8
+ 'make_contribution',
9
+ 'material_improvement',
10
+ 'edit_page',
11
+ 'how_to_improve',
12
+ 'report_problem',
13
+ );
14
+ const paneVisible = defineModel<boolean>('pane');
15
+
16
+ const issueLink = computed(() => {
17
+ const ghRepositorty = eruditConfig.repository;
18
+ return ghRepositorty
19
+ ? `https://github.com/${ghRepositorty.name}/issues/`
20
+ : null;
21
+ });
22
+
23
+ const editPageLink = computed(() => {
24
+ const ghRepository = eruditConfig.repository;
25
+ return ghRepository
26
+ ? `https://github.com/${ghRepository.name}/tree/${ghRepository.branch}/content/${props.fullContentId}`
27
+ : null;
28
+ });
29
+ </script>
30
+
31
+ <template>
32
+ <button :class="$style.contribute" @click="paneVisible = true">
33
+ <div :class="$style.icon"><MyIcon name="draw" /></div>
34
+ <div :class="$style.label">{{ phrase.make_contribution }}</div>
35
+ </button>
36
+ <TransitionFade>
37
+ <AsideOverlayPane v-if="paneVisible" stick="bottom">
38
+ <div :class="$style.paneBottomActions">
39
+ <AsideListItem
40
+ icon="circle-help"
41
+ :main="phrase.how_to_improve"
42
+ />
43
+ <AsideListItem
44
+ v-if="issueLink"
45
+ icon="bug"
46
+ :main="phrase.report_problem"
47
+ :link="issueLink"
48
+ target="_blank"
49
+ />
50
+ <AsideListItem
51
+ v-if="editPageLink"
52
+ icon="draw"
53
+ :main="phrase.edit_page"
54
+ :link="editPageLink"
55
+ target="_blank"
56
+ />
57
+ </div>
58
+ <div :class="$style.paneFooter">
59
+ <span>{{ phrase.material_improvement }}</span>
60
+ <span style="flex: 1"></span>
61
+ <MyIcon
62
+ name="cross"
63
+ :class="$style.close"
64
+ @click="paneVisible = false"
65
+ />
66
+ </div>
67
+ </AsideOverlayPane>
68
+ </TransitionFade>
69
+ </template>
70
+
71
+ <style lang="scss" module>
72
+ .contribute {
73
+ display: flex;
74
+ gap: var(--gap);
75
+ align-items: center;
76
+ border: none;
77
+ border-top: 1px solid var(--border);
78
+ padding: var(--gap);
79
+ background: transparent;
80
+ cursor: pointer;
81
+ @include transition(background);
82
+
83
+ &:hover {
84
+ background: var(--bgAccent);
85
+ .icon {
86
+ border-color: var(--textDimmed);
87
+ }
88
+ .label {
89
+ color: var(--text);
90
+ }
91
+ }
92
+
93
+ .icon {
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ width: 40px;
98
+ height: 40px;
99
+ border: 3px dashed var(--border);
100
+ border-radius: 50%;
101
+ color: var(--textMuted);
102
+ @include transition(border-color);
103
+ }
104
+
105
+ .label {
106
+ color: var(--textMuted);
107
+ @include transition(color);
108
+ }
109
+ }
110
+
111
+ .paneBottomActions {
112
+ overflow: auto;
113
+ @include scroll;
114
+
115
+ > * {
116
+ border-bottom: none !important;
117
+ border-top: 1px solid var(--border);
118
+ min-height: 70px;
119
+ }
120
+ }
121
+
122
+ .paneFooter {
123
+ display: flex;
124
+ align-items: center;
125
+ gap: var(--gap);
126
+ border-top: 1px solid var(--border);
127
+ height: 70px;
128
+ padding-left: var(--gap);
129
+ font-size: 1.1em;
130
+ font-weight: 600;
131
+
132
+ .close {
133
+ cursor: pointer;
134
+ padding: var(--gap);
135
+ font-size: 20px;
136
+ color: var(--textMuted);
137
+
138
+ @include transition(color);
139
+
140
+ &:hover {
141
+ color: var(--text);
142
+ }
143
+ }
144
+ }
145
+ </style>
@@ -0,0 +1,92 @@
1
+ <script lang="ts" setup>
2
+ import type { AsideMinorContent } from '@shared/aside/minor';
3
+ import { injectAsideData } from '@app/scripts/aside/minor/state';
4
+
5
+ const contentData = injectAsideData<AsideMinorContent>();
6
+ const phrase = await usePhrases('contributors', 'no_contributors');
7
+ const contributePaneVisible = ref(false);
8
+
9
+ watch(contentData, () => (contributePaneVisible.value = false));
10
+ </script>
11
+
12
+ <template>
13
+ <AsideMinorPane :class="$style.asideMinorContent">
14
+ <section :class="$style.contentNav">
15
+ <AsideMinorTopLink
16
+ :title="contentData.nav?.previous?.title"
17
+ :link="contentData.nav?.previous?.link"
18
+ :icon="'arrow-left'"
19
+ />
20
+
21
+ <div :class="$style.title">
22
+ {{ phrase.contributors }}:
23
+ <span>{{ contentData.contributors?.length || 0 }}</span>
24
+ </div>
25
+
26
+ <AsideMinorTopLink
27
+ :title="contentData.nav?.next?.title"
28
+ :link="contentData.nav?.next?.link"
29
+ :icon="'arrow-left'"
30
+ class="icon-flip-h"
31
+ />
32
+ </section>
33
+ <section v-if="contentData.contributors" :class="$style.contributors">
34
+ <ContributorListItem
35
+ v-for="contributor of contentData.contributors"
36
+ v-bind="contributor"
37
+ />
38
+ </section>
39
+ <section v-else :class="$style.noContributors">
40
+ {{ phrase.no_contributors }}
41
+ </section>
42
+ <AsideMinorContribute
43
+ :fullContentId="contentData.fullContentId"
44
+ v-model:pane="contributePaneVisible"
45
+ />
46
+ </AsideMinorPane>
47
+ </template>
48
+
49
+ <style lang="scss" module>
50
+ .asideMinorContent {
51
+ display: flex;
52
+ flex-direction: column;
53
+
54
+ .contentNav {
55
+ border-bottom: 1px solid var(--border);
56
+ display: flex;
57
+ justify-content: center;
58
+ align-items: center;
59
+ gap: 10px;
60
+
61
+ .title {
62
+ text-align: center;
63
+ color: var(--text);
64
+ font-size: 1.1em;
65
+ font-weight: 600;
66
+ width: 158px;
67
+
68
+ span {
69
+ padding-left: var(--gap);
70
+ color: var(--textMuted);
71
+ }
72
+ }
73
+ }
74
+
75
+ .contributors {
76
+ flex: 1;
77
+ overflow: auto;
78
+ @include scroll;
79
+
80
+ > * {
81
+ border-bottom: 1px solid var(--border);
82
+ }
83
+ }
84
+
85
+ .noContributors {
86
+ flex: 1;
87
+ text-align: center;
88
+ padding: var(--gap);
89
+ color: var(--textMuted);
90
+ }
91
+ }
92
+ </style>
@@ -0,0 +1,32 @@
1
+ <script lang="ts" setup>
2
+ import type { AsideMinorTopic } from '@shared/aside/minor';
3
+ import { injectAsideData } from '@app/scripts/aside/minor/state';
4
+
5
+ import TopicNav from './TopicNav.vue';
6
+ import TopicToc from './TopicToc.vue';
7
+ import TopicContributors from './TopicContributors.vue';
8
+
9
+ const topicData = injectAsideData<AsideMinorTopic>();
10
+ const contributePaneVisible = ref(false);
11
+
12
+ watch(topicData, () => (contributePaneVisible.value = false));
13
+ </script>
14
+
15
+ <template>
16
+ <AsideMinorPane :class="$style.asideMinorTopic">
17
+ <TopicNav />
18
+ <TopicToc />
19
+ <TopicContributors v-if="topicData.contributors" />
20
+ <AsideMinorContribute
21
+ :fullContentId="topicData.fullContentId"
22
+ v-model:pane="contributePaneVisible"
23
+ />
24
+ </AsideMinorPane>
25
+ </template>
26
+
27
+ <style lang="scss" module>
28
+ .asideMinorTopic {
29
+ display: flex;
30
+ flex-direction: column;
31
+ }
32
+ </style>
@@ -0,0 +1,177 @@
1
+ <script lang="ts" setup>
2
+ import { injectAsideData } from '@app/scripts/aside/minor/state';
3
+ import { type AsideMinorTopic } from '@shared/aside/minor';
4
+
5
+ import AsideOverlayPane from '../../utils/AsideOverlayPane.vue';
6
+ import type { ContentContributor } from '@shared/contributor';
7
+
8
+ const phrase = await usePhrases('contributors');
9
+ const topicData = injectAsideData<AsideMinorTopic>();
10
+ const listPaneVisible = ref(false);
11
+
12
+ const showcaseMax = 4;
13
+ const showcase = shallowRef<ContentContributor[]>();
14
+
15
+ const counter = computed(() => {
16
+ const toShow = Math.min(showcaseMax, topicData.value.contributors!.length);
17
+
18
+ return {
19
+ showcase: toShow,
20
+ rest: topicData.value.contributors!.length - toShow,
21
+ };
22
+ });
23
+
24
+ let previousFullId: string;
25
+
26
+ onMounted(() => {
27
+ watch(
28
+ topicData,
29
+ () => {
30
+ if (previousFullId === topicData.value.fullContentId) return;
31
+
32
+ previousFullId = topicData.value.fullContentId;
33
+ showcase.value = [...topicData.value.contributors!]
34
+ .sort(() => 0.5 - Math.random())
35
+ .slice(0, counter.value.showcase);
36
+ listPaneVisible.value = false;
37
+ },
38
+ { immediate: true },
39
+ );
40
+ });
41
+ </script>
42
+
43
+ <template>
44
+ <section :class="$style.topicContributors" @click="listPaneVisible = true">
45
+ <div :class="$style.showcase">
46
+ <template v-if="showcase">
47
+ <ContributorAvatar
48
+ v-for="contributor of showcase"
49
+ :contributorId="contributor.contributorId"
50
+ :avatar="contributor.avatar"
51
+ :class="$style.avatar"
52
+ />
53
+ </template>
54
+ <template v-else>
55
+ <div
56
+ v-if="!showcase"
57
+ v-for="i in counter.showcase"
58
+ :class="$style.avatarReplacer"
59
+ ></div>
60
+ </template>
61
+ </div>
62
+ <div v-if="counter.rest" :class="$style.restCounter">
63
+ + {{ counter.rest }}
64
+ </div>
65
+ </section>
66
+ <TransitionFade>
67
+ <AsideOverlayPane v-if="listPaneVisible" stick="bottom">
68
+ <div :class="$style.paneList">
69
+ <ContributorListItem
70
+ v-for="contributor of topicData.contributors"
71
+ v-bind="contributor"
72
+ />
73
+ </div>
74
+ <div :class="$style.paneFooter">
75
+ <span>{{ phrase.contributors }}:</span>
76
+ <span :class="$style.counter">{{
77
+ topicData.contributors!.length
78
+ }}</span>
79
+ <span style="flex: 1"></span>
80
+ <MyIcon
81
+ name="cross"
82
+ :class="$style.close"
83
+ @click="listPaneVisible = false"
84
+ />
85
+ </div>
86
+ </AsideOverlayPane>
87
+ </TransitionFade>
88
+ </template>
89
+
90
+ <style lang="scss" module>
91
+ .topicContributors {
92
+ border-top: 1px solid var(--border);
93
+ padding: var(--gap);
94
+ display: flex;
95
+ align-items: center;
96
+ gap: var(--gap);
97
+ cursor: pointer;
98
+ background: transparent;
99
+
100
+ @include transition(background);
101
+
102
+ &:hover {
103
+ background: var(--bgAccent);
104
+ }
105
+ }
106
+
107
+ .showcase {
108
+ $showcaseAvatarSize: 40px;
109
+
110
+ display: flex;
111
+ gap: var(--gap);
112
+
113
+ .avatar,
114
+ .avatarReplacer {
115
+ width: #{$showcaseAvatarSize};
116
+ height: #{$showcaseAvatarSize};
117
+ }
118
+
119
+ .avatarReplacer {
120
+ border-radius: 50%;
121
+ background: var(--textDimmed);
122
+ animation: avatarReplacer 500ms infinite ease-in-out alternate;
123
+ }
124
+ }
125
+
126
+ .restCounter {
127
+ color: var(--textMuted);
128
+ font-size: 1.1em;
129
+ font-weight: 600;
130
+ }
131
+
132
+ @keyframes avatarReplacer {
133
+ from {
134
+ opacity: 0.625;
135
+ }
136
+ to {
137
+ opacity: 0.4;
138
+ }
139
+ }
140
+
141
+ .paneList {
142
+ overflow: auto;
143
+ @include scroll;
144
+
145
+ > * {
146
+ border-top: 1px solid var(--border);
147
+ }
148
+ }
149
+
150
+ .paneFooter {
151
+ display: flex;
152
+ align-items: center;
153
+ gap: var(--gap);
154
+ border-top: 1px solid var(--border);
155
+ height: 70px;
156
+ padding-left: var(--gap);
157
+ font-size: 1.1em;
158
+ font-weight: 600;
159
+
160
+ .counter {
161
+ color: var(--textMuted);
162
+ }
163
+
164
+ .close {
165
+ cursor: pointer;
166
+ padding: var(--gap);
167
+ font-size: 20px;
168
+ color: var(--textMuted);
169
+
170
+ @include transition(color);
171
+
172
+ &:hover {
173
+ color: var(--text);
174
+ }
175
+ }
176
+ }
177
+ </style>
@@ -0,0 +1,49 @@
1
+ <script lang="ts" setup>
2
+ import { topicParts, type TopicPart } from 'erudit-cog/schema';
3
+
4
+ import { injectAsideData } from '@app/scripts/aside/minor/state';
5
+ import type { AsideMinorTopic } from '@shared/aside/minor';
6
+ import { TOPIC_PART_ICON } from '@erudit/shared/icons';
7
+
8
+ const phrase = await usePhrases('article', 'summary', 'practice');
9
+
10
+ const topicData = injectAsideData<AsideMinorTopic>();
11
+
12
+ const currentTopicPart = computed(() => {
13
+ return topicData.value.location.type as TopicPart;
14
+ });
15
+ </script>
16
+
17
+ <template>
18
+ <section :class="$style.topicNav">
19
+ <AsideMinorTopLink
20
+ :title="topicData.nav?.previous?.title"
21
+ :link="topicData.nav?.previous?.link"
22
+ :icon="'arrow-left'"
23
+ />
24
+
25
+ <AsideMinorTopLink
26
+ v-for="topicPart of topicParts"
27
+ :title="phrase[topicPart]"
28
+ :icon="TOPIC_PART_ICON[topicPart]"
29
+ :link="topicData.nav?.[topicPart]"
30
+ :active="topicPart === currentTopicPart"
31
+ />
32
+
33
+ <AsideMinorTopLink
34
+ :title="topicData.nav?.next?.title"
35
+ :link="topicData.nav?.next?.link"
36
+ :icon="'arrow-left'"
37
+ class="icon-flip-h"
38
+ />
39
+ </section>
40
+ </template>
41
+
42
+ <style lang="scss" module>
43
+ .topicNav {
44
+ border-bottom: 1px solid var(--border);
45
+ display: flex;
46
+ justify-content: center;
47
+ gap: 10px;
48
+ }
49
+ </style>
@@ -0,0 +1,202 @@
1
+ <script lang="ts" setup>
2
+ import { stringifyBitranLocation } from '@shared/bitran/location';
3
+ import type { TocItem } from '@erudit/shared/bitran/toc';
4
+ import { headingName } from '@shared/bitran/products/heading/shared';
5
+ import { topicLocation } from '@app/scripts/aside/minor/topic';
6
+ import { injectAsideData } from '@app/scripts/aside/minor/state';
7
+ import type { AsideMinorTopic } from '@shared/aside/minor';
8
+
9
+ import TopicTocItem from './TopicTocItem.vue';
10
+
11
+ interface RuntimeTocItem extends TocItem {
12
+ /**
13
+ * * `0` — Not active
14
+ * * `1` — Active for `window` events
15
+ * * `2` — Active for Intersection Observer and currently in viewport
16
+ */
17
+ _active: 0 | 1 | 2;
18
+ _position: number;
19
+ }
20
+
21
+ type RuntimeToc = RuntimeTocItem[];
22
+
23
+ const topicData = injectAsideData<AsideMinorTopic>();
24
+ const phrase = await usePhrases('empty_toc');
25
+ const runtimeToc = ref<RuntimeToc>();
26
+ const tocStateKey = ref(0);
27
+
28
+ watch(topicData, setupRuntimeToc);
29
+ setupRuntimeToc();
30
+
31
+ function setupRuntimeToc() {
32
+ const _newToc: RuntimeToc = [];
33
+
34
+ for (let i = 0; i < topicData.value.toc.length; i++) {
35
+ _newToc.push({
36
+ ...topicData.value.toc[i]!,
37
+ _active: 0,
38
+ _position: i,
39
+ });
40
+ }
41
+
42
+ tocStateKey.value++;
43
+ runtimeToc.value = _newToc;
44
+ }
45
+
46
+ //
47
+ // Live TOC
48
+ //
49
+
50
+ let observer: IntersectionObserver;
51
+ let id2TocItemIndex: Record<string, number> = {};
52
+
53
+ const windowEvents = ['DOMContentLoaded', 'load', 'resize', 'scroll'];
54
+ let headings: RuntimeTocItem[];
55
+ let closestAboveHeading: RuntimeTocItem;
56
+
57
+ function disableLiveToc() {
58
+ // Live TOC heading with `window` events
59
+
60
+ for (const event of windowEvents)
61
+ window.removeEventListener(event, updateActiveTopHeading);
62
+
63
+ headings = closestAboveHeading = null;
64
+
65
+ // Live TOC with Intersection Observer
66
+
67
+ id2TocItemIndex = null;
68
+
69
+ observer?.disconnect();
70
+ observer = null;
71
+
72
+ //
73
+
74
+ if (runtimeToc.value?.length) {
75
+ for (const tocItem of runtimeToc.value) tocItem._active = 0;
76
+ }
77
+ }
78
+
79
+ function enableLiveToc() {
80
+ if (!runtimeToc.value?.length) return;
81
+
82
+ // Live TOC heading with `window` events
83
+
84
+ headings = runtimeToc.value.filter(
85
+ (item) => item.productName === headingName,
86
+ );
87
+
88
+ for (const event of windowEvents)
89
+ window.addEventListener(event, updateActiveTopHeading);
90
+
91
+ updateActiveTopHeading();
92
+
93
+ // Live TOC with Intersection Observer
94
+
95
+ observer = new IntersectionObserver(intersectionTrigger);
96
+ id2TocItemIndex = {};
97
+
98
+ for (const tocItem of runtimeToc.value) {
99
+ const id = tocItem.id;
100
+ id2TocItemIndex[id] = tocItem._position;
101
+ observer.observe(document.getElementById(id));
102
+ }
103
+ }
104
+
105
+ function updateActiveTopHeading() {
106
+ function getBottom(id: string) {
107
+ const defaultBottom = 1;
108
+ const element = document.getElementById(id);
109
+ return element ? element.getBoundingClientRect().bottom : defaultBottom;
110
+ }
111
+
112
+ if (closestAboveHeading) {
113
+ closestAboveHeading._active = closestAboveHeading._active === 2 ? 2 : 0;
114
+ closestAboveHeading = null;
115
+ }
116
+
117
+ if (runtimeToc.value?.length) {
118
+ let topIndex = 0;
119
+ let bottomIndex = headings.length;
120
+ let targetIndex = 0;
121
+
122
+ while (topIndex < bottomIndex) {
123
+ const middleIndex = ((topIndex + bottomIndex) / 2) | 0;
124
+ const middleHeading = headings[middleIndex];
125
+ const middleHeadingTop = getBottom(middleHeading.id);
126
+
127
+ if (middleHeadingTop <= 0) {
128
+ targetIndex = middleIndex;
129
+ topIndex = middleIndex + 1;
130
+ } else {
131
+ bottomIndex = middleIndex;
132
+ }
133
+ }
134
+
135
+ closestAboveHeading = headings[targetIndex];
136
+ if (closestAboveHeading && closestAboveHeading._active < 2)
137
+ closestAboveHeading._active =
138
+ getBottom(closestAboveHeading.id) <= 0 ? 1 : 0;
139
+ }
140
+ }
141
+
142
+ function intersectionTrigger(entries: IntersectionObserverEntry[]) {
143
+ for (const entry of entries) {
144
+ const tocItem = runtimeToc.value[id2TocItemIndex[entry.target.id]];
145
+ tocItem._active = entry.isIntersecting
146
+ ? 2
147
+ : tocItem._active === 1
148
+ ? 1
149
+ : 0;
150
+ }
151
+ }
152
+
153
+ onMounted(() => {
154
+ watch(
155
+ [topicData, topicLocation],
156
+ () => {
157
+ disableLiveToc();
158
+
159
+ if (!topicData.value.location || !topicLocation.value) return;
160
+
161
+ if (
162
+ stringifyBitranLocation(topicData.value.location) ===
163
+ stringifyBitranLocation(topicLocation.value)
164
+ )
165
+ enableLiveToc();
166
+ },
167
+ { immediate: true },
168
+ );
169
+ });
170
+
171
+ onUnmounted(() => {
172
+ disableLiveToc();
173
+ });
174
+ </script>
175
+
176
+ <template>
177
+ <section :class="$style.topicToc">
178
+ <TreeContainer v-if="runtimeToc.length > 0">
179
+ <TopicTocItem
180
+ v-for="tocItem of runtimeToc"
181
+ v-memo="[tocStateKey, tocItem.id, tocItem._active]"
182
+ :active="!!tocItem._active"
183
+ :tocItem
184
+ />
185
+ </TreeContainer>
186
+ <div v-else :class="$style.tocEmpty">{{ phrase.empty_toc }}</div>
187
+ </section>
188
+ </template>
189
+
190
+ <style lang="scss" module>
191
+ .topicToc {
192
+ flex: 1;
193
+ overflow: auto;
194
+ @include scroll();
195
+ }
196
+
197
+ .tocEmpty {
198
+ padding: var(--gap);
199
+ text-align: center;
200
+ color: var(--textMuted);
201
+ }
202
+ </style>