@erudit-js/prose 4.0.0-dev.5 → 4.0.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 (86) hide show
  1. package/dist/app/default/Inliners.vue +11 -11
  2. package/dist/app/default/Mix.vue +11 -11
  3. package/dist/app/default/Text.vue +25 -25
  4. package/dist/app/shared/Prose.vue +40 -40
  5. package/dist/app/shared/Render.vue +51 -51
  6. package/dist/app/shared/assets/block.svg +2 -2
  7. package/dist/app/shared/assets/check.svg +2 -2
  8. package/dist/app/shared/assets/inliner.svg +2 -2
  9. package/dist/app/shared/assets/plus.svg +2 -2
  10. package/dist/app/shared/block/AsideMenu.vue +44 -44
  11. package/dist/app/shared/block/AsideMenuButton.vue +51 -51
  12. package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -40
  13. package/dist/app/shared/block/AsideMenuSeparator.vue +3 -3
  14. package/dist/app/shared/block/Block.vue +270 -270
  15. package/dist/app/shared/inliner/Inliner.vue +11 -11
  16. package/dist/app/shared/photoswipe/style.css +22 -22
  17. package/dist/elements/accent/Accent.vue +88 -88
  18. package/dist/elements/accent/AccentColumnSection.vue +61 -61
  19. package/dist/elements/accent/AccentRowSections.vue +64 -64
  20. package/dist/elements/callout/Callout.vue +81 -81
  21. package/dist/elements/callout/_global.d.ts +15 -15
  22. package/dist/elements/caption/Caption.vue +44 -44
  23. package/dist/elements/caption/_global.d.ts +26 -26
  24. package/dist/elements/details/Details.vue +49 -49
  25. package/dist/elements/details/_global.d.ts +27 -27
  26. package/dist/elements/details/icon.svg +2 -2
  27. package/dist/elements/diagram/Diagram.vue +360 -360
  28. package/dist/elements/diagram/_global.d.ts +19 -19
  29. package/dist/elements/emphasis/Emphasis.vue +25 -25
  30. package/dist/elements/emphasis/_global.d.ts +18 -18
  31. package/dist/elements/flex/Flex.vue +36 -36
  32. package/dist/elements/flex/_global.d.ts +23 -23
  33. package/dist/elements/gallery/Gallery.vue +56 -56
  34. package/dist/elements/gallery/_global.d.ts +18 -18
  35. package/dist/elements/heading/Heading.vue +44 -44
  36. package/dist/elements/heading/_global.d.ts +42 -42
  37. package/dist/elements/heading/icon.svg +2 -2
  38. package/dist/elements/horizontalLine/HorizontalLine.vue +6 -6
  39. package/dist/elements/horizontalLine/_global.d.ts +17 -17
  40. package/dist/elements/image/Image.vue +15 -15
  41. package/dist/elements/image/ImageElement.vue +80 -80
  42. package/dist/elements/image/_global.d.ts +18 -18
  43. package/dist/elements/lineBreak/LineBreak.vue +3 -3
  44. package/dist/elements/lineBreak/_global.d.ts +18 -18
  45. package/dist/elements/link/BlockLink.vue +108 -108
  46. package/dist/elements/link/Link.vue +92 -92
  47. package/dist/elements/link/dependency/_global.d.ts +47 -47
  48. package/dist/elements/link/reference/_global.d.ts +49 -49
  49. package/dist/elements/list/List.vue +58 -58
  50. package/dist/elements/list/_global.d.ts +50 -50
  51. package/dist/elements/math/_global.d.ts +72 -72
  52. package/dist/elements/math/_global.ts +3 -3
  53. package/dist/elements/math/components/BlockMath.vue +30 -30
  54. package/dist/elements/math/components/InlinerMath.vue +65 -65
  55. package/dist/elements/math/components/Katex.vue +88 -88
  56. package/dist/elements/math/components/MathGroup.vue +41 -41
  57. package/dist/elements/paragraph/Paragraph.vue +25 -25
  58. package/dist/elements/paragraph/_global.d.ts +27 -27
  59. package/dist/elements/paragraph/icon.svg +3 -3
  60. package/dist/elements/problem/_global.d.ts +112 -112
  61. package/dist/elements/problem/assets/actions/answer.svg +2 -2
  62. package/dist/elements/problem/assets/actions/check.svg +2 -2
  63. package/dist/elements/problem/assets/actions/generate.svg +2 -2
  64. package/dist/elements/problem/assets/actions/hint.svg +2 -2
  65. package/dist/elements/problem/assets/actions/note.svg +2 -2
  66. package/dist/elements/problem/assets/actions/solution.svg +2 -2
  67. package/dist/elements/problem/assets/icon.svg +2 -2
  68. package/dist/elements/problem/components/Problem.vue +22 -22
  69. package/dist/elements/problem/components/ProblemButton.vue +20 -20
  70. package/dist/elements/problem/components/ProblemContainer.vue +8 -8
  71. package/dist/elements/problem/components/ProblemContent.vue +356 -356
  72. package/dist/elements/problem/components/ProblemExpander.vue +7 -7
  73. package/dist/elements/problem/components/ProblemExpanderSection.vue +57 -57
  74. package/dist/elements/problem/components/ProblemHeader.vue +100 -100
  75. package/dist/elements/problem/components/Problems.vue +83 -83
  76. package/dist/elements/problem/components/SubProblem.vue +14 -14
  77. package/dist/elements/problem/components/expanders/Check.vue +153 -153
  78. package/dist/elements/problem/components/expanders/Checks.vue +146 -146
  79. package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +38 -38
  80. package/dist/elements/problem/components/expanders/Hint.vue +26 -26
  81. package/dist/elements/table/Table.vue +100 -100
  82. package/dist/elements/table/_global.d.ts +36 -36
  83. package/dist/elements/video/Video.vue +110 -110
  84. package/dist/elements/video/_global.d.ts +18 -18
  85. package/package.json +4 -4
  86. package/types.d.ts +4 -4
@@ -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
- <Block :element>
13
- <ImageElement :element />
14
- </Block>
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
- 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
+ <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
- <br />
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,108 +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
- 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>
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>