erudit 3.0.0-dev.17 → 3.0.0-dev.19

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 (250) hide show
  1. package/app/app.vue +193 -191
  2. package/app/assets/icons/graduation.svg +3 -0
  3. package/app/components/Loading.vue +23 -23
  4. package/app/components/SiteAside.vue +393 -393
  5. package/app/components/SiteMain.vue +32 -32
  6. package/app/components/aside/AsideListItem.vue +74 -74
  7. package/app/components/aside/AsideMajor.vue +56 -56
  8. package/app/components/aside/AsideMinor.vue +97 -73
  9. package/app/components/aside/major/PaneContentScroll.vue +23 -23
  10. package/app/components/aside/major/PaneSwitch.vue +54 -54
  11. package/app/components/aside/major/PaneSwitchButton.vue +63 -63
  12. package/app/components/aside/major/SiteInfo.vue +85 -85
  13. package/app/components/aside/major/panes/Language.vue +79 -79
  14. package/app/components/aside/major/panes/Pages.vue +31 -34
  15. package/app/components/aside/major/panes/Search.vue +11 -11
  16. package/app/components/aside/major/panes/nav/Nav.vue +92 -92
  17. package/app/components/aside/major/panes/nav/NavBook.vue +95 -95
  18. package/app/components/aside/major/panes/nav/NavBookLoading.vue +24 -24
  19. package/app/components/aside/major/panes/nav/NavGlobal.vue +16 -16
  20. package/app/components/aside/major/panes/nav/fnav/FNav.vue +105 -105
  21. package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +32 -32
  22. package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +40 -40
  23. package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +60 -60
  24. package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +34 -34
  25. package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +80 -80
  26. package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +24 -24
  27. package/app/components/aside/major/panes/other/ItemContent.vue +29 -29
  28. package/app/components/aside/major/panes/other/ItemGenerator.vue +13 -13
  29. package/app/components/aside/major/panes/other/ItemTheme.vue +54 -54
  30. package/app/components/aside/major/panes/other/Other.vue +16 -16
  31. package/app/components/aside/minor/{Contribute.vue → AsideMinorContribute.vue} +175 -145
  32. package/app/components/aside/minor/AsideMinorNews.vue +11 -11
  33. package/app/components/aside/minor/AsideMinorPane.vue +15 -15
  34. package/app/components/aside/minor/AsideMinorTopLink.vue +67 -67
  35. package/app/components/aside/minor/content/AsideMinorContent.vue +89 -92
  36. package/app/components/aside/minor/contributor/AsideMinorContributor.vue +78 -0
  37. package/app/components/aside/minor/contributor/BookContribution.vue +64 -0
  38. package/app/components/aside/minor/topic/AsideMinorTopic.vue +29 -32
  39. package/app/components/aside/minor/topic/TopicContributors.vue +177 -177
  40. package/app/components/aside/minor/topic/TopicNav.vue +49 -49
  41. package/app/components/aside/minor/topic/TopicToc.vue +213 -214
  42. package/app/components/aside/minor/topic/TopicTocItem.vue +32 -32
  43. package/app/components/aside/utils/AsideOverlayPane.vue +40 -40
  44. package/app/components/bitran/BitranContent.vue +90 -91
  45. package/app/components/bitran/RenderWrapper.vue +10 -10
  46. package/app/components/contributor/ContributorAvatar.vue +45 -45
  47. package/app/components/contributor/ContributorListItem.vue +35 -35
  48. package/app/components/main/MainBitranContent.vue +41 -0
  49. package/app/components/main/{utils/Breadcrumb.vue → MainBreadcrumb.vue} +67 -74
  50. package/app/components/main/MainDescription.vue +24 -0
  51. package/app/components/main/{utils/ContentTitle.vue → MainTitle.vue} +72 -63
  52. package/app/components/main/content/ContentBreadcrumb.vue +28 -0
  53. package/app/components/main/{utils → content}/ContentDecoration.vue +29 -29
  54. package/app/components/main/{utils → content}/ContentPopover.vue +188 -188
  55. package/app/components/main/{utils → content}/ContentPopovers.vue +111 -111
  56. package/app/components/main/{utils → content}/ContentReferences.vue +70 -70
  57. package/app/components/main/{utils → content}/ContentSection.vue +45 -45
  58. package/app/components/main/{utils → content}/reference/ReferenceGroup.vue +38 -38
  59. package/app/components/main/{utils → content}/reference/ReferenceItem.vue +70 -70
  60. package/app/components/main/{utils → content}/reference/ReferenceSource.vue +120 -120
  61. package/app/components/main/topic/MainTopic.vue +83 -88
  62. package/app/components/main/topic/TopicPartSwitch.vue +124 -118
  63. package/app/components/preview/Preview.vue +186 -186
  64. package/app/components/preview/PreviewDisplay.vue +139 -139
  65. package/app/components/preview/PreviewFooterAction.vue +73 -73
  66. package/app/components/preview/PreviewLoading.vue +14 -14
  67. package/app/components/preview/PreviewScreen.vue +141 -141
  68. package/app/components/preview/display/Alert.vue +50 -50
  69. package/app/components/preview/display/Custom.vue +18 -18
  70. package/app/components/preview/display/GenericLink.vue +48 -48
  71. package/app/components/preview/display/PageLink.vue +22 -22
  72. package/app/components/preview/display/Unique.vue +46 -55
  73. package/app/components/transition/Fade.vue +19 -19
  74. package/app/components/tree/TreeContainer.vue +11 -11
  75. package/app/components/tree/TreeItem.vue +89 -89
  76. package/app/composables/adsAllowed.ts +11 -0
  77. package/app/composables/bitran.ts +108 -108
  78. package/app/composables/bitranLocation.ts +7 -7
  79. package/app/composables/contentData.ts +38 -38
  80. package/app/composables/contentPage.ts +168 -158
  81. package/app/composables/contentRoute.ts +45 -45
  82. package/app/composables/darkMagic.ts +24 -24
  83. package/app/composables/externalApi.ts +69 -69
  84. package/app/composables/favicon.ts +8 -8
  85. package/app/composables/formatText.ts +99 -99
  86. package/app/composables/majorPane.ts +61 -60
  87. package/app/composables/phrases.ts +77 -65
  88. package/app/composables/theme.ts +29 -29
  89. package/app/composables/url.ts +33 -33
  90. package/app/pages/_test/preview.vue +110 -110
  91. package/app/pages/article/[...articleId].vue +3 -3
  92. package/app/pages/book/[...bookId].vue +42 -47
  93. package/app/pages/contributor/[contributorId].vue +225 -0
  94. package/app/pages/contributors.vue +183 -0
  95. package/app/pages/group/[...groupId].vue +58 -66
  96. package/app/pages/index.vue +32 -32
  97. package/app/pages/practice/[...practice].vue +3 -3
  98. package/app/pages/summary/[...summaryId].vue +3 -3
  99. package/app/plugins/analytics.ts +8 -0
  100. package/app/plugins/prerender.server.ts +22 -22
  101. package/app/scripts/_immediate.js +9 -9
  102. package/app/scripts/aside/index.ts +59 -59
  103. package/app/scripts/aside/major/nav.ts +26 -26
  104. package/app/scripts/aside/minor/state.ts +37 -37
  105. package/app/scripts/aside/minor/topic.ts +3 -3
  106. package/app/scripts/flag.ts +28 -28
  107. package/app/scripts/og.ts +27 -27
  108. package/app/scripts/preview/build.ts +76 -76
  109. package/app/scripts/preview/data/alert.ts +19 -19
  110. package/app/scripts/preview/data/custom.ts +8 -8
  111. package/app/scripts/preview/data/genericLink.ts +24 -24
  112. package/app/scripts/preview/data/pageLink.ts +23 -23
  113. package/app/scripts/preview/data/unique.ts +69 -72
  114. package/app/scripts/preview/data.ts +24 -24
  115. package/app/scripts/preview/display.ts +37 -37
  116. package/app/scripts/preview/footer.ts +9 -9
  117. package/app/scripts/preview/request.ts +51 -51
  118. package/app/scripts/preview/state.ts +63 -63
  119. package/app/styles/_immediate.css +7 -7
  120. package/app/styles/_util.scss +43 -43
  121. package/app/styles/_utils.scss +44 -44
  122. package/app/styles/app.scss +91 -91
  123. package/app/styles/def/_bp.scss +27 -27
  124. package/app/styles/def/_size.scss +7 -7
  125. package/app/styles/def/_z.scss +5 -5
  126. package/app/styles/normalize.scss +49 -49
  127. package/app/styles/partials/_darkMagic.scss +5 -5
  128. package/app/styles/partials/_fnav.scss +15 -15
  129. package/app/styles/partials/_preview.scss +5 -5
  130. package/bin/erudit.mjs +2 -2
  131. package/const.ts +4 -4
  132. package/globalPath.ts +21 -21
  133. package/globals/bitran.ts +1 -1
  134. package/globals/content.ts +27 -27
  135. package/globals/contributor.ts +5 -5
  136. package/globals/erudit.ts +5 -5
  137. package/globals/register.ts +18 -18
  138. package/languages/en.ts +103 -94
  139. package/languages/ru.ts +107 -98
  140. package/module/bitran.ts +66 -66
  141. package/module/config.ts +35 -35
  142. package/module/imports.ts +67 -67
  143. package/module/index.ts +47 -47
  144. package/module/logger.ts +10 -10
  145. package/module/paths.ts +22 -22
  146. package/module/restart.ts +61 -61
  147. package/nuxt.config.ts +131 -131
  148. package/package.json +5 -5
  149. package/server/api/aside/major/nav/bookIds.ts +5 -5
  150. package/server/api/aside/major/nav/bookNav/[...bookId].ts +17 -20
  151. package/server/api/aside/major/nav/global.ts +7 -7
  152. package/server/api/aside/minor/book/[...bookId].ts +18 -0
  153. package/server/api/aside/minor/contributor/[contributorId].ts +18 -0
  154. package/server/api/aside/minor/group/[...groupId].ts +18 -0
  155. package/server/api/aside/minor/news.ts +7 -7
  156. package/server/api/aside/minor/topic.ts +36 -0
  157. package/server/api/bitran/content/[...location].ts +13 -10
  158. package/server/api/bitran/toc/[...location].ts +9 -9
  159. package/server/api/content/data.ts +75 -75
  160. package/server/api/contributor/count.ts +6 -6
  161. package/server/api/contributor/list.ts +44 -0
  162. package/server/api/contributor/page/[contributorId].ts +14 -0
  163. package/server/api/fake/content.ts +11 -11
  164. package/server/api/fake/shared/languages.ts +12 -12
  165. package/server/api/language/functions.ts +12 -12
  166. package/server/api/language/phrase/[phraseId].ts +19 -19
  167. package/server/api/language/phraseIds.ts +8 -8
  168. package/server/api/prerender.ts +19 -120
  169. package/server/api/preview/page/[...parts].ts +78 -78
  170. package/server/api/preview/unique/[...location].ts +48 -61
  171. package/server/plugin/bitran/content.ts +252 -190
  172. package/server/plugin/bitran/elements/include.ts +229 -229
  173. package/server/plugin/bitran/location.ts +43 -39
  174. package/server/plugin/bitran/toc.ts +94 -94
  175. package/server/plugin/bitran/transpiler.ts +18 -18
  176. package/server/plugin/build/close.ts +12 -12
  177. package/server/plugin/build/jobs/content/builderArgs.ts +8 -8
  178. package/server/plugin/build/jobs/content/generic.ts +191 -191
  179. package/server/plugin/build/jobs/content/parse.ts +113 -113
  180. package/server/plugin/build/jobs/content/path.ts +6 -6
  181. package/server/plugin/build/jobs/content/type/book.ts +9 -9
  182. package/server/plugin/build/jobs/content/type/group.ts +37 -37
  183. package/server/plugin/build/jobs/content/type/topic.ts +36 -36
  184. package/server/plugin/build/jobs/contributors.ts +69 -66
  185. package/server/plugin/build/jobs/language.ts +36 -36
  186. package/server/plugin/build/jobs/nav.ts +345 -345
  187. package/server/plugin/build/process.ts +32 -32
  188. package/server/plugin/build/rebuild.ts +66 -66
  189. package/server/plugin/build/setup.ts +19 -19
  190. package/server/plugin/content/context.ts +119 -119
  191. package/server/plugin/db/entities/Book.ts +7 -7
  192. package/server/plugin/db/entities/Content.ts +45 -45
  193. package/server/plugin/db/entities/Contribution.ts +10 -10
  194. package/server/plugin/db/entities/Contributor.ts +25 -16
  195. package/server/plugin/db/entities/File.ts +10 -10
  196. package/server/plugin/db/entities/Group.ts +14 -14
  197. package/server/plugin/db/entities/Hash.ts +15 -15
  198. package/server/plugin/db/entities/Topic.ts +20 -20
  199. package/server/plugin/db/entities/Unique.ts +21 -21
  200. package/server/plugin/db/reset.ts +12 -12
  201. package/server/plugin/db/setup.ts +49 -49
  202. package/server/plugin/global.ts +16 -16
  203. package/server/plugin/importer.ts +16 -16
  204. package/server/plugin/index.ts +9 -9
  205. package/server/plugin/logger.ts +23 -23
  206. package/server/plugin/nav/node.ts +27 -27
  207. package/server/plugin/nav/utils.ts +179 -175
  208. package/server/plugin/repository/asideMinor.ts +51 -0
  209. package/server/plugin/repository/book.ts +39 -21
  210. package/server/plugin/repository/content.ts +240 -240
  211. package/server/plugin/repository/contentId.ts +40 -40
  212. package/server/plugin/repository/contributor.ts +98 -8
  213. package/server/plugin/repository/file.ts +10 -10
  214. package/server/plugin/repository/frontNav.ts +145 -145
  215. package/server/plugin/repository/topic.ts +35 -35
  216. package/server/tsconfig.json +9 -9
  217. package/shared/aside/minor.ts +55 -51
  218. package/shared/asset.ts +22 -22
  219. package/shared/bitran/content.ts +9 -0
  220. package/shared/bitran/contentId.ts +56 -56
  221. package/shared/bitran/toc.ts +8 -8
  222. package/shared/breadcrumb.ts +7 -0
  223. package/shared/content/bookId.ts +12 -12
  224. package/shared/content/context.ts +9 -9
  225. package/shared/content/data/base.ts +32 -32
  226. package/shared/content/data/index.ts +5 -5
  227. package/shared/content/data/type/book.ts +5 -5
  228. package/shared/content/data/type/group.ts +6 -6
  229. package/shared/content/data/type/topic.ts +11 -11
  230. package/shared/content/previousNext.ts +9 -9
  231. package/shared/contributor.ts +33 -5
  232. package/shared/frontNav.ts +41 -41
  233. package/shared/icons.ts +38 -38
  234. package/shared/image.ts +5 -5
  235. package/shared/link.ts +28 -28
  236. package/shared/popover.ts +8 -8
  237. package/shared/types/language.ts +79 -74
  238. package/shared/utils/objectsEqual.ts +4 -4
  239. package/shared/utils/stringColor.ts +9 -9
  240. package/test/contentId.test.ts +91 -91
  241. package/tsconfig.json +8 -8
  242. package/utils/contentPath.ts +67 -67
  243. package/utils/slash.ts +11 -11
  244. package/utils/stress.ts +9 -9
  245. package/app/components/aside/minor/AsideMinorContributor.vue +0 -5
  246. package/app/components/main/utils/ContentDescription.vue +0 -19
  247. package/app/composables/bitranContent.ts +0 -92
  248. package/app/pages/members.vue +0 -6
  249. package/server/api/aside/minor/path.ts +0 -82
  250. package/shared/bitran/stringContent.ts +0 -6
@@ -1,32 +1,32 @@
1
- <template>
2
- <main :class="$style.main" erudit-main>
3
- <Preview />
4
- <div :class="$style.mainInner">
5
- <slot></slot>
6
- </div>
7
- </main>
8
- </template>
9
-
10
- <style lang="scss" module>
11
- @use '$/def/bp';
12
-
13
- .main {
14
- --_pMainBase: var(--gapBig);
15
- --_pMainX: var(--_pMainBase);
16
- --_pMainY: calc(var(--_pMainBase) / 2);
17
-
18
- position: relative;
19
- min-height: 100dvh;
20
- background: var(--bgMain);
21
- font-size: 18px;
22
-
23
- @include bp.below('mobile') {
24
- --_pMainBase: var(--_bitran_asideWidth);
25
- font-size: 15px;
26
- }
27
-
28
- .mainInner {
29
- padding: var(--_pMainY) 0;
30
- }
31
- }
32
- </style>
1
+ <template>
2
+ <main :class="$style.main" erudit-main>
3
+ <Preview />
4
+ <div :class="$style.mainInner">
5
+ <slot></slot>
6
+ </div>
7
+ </main>
8
+ </template>
9
+
10
+ <style lang="scss" module>
11
+ @use '$/def/bp';
12
+
13
+ .main {
14
+ --_pMainBase: var(--gapBig);
15
+ --_pMainX: var(--_pMainBase);
16
+ --_pMainY: calc(var(--_pMainBase) / 2);
17
+
18
+ position: relative;
19
+ min-height: 100dvh;
20
+ background: var(--bgMain);
21
+ font-size: 18px;
22
+
23
+ @include bp.below('mobile') {
24
+ --_pMainBase: var(--_bitran_asideWidth);
25
+ font-size: 15px;
26
+ }
27
+
28
+ .mainInner {
29
+ padding: var(--_pMainY) 0;
30
+ }
31
+ }
32
+ </style>
@@ -1,74 +1,74 @@
1
- <script lang="ts" setup>
2
- import type { MyIconName } from '#my-icons';
3
-
4
- const props = defineProps<{
5
- link?: string;
6
- icon?: MyIconName;
7
- main?: string;
8
- active?: boolean;
9
- secondary?: string;
10
- }>();
11
-
12
- const vnode = h(props.link ? defineNuxtLink({}) : 'div');
13
- </script>
14
-
15
- <template>
16
- <component
17
- :is="vnode"
18
- :to="link"
19
- :class="[$style.asideListItem, active ? $style.active : '']"
20
- >
21
- <slot>
22
- <MyIcon v-if="icon" :name="icon" />
23
- <div :class="$style.main">{{ main }}</div>
24
- <div v-if="secondary" :class="$style.secondary">
25
- {{ secondary }}
26
- </div>
27
- </slot>
28
- </component>
29
- </template>
30
-
31
- <style lang="scss" module>
32
- .asideListItem {
33
- display: flex;
34
- align-items: center;
35
- gap: var(--gap);
36
- padding: var(--gap);
37
- height: 60px;
38
- border-bottom: 1px solid var(--border);
39
- color: var(--textMuted);
40
- text-decoration: none;
41
- background: transparent;
42
- cursor: pointer;
43
- @include transition(color, background);
44
-
45
- &:hover {
46
- color: var(--text);
47
- background: var(--bgAccent);
48
- }
49
-
50
- [my-icon] {
51
- position: relative;
52
- top: 1px;
53
- flex-shrink: 0;
54
- font-size: 20px;
55
- }
56
-
57
- .secondary {
58
- font-weight: 500;
59
- color: var(--textDimmed);
60
- }
61
-
62
- [my-icon],
63
- .main {
64
- @include transition(color);
65
- }
66
-
67
- &.active {
68
- [my-icon],
69
- .main {
70
- color: var(--brand);
71
- }
72
- }
73
- }
74
- </style>
1
+ <script lang="ts" setup>
2
+ import type { MyIconName } from '#my-icons';
3
+
4
+ const props = defineProps<{
5
+ link?: string;
6
+ icon?: MyIconName;
7
+ main?: string;
8
+ active?: boolean;
9
+ secondary?: string;
10
+ }>();
11
+
12
+ const vnode = h(props.link ? defineNuxtLink({}) : 'div');
13
+ </script>
14
+
15
+ <template>
16
+ <component
17
+ :is="vnode"
18
+ :to="link"
19
+ :class="[$style.asideListItem, active ? $style.active : '']"
20
+ >
21
+ <slot>
22
+ <MyIcon v-if="icon" :name="icon" />
23
+ <div :class="$style.main">{{ main }}</div>
24
+ <div v-if="secondary" :class="$style.secondary">
25
+ {{ secondary }}
26
+ </div>
27
+ </slot>
28
+ </component>
29
+ </template>
30
+
31
+ <style lang="scss" module>
32
+ .asideListItem {
33
+ display: flex;
34
+ align-items: center;
35
+ gap: var(--gap);
36
+ padding: var(--gap);
37
+ height: 60px;
38
+ border-bottom: 1px solid var(--border);
39
+ color: var(--textMuted);
40
+ text-decoration: none;
41
+ background: transparent;
42
+ cursor: pointer;
43
+ @include transition(color, background);
44
+
45
+ &:hover {
46
+ color: var(--text);
47
+ background: var(--bgAccent);
48
+ }
49
+
50
+ [my-icon] {
51
+ position: relative;
52
+ top: 1px;
53
+ flex-shrink: 0;
54
+ font-size: 20px;
55
+ }
56
+
57
+ .secondary {
58
+ font-weight: 500;
59
+ color: var(--textDimmed);
60
+ }
61
+
62
+ [my-icon],
63
+ .main {
64
+ @include transition(color);
65
+ }
66
+
67
+ &.active {
68
+ [my-icon],
69
+ .main {
70
+ color: var(--brand);
71
+ }
72
+ }
73
+ }
74
+ </style>
@@ -1,56 +1,56 @@
1
- <script lang="ts" setup>
2
- import eruditConfig from '#erudit/config';
3
-
4
- import PaneSwitch from './major/PaneSwitch.vue';
5
-
6
- const { panes, activePane, getPaneOrder } = useMajorPane();
7
-
8
- function paneStyle(paneKey: MajorPaneKey) {
9
- const thisPaneOrder = getPaneOrder(paneKey);
10
- const activePaneOrder = getPaneOrder(activePane.value);
11
-
12
- return {
13
- left: `calc(${Math.sign(thisPaneOrder - activePaneOrder)} * var(--wAside))`,
14
- opacity: thisPaneOrder === activePaneOrder ? 1 : 0,
15
- };
16
- }
17
- </script>
18
-
19
- <template>
20
- <div :class="$style.asideInner">
21
- <AsideMajorSiteInfo />
22
- <PaneSwitch />
23
- <div :class="$style.paneHolder">
24
- <component
25
- v-for="(pane, paneKey) of panes"
26
- :is="pane.content"
27
- :class="$style.pane"
28
- :style="paneStyle(paneKey)"
29
- />
30
- </div>
31
- <AdsBannerAside v-if="eruditConfig.ads?.aside" />
32
- </div>
33
- </template>
34
-
35
- <style lang="scss" module>
36
- .asideInner {
37
- display: flex;
38
- flex-direction: column;
39
- height: 100%;
40
- }
41
-
42
- .paneHolder {
43
- flex: 1;
44
- position: relative;
45
- overflow-x: hidden;
46
- }
47
-
48
- .pane {
49
- position: absolute;
50
- top: 0;
51
- width: 100%;
52
- height: 100%;
53
- opacity: 0;
54
- @include transition(left, opacity);
55
- }
56
- </style>
1
+ <script lang="ts" setup>
2
+ import eruditConfig from '#erudit/config';
3
+
4
+ import PaneSwitch from './major/PaneSwitch.vue';
5
+
6
+ const { panes, activePane, getPaneOrder } = useMajorPane();
7
+
8
+ function paneStyle(paneKey: MajorPaneKey) {
9
+ const thisPaneOrder = getPaneOrder(paneKey);
10
+ const activePaneOrder = getPaneOrder(activePane.value);
11
+
12
+ return {
13
+ left: `calc(${Math.sign(thisPaneOrder - activePaneOrder)} * var(--wAside))`,
14
+ opacity: thisPaneOrder === activePaneOrder ? 1 : 0,
15
+ };
16
+ }
17
+ </script>
18
+
19
+ <template>
20
+ <div :class="$style.asideInner">
21
+ <AsideMajorSiteInfo />
22
+ <PaneSwitch />
23
+ <div :class="$style.paneHolder">
24
+ <component
25
+ v-for="(pane, paneKey) of panes"
26
+ :is="pane.content"
27
+ :class="$style.pane"
28
+ :style="paneStyle(paneKey)"
29
+ />
30
+ </div>
31
+ <AdsBannerAside v-if="adsAllowed() && eruditConfig.ads?.aside" />
32
+ </div>
33
+ </template>
34
+
35
+ <style lang="scss" module>
36
+ .asideInner {
37
+ display: flex;
38
+ flex-direction: column;
39
+ height: 100%;
40
+ }
41
+
42
+ .paneHolder {
43
+ flex: 1;
44
+ position: relative;
45
+ overflow-x: hidden;
46
+ }
47
+
48
+ .pane {
49
+ position: absolute;
50
+ top: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ opacity: 0;
54
+ @include transition(left, opacity);
55
+ }
56
+ </style>
@@ -1,73 +1,97 @@
1
- <script lang="ts" setup>
2
- import type { AsideMinorData } from '@shared/aside/minor';
3
- import { trailingSlash } from '@erudit/utils/slash';
4
- import { asideMinorKey } from '@app/scripts/aside/minor/state';
5
-
6
- import {
7
- LazyAsideMinorNews,
8
- LazyAsideMinorTopic,
9
- LazyAsideMinorContent,
10
- } from '#components';
11
-
12
- let setupI = 0;
13
-
14
- const route = useRoute();
15
- const nuxtApp = useNuxtApp();
16
-
17
- const asideData = shallowRef<AsideMinorData>();
18
- const AsideMinorPane = shallowRef<Component>();
19
-
20
- async function setupAsideMinorData() {
21
- const currentSetupI = ++setupI;
22
- const dataKey = trailingSlash(route.path, false);
23
- const payloadKey = 'aside-minor';
24
- const asideMinorPayload =
25
- (nuxtApp.static.data[payloadKey] ||=
26
- nuxtApp.payload.data[payloadKey] ||=
27
- {});
28
-
29
- const data: AsideMinorData = await (async () => {
30
- const payloadKeyValue: AsideMinorData | 'news' = (asideMinorPayload[
31
- dataKey
32
- ] ||= await $fetch(`/api/aside/minor/path`, {
33
- query: { path: dataKey },
34
- }));
35
-
36
- if (payloadKeyValue === 'news') {
37
- // We do not save news in the payload as it will always have the same content.
38
- // So we prerender news once and use the same data for all pages.
39
- nuxtApp.runWithContext(() =>
40
- prerenderRoutes('/api/aside/minor/news'),
41
- );
42
- return await $fetch('/api/aside/minor/news');
43
- } else return payloadKeyValue;
44
- })();
45
-
46
- if (currentSetupI !== setupI) return; // This data is outdated because new `setupAsideMinorData` was called.
47
-
48
- asideData.value = data;
49
-
50
- AsideMinorPane.value = (() => {
51
- switch (asideData.value.type) {
52
- case 'topic':
53
- return LazyAsideMinorTopic;
54
- case 'book':
55
- case 'group':
56
- return LazyAsideMinorContent;
57
- }
58
-
59
- return LazyAsideMinorNews;
60
- })();
61
- }
62
-
63
- watch(route, setupAsideMinorData);
64
- await setupAsideMinorData();
65
-
66
- provide(asideMinorKey, asideData);
67
- </script>
68
-
69
- <template>
70
- <TransitionFade>
71
- <component :is="AsideMinorPane" />
72
- </TransitionFade>
73
- </template>
1
+ <script lang="ts" setup>
2
+ import { isTopicPart } from '@erudit-js/cog/schema';
3
+
4
+ import { type AsideMinorNews, type AsideMinorData } from '@shared/aside/minor';
5
+ import { trailingSlash } from '@erudit/utils/slash';
6
+ import { asideMinorKey } from '@app/scripts/aside/minor/state';
7
+
8
+ import {
9
+ LazyAsideMinorNews,
10
+ LazyAsideMinorTopic,
11
+ LazyAsideMinorContent,
12
+ LazyAsideMinorContributor,
13
+ } from '#components';
14
+
15
+ let setupI = 0;
16
+
17
+ const route = useRoute();
18
+ const nuxtApp = useNuxtApp();
19
+
20
+ const asideData = shallowRef<AsideMinorData>();
21
+ const AsideMinorPane = shallowRef<Component>();
22
+
23
+ async function setupAsideMinorData() {
24
+ const currentSetupI = ++setupI;
25
+ const path = trailingSlash(route.path, false).substring(1);
26
+ const pathParts = path.split('/');
27
+
28
+ const payloadKey = 'aside-minor';
29
+ const asideMinorPayload =
30
+ (nuxtApp.static.data[payloadKey] ||=
31
+ nuxtApp.payload.data[payloadKey] ||=
32
+ {});
33
+
34
+ const data: AsideMinorData = await (async () => {
35
+ const firstPathPart = pathParts[0];
36
+
37
+ if (isTopicPart(firstPathPart)) {
38
+ return (asideMinorPayload[path] ||= await $fetch(
39
+ `/api/aside/minor/topic`,
40
+ {
41
+ query: {
42
+ topicPart: firstPathPart,
43
+ topicId: pathParts.slice(1).join('/'),
44
+ },
45
+ },
46
+ ));
47
+ }
48
+
49
+ switch (firstPathPart) {
50
+ case 'book':
51
+ case 'group':
52
+ return (asideMinorPayload[path] ||= await $fetch(
53
+ `/api/aside/minor/${pathParts.join('/')}`,
54
+ ));
55
+ case 'contributor':
56
+ return (asideMinorPayload[path] ||= await $fetch(
57
+ `/api/aside/minor/contributor/${pathParts[1]}`,
58
+ ));
59
+ default:
60
+ prerenderRoutes(['/api/aside/minor/news']);
61
+ return await $fetch<AsideMinorNews>(`/api/aside/minor/news`);
62
+ }
63
+ })();
64
+
65
+ if (currentSetupI !== setupI) {
66
+ // This data is outdated because new `setupAsideMinorData` was called
67
+ return;
68
+ }
69
+
70
+ asideData.value = data;
71
+
72
+ AsideMinorPane.value = (() => {
73
+ switch (asideData.value.type) {
74
+ case 'topic':
75
+ return LazyAsideMinorTopic;
76
+ case 'book':
77
+ case 'group':
78
+ return LazyAsideMinorContent;
79
+ case 'contributor':
80
+ return LazyAsideMinorContributor;
81
+ }
82
+
83
+ return LazyAsideMinorNews;
84
+ })();
85
+ }
86
+
87
+ watch(route, setupAsideMinorData);
88
+ await setupAsideMinorData();
89
+
90
+ provide(asideMinorKey, asideData);
91
+ </script>
92
+
93
+ <template>
94
+ <TransitionFade>
95
+ <component :is="AsideMinorPane" />
96
+ </TransitionFade>
97
+ </template>
@@ -1,23 +1,23 @@
1
- <template>
2
- <div :class="$style.paneContentScroll">
3
- <div>
4
- <slot></slot>
5
- </div>
6
- </div>
7
- </template>
8
-
9
- <style lang="scss" module>
10
- .paneContentScroll {
11
- width: 100%;
12
- height: 100%;
13
- overflow-y: auto;
14
- direction: rtl;
15
- @include scroll;
16
-
17
- > div {
18
- width: 100%;
19
- height: 100%;
20
- direction: ltr;
21
- }
22
- }
23
- </style>
1
+ <template>
2
+ <div :class="$style.paneContentScroll">
3
+ <div>
4
+ <slot></slot>
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <style lang="scss" module>
10
+ .paneContentScroll {
11
+ width: 100%;
12
+ height: 100%;
13
+ overflow-y: auto;
14
+ direction: rtl;
15
+ @include scroll;
16
+
17
+ > div {
18
+ width: 100%;
19
+ height: 100%;
20
+ direction: ltr;
21
+ }
22
+ }
23
+ </style>
@@ -1,54 +1,54 @@
1
- <script lang="ts" setup>
2
- import PaneSwitchButton from './PaneSwitchButton.vue';
3
-
4
- const { panes, activePane, getPaneOrder } = useMajorPane();
5
-
6
- const phrase = await usePhrases(
7
- ...Object.values(panes).map((pane) => pane.phrase),
8
- );
9
- </script>
10
-
11
- <template>
12
- <section :class="$style.paneSwitch">
13
- <div :class="$style.inner">
14
- <PaneSwitchButton
15
- v-for="(pane, paneKey) of panes"
16
- :paneKey
17
- :icon="pane.icon"
18
- :title="phrase[pane.phrase]"
19
- />
20
-
21
- <div
22
- :class="$style.slider"
23
- :style="{ '--_activePane': getPaneOrder(activePane) }"
24
- ></div>
25
- </div>
26
- </section>
27
- </template>
28
-
29
- <style lang="scss" module>
30
- .paneSwitch {
31
- --buttonSize: 40px;
32
- --gapSize: var(--gap);
33
-
34
- border-bottom: 1px solid var(--border);
35
- display: flex;
36
- justify-content: center;
37
-
38
- .inner {
39
- position: relative;
40
- display: flex;
41
- }
42
-
43
- .slider {
44
- position: absolute;
45
- width: var(--buttonSize);
46
- height: 3px;
47
- bottom: -1px;
48
- margin-left: calc(var(--gapSize) / 2);
49
- background: var(--textMuted);
50
- left: calc(var(--_activePane) * (var(--buttonSize) + var(--gapSize)));
51
- @include transition(left);
52
- }
53
- }
54
- </style>
1
+ <script lang="ts" setup>
2
+ import PaneSwitchButton from './PaneSwitchButton.vue';
3
+
4
+ const { panes, activePane, getPaneOrder } = useMajorPane();
5
+
6
+ const phrase = await usePhrases(
7
+ ...Object.values(panes).map((pane) => pane.phrase),
8
+ );
9
+ </script>
10
+
11
+ <template>
12
+ <section :class="$style.paneSwitch">
13
+ <div :class="$style.inner">
14
+ <PaneSwitchButton
15
+ v-for="(pane, paneKey) of panes"
16
+ :paneKey
17
+ :icon="pane.icon"
18
+ :title="phrase[pane.phrase]"
19
+ />
20
+
21
+ <div
22
+ :class="$style.slider"
23
+ :style="{ '--_activePane': getPaneOrder(activePane) }"
24
+ ></div>
25
+ </div>
26
+ </section>
27
+ </template>
28
+
29
+ <style lang="scss" module>
30
+ .paneSwitch {
31
+ --buttonSize: 40px;
32
+ --gapSize: var(--gap);
33
+
34
+ border-bottom: 1px solid var(--border);
35
+ display: flex;
36
+ justify-content: center;
37
+
38
+ .inner {
39
+ position: relative;
40
+ display: flex;
41
+ }
42
+
43
+ .slider {
44
+ position: absolute;
45
+ width: var(--buttonSize);
46
+ height: 3px;
47
+ bottom: -1px;
48
+ margin-left: calc(var(--gapSize) / 2);
49
+ background: var(--textMuted);
50
+ left: calc(var(--_activePane) * (var(--buttonSize) + var(--gapSize)));
51
+ @include transition(left);
52
+ }
53
+ }
54
+ </style>