erudit 3.0.0-dev.19 → 3.0.0-dev.20

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.
@@ -5,6 +5,7 @@ import { setEruditBitranRuntime } from '@erudit-js/cog/schema';
5
5
  import eruditConfig from '#erudit/config';
6
6
  import type { RawBitranContent } from '@shared/bitran/content';
7
7
  import RenderWrapper from './RenderWrapper.vue';
8
+ import { HeadingNode } from '@erudit-js/bitran-elements/heading/shared';
8
9
 
9
10
  const props = defineProps<{
10
11
  rawContent: RawBitranContent;
@@ -17,7 +18,7 @@ for (const route of props.rawContent.routes) {
17
18
  const bitranTranspiler = await useBitranTranspiler();
18
19
  const bitranRenderers = await useBitranRenderers();
19
20
 
20
- [(bitranTranspiler.parser, bitranTranspiler.stringifier)].forEach((item) => {
21
+ [bitranTranspiler.parser, bitranTranspiler.stringifier].forEach((item) => {
21
22
  setEruditBitranRuntime(item, {
22
23
  eruditConfig,
23
24
  insideInclude: false,
@@ -1,9 +1,16 @@
1
1
  <script lang="ts" setup>
2
2
  import {
3
+ locationsEqual,
3
4
  stringifyBitranLocation,
4
5
  type BitranLocation,
5
6
  } from '@erudit-js/cog/schema';
6
- import type { RawBitranContent } from '@erudit/shared/bitran/content';
7
+
8
+ import type { RawBitranContent } from '@shared/bitran/content';
9
+ import ContentSection from '@app/components/main/content/ContentSection.vue';
10
+
11
+ type MainBitranPayload = RawBitranContent & {
12
+ mainLocation: BitranLocation;
13
+ };
7
14
 
8
15
  const props = defineProps<{ location: BitranLocation }>();
9
16
 
@@ -11,20 +18,15 @@ const nuxtApp = useNuxtApp();
11
18
  const stringLocation = stringifyBitranLocation(props.location);
12
19
 
13
20
  const payloadKey = `main-bitran-content`;
14
- const payloadValue: RawBitranContent =
21
+ const payloadValue: MainBitranPayload =
15
22
  (nuxtApp.static.data[payloadKey] ||=
16
23
  nuxtApp.payload.data[payloadKey] ||=
17
24
  {});
18
25
 
19
- const payloadStringLocation = (() => {
20
- if (!payloadValue?.context?.location) {
21
- return undefined;
22
- }
23
-
24
- return stringifyBitranLocation(payloadValue.context.location);
25
- })();
26
-
27
- if (stringLocation !== payloadStringLocation) {
26
+ if (
27
+ !payloadValue.mainLocation ||
28
+ !locationsEqual(payloadValue.mainLocation, props.location)
29
+ ) {
28
30
  const rawBitranContent = await $fetch<RawBitranContent>(
29
31
  `/api/bitran/content/${stringLocation}`,
30
32
  {
@@ -32,10 +34,14 @@ if (stringLocation !== payloadStringLocation) {
32
34
  },
33
35
  );
34
36
 
35
- Object.assign(payloadValue, rawBitranContent);
37
+ Object.assign(payloadValue, rawBitranContent, {
38
+ mainLocation: props.location,
39
+ });
36
40
  }
37
41
  </script>
38
42
 
39
43
  <template>
40
- <BitranContent :rawContent="payloadValue" />
44
+ <ContentSection v-if="payloadValue.biCode">
45
+ <BitranContent :rawContent="payloadValue" />
46
+ </ContentSection>
41
47
  </template>
@@ -30,7 +30,11 @@ defineProps<{ icon: string; title: string; hint?: string }>();
30
30
  display: flex;
31
31
  align-items: center;
32
32
  gap: var(--gap);
33
- padding: var(--_pMainY) var(--_pMainX);
33
+ padding: 0 var(--_pMainX);
34
+
35
+ @include bp.below('mobile') {
36
+ padding: var(--_pMainY) var(--_pMainX);
37
+ }
34
38
 
35
39
  [my-icon] {
36
40
  flex-shrink: 0;
@@ -61,9 +61,7 @@ onMounted(() => {
61
61
 
62
62
  <div style="clear: both"></div>
63
63
 
64
- <ContentSection>
65
- <MainBitranContent :location />
66
- </ContentSection>
64
+ <MainBitranContent :location />
67
65
 
68
66
  <ContentSection v-if="topicData.generic.references">
69
67
  <ContentReferences :references="topicData.generic.references" />
@@ -41,7 +41,7 @@ const Link = defineNuxtLink({ prefetch: false });
41
41
  justify-content: center;
42
42
  gap: var(--gapBig);
43
43
  margin: var(--_pMainY) 0;
44
- margin-top: -30px;
44
+ margin-top: -40px;
45
45
 
46
46
  width: 100%;
47
47
  height: var(--height);
@@ -127,11 +127,10 @@ useSeoMeta({
127
127
  </div>
128
128
  </div>
129
129
  </header>
130
- <ContentSection v-if="contributor.hasDescription">
131
- <MainBitranContent
132
- :location="{ type: 'contributor', path: contributor.contributorId }"
133
- />
134
- </ContentSection>
130
+ <MainBitranContent
131
+ v-if="contributor.hasDescription"
132
+ :location="{ type: 'contributor', path: contributor.contributorId }"
133
+ />
135
134
  </template>
136
135
 
137
136
  <style lang="scss" module>
@@ -42,15 +42,9 @@ const phrase = await usePhrases('group');
42
42
 
43
43
  <ContentPopovers :generic="groupData.generic" />
44
44
 
45
- <!-- TODO: List of materials in group -->
46
-
47
45
  <div style="clear: both"></div>
48
46
 
49
- <hr style="display: none" />
50
-
51
- <ContentSection>
52
- <MainBitranContent :location />
53
- </ContentSection>
47
+ <MainBitranContent :location />
54
48
 
55
49
  <ContentSection v-if="adsAllowed() && eruditConfig.ads?.bottom">
56
50
  <AdsBannerBottom />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erudit",
3
- "version": "3.0.0-dev.19",
3
+ "version": "3.0.0-dev.20",
4
4
  "type": "module",
5
5
  "description": "🤓 CMS for perfect educational sites.",
6
6
  "license": "MIT",
@@ -15,9 +15,9 @@
15
15
  "erudit": "bin/erudit.mjs"
16
16
  },
17
17
  "peerDependencies": {
18
- "@erudit-js/cog": "3.0.0-dev.19",
19
- "@erudit-js/cli": "3.0.0-dev.19",
20
- "@erudit-js/bitran-elements": "3.0.0-dev.19"
18
+ "@erudit-js/cog": "3.0.0-dev.20",
19
+ "@erudit-js/cli": "3.0.0-dev.20",
20
+ "@erudit-js/bitran-elements": "3.0.0-dev.20"
21
21
  },
22
22
  "dependencies": {
23
23
  "@bitran-js/core": "1.0.0-dev.13",