@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.
Files changed (83) 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/block/AsideMenu.vue +44 -44
  7. package/dist/app/shared/block/AsideMenuButton.vue +51 -53
  8. package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -40
  9. package/dist/app/shared/block/AsideMenuSeparator.vue +3 -3
  10. package/dist/app/shared/block/Block.vue +270 -275
  11. package/dist/app/shared/inliner/Inliner.vue +11 -11
  12. package/dist/app/shared/photoswipe/style.css +22 -26
  13. package/dist/elements/accent/Accent.vue +88 -92
  14. package/dist/elements/accent/AccentColumnSection.vue +61 -61
  15. package/dist/elements/accent/AccentRowSections.vue +64 -65
  16. package/dist/elements/callout/Callout.vue +81 -85
  17. package/dist/elements/callout/_global.d.ts +15 -15
  18. package/dist/elements/caption/Caption.vue +44 -47
  19. package/dist/elements/caption/_global.d.ts +26 -26
  20. package/dist/elements/details/Details.vue +49 -50
  21. package/dist/elements/details/_global.d.ts +27 -27
  22. package/dist/elements/diagram/Diagram.vue +360 -374
  23. package/dist/elements/diagram/_global.d.ts +19 -19
  24. package/dist/elements/diagram/core.d.ts +0 -4
  25. package/dist/elements/diagram/core.js +1 -7
  26. package/dist/elements/emphasis/Emphasis.vue +25 -25
  27. package/dist/elements/emphasis/_global.d.ts +18 -18
  28. package/dist/elements/flex/Flex.vue +36 -38
  29. package/dist/elements/flex/_global.d.ts +23 -23
  30. package/dist/elements/gallery/Gallery.vue +56 -56
  31. package/dist/elements/gallery/_global.d.ts +18 -18
  32. package/dist/elements/heading/Heading.vue +44 -44
  33. package/dist/elements/heading/_global.d.ts +42 -45
  34. package/dist/elements/heading/core.js +7 -14
  35. package/dist/elements/horizontalLine/HorizontalLine.vue +6 -6
  36. package/dist/elements/horizontalLine/_global.d.ts +17 -17
  37. package/dist/elements/image/Image.vue +15 -15
  38. package/dist/elements/image/ImageElement.vue +80 -80
  39. package/dist/elements/image/_global.d.ts +18 -18
  40. package/dist/elements/lineBreak/LineBreak.vue +3 -3
  41. package/dist/elements/lineBreak/_global.d.ts +18 -18
  42. package/dist/elements/link/BlockLink.vue +108 -110
  43. package/dist/elements/link/Link.vue +92 -96
  44. package/dist/elements/link/dependency/_global.d.ts +47 -47
  45. package/dist/elements/link/reference/_global.d.ts +49 -49
  46. package/dist/elements/list/List.vue +58 -65
  47. package/dist/elements/list/_global.d.ts +50 -50
  48. package/dist/elements/math/_global.d.ts +72 -72
  49. package/dist/elements/math/_global.ts +3 -3
  50. package/dist/elements/math/components/BlockMath.vue +30 -30
  51. package/dist/elements/math/components/InlinerMath.vue +65 -65
  52. package/dist/elements/math/components/Katex.vue +88 -89
  53. package/dist/elements/math/components/MathGroup.vue +41 -41
  54. package/dist/elements/math/katex.js +17 -6
  55. package/dist/elements/paragraph/Paragraph.vue +25 -27
  56. package/dist/elements/paragraph/_global.d.ts +27 -27
  57. package/dist/elements/problem/_global.d.ts +112 -112
  58. package/dist/elements/problem/components/Problem.vue +22 -22
  59. package/dist/elements/problem/components/ProblemButton.vue +20 -21
  60. package/dist/elements/problem/components/ProblemContainer.vue +8 -8
  61. package/dist/elements/problem/components/ProblemContent.vue +356 -371
  62. package/dist/elements/problem/components/ProblemExpander.vue +7 -7
  63. package/dist/elements/problem/components/ProblemExpanderSection.vue +57 -57
  64. package/dist/elements/problem/components/ProblemHeader.vue +100 -102
  65. package/dist/elements/problem/components/Problems.vue +83 -87
  66. package/dist/elements/problem/components/SubProblem.vue +14 -14
  67. package/dist/elements/problem/components/expanders/Check.vue +153 -150
  68. package/dist/elements/problem/components/expanders/Checks.vue +146 -83
  69. package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +38 -38
  70. package/dist/elements/problem/components/expanders/Hint.vue +26 -26
  71. package/dist/elements/problem/core.d.ts +23 -23
  72. package/dist/elements/problem/problemContent.d.ts +134 -30
  73. package/dist/elements/problem/problemContent.js +157 -197
  74. package/dist/elements/problem/problemScript.d.ts +2 -2
  75. package/dist/elements/problem/problemScript.js +2 -2
  76. package/dist/elements/problem/rng.d.ts +1 -1
  77. package/dist/elements/problem/rng.js +1 -1
  78. package/dist/elements/table/Table.vue +100 -102
  79. package/dist/elements/table/_global.d.ts +36 -36
  80. package/dist/elements/video/Video.vue +110 -109
  81. package/dist/elements/video/_global.d.ts +18 -18
  82. package/package.json +42 -43
  83. package/types.d.ts +4 -4
@@ -1,27 +1,25 @@
1
- <script setup lang="ts">
2
- import type { ProseElement } from '@jsprose/core';
3
-
4
- import type { paragraphSchema } from './core.js';
5
- import Block from '../../app/shared/block/Block.vue';
6
- import Render from '../../app/shared/Render.vue';
7
-
8
- defineProps<{ element: ProseElement<typeof paragraphSchema> }>();
9
- </script>
10
-
11
- <template>
12
- <Block :element>
13
- <div
14
- :class="[
15
- 'wrap-break-word',
16
- element.data?.center
17
- ? 'text-center'
18
- : 'micro:text-justify text-left',
19
- {
20
- 'font-serif': element.data?.serif,
21
- },
22
- ]"
23
- >
24
- <Render v-for="child of element.children" :element="child" />
25
- </div>
26
- </Block>
27
- </template>
1
+ <script setup lang="ts">
2
+ import type { ProseElement } from '@jsprose/core';
3
+
4
+ import type { paragraphSchema } from './core.js';
5
+ import Block from '../../app/shared/block/Block.vue';
6
+ import Render from '../../app/shared/Render.vue';
7
+
8
+ defineProps<{ element: ProseElement<typeof paragraphSchema> }>();
9
+ </script>
10
+
11
+ <template>
12
+ <Block :element>
13
+ <div
14
+ :class="[
15
+ 'wrap-break-word',
16
+ element.data?.center ? 'text-center' : 'micro:text-justify text-left',
17
+ {
18
+ 'font-serif': element.data?.serif,
19
+ },
20
+ ]"
21
+ >
22
+ <Render v-for="child of element.children" :element="child" />
23
+ </div>
24
+ </Block>
25
+ </template>
@@ -1,27 +1,27 @@
1
- /**
2
- * Paragraph are general prose containers.
3
- *
4
- * When writing paragraphs, stick to **"rule of 3"**:
5
- * * Ideally **3** sentences per paragraph.
6
- * * After each **3** paragraphs use a different block: heading, list, image, formula, etc.
7
- *
8
- * Paragraphs can be centered via `center` prop, and can use serif font style via `serif` prop.
9
- * Use these with extra caution, as they reduce readability if overused!
10
- *
11
- * @title Paragraph
12
- * @layout block
13
- * @example
14
- * ```tsx
15
- * <P>Normal Paragraph</P>
16
- *
17
- * <P center>Centered Paragraph</P>
18
- * <P serif>Paragraph with serif font style</P>
19
- * <P center serif>Centered Paragraph with serif font style</P>
20
- *
21
- * <P>
22
- * Paragraph<Br />
23
- * With Line Break
24
- * </P>
25
- * ```
26
- */
27
- export const P = '_tag_';
1
+ /**
2
+ * Paragraph are general prose containers.
3
+ *
4
+ * When writing paragraphs, stick to **"rule of 3"**:
5
+ * * Ideally **3** sentences per paragraph.
6
+ * * After each **3** paragraphs use a different block: heading, list, image, formula, etc.
7
+ *
8
+ * Paragraphs can be centered via `center` prop, and can use serif font style via `serif` prop.
9
+ * Use these with extra caution, as they reduce readability if overused!
10
+ *
11
+ * @title Paragraph
12
+ * @layout block
13
+ * @example
14
+ * ```tsx
15
+ * <P>Normal Paragraph</P>
16
+ *
17
+ * <P center>Centered Paragraph</P>
18
+ * <P serif>Paragraph with serif font style</P>
19
+ * <P center serif>Centered Paragraph with serif font style</P>
20
+ *
21
+ * <P>
22
+ * Paragraph<Br />
23
+ * With Line Break
24
+ * </P>
25
+ * ```
26
+ */
27
+ export const P = '_tag_';
@@ -1,112 +1,112 @@
1
- import type { ProblemCustomAttribute as PAC } from './shared.js';
2
-
3
- /**
4
- * Problems are used to present exercises and questions to the reader.
5
- * See the example for a full breakdown of the sub-elements available.
6
- *
7
- * All problems are added to TOC and search by default (can be disabled via tag properties).
8
- *
9
- * @title Problem
10
- * @layout block
11
- * @example
12
- * ```tsx
13
- * // Static problem
14
- * <Problem title="Find the square" level="easy">
15
- * <ProblemDescription>
16
- * <P>What is the square of 2?</P>
17
- * <P>Think carefully about your answer before proceeding to the hints and solution.</P>
18
- * </ProblemDescription>
19
- *
20
- * <ProblemHint>
21
- * <P>Recall that squaring a number means multiplying it by itself.</P>
22
- * </ProblemHint>
23
- * <ProblemHint>
24
- * <P>For example, the square of 3 is 9, since 3 * 3 = 9.</P>
25
- * </ProblemHint>
26
- * // More hints...
27
- *
28
- * <ProblemSolution>
29
- * <P>Some general phrases visible immediately.</P>
30
- *
31
- * <ProblemSection title="Detailed Solution">
32
- * <P>The square of 2 is 4, since 2 * 2 = 4.</P>
33
- * </ProblemSection>
34
- * // More sections...
35
- *
36
- * </ProblemSolution>
37
- *
38
- * <ProblemAnswer>
39
- * <P><M>4</M></P>
40
- * </ProblemAnswer>
41
- *
42
- * <ProblemCheck label="The square of 2 is" answer={4} />
43
- * // More checks...
44
- *
45
- * <ProblemNote>
46
- * In fact, you can find the square of any number by multiplying it by itself!
47
- * </ProblemNote>
48
- * </Problem>
49
- *
50
- * // Script problem
51
- * export const fooScript = defineProblemScript({
52
- * isGenerator: true,
53
- * })(({ initial, random }) => {
54
- * const a = initial.nextInt(1, 10);
55
- * const b = initial.nextInt(1, 10);
56
- *
57
- * return (
58
- * <>
59
- * <ProblemDescription>
60
- * What is <M>{a} + {b}</M>?
61
- * </ProblemDescription>
62
- * <ProblemAnswer>
63
- * <M>{a + b}</M>
64
- * </ProblemAnswer>
65
- * <ProblemCheck label="The answer is" answer={a + b} />
66
- * </>
67
- * );
68
- * });
69
- *
70
- * <Problem title="Addition Problem" level="medium" script={fooScript} />
71
- * ```
72
- */
73
- export const Problem = '_tag_';
74
- export const ProblemDescription = '_tag_';
75
- export const ProblemHint = '_tag_';
76
- export const ProblemSection = '_tag_';
77
- export const ProblemSolution = '_tag_';
78
- export const ProblemAnswer = '_tag_';
79
- export const ProblemNote = '_tag_';
80
- export const ProblemCheck = '_tag_';
81
-
82
- /**
83
- * Problem set is a collection of related problems presented together.
84
- * `<Problems>` tag contains general problem information and insude can have multiple `<SubProblem>` tags.
85
- *
86
- * Each `<SubProblem>` contains the same problem content tags as single `<Problem>` tag.
87
- *
88
- * All problems are added to TOC and search by default (can be disabled via tag properties).
89
- *
90
- * @title Problems
91
- * @layout block
92
- * @example
93
- * ```tsx
94
- * // export const problemScript = defineProblemScript(...) ~> see Problem docs for details
95
- * <Problems title="Sample Problem Set" level="hard">
96
- * <SubProblem label="Example">
97
- * <ProblemDescription>
98
- * This is an example sub-problem.
99
- * </ProblemDescription>
100
- * </SubProblem>
101
- *
102
- * <SubProblem script={problemScript} />
103
- * </Problems>
104
- * ```
105
- */
106
- export const Problems = '_tag_';
107
- export const SubProblem = '_tag_';
108
-
109
- /**
110
- * Typeguard for creating custom problem attributes.
111
- */
112
- export type ProblemCustomAttribute = PAC;
1
+ import type { ProblemCustomAttribute as PAC } from './shared.js';
2
+
3
+ /**
4
+ * Problems are used to present exercises and questions to the reader.
5
+ * See the example for a full breakdown of the sub-elements available.
6
+ *
7
+ * All problems are added to TOC and search by default (can be disabled via tag properties).
8
+ *
9
+ * @title Problem
10
+ * @layout block
11
+ * @example
12
+ * ```tsx
13
+ * // Static problem
14
+ * <Problem title="Find the square" level="easy">
15
+ * <ProblemDescription>
16
+ * <P>What is the square of 2?</P>
17
+ * <P>Think carefully about your answer before proceeding to the hints and solution.</P>
18
+ * </ProblemDescription>
19
+ *
20
+ * <ProblemHint>
21
+ * <P>Recall that squaring a number means multiplying it by itself.</P>
22
+ * </ProblemHint>
23
+ * <ProblemHint>
24
+ * <P>For example, the square of 3 is 9, since 3 * 3 = 9.</P>
25
+ * </ProblemHint>
26
+ * // More hints...
27
+ *
28
+ * <ProblemSolution>
29
+ * <P>Some general phrases visible immediately.</P>
30
+ *
31
+ * <ProblemSection title="Detailed Solution">
32
+ * <P>The square of 2 is 4, since 2 * 2 = 4.</P>
33
+ * </ProblemSection>
34
+ * // More sections...
35
+ *
36
+ * </ProblemSolution>
37
+ *
38
+ * <ProblemAnswer>
39
+ * <P><M>4</M></P>
40
+ * </ProblemAnswer>
41
+ *
42
+ * <ProblemCheck label="The square of 2 is" answer={4} />
43
+ * // More checks...
44
+ *
45
+ * <ProblemNote>
46
+ * In fact, you can find the square of any number by multiplying it by itself!
47
+ * </ProblemNote>
48
+ * </Problem>
49
+ *
50
+ * // Script problem
51
+ * export const fooScript = defineProblemScript({
52
+ * isGenerator: true,
53
+ * })(({ initial, random }) => {
54
+ * const a = initial.nextInt(1, 10);
55
+ * const b = initial.nextInt(1, 10);
56
+ *
57
+ * return (
58
+ * <>
59
+ * <ProblemDescription>
60
+ * What is <M>{a} + {b}</M>?
61
+ * </ProblemDescription>
62
+ * <ProblemAnswer>
63
+ * <M>{a + b}</M>
64
+ * </ProblemAnswer>
65
+ * <ProblemCheck label="The answer is" answer={a + b} />
66
+ * </>
67
+ * );
68
+ * });
69
+ *
70
+ * <Problem title="Addition Problem" level="medium" script={fooScript} />
71
+ * ```
72
+ */
73
+ export const Problem = '_tag_';
74
+ export const ProblemDescription = '_tag_';
75
+ export const ProblemHint = '_tag_';
76
+ export const ProblemSection = '_tag_';
77
+ export const ProblemSolution = '_tag_';
78
+ export const ProblemAnswer = '_tag_';
79
+ export const ProblemNote = '_tag_';
80
+ export const ProblemCheck = '_tag_';
81
+
82
+ /**
83
+ * Problem set is a collection of related problems presented together.
84
+ * `<Problems>` tag contains general problem information and insude can have multiple `<SubProblem>` tags.
85
+ *
86
+ * Each `<SubProblem>` contains the same problem content tags as single `<Problem>` tag.
87
+ *
88
+ * All problems are added to TOC and search by default (can be disabled via tag properties).
89
+ *
90
+ * @title Problems
91
+ * @layout block
92
+ * @example
93
+ * ```tsx
94
+ * // export const problemScript = defineProblemScript(...) ~> see Problem docs for details
95
+ * <Problems title="Sample Problem Set" level="hard">
96
+ * <SubProblem label="Example">
97
+ * <ProblemDescription>
98
+ * This is an example sub-problem.
99
+ * </ProblemDescription>
100
+ * </SubProblem>
101
+ *
102
+ * <SubProblem script={problemScript} />
103
+ * </Problems>
104
+ * ```
105
+ */
106
+ export const Problems = '_tag_';
107
+ export const SubProblem = '_tag_';
108
+
109
+ /**
110
+ * Typeguard for creating custom problem attributes.
111
+ */
112
+ export type ProblemCustomAttribute = PAC;
@@ -1,22 +1,22 @@
1
- <script setup lang="ts">
2
- import type { ProseElement } from '@jsprose/core';
3
-
4
- import { problemSchema } from '../problem.js';
5
- import Block from '../../../app/shared/block/Block.vue';
6
- import ProblemContainer from './ProblemContainer.vue';
7
- import ProblemHeader from './ProblemHeader.vue';
8
- import ProblemContent from './ProblemContent.vue';
9
-
10
- const { element } = defineProps<{
11
- element: ProseElement<typeof problemSchema>;
12
- }>();
13
- </script>
14
-
15
- <template>
16
- <Block :element>
17
- <ProblemContainer>
18
- <ProblemHeader :info="element.data.info" />
19
- <ProblemContent :element :initialElements="element.children" />
20
- </ProblemContainer>
21
- </Block>
22
- </template>
1
+ <script setup lang="ts">
2
+ import type { ProseElement } from '@jsprose/core';
3
+
4
+ import { problemSchema } from '../problem.js';
5
+ import Block from '../../../app/shared/block/Block.vue';
6
+ import ProblemContainer from './ProblemContainer.vue';
7
+ import ProblemHeader from './ProblemHeader.vue';
8
+ import ProblemContent from './ProblemContent.vue';
9
+
10
+ const { element } = defineProps<{
11
+ element: ProseElement<typeof problemSchema>;
12
+ }>();
13
+ </script>
14
+
15
+ <template>
16
+ <Block :element>
17
+ <ProblemContainer>
18
+ <ProblemHeader :info="element.data.info" />
19
+ <ProblemContent :element :initialElements="element.children" />
20
+ </ProblemContainer>
21
+ </Block>
22
+ </template>
@@ -1,21 +1,20 @@
1
- <script lang="ts" setup>
2
- defineProps<{ active?: boolean }>();
3
- </script>
4
-
5
- <template>
6
- <button
7
- :class="[
8
- `bg-bg-main border-border/80 text-main-xs micro:px-2.5 min-w-[30px]
9
- cursor-pointer rounded border px-1.5 py-[5px] font-semibold shadow
10
- shadow-[light-dark(#d9d9d9,#3c3c3c)]
11
- transition-[color,background,border,box-shadow]`,
12
- {
13
- 'border-brand/50 bg-brand/10 text-brand': active,
14
- ['text-text-muted hocus:text-brand hocus:border-brand/50']:
15
- !active,
16
- },
17
- ]"
18
- >
19
- <slot></slot>
20
- </button>
21
- </template>
1
+ <script lang="ts" setup>
2
+ defineProps<{ active?: boolean }>();
3
+ </script>
4
+
5
+ <template>
6
+ <button
7
+ :class="[
8
+ `bg-bg-main border-border/80 text-main-xs micro:px-2.5 min-w-[30px]
9
+ cursor-pointer rounded border px-1.5 py-[5px] font-semibold shadow
10
+ shadow-[light-dark(#d9d9d9,#3c3c3c)]
11
+ transition-[color,background,border,box-shadow]`,
12
+ {
13
+ 'border-brand/50 bg-brand/10 text-brand': active,
14
+ ['text-text-muted hocus:text-brand hocus:border-brand/50']: !active,
15
+ },
16
+ ]"
17
+ >
18
+ <slot></slot>
19
+ </button>
20
+ </template>
@@ -1,8 +1,8 @@
1
- <template>
2
- <div
3
- class="bg-bg-accent/30 dark:bg-bg-accent/50 border-border/50
4
- dark:border-border/90 rounded-xl border"
5
- >
6
- <slot></slot>
7
- </div>
8
- </template>
1
+ <template>
2
+ <div
3
+ class="bg-bg-accent/30 dark:bg-bg-accent/50 border-border/50
4
+ dark:border-border/90 rounded-xl border"
5
+ >
6
+ <slot></slot>
7
+ </div>
8
+ </template>