erudit 4.1.0 → 4.2.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.
Files changed (118) hide show
  1. package/app/assets/icons/update.svg +3 -0
  2. package/app/components/Prose.vue +7 -7
  3. package/app/components/SmartMedia.vue +4 -4
  4. package/app/components/aside/major/contentNav/PaneBookNav.vue +1 -4
  5. package/app/components/aside/minor/content/Toc.vue +24 -1
  6. package/app/components/aside/minor/content/TocItem.vue +2 -1
  7. package/app/components/aside/minor/news/AsideMinorNews.vue +1 -3
  8. package/app/components/aside/minor/news/NewsItem.vue +3 -4
  9. package/app/components/aside/minor/news/RenderNewsElement.vue +4 -11
  10. package/app/components/aside/minor/news/elements/Mix.vue +2 -3
  11. package/app/components/aside/minor/news/elements/P.vue +3 -3
  12. package/app/components/aside/minor/news/elements/Ref.vue +3 -3
  13. package/app/components/aside/minor/news/elements/Text.vue +2 -2
  14. package/app/components/main/MainContentChild.vue +3 -3
  15. package/app/components/main/{MainQuickLink.vue → MainKeyLink.vue} +11 -11
  16. package/app/components/main/{MainQuickLinks.vue → MainKeyLinks.vue} +7 -7
  17. package/app/components/main/MainQuoteLoader.vue +2 -4
  18. package/app/components/main/MainStickyHeader.vue +1 -1
  19. package/app/components/main/MainStickyHeaderPreamble.vue +6 -2
  20. package/app/components/main/MainTopicPartPage.vue +8 -3
  21. package/app/components/main/connections/DepUnique.vue +45 -0
  22. package/app/components/main/connections/Deps.vue +15 -5
  23. package/app/components/main/connections/Externals.vue +4 -4
  24. package/app/components/main/connections/MainConnections.vue +1 -0
  25. package/app/components/main/contentStats/ItemLastChanged.vue +68 -0
  26. package/app/components/main/contentStats/MainContentStats.vue +36 -28
  27. package/app/components/preview/PreviewScreen.vue +2 -2
  28. package/app/components/preview/screen/ContentPage.vue +1 -4
  29. package/app/components/preview/screen/Unique.vue +3 -5
  30. package/app/composables/appElements.ts +2 -4
  31. package/app/composables/asideMajorPane.ts +3 -3
  32. package/app/composables/fetchJson.ts +4 -0
  33. package/app/composables/lastChanged.ts +28 -0
  34. package/app/composables/mainContent.ts +1 -4
  35. package/app/composables/og.ts +43 -35
  36. package/app/composables/phrases.ts +0 -3
  37. package/app/composables/scrollUp.ts +1 -1
  38. package/app/pages/book/[...bookId].vue +5 -1
  39. package/app/pages/contributor/[contributorId].vue +3 -5
  40. package/app/pages/contributors.vue +1 -1
  41. package/app/pages/group/[...groupId].vue +5 -1
  42. package/app/pages/index.vue +1 -1
  43. package/app/pages/page/[...pageId].vue +8 -3
  44. package/app/pages/sponsors.vue +1 -1
  45. package/app/plugins/appSetup/index.ts +0 -5
  46. package/app/plugins/fetchJson.ts +11 -0
  47. package/app/plugins/prerender.server.ts +1 -1
  48. package/app/router.options.ts +1 -1
  49. package/modules/erudit/globals/prose.ts +3 -4
  50. package/modules/erudit/setup/elements/appTemplate.ts +6 -7
  51. package/modules/erudit/setup/elements/{globalTypes.ts → elementGlobalTypes.ts} +21 -21
  52. package/modules/erudit/setup/elements/globalTemplate.ts +29 -23
  53. package/modules/erudit/setup/elements/setup.ts +18 -16
  54. package/modules/erudit/setup/elements/shared.ts +2 -2
  55. package/modules/erudit/setup/elements/tagsTable.ts +1 -1
  56. package/modules/erudit/setup/runtimeConfig.ts +2 -0
  57. package/nuxt.config.ts +2 -2
  58. package/package.json +14 -13
  59. package/server/api/main/content/[...contentTypePath].ts +5 -4
  60. package/server/api/prerender/content.ts +1 -3
  61. package/server/api/preview/contentPage/[...contentTypePath].ts +1 -2
  62. package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +16 -31
  63. package/server/api/problemScript/[...problemScriptPath].ts +73 -4
  64. package/server/erudit/content/global/build.ts +21 -7
  65. package/server/erudit/content/nav/build.ts +4 -4
  66. package/server/erudit/content/repository/children.ts +3 -3
  67. package/server/erudit/content/repository/deps.ts +127 -39
  68. package/server/erudit/content/repository/elementSnippets.ts +16 -16
  69. package/server/erudit/content/repository/stats.ts +30 -22
  70. package/server/erudit/content/repository/topicParts.ts +1 -1
  71. package/server/erudit/content/repository/unique.ts +14 -15
  72. package/server/erudit/content/resolve/index.ts +6 -1
  73. package/server/erudit/content/resolve/page.ts +15 -35
  74. package/server/erudit/content/resolve/topic.ts +33 -164
  75. package/server/erudit/content/resolve/utils/insertContentItem.ts +2 -2
  76. package/server/erudit/content/resolve/utils/insertContentResolved.ts +82 -31
  77. package/server/erudit/content/search.ts +5 -22
  78. package/server/erudit/contributors/build.ts +7 -8
  79. package/server/erudit/db/repository/pushFile.ts +10 -3
  80. package/server/erudit/db/repository/pushProblemScript.ts +14 -3
  81. package/server/erudit/db/schema/contentDeps.ts +3 -0
  82. package/server/erudit/db/schema/contentSnippets.ts +3 -3
  83. package/server/erudit/db/schema/contentUniques.ts +2 -2
  84. package/server/erudit/db/schema/contributors.ts +2 -2
  85. package/server/erudit/db/schema/news.ts +2 -2
  86. package/server/erudit/db/schema/pages.ts +2 -2
  87. package/server/erudit/db/schema/topics.ts +4 -4
  88. package/server/erudit/global.ts +4 -0
  89. package/server/erudit/importer.ts +16 -8
  90. package/server/erudit/index.ts +0 -3
  91. package/server/erudit/language/list/en.ts +1 -0
  92. package/server/erudit/language/list/ru.ts +1 -0
  93. package/server/erudit/news/build.ts +6 -6
  94. package/server/erudit/news/repository/batch.ts +2 -2
  95. package/server/erudit/prose/repository/finalize.ts +22 -25
  96. package/server/erudit/prose/repository/get.ts +3 -5
  97. package/server/erudit/prose/repository/rawToProse.ts +31 -0
  98. package/server/erudit/prose/storage/callout.ts +9 -7
  99. package/server/erudit/prose/storage/image.ts +8 -11
  100. package/server/erudit/prose/storage/link.ts +24 -32
  101. package/server/erudit/prose/storage/problemScript.ts +8 -14
  102. package/server/erudit/prose/storage/video.ts +9 -7
  103. package/server/erudit/repository.ts +4 -4
  104. package/server/routes/file/[...path].ts +1 -1
  105. package/shared/types/contentChildren.ts +5 -2
  106. package/shared/types/contentConnections.ts +9 -0
  107. package/shared/types/elementSnippet.ts +1 -1
  108. package/shared/types/indexPage.ts +3 -0
  109. package/shared/types/language.ts +1 -83
  110. package/shared/types/mainContent.ts +11 -5
  111. package/shared/types/news.ts +2 -2
  112. package/shared/types/preview.ts +3 -2
  113. package/shared/types/runtimeConfig.ts +1 -0
  114. package/shared/types/search.ts +2 -0
  115. package/shared/utils/pages.ts +4 -2
  116. package/shared/utils/stringColor.ts +16 -6
  117. package/server/erudit/prose/repository/resolve.ts +0 -17
  118. package/server/erudit/prose/transform/bundleProblemScript.ts +0 -6
@@ -3,7 +3,7 @@ export interface ElementSnippet {
3
3
  link: string;
4
4
  title: string;
5
5
  description?: string;
6
- quick?: {
6
+ key?: {
7
7
  title?: string;
8
8
  description?: string;
9
9
  };
@@ -1,3 +1,6 @@
1
+ import type { ContentStats } from './contentStats';
2
+ import type { MainContentChildrenItem } from './mainContent';
3
+
1
4
  export interface IndexPage {
2
5
  title: string;
3
6
  short: string;
@@ -79,6 +79,7 @@ export type LanguagePhrases = Phrases<{
79
79
  no_contribution: string;
80
80
  editor: string;
81
81
  materials: string;
82
+ updated: string;
82
83
  x_sponsors: (count: number) => string;
83
84
  x_contributors: (count: number) => string;
84
85
  news: string;
@@ -99,89 +100,6 @@ export type LanguagePhrases = Phrases<{
99
100
  default_index_title: string;
100
101
  default_index_short: string;
101
102
  default_site_info_short: string;
102
-
103
- // _language_title: string;
104
- // _language_code: string;
105
- // site_info_title: string;
106
- // site_info_slogan: string;
107
- // seo_index_title: string;
108
- // seo_index_description: string;
109
- // seo_article_description: (contentTitle: string) => string;
110
- // seo_summary_description: (contentTitle: string) => string;
111
- // seo_practice_description: (contentTitle: string) => string;
112
- // index: string;
113
- // pages: string;
114
- // search: string;
115
- // language: string;
116
- // other: string;
117
- // ads_replacer: string;
118
- // theme: string;
119
- // theme_system: string;
120
- // theme_light: string;
121
- // theme_dark: string;
122
- // content: string;
123
- // main_page: string;
124
- // contributors: string;
125
- // contributors_page_description: string;
126
- // contributors_page_invite: string;
127
- // become_contributor: string;
128
- // contributor: string;
129
- // contribution: string;
130
- // contributions_explain: (count: number) => string;
131
- // contributor_description: (name: string) => string;
132
- // editor: string;
133
- // add_translation: string;
134
- // empty_nav: string;
135
- // flag_dev: string;
136
- // flag_dev_description: string;
137
- // flag_advanced: string;
138
- // flag_advanced_description: string;
139
- // flag_secondary: string;
140
- // flag_secondary_description: string;
141
- // popover_dependencies: string;
142
- // popover_dependencies_description: string;
143
- // close: string;
144
- // back: string;
145
- // goto: string;
146
- // error: string;
147
- // external_link: string;
148
- // external_link_warn: string;
149
- // internal_link: string;
150
- // internal_link_warn: string;
151
- // book: string;
152
- // group: string;
153
- // topic: string;
154
- // topics: string;
155
- // article: string;
156
- // summary: string;
157
- // practice: string;
158
- // element_id: string;
159
- // preview_missing_title: string;
160
- // preview_missing_explain: string;
161
- // preview_missing_explain_mismatch: string;
162
- // preview_hash_mismatch_title: string;
163
- // preview_hash_mismatch_explain: string;
164
- // current_page_hash: string;
165
- // expected_page_hash: string;
166
- // empty_toc: string;
167
- // no_contributors: string;
168
- // make_contribution: string;
169
- // material_improvement: string;
170
- // how_to_improve: string;
171
- // edit_page: string;
172
- // report_problem: string;
173
- // references: string;
174
- // reference_source_featured: string;
175
- // references_description: string;
176
- // sponsors: string;
177
- // sponsors_description: string;
178
- // become_sponsor: string;
179
- // toc: string;
180
- // mentions: (conte: number) => string;
181
- // start_learning: string;
182
- // x_contributors: (count: number) => string;
183
- // x_sponsors: (count: number) => string;
184
- // show_all: string;
185
103
  }>;
186
104
 
187
105
  //
@@ -1,10 +1,16 @@
1
- import type { FinalizedProse } from '@jsprose/core';
1
+ import type { ProseWithStorage } from 'tsprose';
2
+
3
+ import type { ContentSeo } from '@erudit-js/core/content/seo';
2
4
  import type { ContentType } from '@erudit-js/core/content/type';
3
5
  import type { TopicPart } from '@erudit-js/core/content/topic';
4
6
  import type { ContentFlags } from '@erudit-js/core/content/flags';
5
7
  import type { ContentContribution } from '@erudit-js/core/content/contributions';
6
8
  import type { ResolvedTocItem } from '@erudit-js/prose';
7
- import type { ContentSeo } from '@erudit-js/core/content/seo';
9
+
10
+ import type { Breadcrumbs } from './breadcrumbs';
11
+ import type { ContentStats } from './contentStats';
12
+ import type { ContentConnections } from './contentConnections';
13
+ import type { ElementSnippet } from './elementSnippet';
8
14
 
9
15
  export interface MainContentBase {
10
16
  type: ContentType;
@@ -28,7 +34,7 @@ export interface MainContentChildrenItem {
28
34
  link: string;
29
35
  title: string;
30
36
  description?: string;
31
- quickLinks?: ElementSnippet[];
37
+ keyLinks?: ElementSnippet[];
32
38
  stats?: ContentStats;
33
39
  }
34
40
 
@@ -37,7 +43,7 @@ export interface MainContentChildrenItem {
37
43
  //
38
44
 
39
45
  export type MainContentTopicPart = MainContentBase &
40
- FinalizedProse & {
46
+ ProseWithStorage & {
41
47
  type: 'topic';
42
48
  part: TopicPart;
43
49
  parts: TopicPart[];
@@ -46,7 +52,7 @@ export type MainContentTopicPart = MainContentBase &
46
52
  };
47
53
 
48
54
  export type MainContentPage = MainContentBase &
49
- FinalizedProse & {
55
+ ProseWithStorage & {
50
56
  type: 'page';
51
57
  snippets?: ElementSnippet[];
52
58
  toc?: ResolvedTocItem[];
@@ -1,4 +1,4 @@
1
- import type { FinalizedProse } from '@jsprose/core';
1
+ import type { ProseWithStorage } from 'tsprose';
2
2
 
3
3
  export interface NewsBatch {
4
4
  items: NewsItem[];
@@ -9,5 +9,5 @@ export interface NewsBatch {
9
9
 
10
10
  export interface NewsItem {
11
11
  date: string;
12
- content: FinalizedProse;
12
+ content: ProseWithStorage;
13
13
  }
@@ -1,4 +1,5 @@
1
- import type { FinalizedProse } from '@jsprose/core';
1
+ import type { ProseWithStorage } from 'tsprose';
2
+
2
3
  import type { PreviewRequest } from '@erudit-js/core/preview/request';
3
4
  import type { ContentType } from '@erudit-js/core/content/type';
4
5
 
@@ -25,4 +26,4 @@ export type PreviewContentUnique = {
25
26
  elementTitle?: string;
26
27
  schemaName: string;
27
28
  fadeOverlay?: boolean;
28
- } & FinalizedProse;
29
+ } & ProseWithStorage;
@@ -27,6 +27,7 @@ export interface EruditPublicRuntimeConfig {
27
27
  ads: boolean;
28
28
  fakeApi: {
29
29
  repository: boolean;
30
+ lastChanged: boolean | string;
30
31
  };
31
32
  analytics?: boolean;
32
33
  };
@@ -1,3 +1,5 @@
1
+ import type { LanguageCode } from './language';
2
+
1
3
  //
2
4
  // Commands
3
5
  //
@@ -15,9 +15,11 @@ export const PAGES = {
15
15
  return sn(`/group/${shortId}/`);
16
16
  },
17
17
  ['page']: (shortId: string, elementId?: string) => {
18
- return sn(`/page/${shortId}/${elementId ? '#' + elementId : ''}`);
18
+ return sn(`/page/${shortId}/${elementId ? '?element=' + elementId : ''}`);
19
19
  },
20
20
  ['topic']: (part: TopicPart, shortId: string, elementId?: string) => {
21
- return sn(`/${part}/${shortId}/${elementId ? '#' + elementId : ''}`);
21
+ return sn(
22
+ `/${part}/${shortId}/${elementId ? '?element=' + elementId : ''}`,
23
+ );
22
24
  },
23
25
  };
@@ -1,13 +1,23 @@
1
1
  export function stringColor(text: string) {
2
- let hash = 0;
3
-
2
+ // FNV-1a >>> 0 after every step keeps values in unsigned 32-bit space
3
+ let hash = 0x811c9dc5 >>> 0;
4
4
  for (let i = 0; i < text.length; i++) {
5
- hash = text.charCodeAt(i) + ((hash << 5) - hash);
5
+ hash = (hash ^ text.charCodeAt(i)) >>> 0;
6
+ hash = Math.imul(hash, 0x01000193) >>> 0;
6
7
  }
7
8
 
8
- const hue = hash % 360;
9
- const lightColor = `hsl(${hue}, 70%, 35%)`; // Darker for white background
10
- const darkColor = `hsl(${hue}, 75%, 70%)`; // Lighter for black background
9
+ // Wang hash finalizer — avalanche remaining bit clusters
10
+ hash = (hash ^ (hash >>> 16)) >>> 0;
11
+ hash = Math.imul(hash, 0x45d9f3b) >>> 0;
12
+ hash = (hash ^ (hash >>> 16)) >>> 0;
13
+
14
+ // Divide full uint32 range by 2^32 → uniform [0, 1) → full 360° hue wheel
15
+ const h = Math.floor((hash / 0x100000000) * 360);
16
+ // Use a non-overlapping slice of bits for saturation variance
17
+ const s = 55 + Math.floor(((hash >>> 22) / 0x400) * 20); // 55–74%
18
+
19
+ const lightColor = `hsl(${h}, 70%, 35%)`;
20
+ const darkColor = `hsl(${h}, 70%, 68%)`;
11
21
 
12
22
  return `light-dark(${lightColor}, ${darkColor})`;
13
23
  }
@@ -1,17 +0,0 @@
1
- import type { AnySchema, RawElement } from '@jsprose/core';
2
- import { resolveEruditRawElement, type ResolveStep } from '@erudit-js/prose';
3
-
4
- export async function resolveEruditProse(
5
- rawElement: RawElement<AnySchema>,
6
- linkable: boolean,
7
- step?: ResolveStep,
8
- ) {
9
- return await resolveEruditRawElement({
10
- context: {
11
- language: ERUDIT.config.public.language.current,
12
- linkable,
13
- },
14
- rawElement,
15
- step,
16
- });
17
- }
@@ -1,6 +0,0 @@
1
- export async function bundleProblemScript(problemId: string) {
2
- // Создаем фейковый stdin для esbuild, в котором импортирует требуемый скрипт из файла, где он объявлен
3
- // Так на выходе получим только бандл скрипта, без лишних зависимостей
4
- }
5
-
6
- // Функция для вызова ESBuild бандлера, чтобы собирать problem скрипты и прочее