@erudit-js/prose 4.0.0 → 4.1.0

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 (129) hide show
  1. package/dist/app/composables/context.d.ts +6 -1
  2. package/dist/app/default/Inliners.vue +11 -11
  3. package/dist/app/default/Mix.vue +11 -11
  4. package/dist/app/default/Text.vue +25 -25
  5. package/dist/app/language/element.d.ts +1 -1
  6. package/dist/app/shared/Prose.vue +40 -40
  7. package/dist/app/shared/Render.vue +51 -51
  8. package/dist/app/shared/assets/block.svg +2 -2
  9. package/dist/app/shared/assets/check.svg +2 -2
  10. package/dist/app/shared/assets/inliner.svg +2 -2
  11. package/dist/app/shared/assets/plus.svg +2 -2
  12. package/dist/app/shared/block/AsideMenu.vue +44 -44
  13. package/dist/app/shared/block/AsideMenuButton.vue +51 -51
  14. package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -40
  15. package/dist/app/shared/block/AsideMenuSeparator.vue +3 -3
  16. package/dist/app/shared/block/Block.vue +270 -270
  17. package/dist/app/shared/inliner/Inliner.vue +11 -11
  18. package/dist/app/shared/photoswipe/style.css +22 -22
  19. package/dist/elements/accent/Accent.vue +89 -88
  20. package/dist/elements/accent/AccentColumnSection.vue +61 -61
  21. package/dist/elements/accent/AccentRowSections.vue +64 -64
  22. package/dist/elements/callout/Callout.vue +81 -81
  23. package/dist/elements/callout/_global.d.ts +15 -15
  24. package/dist/elements/caption/Caption.vue +44 -44
  25. package/dist/elements/caption/_global.d.ts +26 -26
  26. package/dist/elements/details/Details.vue +49 -49
  27. package/dist/elements/details/_global.d.ts +27 -27
  28. package/dist/elements/details/icon.svg +2 -2
  29. package/dist/elements/diagram/Diagram.vue +356 -360
  30. package/dist/elements/diagram/_global.d.ts +19 -19
  31. package/dist/elements/emphasis/Emphasis.vue +25 -25
  32. package/dist/elements/emphasis/_global.d.ts +18 -18
  33. package/dist/elements/flex/Flex.vue +36 -36
  34. package/dist/elements/flex/_global.d.ts +23 -23
  35. package/dist/elements/gallery/Gallery.vue +56 -56
  36. package/dist/elements/gallery/_global.d.ts +18 -18
  37. package/dist/elements/heading/Heading.vue +44 -44
  38. package/dist/elements/heading/_global.d.ts +42 -42
  39. package/dist/elements/heading/icon.svg +2 -2
  40. package/dist/elements/horizontalLine/HorizontalLine.vue +6 -6
  41. package/dist/elements/horizontalLine/_global.d.ts +17 -17
  42. package/dist/elements/image/Image.vue +15 -15
  43. package/dist/elements/image/ImageElement.vue +80 -80
  44. package/dist/elements/image/_global.d.ts +18 -18
  45. package/dist/elements/lineBreak/LineBreak.vue +3 -3
  46. package/dist/elements/lineBreak/_global.d.ts +18 -18
  47. package/dist/elements/link/BlockLink.vue +159 -108
  48. package/dist/elements/link/Link.vue +119 -92
  49. package/dist/elements/link/core.js +1 -1
  50. package/dist/elements/link/dependency/_global.d.ts +47 -47
  51. package/dist/elements/link/dependency/app.d.ts +2 -2
  52. package/dist/elements/link/dependency/core.d.ts +12 -18
  53. package/dist/elements/link/dependency/core.js +1 -17
  54. package/dist/elements/link/reference/_global.d.ts +49 -49
  55. package/dist/elements/link/reference/languages/en.d.ts +2 -3
  56. package/dist/elements/link/reference/languages/en.js +5 -1
  57. package/dist/elements/link/reference/languages/ru.d.ts +2 -3
  58. package/dist/elements/link/reference/languages/ru.js +5 -1
  59. package/dist/elements/link/reference/phrases.d.ts +5 -0
  60. package/dist/elements/link/reference/phrases.js +1 -0
  61. package/dist/elements/link/step.d.ts +16 -0
  62. package/dist/elements/link/step.js +36 -0
  63. package/dist/elements/link/storage.d.ts +9 -5
  64. package/dist/elements/link/storage.js +4 -4
  65. package/dist/elements/list/List.vue +58 -58
  66. package/dist/elements/list/_global.d.ts +50 -50
  67. package/dist/elements/math/_global.d.ts +79 -72
  68. package/dist/elements/math/_global.ts +3 -3
  69. package/dist/elements/math/block.d.ts +2 -0
  70. package/dist/elements/math/block.js +42 -29
  71. package/dist/elements/math/components/BlockMath.vue +30 -30
  72. package/dist/elements/math/components/InlinerMath.vue +65 -65
  73. package/dist/elements/math/components/Katex.vue +88 -88
  74. package/dist/elements/math/components/MathGroup.vue +58 -41
  75. package/dist/elements/paragraph/Paragraph.vue +25 -25
  76. package/dist/elements/paragraph/_global.d.ts +27 -27
  77. package/dist/elements/paragraph/icon.svg +3 -3
  78. package/dist/elements/problem/_global.d.ts +257 -112
  79. package/dist/elements/problem/app.d.ts +7 -7
  80. package/dist/elements/problem/app.js +13 -12
  81. package/dist/elements/problem/assets/actions/answer.svg +2 -2
  82. package/dist/elements/problem/assets/actions/check.svg +2 -2
  83. package/dist/elements/problem/assets/actions/generate.svg +2 -2
  84. package/dist/elements/problem/assets/actions/hint.svg +2 -2
  85. package/dist/elements/problem/assets/actions/note.svg +2 -2
  86. package/dist/elements/problem/assets/actions/solution.svg +2 -2
  87. package/dist/elements/problem/assets/icon.svg +2 -2
  88. package/dist/elements/problem/components/Problem.vue +22 -22
  89. package/dist/elements/problem/components/ProblemButton.vue +20 -20
  90. package/dist/elements/problem/components/ProblemButtonGenerate.vue +96 -0
  91. package/dist/elements/problem/components/ProblemContainer.vue +8 -8
  92. package/dist/elements/problem/components/ProblemContent.vue +266 -356
  93. package/dist/elements/problem/components/ProblemExpander.vue +7 -7
  94. package/dist/elements/problem/components/ProblemExpanderSection.vue +57 -57
  95. package/dist/elements/problem/components/ProblemHeader.vue +100 -100
  96. package/dist/elements/problem/components/Problems.vue +83 -83
  97. package/dist/elements/problem/components/SubProblem.vue +14 -14
  98. package/dist/elements/problem/components/expanders/Check.vue +200 -153
  99. package/dist/elements/problem/components/expanders/Checks.vue +146 -146
  100. package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +36 -38
  101. package/dist/elements/problem/components/expanders/Hint.vue +26 -26
  102. package/dist/elements/problem/core.d.ts +55 -28
  103. package/dist/elements/problem/core.js +2 -1
  104. package/dist/elements/problem/languages/{en.d.ts → problem/en.d.ts} +1 -1
  105. package/dist/elements/problem/languages/problem/en.js +6 -0
  106. package/dist/elements/problem/languages/{ru.d.ts → problem/ru.d.ts} +1 -1
  107. package/dist/elements/problem/languages/problem/ru.js +6 -0
  108. package/dist/elements/problem/languages/problems/en.d.ts +3 -0
  109. package/dist/elements/problem/languages/problems/en.js +6 -0
  110. package/dist/elements/problem/languages/problems/ru.d.ts +3 -0
  111. package/dist/elements/problem/languages/problems/ru.js +6 -0
  112. package/dist/elements/problem/languages/shared/en.d.ts +3 -0
  113. package/dist/elements/problem/languages/{en.js → shared/en.js} +12 -3
  114. package/dist/elements/problem/languages/shared/ru.d.ts +3 -0
  115. package/dist/elements/problem/languages/{ru.js → shared/ru.js} +12 -3
  116. package/dist/elements/problem/phrases.d.ts +4 -0
  117. package/dist/elements/problem/problemCheck.d.ts +166 -0
  118. package/dist/elements/problem/problemCheck.js +203 -0
  119. package/dist/elements/problem/problemContent.d.ts +2 -120
  120. package/dist/elements/problem/problemContent.js +2 -127
  121. package/dist/elements/problem/problemScript.d.ts +6 -1
  122. package/dist/elements/table/Table.vue +100 -100
  123. package/dist/elements/table/_global.d.ts +36 -36
  124. package/dist/elements/video/Video.vue +110 -110
  125. package/dist/elements/video/_global.d.ts +18 -18
  126. package/dist/resolve.d.ts +2 -1
  127. package/dist/resolve.js +8 -5
  128. package/package.json +4 -4
  129. package/types.d.ts +4 -4
@@ -1,44 +1,44 @@
1
- <script lang="ts" setup>
2
- import { onMounted, useTemplateRef } from 'vue';
3
- import { isProseElement, type ProseElement } from '@jsprose/core';
4
-
5
- import { captionSecondarySchema, type captionSchema } from './core.js';
6
- import Render from '../../app/shared/Render.vue';
7
-
8
- const { caption } = defineProps<{
9
- caption: ProseElement<typeof captionSchema>;
10
- }>();
11
-
12
- const emit = defineEmits(['captionMounted']);
13
-
14
- const captionElement = useTemplateRef('caption');
15
-
16
- const captionSecondary = caption.children.find((child) =>
17
- isProseElement(child, captionSecondarySchema),
18
- );
19
- const mainInliners = caption.children.filter(
20
- (child) => child !== captionSecondary,
21
- );
22
-
23
- const width = caption.data?.width ? `min(${caption.data.width}, 100%)` : '';
24
-
25
- onMounted(() => {
26
- emit('captionMounted', captionElement.value);
27
- });
28
- </script>
29
-
30
- <template>
31
- <div
32
- ref="caption"
33
- class="**:text-text-muted text-main-sm mt-small micro:mt-normal m-auto
34
- text-center"
35
- v-bind="width ? { style: { width } } : {}"
36
- >
37
- <div class="font-semibold">
38
- <Render v-for="child of mainInliners" :element="child" />
39
- </div>
40
- <div v-if="captionSecondary">
41
- <Render v-for="child of captionSecondary.children" :element="child" />
42
- </div>
43
- </div>
44
- </template>
1
+ <script lang="ts" setup>
2
+ import { onMounted, useTemplateRef } from 'vue';
3
+ import { isProseElement, type ProseElement } from '@jsprose/core';
4
+
5
+ import { captionSecondarySchema, type captionSchema } from './core.js';
6
+ import Render from '../../app/shared/Render.vue';
7
+
8
+ const { caption } = defineProps<{
9
+ caption: ProseElement<typeof captionSchema>;
10
+ }>();
11
+
12
+ const emit = defineEmits(['captionMounted']);
13
+
14
+ const captionElement = useTemplateRef('caption');
15
+
16
+ const captionSecondary = caption.children.find((child) =>
17
+ isProseElement(child, captionSecondarySchema),
18
+ );
19
+ const mainInliners = caption.children.filter(
20
+ (child) => child !== captionSecondary,
21
+ );
22
+
23
+ const width = caption.data?.width ? `min(${caption.data.width}, 100%)` : '';
24
+
25
+ onMounted(() => {
26
+ emit('captionMounted', captionElement.value);
27
+ });
28
+ </script>
29
+
30
+ <template>
31
+ <div
32
+ ref="caption"
33
+ class="**:text-text-muted text-main-sm mt-small micro:mt-normal m-auto
34
+ text-center"
35
+ v-bind="width ? { style: { width } } : {}"
36
+ >
37
+ <div class="font-semibold">
38
+ <Render v-for="child of mainInliners" :element="child" />
39
+ </div>
40
+ <div v-if="captionSecondary">
41
+ <Render v-for="child of captionSecondary.children" :element="child" />
42
+ </div>
43
+ </div>
44
+ </template>
@@ -1,26 +1,26 @@
1
- /**
2
- * Captions are used to provide descriptive text for images, videos, and other media elements.
3
- * They can contain content (which is treated as the main caption) and an optional secondary caption for additional context.
4
- *
5
- * @title Caption
6
- * @layout inliner
7
- * @example
8
- * ```tsx
9
- * <Image src={triangleA}>
10
- * <Caption width="300px">
11
- * A right-angled triangle with sides <M>A</M>, <M>B</M> and hypotenuse <M>C</M>.
12
- * </Caption>
13
- * </Image>
14
- *
15
- * <Video src={lawOfSines}>
16
- * <Caption>
17
- * Law of sines explanation.
18
- * <CaptionSecondary>
19
- * Pay attention to the angle notation!
20
- * </CaptionSecondary>
21
- * </Caption>
22
- * </Video>
23
- * ```
24
- */
25
- export const Caption = '_tag_';
26
- export const CaptionSecondary = '_tag_';
1
+ /**
2
+ * Captions are used to provide descriptive text for images, videos, and other media elements.
3
+ * They can contain content (which is treated as the main caption) and an optional secondary caption for additional context.
4
+ *
5
+ * @title Caption
6
+ * @layout inliner
7
+ * @example
8
+ * ```tsx
9
+ * <Image src={triangleA}>
10
+ * <Caption width="300px">
11
+ * A right-angled triangle with sides <M>A</M>, <M>B</M> and hypotenuse <M>C</M>.
12
+ * </Caption>
13
+ * </Image>
14
+ *
15
+ * <Video src={lawOfSines}>
16
+ * <Caption>
17
+ * Law of sines explanation.
18
+ * <CaptionSecondary>
19
+ * Pay attention to the angle notation!
20
+ * </CaptionSecondary>
21
+ * </Caption>
22
+ * </Video>
23
+ * ```
24
+ */
25
+ export const Caption = '_tag_';
26
+ export const CaptionSecondary = '_tag_';
@@ -1,49 +1,49 @@
1
- <script lang="ts" setup>
2
- import type { ProseElement } from '@jsprose/core';
3
-
4
- import type { detailsSchema } from './core.js';
5
- import { useFormatText } from '../../app/composables/formatText.js';
6
- import { useProseContext } from '../../app/composables/context.js';
7
- import {
8
- useIsAnchor,
9
- useContainsAnchor,
10
- } from '../../app/composables/anchor.js';
11
- import { useElementIcon } from '../../app/composables/elementIcon.js';
12
- import { useElementPhrase } from '../../app/composables/language.js';
13
- import Block from '../../app/shared/block/Block.vue';
14
- import Render from '../../app/shared/Render.vue';
15
-
16
- const { element } = defineProps<{
17
- element: ProseElement<typeof detailsSchema>;
18
- }>();
19
-
20
- const { EruditIcon } = useProseContext();
21
- const formatText = useFormatText();
22
- const icon = await useElementIcon(element);
23
- const phrase = await useElementPhrase(element);
24
- const { mode } = useProseContext();
25
- const isAnchor = useIsAnchor(element);
26
- const containsAnchor = useContainsAnchor(element);
27
- </script>
28
-
29
- <template>
30
- <Block :element v-if="isAnchor || containsAnchor || mode !== 'static'">
31
- <div
32
- class="border-border bg-bg-accent/30 rounded-xl border-2 border-dashed
33
- dark:border-white/30 dark:bg-white/5"
34
- >
35
- <div class="text-text-muted p-(--proseAsideWidth) font-medium">
36
- <EruditIcon
37
- :name="icon"
38
- class="text-main-sm mr-small relative top-0.5 inline align-baseline"
39
- />
40
- <span>
41
- {{ formatText(element.data.title || phrase.element_name) }}
42
- </span>
43
- </div>
44
- <div class="pb-(--proseAsideWidth)">
45
- <Render v-for="child in element.children" :element="child" />
46
- </div>
47
- </div>
48
- </Block>
49
- </template>
1
+ <script lang="ts" setup>
2
+ import type { ProseElement } from '@jsprose/core';
3
+
4
+ import type { detailsSchema } from './core.js';
5
+ import { useFormatText } from '../../app/composables/formatText.js';
6
+ import { useProseContext } from '../../app/composables/context.js';
7
+ import {
8
+ useIsAnchor,
9
+ useContainsAnchor,
10
+ } from '../../app/composables/anchor.js';
11
+ import { useElementIcon } from '../../app/composables/elementIcon.js';
12
+ import { useElementPhrase } from '../../app/composables/language.js';
13
+ import Block from '../../app/shared/block/Block.vue';
14
+ import Render from '../../app/shared/Render.vue';
15
+
16
+ const { element } = defineProps<{
17
+ element: ProseElement<typeof detailsSchema>;
18
+ }>();
19
+
20
+ const { EruditIcon } = useProseContext();
21
+ const formatText = useFormatText();
22
+ const icon = await useElementIcon(element);
23
+ const phrase = await useElementPhrase(element);
24
+ const { mode } = useProseContext();
25
+ const isAnchor = useIsAnchor(element);
26
+ const containsAnchor = useContainsAnchor(element);
27
+ </script>
28
+
29
+ <template>
30
+ <Block :element v-if="isAnchor || containsAnchor || mode !== 'static'">
31
+ <div
32
+ class="border-border bg-bg-accent/30 rounded-xl border-2 border-dashed
33
+ dark:border-white/30 dark:bg-white/5"
34
+ >
35
+ <div class="text-text-muted p-(--proseAsideWidth) font-medium">
36
+ <EruditIcon
37
+ :name="icon"
38
+ class="text-main-sm mr-small relative top-0.5 inline align-baseline"
39
+ />
40
+ <span>
41
+ {{ formatText(element.data.title || phrase.element_name) }}
42
+ </span>
43
+ </div>
44
+ <div class="pb-(--proseAsideWidth)">
45
+ <Render v-for="child in element.children" :element="child" />
46
+ </div>
47
+ </div>
48
+ </Block>
49
+ </template>
@@ -1,27 +1,27 @@
1
- /**
2
- * Details are used to hide additional explanations or secondary content.
3
- * Default title "Details" can be changed via `title` prop.
4
- *
5
- * Clicking on a link to the details block will show it in preview area.
6
- * That is why **all** details blocks **have to be unique elements**!
7
- * You can not create details block without unique attached to it.
8
- *
9
- * Opening a link to the details block in new tab will make it visible inside main prose content.
10
- * Because of this you should place them near the link pointing to them to keep context.
11
- *
12
- * Details blocks can't be added to Table of Contents and can't have snippets.
13
- *
14
- * @title Details
15
- * @layout block
16
- * @example
17
- * ```tsx
18
- * <P>
19
- * The number 4 is even, which is <A to={{uniques.whyEven}}>obvious</A>.
20
- * </P>
21
- *
22
- * <Details $={{uniques.whyEven}} title="Why is 4 even?">
23
- * <P>Because it is divisible by 2 without a remainder.</P>
24
- * </Details>
25
- * ```
26
- */
27
- export const Details = '_tag_';
1
+ /**
2
+ * Details are used to hide additional explanations or secondary content.
3
+ * Default title "Details" can be changed via `title` prop.
4
+ *
5
+ * Clicking on a link to the details block will show it in preview area.
6
+ * That is why **all** details blocks **have to be unique elements**!
7
+ * You can not create details block without unique attached to it.
8
+ *
9
+ * Opening a link to the details block in new tab will make it visible inside main prose content.
10
+ * Because of this you should place them near the link pointing to them to keep context.
11
+ *
12
+ * Details blocks can't be added to Table of Contents and can't have snippets.
13
+ *
14
+ * @title Details
15
+ * @layout block
16
+ * @example
17
+ * ```tsx
18
+ * <P>
19
+ * The number 4 is even, which is <A to={{uniques.whyEven}}>obvious</A>.
20
+ * </P>
21
+ *
22
+ * <Details $={{uniques.whyEven}} title="Why is 4 even?">
23
+ * <P>Because it is divisible by 2 without a remainder.</P>
24
+ * </Details>
25
+ * ```
26
+ */
27
+ export const Details = '_tag_';
@@ -1,3 +1,3 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 34">
2
- <path d="M30.3,11.3c-.56-.56-1.52-.56-2.08,0l-1.92,2c-1.04-.96-2.32-1.92-3.85-2.56l.8-2.72c.24-.8-.16-1.68-.96-1.92-.8-.24-1.6.24-1.84,1.04l-.8,2.72c-1.6-.32-3.53-.32-5.13,0l-.8-2.72c-.24-.8-1.04-1.28-1.84-1.04s-1.2,1.12-.96,1.92l.8,2.72c-1.52.72-2.8,1.6-3.85,2.56l-1.92-2c-.56-.56-1.52-.56-2.08,0-.56.56-.56,1.52,0,2.16l2,2.16c-1.12,1.52-1.6,2.8-1.6,3.21,0,1.04,4.09,9.14,12.74,9.14s12.74-8.09,12.74-9.14-.56-1.68-1.6-3.21l2-2.16c.56-.56.56-1.52,0-2.16h.16ZM17.08,24.92c-5.85,0-8.82-4.57-9.7-6.09.64-1.2,2.72-4.33,6.41-5.61h.24c.88-.24,1.92-.4,3.05-.4s2.08.16,3.05.4h.24c3.77,1.2,5.77,4.33,6.41,5.61-.88,1.52-3.85,6.09-9.7,6.09ZM18.2,13.95c-2.56-.64-5.13.96-5.77,3.77-.64,2.64.96,5.37,3.53,6.01.4.08.72.16,1.12.16.88,0,1.68-.24,2.48-.72,1.12-.72,1.84-1.76,2.16-3.05v-.08c.32-1.28.08-2.64-.56-3.77-.64-1.12-1.68-1.92-2.97-2.24v-.08ZM18.84,19.31c-.08.48-.4.96-.8,1.2s-.88.32-1.36.24c-.96-.24-1.6-1.28-1.36-2.4.24-.88.96-1.44,1.76-1.44s.32,0,.4,0h0c.48.16.88.4,1.12.88.24.4.32.96.16,1.52h.08Z"/>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34 34">
2
+ <path d="M30.3,11.3c-.56-.56-1.52-.56-2.08,0l-1.92,2c-1.04-.96-2.32-1.92-3.85-2.56l.8-2.72c.24-.8-.16-1.68-.96-1.92-.8-.24-1.6.24-1.84,1.04l-.8,2.72c-1.6-.32-3.53-.32-5.13,0l-.8-2.72c-.24-.8-1.04-1.28-1.84-1.04s-1.2,1.12-.96,1.92l.8,2.72c-1.52.72-2.8,1.6-3.85,2.56l-1.92-2c-.56-.56-1.52-.56-2.08,0-.56.56-.56,1.52,0,2.16l2,2.16c-1.12,1.52-1.6,2.8-1.6,3.21,0,1.04,4.09,9.14,12.74,9.14s12.74-8.09,12.74-9.14-.56-1.68-1.6-3.21l2-2.16c.56-.56.56-1.52,0-2.16h.16ZM17.08,24.92c-5.85,0-8.82-4.57-9.7-6.09.64-1.2,2.72-4.33,6.41-5.61h.24c.88-.24,1.92-.4,3.05-.4s2.08.16,3.05.4h.24c3.77,1.2,5.77,4.33,6.41,5.61-.88,1.52-3.85,6.09-9.7,6.09ZM18.2,13.95c-2.56-.64-5.13.96-5.77,3.77-.64,2.64.96,5.37,3.53,6.01.4.08.72.16,1.12.16.88,0,1.68-.24,2.48-.72,1.12-.72,1.84-1.76,2.16-3.05v-.08c.32-1.28.08-2.64-.56-3.77-.64-1.12-1.68-1.92-2.97-2.24v-.08ZM18.84,19.31c-.08.48-.4.96-.8,1.2s-.88.32-1.36.24c-.96-.24-1.6-1.28-1.36-2.4.24-.88.96-1.44,1.76-1.44s.32,0,.4,0h0c.48.16.88.4,1.12.88.24.4.32.96.16,1.52h.08Z"/>
3
3
  </svg>