@erudit-js/prose 4.0.0-dev.4 → 4.0.0-dev.5
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/dist/app/default/Inliners.vue +11 -11
- package/dist/app/default/Mix.vue +11 -11
- package/dist/app/default/Text.vue +25 -25
- package/dist/app/shared/Prose.vue +40 -40
- package/dist/app/shared/Render.vue +51 -51
- package/dist/app/shared/block/AsideMenu.vue +44 -44
- package/dist/app/shared/block/AsideMenuButton.vue +51 -53
- package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -40
- package/dist/app/shared/block/AsideMenuSeparator.vue +3 -3
- package/dist/app/shared/block/Block.vue +270 -275
- package/dist/app/shared/inliner/Inliner.vue +11 -11
- package/dist/app/shared/photoswipe/style.css +22 -26
- package/dist/elements/accent/Accent.vue +88 -92
- package/dist/elements/accent/AccentColumnSection.vue +61 -61
- package/dist/elements/accent/AccentRowSections.vue +64 -65
- package/dist/elements/callout/Callout.vue +81 -85
- package/dist/elements/callout/_global.d.ts +15 -15
- package/dist/elements/caption/Caption.vue +44 -47
- package/dist/elements/caption/_global.d.ts +26 -26
- package/dist/elements/details/Details.vue +49 -50
- package/dist/elements/details/_global.d.ts +27 -27
- package/dist/elements/diagram/Diagram.vue +360 -374
- package/dist/elements/diagram/_global.d.ts +19 -19
- package/dist/elements/diagram/core.d.ts +0 -4
- package/dist/elements/diagram/core.js +1 -7
- package/dist/elements/emphasis/Emphasis.vue +25 -25
- package/dist/elements/emphasis/_global.d.ts +18 -18
- package/dist/elements/flex/Flex.vue +36 -38
- package/dist/elements/flex/_global.d.ts +23 -23
- package/dist/elements/gallery/Gallery.vue +56 -56
- package/dist/elements/gallery/_global.d.ts +18 -18
- package/dist/elements/heading/Heading.vue +44 -44
- package/dist/elements/heading/_global.d.ts +42 -45
- package/dist/elements/heading/core.js +7 -14
- package/dist/elements/horizontalLine/HorizontalLine.vue +6 -6
- package/dist/elements/horizontalLine/_global.d.ts +17 -17
- package/dist/elements/image/Image.vue +15 -15
- package/dist/elements/image/ImageElement.vue +80 -80
- package/dist/elements/image/_global.d.ts +18 -18
- package/dist/elements/lineBreak/LineBreak.vue +3 -3
- package/dist/elements/lineBreak/_global.d.ts +18 -18
- package/dist/elements/link/BlockLink.vue +108 -110
- package/dist/elements/link/Link.vue +92 -96
- package/dist/elements/link/dependency/_global.d.ts +47 -47
- package/dist/elements/link/reference/_global.d.ts +49 -49
- package/dist/elements/list/List.vue +58 -65
- package/dist/elements/list/_global.d.ts +50 -50
- package/dist/elements/math/_global.d.ts +72 -72
- package/dist/elements/math/_global.ts +3 -3
- package/dist/elements/math/components/BlockMath.vue +30 -30
- package/dist/elements/math/components/InlinerMath.vue +65 -65
- package/dist/elements/math/components/Katex.vue +88 -89
- package/dist/elements/math/components/MathGroup.vue +41 -41
- package/dist/elements/math/katex.js +17 -6
- package/dist/elements/paragraph/Paragraph.vue +25 -27
- package/dist/elements/paragraph/_global.d.ts +27 -27
- package/dist/elements/problem/_global.d.ts +112 -112
- package/dist/elements/problem/components/Problem.vue +22 -22
- package/dist/elements/problem/components/ProblemButton.vue +20 -21
- package/dist/elements/problem/components/ProblemContainer.vue +8 -8
- package/dist/elements/problem/components/ProblemContent.vue +356 -371
- package/dist/elements/problem/components/ProblemExpander.vue +7 -7
- package/dist/elements/problem/components/ProblemExpanderSection.vue +57 -57
- package/dist/elements/problem/components/ProblemHeader.vue +100 -102
- package/dist/elements/problem/components/Problems.vue +83 -87
- package/dist/elements/problem/components/SubProblem.vue +14 -14
- package/dist/elements/problem/components/expanders/Check.vue +153 -150
- package/dist/elements/problem/components/expanders/Checks.vue +146 -83
- package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +38 -38
- package/dist/elements/problem/components/expanders/Hint.vue +26 -26
- package/dist/elements/problem/core.d.ts +23 -23
- package/dist/elements/problem/problemContent.d.ts +134 -30
- package/dist/elements/problem/problemContent.js +157 -197
- package/dist/elements/problem/problemScript.d.ts +2 -2
- package/dist/elements/problem/problemScript.js +2 -2
- package/dist/elements/problem/rng.d.ts +1 -1
- package/dist/elements/problem/rng.js +1 -1
- package/dist/elements/table/Table.vue +100 -102
- package/dist/elements/table/_global.d.ts +36 -36
- package/dist/elements/video/Video.vue +110 -109
- package/dist/elements/video/_global.d.ts +18 -18
- package/package.json +42 -43
- package/types.d.ts +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<hr
|
|
3
|
+
class="border-border mx-(--proseAsideWidth) mt-(--proseGap) rounded border-0
|
|
4
|
+
border-b"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Horizontal lines are used to separate prose content in places
|
|
3
|
-
* where it is not possible to use headings or built-in block separators.
|
|
4
|
-
*
|
|
5
|
-
* Use with extra caution, as overuse of horizontal lines can make prose look cluttered!
|
|
6
|
-
* When possible, prefer other means of content separation.
|
|
7
|
-
*
|
|
8
|
-
* @title Horizontal Line
|
|
9
|
-
* @layout block
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <P>Paragraph 1</P>
|
|
13
|
-
* <Hr />
|
|
14
|
-
* <P>Paragraph 2</P>
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export const Hr = '_tag_';
|
|
1
|
+
/**
|
|
2
|
+
* Horizontal lines are used to separate prose content in places
|
|
3
|
+
* where it is not possible to use headings or built-in block separators.
|
|
4
|
+
*
|
|
5
|
+
* Use with extra caution, as overuse of horizontal lines can make prose look cluttered!
|
|
6
|
+
* When possible, prefer other means of content separation.
|
|
7
|
+
*
|
|
8
|
+
* @title Horizontal Line
|
|
9
|
+
* @layout block
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <P>Paragraph 1</P>
|
|
13
|
+
* <Hr />
|
|
14
|
+
* <P>Paragraph 2</P>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export const Hr = '_tag_';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ProseElement } from '@jsprose/core';
|
|
3
|
-
|
|
4
|
-
import type { imageSchema } from './core.js';
|
|
5
|
-
import Block from '../../app/shared/block/Block.vue';
|
|
6
|
-
import ImageElement from './ImageElement.vue';
|
|
7
|
-
|
|
8
|
-
defineProps<{ element: ProseElement<typeof imageSchema> }>();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ProseElement } from '@jsprose/core';
|
|
3
|
+
|
|
4
|
+
import type { imageSchema } from './core.js';
|
|
5
|
+
import Block from '../../app/shared/block/Block.vue';
|
|
6
|
+
import ImageElement from './ImageElement.vue';
|
|
7
|
+
|
|
8
|
+
defineProps<{ element: ProseElement<typeof imageSchema> }>();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<Block :element>
|
|
13
|
+
<ImageElement :element />
|
|
14
|
+
</Block>
|
|
15
|
+
</template>
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { shallowRef } from 'vue';
|
|
3
|
-
import type { ProseElement } from '@jsprose/core';
|
|
4
|
-
|
|
5
|
-
import type { imageSchema } from './core.js';
|
|
6
|
-
import { useElementStorage } from '../../app/composables/storage.js';
|
|
7
|
-
import { usePhotoSwipe } from '../../app/shared/photoswipe/composable.js';
|
|
8
|
-
import { lightInvert, darkInvert } from '../../app/shared/invert.js';
|
|
9
|
-
import Caption from '../caption/Caption.vue';
|
|
10
|
-
|
|
11
|
-
const { element } = defineProps<{
|
|
12
|
-
|
|
13
|
-
}>();
|
|
14
|
-
const imageStorage = await useElementStorage<typeof imageSchema>(element);
|
|
15
|
-
|
|
16
|
-
const captionElement = shallowRef<HTMLElement>();
|
|
17
|
-
const { lightbox, initLightbox } = usePhotoSwipe();
|
|
18
|
-
|
|
19
|
-
function imageClick() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<template>
|
|
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
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { shallowRef } from 'vue';
|
|
3
|
+
import type { ProseElement } from '@jsprose/core';
|
|
4
|
+
|
|
5
|
+
import type { imageSchema } from './core.js';
|
|
6
|
+
import { useElementStorage } from '../../app/composables/storage.js';
|
|
7
|
+
import { usePhotoSwipe } from '../../app/shared/photoswipe/composable.js';
|
|
8
|
+
import { lightInvert, darkInvert } from '../../app/shared/invert.js';
|
|
9
|
+
import Caption from '../caption/Caption.vue';
|
|
10
|
+
|
|
11
|
+
const { element } = defineProps<{
|
|
12
|
+
element: ProseElement<typeof imageSchema>;
|
|
13
|
+
}>();
|
|
14
|
+
const imageStorage = await useElementStorage<typeof imageSchema>(element);
|
|
15
|
+
|
|
16
|
+
const captionElement = shallowRef<HTMLElement>();
|
|
17
|
+
const { lightbox, initLightbox } = usePhotoSwipe();
|
|
18
|
+
|
|
19
|
+
function imageClick() {
|
|
20
|
+
if (!lightbox.value) {
|
|
21
|
+
initLightbox(
|
|
22
|
+
{
|
|
23
|
+
dataSource: [
|
|
24
|
+
{
|
|
25
|
+
src: imageStorage.resolvedSrc,
|
|
26
|
+
width: imageStorage.width,
|
|
27
|
+
height: imageStorage.height,
|
|
28
|
+
type: 'image',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
captionElement.value,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
lightbox.value!.on('contentActivate', (event) => {
|
|
36
|
+
event.content.element!.className +=
|
|
37
|
+
' ' +
|
|
38
|
+
(element.data.invert === 'light'
|
|
39
|
+
? lightInvert
|
|
40
|
+
: element.data.invert === 'dark'
|
|
41
|
+
? darkInvert
|
|
42
|
+
: '');
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
lightbox.value!.loadAndOpen(0);
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div class="text-center">
|
|
52
|
+
<img
|
|
53
|
+
:src="imageStorage.resolvedSrc"
|
|
54
|
+
@click="imageClick"
|
|
55
|
+
loading="lazy"
|
|
56
|
+
v-bind="
|
|
57
|
+
element.data.width
|
|
58
|
+
? {
|
|
59
|
+
style: {
|
|
60
|
+
width: element.data.width,
|
|
61
|
+
maxWidth: `min(${element.data.width}, 100%)`,
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
: {}
|
|
65
|
+
"
|
|
66
|
+
:class="[
|
|
67
|
+
'inline-block cursor-pointer rounded-xl',
|
|
68
|
+
{
|
|
69
|
+
[lightInvert]: element.data.invert === 'light',
|
|
70
|
+
[darkInvert]: element.data.invert === 'dark',
|
|
71
|
+
},
|
|
72
|
+
]"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
<Caption
|
|
76
|
+
v-if="element.children"
|
|
77
|
+
@captionMounted="(element) => (captionElement = element)"
|
|
78
|
+
:caption="element.children[0]"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* **Caution:** images should be placed locally somewhere within current Erudit project folder
|
|
3
|
-
* (preferable somewhere near the document using them).
|
|
4
|
-
*
|
|
5
|
-
* @title Image
|
|
6
|
-
* @layout block
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* // import vectorProjection from './assets/vector-projection.svg';
|
|
10
|
-
* <Image src={vectorProjection} width="400px" invert="dark" />
|
|
11
|
-
*
|
|
12
|
-
* // import complexDiagram from './assets/complex-diagram.png';
|
|
13
|
-
* <Image src={complexDiagram}>
|
|
14
|
-
* <Caption>Complex diagram example</Caption>
|
|
15
|
-
* </Image>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export const Image = '_tag_';
|
|
1
|
+
/**
|
|
2
|
+
* **Caution:** images should be placed locally somewhere within current Erudit project folder
|
|
3
|
+
* (preferable somewhere near the document using them).
|
|
4
|
+
*
|
|
5
|
+
* @title Image
|
|
6
|
+
* @layout block
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // import vectorProjection from './assets/vector-projection.svg';
|
|
10
|
+
* <Image src={vectorProjection} width="400px" invert="dark" />
|
|
11
|
+
*
|
|
12
|
+
* // import complexDiagram from './assets/complex-diagram.png';
|
|
13
|
+
* <Image src={complexDiagram}>
|
|
14
|
+
* <Caption>Complex diagram example</Caption>
|
|
15
|
+
* </Image>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const Image = '_tag_';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<br />
|
|
3
|
+
</template>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* By default text is aligned stretch to fill the line width in wide layouts and left-aligned in narrow layouts.
|
|
3
|
-
* Line breaking is done automatically based on the available width.
|
|
4
|
-
*
|
|
5
|
-
* `<Br />` can be used to manually break the line.
|
|
6
|
-
*
|
|
7
|
-
* @title Line Break
|
|
8
|
-
* @layout inliner
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <>
|
|
12
|
-
* Snow on the ground.<Br />
|
|
13
|
-
* Snow on the tree.<Br />
|
|
14
|
-
* Snow on the house.<Br />
|
|
15
|
-
* Snow on me!
|
|
16
|
-
* </>
|
|
17
|
-
*/
|
|
18
|
-
export const Br = '_tag_';
|
|
1
|
+
/**
|
|
2
|
+
* By default text is aligned stretch to fill the line width in wide layouts and left-aligned in narrow layouts.
|
|
3
|
+
* Line breaking is done automatically based on the available width.
|
|
4
|
+
*
|
|
5
|
+
* `<Br />` can be used to manually break the line.
|
|
6
|
+
*
|
|
7
|
+
* @title Line Break
|
|
8
|
+
* @layout inliner
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <>
|
|
12
|
+
* Snow on the ground.<Br />
|
|
13
|
+
* Snow on the tree.<Br />
|
|
14
|
+
* Snow on the house.<Br />
|
|
15
|
+
* Snow on me!
|
|
16
|
+
* </>
|
|
17
|
+
*/
|
|
18
|
+
export const Br = '_tag_';
|
|
@@ -1,110 +1,108 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { shallowRef } from 'vue';
|
|
3
|
-
import { ProseError, type ProseElement } from '@jsprose/core';
|
|
4
|
-
|
|
5
|
-
import type { dependencySchema } from './dependency/core.js';
|
|
6
|
-
import type { referenceSchema } from './reference/core.js';
|
|
7
|
-
import type { LinkStorage } from './storage.js';
|
|
8
|
-
import { useProseContext } from '../../app/composables/context.js';
|
|
9
|
-
import { useElementStorage } from '../../app/composables/storage.js';
|
|
10
|
-
import { useFormatText } from '../../app/composables/formatText.js';
|
|
11
|
-
import { useElementPhrase } from '../../app/composables/language.js';
|
|
12
|
-
import { useElementIcon } from '../../app/composables/elementIcon.js';
|
|
13
|
-
import Block from '../../app/shared/block/Block.vue';
|
|
14
|
-
|
|
15
|
-
const { element } = defineProps<{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}>();
|
|
20
|
-
|
|
21
|
-
const { EruditLink, EruditIcon, eruditIcons } = useProseContext();
|
|
22
|
-
const linkStorage = (await useElementStorage(element as any)) as LinkStorage;
|
|
23
|
-
const formatText = useFormatText();
|
|
24
|
-
|
|
25
|
-
interface UIData {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const uiData = shallowRef<UIData>();
|
|
35
|
-
|
|
36
|
-
switch (linkStorage.type) {
|
|
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
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<template>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</Block>
|
|
110
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { shallowRef } from 'vue';
|
|
3
|
+
import { ProseError, type ProseElement } from '@jsprose/core';
|
|
4
|
+
|
|
5
|
+
import type { dependencySchema } from './dependency/core.js';
|
|
6
|
+
import type { referenceSchema } from './reference/core.js';
|
|
7
|
+
import type { LinkStorage } from './storage.js';
|
|
8
|
+
import { useProseContext } from '../../app/composables/context.js';
|
|
9
|
+
import { useElementStorage } from '../../app/composables/storage.js';
|
|
10
|
+
import { useFormatText } from '../../app/composables/formatText.js';
|
|
11
|
+
import { useElementPhrase } from '../../app/composables/language.js';
|
|
12
|
+
import { useElementIcon } from '../../app/composables/elementIcon.js';
|
|
13
|
+
import Block from '../../app/shared/block/Block.vue';
|
|
14
|
+
|
|
15
|
+
const { element } = defineProps<{
|
|
16
|
+
element:
|
|
17
|
+
| ProseElement<typeof referenceSchema>
|
|
18
|
+
| ProseElement<typeof dependencySchema>;
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const { EruditLink, EruditIcon, eruditIcons } = useProseContext();
|
|
22
|
+
const linkStorage = (await useElementStorage(element as any)) as LinkStorage;
|
|
23
|
+
const formatText = useFormatText();
|
|
24
|
+
|
|
25
|
+
interface UIData {
|
|
26
|
+
icon: string;
|
|
27
|
+
text: string;
|
|
28
|
+
secondary?: {
|
|
29
|
+
icon: string;
|
|
30
|
+
text: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const uiData = shallowRef<UIData>();
|
|
35
|
+
|
|
36
|
+
switch (linkStorage.type) {
|
|
37
|
+
case 'unique':
|
|
38
|
+
const elementPhrase = await useElementPhrase(linkStorage.schemaName);
|
|
39
|
+
uiData.value = {
|
|
40
|
+
icon: await useElementIcon(linkStorage.schemaName),
|
|
41
|
+
text: linkStorage.elementTitle || elementPhrase.element_name,
|
|
42
|
+
secondary: {
|
|
43
|
+
icon: eruditIcons[
|
|
44
|
+
linkStorage.content.contentType === 'topic'
|
|
45
|
+
? linkStorage.content.topicPart
|
|
46
|
+
: linkStorage.content.contentType
|
|
47
|
+
],
|
|
48
|
+
text: linkStorage.content.contentTitle,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
case 'contentItem':
|
|
53
|
+
uiData.value = {
|
|
54
|
+
icon: eruditIcons[
|
|
55
|
+
linkStorage.content.contentType === 'topic'
|
|
56
|
+
? linkStorage.content.topicPart
|
|
57
|
+
: linkStorage.content.contentType
|
|
58
|
+
],
|
|
59
|
+
text: linkStorage.content.contentTitle,
|
|
60
|
+
};
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
throw new ProseError(
|
|
64
|
+
'BlockLink supports only Unique and Document link types!',
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<Block :element>
|
|
71
|
+
<EruditLink
|
|
72
|
+
target="_blank"
|
|
73
|
+
:to="linkStorage.resolvedHref"
|
|
74
|
+
class="group bg-brand/5 border-brand/20 hocus:bg-brand/10
|
|
75
|
+
hocus:border-brand/40 relative block rounded-xl border-2 border-dashed
|
|
76
|
+
p-(--proseAsideWidth) transition-[border,background]"
|
|
77
|
+
>
|
|
78
|
+
<EruditIcon
|
|
79
|
+
name="arrow/outward"
|
|
80
|
+
class="text-brand/15 group-hocus:text-brand/20 top-small right-small
|
|
81
|
+
absolute shrink-0 text-[60px]"
|
|
82
|
+
/>
|
|
83
|
+
<div
|
|
84
|
+
class="text-brand/80 group-hocus:text-brand mb-small gap-small
|
|
85
|
+
font-medium transition-[color]"
|
|
86
|
+
>
|
|
87
|
+
<EruditIcon
|
|
88
|
+
:name="uiData!.icon"
|
|
89
|
+
class="mr-small relative top-0.5 inline align-baseline text-[1.1em]"
|
|
90
|
+
/>
|
|
91
|
+
<span>{{ formatText(uiData!.text) }}</span>
|
|
92
|
+
</div>
|
|
93
|
+
<div class="text-text-muted">
|
|
94
|
+
{{ formatText(element.data.label) }}
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
v-if="uiData!.secondary"
|
|
98
|
+
class="text-text-dimmed mt-small text-main-xs"
|
|
99
|
+
>
|
|
100
|
+
<EruditIcon
|
|
101
|
+
:name="uiData!.secondary!.icon"
|
|
102
|
+
class="mr-small relative top-0.5 inline align-baseline"
|
|
103
|
+
/>
|
|
104
|
+
<span>{{ formatText(uiData!.secondary!.text) }}</span>
|
|
105
|
+
</div>
|
|
106
|
+
</EruditLink>
|
|
107
|
+
</Block>
|
|
108
|
+
</template>
|