@erudit-js/prose 4.1.0 → 4.2.0-dev.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.
- package/dist/app/appElement.d.ts +7 -6
- package/dist/app/appElement.js +1 -1
- package/dist/app/composables/anchor.d.ts +7 -7
- package/dist/app/composables/appElement.d.ts +4 -4
- package/dist/app/composables/appElement.js +3 -3
- package/dist/app/composables/context.d.ts +3 -2
- package/dist/app/composables/elementIcon.d.ts +2 -2
- package/dist/app/composables/elementIcon.js +1 -1
- package/dist/app/composables/language.d.ts +2 -2
- package/dist/app/composables/language.js +1 -1
- package/dist/app/composables/storage.d.ts +4 -4
- package/dist/app/composables/storage.js +0 -4
- package/dist/app/default/Mix.vue +2 -2
- package/dist/app/default/Text.vue +2 -2
- package/dist/app/shared/Prose.vue +3 -3
- package/dist/app/shared/Render.vue +5 -14
- package/dist/app/shared/block/AsideMenu.vue +2 -2
- package/dist/app/shared/block/AsideMenuCopyLink.vue +1 -1
- package/dist/app/shared/block/Block.vue +4 -4
- package/dist/app/shared/inliner/Inliner.vue +2 -2
- package/dist/coreElement.d.ts +25 -7
- package/dist/coreElement.js +2 -2
- package/dist/elements/accent/Accent.vue +4 -4
- package/dist/elements/accent/AccentColumnSection.vue +2 -2
- package/dist/elements/accent/AccentRowSections.vue +2 -2
- package/dist/elements/accent/app.d.ts +3 -3
- package/dist/elements/accent/app.js +2 -2
- package/dist/elements/accent/core.d.ts +61 -300
- package/dist/elements/accent/core.js +83 -68
- package/dist/elements/callout/Callout.vue +4 -4
- package/dist/elements/callout/app.d.ts +1 -8
- package/dist/elements/callout/app.js +2 -2
- package/dist/elements/callout/core.d.ts +21 -59
- package/dist/elements/callout/core.js +18 -17
- package/dist/elements/caption/Caption.vue +3 -3
- package/dist/elements/caption/app.d.ts +1 -8
- package/dist/elements/caption/app.js +2 -2
- package/dist/elements/caption/core.d.ts +21 -99
- package/dist/elements/caption/core.js +18 -22
- package/dist/elements/details/Details.vue +3 -3
- package/dist/elements/details/app.d.ts +1 -8
- package/dist/elements/details/app.js +2 -2
- package/dist/elements/details/core.d.ts +18 -61
- package/dist/elements/details/core.js +16 -11
- package/dist/elements/diagram/Diagram.vue +14 -11
- package/dist/elements/diagram/app.d.ts +1 -29
- package/dist/elements/diagram/app.js +2 -2
- package/dist/elements/diagram/core.d.ts +14 -177
- package/dist/elements/diagram/core.js +5 -8
- package/dist/elements/emphasis/Emphasis.vue +3 -3
- package/dist/elements/emphasis/app.d.ts +1 -8
- package/dist/elements/emphasis/app.js +2 -2
- package/dist/elements/emphasis/core.d.ts +13 -76
- package/dist/elements/emphasis/core.js +8 -9
- package/dist/elements/flex/Flex.vue +3 -3
- package/dist/elements/flex/app.d.ts +1 -8
- package/dist/elements/flex/app.js +2 -2
- package/dist/elements/flex/core.d.ts +16 -58
- package/dist/elements/flex/core.js +6 -7
- package/dist/elements/gallery/Gallery.vue +3 -3
- package/dist/elements/gallery/app.d.ts +1 -22
- package/dist/elements/gallery/app.js +2 -2
- package/dist/elements/gallery/core.d.ts +11 -132
- package/dist/elements/gallery/core.js +4 -5
- package/dist/elements/heading/Heading.vue +3 -3
- package/dist/elements/heading/_global.d.ts +2 -2
- package/dist/elements/heading/app.d.ts +1 -8
- package/dist/elements/heading/app.js +2 -2
- package/dist/elements/heading/core.d.ts +13 -97
- package/dist/elements/heading/core.js +8 -8
- package/dist/elements/horizontalLine/app.d.ts +1 -8
- package/dist/elements/horizontalLine/app.js +2 -2
- package/dist/elements/horizontalLine/core.d.ts +9 -47
- package/dist/elements/horizontalLine/core.js +4 -5
- package/dist/elements/image/Image.vue +3 -3
- package/dist/elements/image/ImageElement.vue +4 -4
- package/dist/elements/image/app.d.ts +1 -15
- package/dist/elements/image/app.js +2 -2
- package/dist/elements/image/core.d.ts +29 -108
- package/dist/elements/image/core.js +12 -19
- package/dist/elements/image/storage.d.ts +1 -1
- package/dist/elements/image/storage.js +6 -6
- package/dist/elements/lineBreak/app.d.ts +1 -8
- package/dist/elements/lineBreak/app.js +2 -2
- package/dist/elements/lineBreak/core.d.ts +9 -47
- package/dist/elements/lineBreak/core.js +4 -5
- package/dist/elements/link/BlockLink.vue +4 -6
- package/dist/elements/link/Link.vue +4 -4
- package/dist/elements/link/core.d.ts +8 -7
- package/dist/elements/link/core.js +5 -4
- package/dist/elements/link/dependency/app.d.ts +1 -15
- package/dist/elements/link/dependency/app.js +3 -3
- package/dist/elements/link/dependency/core.d.ts +30 -108
- package/dist/elements/link/dependency/core.js +6 -8
- package/dist/elements/link/hook.d.ts +12 -0
- package/dist/elements/link/hook.js +45 -0
- package/dist/elements/link/reference/app.d.ts +1 -15
- package/dist/elements/link/reference/app.js +3 -3
- package/dist/elements/link/reference/core.d.ts +24 -103
- package/dist/elements/link/reference/core.js +6 -8
- package/dist/elements/link/storage.js +1 -1
- package/dist/elements/list/List.vue +7 -5
- package/dist/elements/list/_global.d.ts +3 -3
- package/dist/elements/list/app.d.ts +1 -15
- package/dist/elements/list/app.js +2 -2
- package/dist/elements/list/core.d.ts +33 -155
- package/dist/elements/list/core.js +20 -18
- package/dist/elements/math/app.d.ts +1 -15
- package/dist/elements/math/app.js +3 -3
- package/dist/elements/math/block.d.ts +31 -43
- package/dist/elements/math/block.js +10 -9
- package/dist/elements/math/components/BlockMath.vue +4 -4
- package/dist/elements/math/components/InlinerMath.vue +4 -4
- package/dist/elements/math/core.d.ts +25 -53
- package/dist/elements/math/core.js +3 -11
- package/dist/elements/math/inliner.d.ts +24 -36
- package/dist/elements/math/inliner.js +10 -12
- package/dist/elements/paragraph/Paragraph.vue +3 -3
- package/dist/elements/paragraph/app.d.ts +1 -8
- package/dist/elements/paragraph/app.js +2 -2
- package/dist/elements/paragraph/core.d.ts +12 -53
- package/dist/elements/paragraph/core.js +6 -7
- package/dist/elements/problem/app.d.ts +1 -29
- package/dist/elements/problem/app.js +4 -4
- package/dist/elements/problem/components/Problem.vue +3 -3
- package/dist/elements/problem/components/ProblemContent.vue +15 -21
- package/dist/elements/problem/components/ProblemExpanderSection.vue +2 -2
- package/dist/elements/problem/components/Problems.vue +11 -7
- package/dist/elements/problem/components/SubProblem.vue +3 -4
- package/dist/elements/problem/components/expanders/Check.vue +3 -3
- package/dist/elements/problem/components/expanders/Checks.vue +6 -3
- package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +3 -7
- package/dist/elements/problem/components/expanders/Hint.vue +3 -3
- package/dist/elements/problem/composables/problemScript.d.ts +2 -2
- package/dist/elements/problem/core.d.ts +63 -299
- package/dist/elements/problem/core.js +9 -11
- package/dist/elements/problem/hook.d.ts +1 -0
- package/dist/elements/problem/hook.js +14 -0
- package/dist/elements/problem/problem.d.ts +20 -77
- package/dist/elements/problem/problem.js +6 -6
- package/dist/elements/problem/problemCheck.d.ts +33 -83
- package/dist/elements/problem/problemCheck.js +16 -10
- package/dist/elements/problem/problemContent.d.ts +54 -401
- package/dist/elements/problem/problemContent.js +47 -56
- package/dist/elements/problem/problemScript.d.ts +18 -10
- package/dist/elements/problem/problemScript.js +15 -26
- package/dist/elements/problem/problems.d.ts +29 -188
- package/dist/elements/problem/problems.js +11 -15
- package/dist/elements/problem/storage.d.ts +1 -1
- package/dist/elements/problem/storage.js +2 -3
- package/dist/elements/table/Table.vue +3 -3
- package/dist/elements/table/app.d.ts +1 -29
- package/dist/elements/table/app.js +2 -2
- package/dist/elements/table/core.d.ts +28 -309
- package/dist/elements/table/core.js +17 -29
- package/dist/elements/video/Video.vue +4 -4
- package/dist/elements/video/app.d.ts +1 -15
- package/dist/elements/video/app.js +2 -2
- package/dist/elements/video/core.d.ts +26 -106
- package/dist/elements/video/core.js +11 -16
- package/dist/elements/video/storage.d.ts +1 -1
- package/dist/elements/video/storage.js +2 -3
- package/dist/error.d.ts +3 -0
- package/dist/error.js +6 -0
- package/dist/include.d.ts +4 -4
- package/dist/include.js +6 -12
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -11
- package/dist/rawElement.d.ts +9 -6
- package/dist/rawElement.js +4 -0
- package/dist/rawToProse/countSchemas.d.ts +1 -0
- package/dist/rawToProse/countSchemas.js +11 -0
- package/dist/rawToProse/hook.d.ts +39 -0
- package/dist/rawToProse/hook.js +6 -0
- package/dist/rawToProse/index.d.ts +34 -0
- package/dist/rawToProse/index.js +92 -0
- package/dist/rawToProse/uniqueTitles.d.ts +1 -0
- package/dist/rawToProse/uniqueTitles.js +11 -0
- package/dist/shared/filePath.js +2 -2
- package/dist/shared/paragraphWrap.d.ts +3 -3
- package/dist/shared/paragraphWrap.js +7 -12
- package/dist/slugify/index.d.ts +3 -1
- package/dist/slugify/index.js +5 -6
- package/dist/slugify/languages/en.js +1 -1
- package/dist/slugify/languages/ru.js +1 -1
- package/dist/snippet.d.ts +39 -33
- package/dist/snippet.js +139 -73
- package/dist/tag.d.ts +22 -19
- package/dist/tag.js +19 -15
- package/dist/toc.d.ts +12 -18
- package/dist/toc.js +120 -42
- package/package.json +7 -6
- package/dist/app/default/Inliners.vue +0 -11
- package/dist/context.d.ts +0 -4
- package/dist/context.js +0 -1
- package/dist/elements/link/step.d.ts +0 -16
- package/dist/elements/link/step.js +0 -36
- package/dist/elements/problem/step.d.ts +0 -5
- package/dist/elements/problem/step.js +0 -13
- package/dist/resolve.d.ts +0 -21
- package/dist/resolve.js +0 -102
- package/dist/resolveStep.d.ts +0 -9
- package/dist/resolveStep.js +0 -3
- package/dist/title.d.ts +0 -8
- package/dist/title.js +0 -6
- package/dist/utils/docs.d.ts +0 -1
- package/dist/utils/docs.js +0 -22
- package/types.d.ts +0 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defineEruditProseCoreElement } from "../../coreElement.js";
|
|
1
|
+
import { defineSchema, ensureTagInlinerChildren } from "tsprose";
|
|
3
2
|
import { defineEruditTag } from "../../tag.js";
|
|
3
|
+
import { defineProseCoreElement } from "../../coreElement.js";
|
|
4
4
|
export const paragraphSchema = defineSchema({
|
|
5
5
|
name: "paragraph",
|
|
6
6
|
type: "block",
|
|
7
7
|
linkable: true
|
|
8
|
-
})
|
|
8
|
+
});
|
|
9
9
|
export const P = defineEruditTag({
|
|
10
10
|
tagName: "P",
|
|
11
11
|
schema: paragraphSchema
|
|
12
|
-
})(({ element, tagName, props, children
|
|
13
|
-
ensureTagInlinerChildren(tagName, children
|
|
12
|
+
})(({ element, tagName, props, children }) => {
|
|
13
|
+
ensureTagInlinerChildren(tagName, children);
|
|
14
14
|
element.children = children;
|
|
15
15
|
if (props.center || props.serif) {
|
|
16
16
|
element.data = {};
|
|
@@ -22,8 +22,7 @@ export const P = defineEruditTag({
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
export
|
|
25
|
+
export default defineProseCoreElement({
|
|
26
26
|
schema: paragraphSchema,
|
|
27
27
|
tags: [P]
|
|
28
28
|
});
|
|
29
|
-
export default defineEruditProseCoreElement({ registryItem: paragraphRegistryItem });
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
declare const _default: (import("../../app/appElement.js").
|
|
2
|
-
name: "problem";
|
|
3
|
-
type: "block";
|
|
4
|
-
linkable: true;
|
|
5
|
-
Data: import("./problem.js").ProblemData;
|
|
6
|
-
Storage: import("./storage.js").ProblemScriptStorage;
|
|
7
|
-
Children: import("./problemContent.js").ProblemContentChild[];
|
|
8
|
-
}> | import("../../app/appElement.js").AppElement<{
|
|
9
|
-
name: "problems";
|
|
10
|
-
type: "block";
|
|
11
|
-
linkable: true;
|
|
12
|
-
Data: import("./shared.js").ProblemInfo;
|
|
13
|
-
Storage: undefined;
|
|
14
|
-
Children: (import("@jsprose/core").BlockSchema | {
|
|
15
|
-
name: "subProblem";
|
|
16
|
-
type: "block";
|
|
17
|
-
linkable: false;
|
|
18
|
-
Data: import("./problems.js").SubProblemData;
|
|
19
|
-
Storage: import("./storage.js").ProblemScriptStorage;
|
|
20
|
-
Children: import("./problemContent.js").ProblemContentChild[];
|
|
21
|
-
})[];
|
|
22
|
-
}> | import("../../app/appElement.js").AppElement<{
|
|
23
|
-
name: "subProblem";
|
|
24
|
-
type: "block";
|
|
25
|
-
linkable: false;
|
|
26
|
-
Data: import("./problems.js").SubProblemData;
|
|
27
|
-
Storage: import("./storage.js").ProblemScriptStorage;
|
|
28
|
-
Children: import("./problemContent.js").ProblemContentChild[];
|
|
29
|
-
}>)[];
|
|
1
|
+
declare const _default: (import("../../app/appElement.js").ProseAppElement<import("./problem.js").ProblemSchema> | import("../../app/appElement.js").ProseAppElement<import("./problems.js").ProblemsSchema> | import("../../app/appElement.js").ProseAppElement<import("./problems.js").SubProblemSchema>)[];
|
|
30
2
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineProseAppElement } from "../../app/appElement.js";
|
|
2
2
|
import { problemSchema } from "./problem.js";
|
|
3
3
|
import { problemsSchema, subProblemSchema } from "./problems.js";
|
|
4
4
|
const icon = () => import("./assets/icon.svg?raw");
|
|
5
5
|
export default [
|
|
6
|
-
|
|
6
|
+
defineProseAppElement({
|
|
7
7
|
schema: problemSchema,
|
|
8
8
|
component: () => import("./components/Problem.vue"),
|
|
9
9
|
icon,
|
|
@@ -12,7 +12,7 @@ export default [
|
|
|
12
12
|
ru: () => import("./languages/problem/ru.js")
|
|
13
13
|
}
|
|
14
14
|
}),
|
|
15
|
-
|
|
15
|
+
defineProseAppElement({
|
|
16
16
|
schema: problemsSchema,
|
|
17
17
|
component: () => import("./components/Problems.vue"),
|
|
18
18
|
icon,
|
|
@@ -21,7 +21,7 @@ export default [
|
|
|
21
21
|
ru: () => import("./languages/problems/ru.js")
|
|
22
22
|
}
|
|
23
23
|
}),
|
|
24
|
-
|
|
24
|
+
defineProseAppElement({
|
|
25
25
|
schema: subProblemSchema,
|
|
26
26
|
component: () => import("./components/SubProblem.vue")
|
|
27
27
|
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ToProseElement } from 'tsprose';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { type ProblemSchema } from '../problem.js';
|
|
5
5
|
import Block from '../../../app/shared/block/Block.vue';
|
|
6
6
|
import ProblemContainer from './ProblemContainer.vue';
|
|
7
7
|
import ProblemHeader from './ProblemHeader.vue';
|
|
8
8
|
import ProblemContent from './ProblemContent.vue';
|
|
9
9
|
|
|
10
10
|
const { element } = defineProps<{
|
|
11
|
-
element:
|
|
11
|
+
element: ToProseElement<ProblemSchema>;
|
|
12
12
|
}>();
|
|
13
13
|
</script>
|
|
14
14
|
|
|
@@ -7,11 +7,7 @@ import {
|
|
|
7
7
|
watchEffect,
|
|
8
8
|
type Component,
|
|
9
9
|
} from 'vue';
|
|
10
|
-
import {
|
|
11
|
-
isProseElement,
|
|
12
|
-
resolveRawElement,
|
|
13
|
-
type ProseElement,
|
|
14
|
-
} from '@jsprose/core';
|
|
10
|
+
import { isProseElement, type ToProseElement } from 'tsprose';
|
|
15
11
|
|
|
16
12
|
import {
|
|
17
13
|
problemAnswer,
|
|
@@ -28,7 +24,7 @@ import { useProblemPhrase } from '../composables/phrase.js';
|
|
|
28
24
|
import type { ProblemAction } from '../shared.js';
|
|
29
25
|
import { useArrayContainsAnchor } from '../../../app/composables/anchor.js';
|
|
30
26
|
import type { ProblemScriptInstance } from '../problemScript.js';
|
|
31
|
-
import type {
|
|
27
|
+
import type { ProblemSchema } from '../problem.js';
|
|
32
28
|
import type { subProblemSchema } from '../problems.js';
|
|
33
29
|
import { useElementStorage } from '../../../app/composables/storage.js';
|
|
34
30
|
import type { ProblemScriptStorage } from '../storage.js';
|
|
@@ -40,12 +36,13 @@ import DefaultPlusSections from './expanders/DefaultPlusSections.vue';
|
|
|
40
36
|
import ProblemButton from './ProblemButton.vue';
|
|
41
37
|
import Checks from './expanders/Checks.vue';
|
|
42
38
|
import ProblemButtonGenerate from './ProblemButtonGenerate.vue';
|
|
39
|
+
import { eruditRawToProse } from '../../../rawToProse/index.js';
|
|
43
40
|
|
|
44
41
|
const { element, initialElements } = defineProps<{
|
|
45
42
|
element:
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
initialElements:
|
|
43
|
+
| ToProseElement<ProblemSchema>
|
|
44
|
+
| ToProseElement<typeof subProblemSchema>;
|
|
45
|
+
initialElements: ToProseElement<ProblemContentChild>[];
|
|
49
46
|
}>();
|
|
50
47
|
|
|
51
48
|
const { EruditIcon } = useProseContext();
|
|
@@ -67,7 +64,7 @@ const actionIcons: Record<ProblemAction, string> = Object.fromEntries(
|
|
|
67
64
|
|
|
68
65
|
const key = ref(0);
|
|
69
66
|
const elements =
|
|
70
|
-
shallowRef<
|
|
67
|
+
shallowRef<ToProseElement<ProblemContentChild>[]>(initialElements);
|
|
71
68
|
|
|
72
69
|
const description = computed(() => {
|
|
73
70
|
return elements.value.find((element) =>
|
|
@@ -93,12 +90,12 @@ const expandableActions = computed(() => {
|
|
|
93
90
|
: never;
|
|
94
91
|
|
|
95
92
|
const actionMap: ActionMap<{
|
|
96
|
-
hint?:
|
|
97
|
-
answer?:
|
|
98
|
-
solution?:
|
|
99
|
-
note?:
|
|
93
|
+
hint?: ToProseElement<typeof problemHintSchema>[];
|
|
94
|
+
answer?: ToProseElement<typeof problemAnswer.schema>;
|
|
95
|
+
solution?: ToProseElement<typeof problemSolution.schema>;
|
|
96
|
+
note?: ToProseElement<typeof problemNote.schema>;
|
|
100
97
|
check?: {
|
|
101
|
-
checkElements:
|
|
98
|
+
checkElements: ToProseElement<typeof problemCheckSchema>[];
|
|
102
99
|
checkFunction?: CheckFunction;
|
|
103
100
|
};
|
|
104
101
|
}> = {};
|
|
@@ -207,13 +204,10 @@ async function doGenerate(seed: ProblemSeed) {
|
|
|
207
204
|
}
|
|
208
205
|
|
|
209
206
|
const rawElements = generateResult.problemContent;
|
|
210
|
-
const proseElements:
|
|
207
|
+
const proseElements: ToProseElement<ProblemContentChild>[] = [];
|
|
211
208
|
for (const rawElement of rawElements) {
|
|
212
|
-
const resolveResult = await
|
|
213
|
-
|
|
214
|
-
linkable: false,
|
|
215
|
-
});
|
|
216
|
-
proseElements.push(resolveResult.proseElement as any);
|
|
209
|
+
const resolveResult = await eruditRawToProse({ rawProse: rawElement });
|
|
210
|
+
proseElements.push(resolveResult.prose as any);
|
|
217
211
|
}
|
|
218
212
|
|
|
219
213
|
if (currentSeed !== seed) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref, watchEffect } from 'vue';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProseElement } from 'tsprose';
|
|
4
4
|
|
|
5
5
|
import plusIcon from '../../../app/shared/assets/plus.svg?raw';
|
|
6
6
|
import { useProseContext } from '../../../app/composables/context.js';
|
|
@@ -10,7 +10,7 @@ import Render from '../../../app/shared/Render.vue';
|
|
|
10
10
|
|
|
11
11
|
const { element } = defineProps<{
|
|
12
12
|
title: string;
|
|
13
|
-
element: ProseElement
|
|
13
|
+
element: ProseElement;
|
|
14
14
|
}>();
|
|
15
15
|
|
|
16
16
|
const formatText = useFormatText();
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
import { ref, watchEffect } from 'vue';
|
|
3
3
|
import {
|
|
4
4
|
isProseElement,
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
} from '
|
|
5
|
+
type BlockProseElement,
|
|
6
|
+
type ToProseElement,
|
|
7
|
+
} from 'tsprose';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
subProblemSchema,
|
|
11
|
+
type ProblemsSchema,
|
|
12
|
+
type SubProblemSchema,
|
|
13
|
+
} from '../problems.js';
|
|
10
14
|
import { useFormatText } from '../../../app/composables/formatText.js';
|
|
11
15
|
import { useArrayContainsAnchor } from '../../../app/composables/anchor.js';
|
|
12
16
|
import SubProblem from './SubProblem.vue';
|
|
@@ -17,18 +21,18 @@ import Render from '../../../app/shared/Render.vue';
|
|
|
17
21
|
import ProblemButton from './ProblemButton.vue';
|
|
18
22
|
|
|
19
23
|
const { element } = defineProps<{
|
|
20
|
-
element:
|
|
24
|
+
element: ToProseElement<ProblemsSchema>;
|
|
21
25
|
}>();
|
|
22
26
|
|
|
23
27
|
const formatText = useFormatText();
|
|
24
28
|
|
|
25
29
|
const sharedChildren = element.children.filter(
|
|
26
30
|
(child) => !isProseElement(child, subProblemSchema),
|
|
27
|
-
) as
|
|
31
|
+
) as BlockProseElement[];
|
|
28
32
|
|
|
29
33
|
const subProblems = element.children.filter((child) =>
|
|
30
34
|
isProseElement(child, subProblemSchema),
|
|
31
|
-
) as
|
|
35
|
+
) as ToProseElement<SubProblemSchema>[];
|
|
32
36
|
|
|
33
37
|
const activeSubProblemI = ref(0);
|
|
34
38
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { subProblemSchema } from '../problems.js';
|
|
2
|
+
import type { ToProseElement } from 'tsprose';
|
|
3
|
+
import type { SubProblemSchema } from '../problems.js';
|
|
5
4
|
import ProblemContent from './ProblemContent.vue';
|
|
6
5
|
|
|
7
6
|
const { element } = defineProps<{
|
|
8
|
-
element:
|
|
7
|
+
element: ToProseElement<SubProblemSchema>;
|
|
9
8
|
}>();
|
|
10
9
|
</script>
|
|
11
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useTemplateRef, ref, watch, computed } from 'vue';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ToProseElement } from 'tsprose';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
checkProblemAnswer,
|
|
7
7
|
fromSerializableValidator,
|
|
8
|
-
type
|
|
8
|
+
type ProblemCheckSchema,
|
|
9
9
|
} from '../../problemCheck.js';
|
|
10
10
|
import checkIcon from '../../assets/actions/check.svg?raw';
|
|
11
11
|
import plusIcon from '../../../../app/shared/assets/plus.svg?raw';
|
|
@@ -25,7 +25,7 @@ type CheckState = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const { check, script } = defineProps<{
|
|
28
|
-
check:
|
|
28
|
+
check: ToProseElement<ProblemCheckSchema>;
|
|
29
29
|
script?: {
|
|
30
30
|
check: (answer: string | undefined) => boolean;
|
|
31
31
|
clear: () => void;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
|
-
import { isProseElement, type
|
|
3
|
+
import { isProseElement, type ToProseElement } from 'tsprose';
|
|
4
4
|
|
|
5
5
|
import type { CheckFunction } from '../../problemScript.js';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
problemCheckSchema,
|
|
8
|
+
type ProblemCheckSchema,
|
|
9
|
+
} from '../../problemCheck.js';
|
|
7
10
|
import ProblemExpander from '../ProblemExpander.vue';
|
|
8
11
|
import Check from './Check.vue';
|
|
9
12
|
|
|
10
|
-
type CheckProseElement =
|
|
13
|
+
type CheckProseElement = ToProseElement<ProblemCheckSchema>;
|
|
11
14
|
type CheckStatus = 'default' | 'correct' | 'wrong';
|
|
12
15
|
|
|
13
16
|
const { value } = defineProps<{
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
3
|
-
isProseElement,
|
|
4
|
-
type AnySchema,
|
|
5
|
-
type ProseElement,
|
|
6
|
-
} from '@jsprose/core';
|
|
2
|
+
import { isProseElement, type ProseElement } from 'tsprose';
|
|
7
3
|
|
|
8
4
|
import { problemSectionSchema } from '../../problemContent.js';
|
|
9
5
|
import ProblemExpander from '../ProblemExpander.vue';
|
|
10
6
|
import ProblemExpanderSection from '../ProblemExpanderSection.vue';
|
|
11
7
|
import Render from '../../../../app/shared/Render.vue';
|
|
12
8
|
|
|
13
|
-
const { value } = defineProps<{ value: ProseElement
|
|
9
|
+
const { value } = defineProps<{ value: ProseElement }>();
|
|
14
10
|
|
|
15
11
|
const defaultBlocks = value.children!.filter(
|
|
16
12
|
(element) => !isProseElement(element, problemSectionSchema),
|
|
@@ -18,7 +14,7 @@ const defaultBlocks = value.children!.filter(
|
|
|
18
14
|
|
|
19
15
|
const sections = value.children!.filter((element) =>
|
|
20
16
|
isProseElement(element, problemSectionSchema),
|
|
21
|
-
)
|
|
17
|
+
);
|
|
22
18
|
</script>
|
|
23
19
|
|
|
24
20
|
<template>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import type {
|
|
2
|
+
import type { ToProseElement } from 'tsprose';
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { ProblemHintSchema } from '../../problemContent.js';
|
|
5
5
|
import { useProblemPhrase } from '../../composables/phrase.js';
|
|
6
6
|
import ProblemExpander from '../ProblemExpander.vue';
|
|
7
7
|
import Render from '../../../../app/shared/Render.vue';
|
|
8
8
|
import ProblemExpanderSection from '../ProblemExpanderSection.vue';
|
|
9
9
|
|
|
10
|
-
defineProps<{ value:
|
|
10
|
+
defineProps<{ value: ToProseElement<ProblemHintSchema>[] }>();
|
|
11
11
|
const phrase = await useProblemPhrase();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Unique } from 'tsprose';
|
|
2
2
|
import type { ProblemScriptInstance } from '../problemScript.js';
|
|
3
|
-
export declare function createProblemScriptInstance(scriptUrl?: string, scriptUniques?: Record<string,
|
|
3
|
+
export declare function createProblemScriptInstance(scriptUrl?: string, scriptUniques?: Record<string, Unique>): Promise<ProblemScriptInstance | undefined>;
|