@erudit-js/prose 4.1.1 → 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 +6 -6
- package/dist/elements/link/core.js +4 -3
- 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 +27 -105
- 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,429 +1,82 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type BlockSchema, type NormalizedChildren, type Schema } from 'tsprose';
|
|
2
|
+
import { type UppercaseFirst } from '../../utils/case.js';
|
|
2
3
|
import { problemCheckSchema } from './problemCheck.js';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type: "block";
|
|
7
|
-
linkable: false;
|
|
8
|
-
Data: undefined;
|
|
9
|
-
Storage: undefined;
|
|
10
|
-
Children: AnySchema[];
|
|
11
|
-
};
|
|
12
|
-
tag: import("@jsprose/core").Tag<"ProblemDescription", {
|
|
13
|
-
name: "problemDescription";
|
|
14
|
-
type: "block";
|
|
15
|
-
linkable: false;
|
|
16
|
-
Data: undefined;
|
|
17
|
-
Storage: undefined;
|
|
18
|
-
Children: AnySchema[];
|
|
19
|
-
}, TagChildren>;
|
|
20
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
21
|
-
name: "problemDescription";
|
|
22
|
-
type: "block";
|
|
23
|
-
linkable: false;
|
|
24
|
-
Data: undefined;
|
|
25
|
-
Storage: undefined;
|
|
26
|
-
Children: AnySchema[];
|
|
27
|
-
}, {
|
|
28
|
-
ProblemDescription: import("@jsprose/core").Tag<"ProblemDescription", {
|
|
29
|
-
name: "problemDescription";
|
|
30
|
-
type: "block";
|
|
31
|
-
linkable: false;
|
|
32
|
-
Data: undefined;
|
|
33
|
-
Storage: undefined;
|
|
34
|
-
Children: AnySchema[];
|
|
35
|
-
}, TagChildren>;
|
|
36
|
-
}, undefined>;
|
|
37
|
-
coreElement: {
|
|
38
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
39
|
-
name: "problemDescription";
|
|
40
|
-
type: "block";
|
|
41
|
-
linkable: false;
|
|
42
|
-
Data: undefined;
|
|
43
|
-
Storage: undefined;
|
|
44
|
-
Children: AnySchema[];
|
|
45
|
-
}, {
|
|
46
|
-
ProblemDescription: import("@jsprose/core").Tag<"ProblemDescription", {
|
|
47
|
-
name: "problemDescription";
|
|
48
|
-
type: "block";
|
|
49
|
-
linkable: false;
|
|
50
|
-
Data: undefined;
|
|
51
|
-
Storage: undefined;
|
|
52
|
-
Children: AnySchema[];
|
|
53
|
-
}, TagChildren>;
|
|
54
|
-
}, undefined>;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export declare const problemHint: {
|
|
58
|
-
schema: {
|
|
59
|
-
name: "problemHint";
|
|
60
|
-
type: "block";
|
|
61
|
-
linkable: false;
|
|
62
|
-
Data: undefined;
|
|
63
|
-
Storage: undefined;
|
|
64
|
-
Children: AnySchema[];
|
|
65
|
-
};
|
|
66
|
-
tag: import("@jsprose/core").Tag<"ProblemHint", {
|
|
67
|
-
name: "problemHint";
|
|
68
|
-
type: "block";
|
|
69
|
-
linkable: false;
|
|
70
|
-
Data: undefined;
|
|
71
|
-
Storage: undefined;
|
|
72
|
-
Children: AnySchema[];
|
|
73
|
-
}, TagChildren>;
|
|
74
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
75
|
-
name: "problemHint";
|
|
76
|
-
type: "block";
|
|
77
|
-
linkable: false;
|
|
78
|
-
Data: undefined;
|
|
79
|
-
Storage: undefined;
|
|
80
|
-
Children: AnySchema[];
|
|
81
|
-
}, {
|
|
82
|
-
ProblemHint: import("@jsprose/core").Tag<"ProblemHint", {
|
|
83
|
-
name: "problemHint";
|
|
84
|
-
type: "block";
|
|
85
|
-
linkable: false;
|
|
86
|
-
Data: undefined;
|
|
87
|
-
Storage: undefined;
|
|
88
|
-
Children: AnySchema[];
|
|
89
|
-
}, TagChildren>;
|
|
90
|
-
}, undefined>;
|
|
91
|
-
coreElement: {
|
|
92
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
93
|
-
name: "problemHint";
|
|
94
|
-
type: "block";
|
|
95
|
-
linkable: false;
|
|
96
|
-
Data: undefined;
|
|
97
|
-
Storage: undefined;
|
|
98
|
-
Children: AnySchema[];
|
|
99
|
-
}, {
|
|
100
|
-
ProblemHint: import("@jsprose/core").Tag<"ProblemHint", {
|
|
101
|
-
name: "problemHint";
|
|
102
|
-
type: "block";
|
|
103
|
-
linkable: false;
|
|
104
|
-
Data: undefined;
|
|
105
|
-
Storage: undefined;
|
|
106
|
-
Children: AnySchema[];
|
|
107
|
-
}, TagChildren>;
|
|
108
|
-
}, undefined>;
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
export declare const problemDescriptionSchema: {
|
|
112
|
-
name: "problemDescription";
|
|
113
|
-
type: "block";
|
|
114
|
-
linkable: false;
|
|
115
|
-
Data: undefined;
|
|
116
|
-
Storage: undefined;
|
|
117
|
-
Children: AnySchema[];
|
|
118
|
-
}, ProblemDescription: import("@jsprose/core").Tag<"ProblemDescription", {
|
|
119
|
-
name: "problemDescription";
|
|
120
|
-
type: "block";
|
|
121
|
-
linkable: false;
|
|
122
|
-
Data: undefined;
|
|
123
|
-
Storage: undefined;
|
|
124
|
-
Children: AnySchema[];
|
|
125
|
-
}, TagChildren>, problemDescriptionRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
126
|
-
name: "problemDescription";
|
|
127
|
-
type: "block";
|
|
4
|
+
export interface ProblemDescriptionSchema extends Schema {
|
|
5
|
+
name: 'problemDescription';
|
|
6
|
+
type: 'block';
|
|
128
7
|
linkable: false;
|
|
129
8
|
Data: undefined;
|
|
130
9
|
Storage: undefined;
|
|
131
|
-
Children:
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
Storage: undefined;
|
|
139
|
-
Children: AnySchema[];
|
|
140
|
-
}, TagChildren>;
|
|
141
|
-
}, undefined>, problemDescriptionCoreElement: {
|
|
142
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
143
|
-
name: "problemDescription";
|
|
144
|
-
type: "block";
|
|
145
|
-
linkable: false;
|
|
146
|
-
Data: undefined;
|
|
147
|
-
Storage: undefined;
|
|
148
|
-
Children: AnySchema[];
|
|
149
|
-
}, {
|
|
150
|
-
ProblemDescription: import("@jsprose/core").Tag<"ProblemDescription", {
|
|
151
|
-
name: "problemDescription";
|
|
152
|
-
type: "block";
|
|
153
|
-
linkable: false;
|
|
154
|
-
Data: undefined;
|
|
155
|
-
Storage: undefined;
|
|
156
|
-
Children: AnySchema[];
|
|
157
|
-
}, TagChildren>;
|
|
158
|
-
}, undefined>;
|
|
10
|
+
Children: BlockSchema[];
|
|
11
|
+
}
|
|
12
|
+
export declare const problemDescriptionSchema: ProblemDescriptionSchema;
|
|
13
|
+
export declare const ProblemDescription: import("../../tag.js").ToEruditTag<ProblemDescriptionSchema, "ProblemDescription", unknown>;
|
|
14
|
+
export declare const problemDescriptionCoreElement: {
|
|
15
|
+
readonly schema: ProblemDescriptionSchema;
|
|
16
|
+
readonly tags: [import("../../tag.js").ToEruditTag<ProblemDescriptionSchema, "ProblemDescription", unknown>];
|
|
159
17
|
};
|
|
160
|
-
export
|
|
161
|
-
name:
|
|
162
|
-
type:
|
|
18
|
+
export interface ProblemHintSchema extends Schema {
|
|
19
|
+
name: 'problemHint';
|
|
20
|
+
type: 'block';
|
|
163
21
|
linkable: false;
|
|
164
22
|
Data: undefined;
|
|
165
23
|
Storage: undefined;
|
|
166
|
-
Children:
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
Children: AnySchema[];
|
|
174
|
-
}, TagChildren>, problemHintRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
175
|
-
name: "problemHint";
|
|
176
|
-
type: "block";
|
|
177
|
-
linkable: false;
|
|
178
|
-
Data: undefined;
|
|
179
|
-
Storage: undefined;
|
|
180
|
-
Children: AnySchema[];
|
|
181
|
-
}, {
|
|
182
|
-
ProblemHint: import("@jsprose/core").Tag<"ProblemHint", {
|
|
183
|
-
name: "problemHint";
|
|
184
|
-
type: "block";
|
|
185
|
-
linkable: false;
|
|
186
|
-
Data: undefined;
|
|
187
|
-
Storage: undefined;
|
|
188
|
-
Children: AnySchema[];
|
|
189
|
-
}, TagChildren>;
|
|
190
|
-
}, undefined>, problemHintCoreElement: {
|
|
191
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
192
|
-
name: "problemHint";
|
|
193
|
-
type: "block";
|
|
194
|
-
linkable: false;
|
|
195
|
-
Data: undefined;
|
|
196
|
-
Storage: undefined;
|
|
197
|
-
Children: AnySchema[];
|
|
198
|
-
}, {
|
|
199
|
-
ProblemHint: import("@jsprose/core").Tag<"ProblemHint", {
|
|
200
|
-
name: "problemHint";
|
|
201
|
-
type: "block";
|
|
202
|
-
linkable: false;
|
|
203
|
-
Data: undefined;
|
|
204
|
-
Storage: undefined;
|
|
205
|
-
Children: AnySchema[];
|
|
206
|
-
}, TagChildren>;
|
|
207
|
-
}, undefined>;
|
|
24
|
+
Children: BlockSchema[];
|
|
25
|
+
}
|
|
26
|
+
export declare const problemHintSchema: ProblemHintSchema;
|
|
27
|
+
export declare const ProblemHint: import("../../tag.js").ToEruditTag<ProblemHintSchema, "ProblemHint", unknown>;
|
|
28
|
+
export declare const problemHintCoreElement: {
|
|
29
|
+
readonly schema: ProblemHintSchema;
|
|
30
|
+
readonly tags: [import("../../tag.js").ToEruditTag<ProblemHintSchema, "ProblemHint", unknown>];
|
|
208
31
|
};
|
|
209
|
-
export
|
|
210
|
-
name:
|
|
211
|
-
type:
|
|
32
|
+
export interface ProblemSectionSchema extends Schema {
|
|
33
|
+
name: 'problemSection';
|
|
34
|
+
type: 'block';
|
|
212
35
|
linkable: false;
|
|
213
36
|
Data: string;
|
|
214
37
|
Storage: undefined;
|
|
215
|
-
Children:
|
|
216
|
-
}
|
|
217
|
-
export declare const
|
|
218
|
-
|
|
219
|
-
type: "block";
|
|
220
|
-
linkable: false;
|
|
221
|
-
Data: string;
|
|
222
|
-
Storage: undefined;
|
|
223
|
-
Children: AnySchema[];
|
|
224
|
-
}, {
|
|
38
|
+
Children: BlockSchema[];
|
|
39
|
+
}
|
|
40
|
+
export declare const problemSectionSchema: ProblemSectionSchema;
|
|
41
|
+
export declare const ProblemSection: import("../../tag.js").ToEruditTag<ProblemSectionSchema, "ProblemSection", {
|
|
225
42
|
title: string;
|
|
226
|
-
}
|
|
227
|
-
export declare const problemSectionRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
228
|
-
name: "problemSection";
|
|
229
|
-
type: "block";
|
|
230
|
-
linkable: false;
|
|
231
|
-
Data: string;
|
|
232
|
-
Storage: undefined;
|
|
233
|
-
Children: AnySchema[];
|
|
234
|
-
}, {
|
|
235
|
-
ProblemSection: import("@jsprose/core").Tag<"ProblemSection", {
|
|
236
|
-
name: "problemSection";
|
|
237
|
-
type: "block";
|
|
238
|
-
linkable: false;
|
|
239
|
-
Data: string;
|
|
240
|
-
Storage: undefined;
|
|
241
|
-
Children: AnySchema[];
|
|
242
|
-
}, {
|
|
243
|
-
title: string;
|
|
244
|
-
} & TagChildren>;
|
|
245
|
-
}, undefined>;
|
|
43
|
+
}>;
|
|
246
44
|
export declare const problemSectionCoreElement: {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
Data: string;
|
|
252
|
-
Storage: undefined;
|
|
253
|
-
Children: AnySchema[];
|
|
254
|
-
}, {
|
|
255
|
-
ProblemSection: import("@jsprose/core").Tag<"ProblemSection", {
|
|
256
|
-
name: "problemSection";
|
|
257
|
-
type: "block";
|
|
258
|
-
linkable: false;
|
|
259
|
-
Data: string;
|
|
260
|
-
Storage: undefined;
|
|
261
|
-
Children: AnySchema[];
|
|
262
|
-
}, {
|
|
263
|
-
title: string;
|
|
264
|
-
} & TagChildren>;
|
|
265
|
-
}, undefined>;
|
|
45
|
+
readonly schema: ProblemSectionSchema;
|
|
46
|
+
readonly tags: [import("../../tag.js").ToEruditTag<ProblemSectionSchema, "ProblemSection", {
|
|
47
|
+
title: string;
|
|
48
|
+
}>];
|
|
266
49
|
};
|
|
50
|
+
export interface SectionContainerSchema<ContainerName extends string> extends Schema {
|
|
51
|
+
name: `problem${UppercaseFirst<ContainerName>}`;
|
|
52
|
+
type: 'block';
|
|
53
|
+
linkable: false;
|
|
54
|
+
Data: undefined;
|
|
55
|
+
Storage: undefined;
|
|
56
|
+
Children: BlockSchema[];
|
|
57
|
+
}
|
|
267
58
|
export declare const problemNote: {
|
|
268
|
-
schema:
|
|
269
|
-
|
|
270
|
-
type: "block";
|
|
271
|
-
linkable: false;
|
|
272
|
-
Data: undefined;
|
|
273
|
-
Storage: undefined;
|
|
274
|
-
Children: AnySchema[];
|
|
275
|
-
};
|
|
276
|
-
tag: import("@jsprose/core").Tag<"ProblemNote", {
|
|
277
|
-
name: "problemNote";
|
|
278
|
-
type: "block";
|
|
279
|
-
linkable: false;
|
|
280
|
-
Data: undefined;
|
|
281
|
-
Storage: undefined;
|
|
282
|
-
Children: AnySchema[];
|
|
283
|
-
}, TagChildren>;
|
|
284
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
285
|
-
name: "problemNote";
|
|
286
|
-
type: "block";
|
|
287
|
-
linkable: false;
|
|
288
|
-
Data: undefined;
|
|
289
|
-
Storage: undefined;
|
|
290
|
-
Children: AnySchema[];
|
|
291
|
-
}, {
|
|
292
|
-
ProblemNote: import("@jsprose/core").Tag<"ProblemNote", {
|
|
293
|
-
name: "problemNote";
|
|
294
|
-
type: "block";
|
|
295
|
-
linkable: false;
|
|
296
|
-
Data: undefined;
|
|
297
|
-
Storage: undefined;
|
|
298
|
-
Children: AnySchema[];
|
|
299
|
-
}, TagChildren>;
|
|
300
|
-
}, undefined>;
|
|
59
|
+
schema: SectionContainerSchema<"note">;
|
|
60
|
+
tag: import("../../tag.js").ToEruditTag<SectionContainerSchema<"note">, "ProblemNote", unknown>;
|
|
301
61
|
coreElement: {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
type: "block";
|
|
305
|
-
linkable: false;
|
|
306
|
-
Data: undefined;
|
|
307
|
-
Storage: undefined;
|
|
308
|
-
Children: AnySchema[];
|
|
309
|
-
}, {
|
|
310
|
-
ProblemNote: import("@jsprose/core").Tag<"ProblemNote", {
|
|
311
|
-
name: "problemNote";
|
|
312
|
-
type: "block";
|
|
313
|
-
linkable: false;
|
|
314
|
-
Data: undefined;
|
|
315
|
-
Storage: undefined;
|
|
316
|
-
Children: AnySchema[];
|
|
317
|
-
}, TagChildren>;
|
|
318
|
-
}, undefined>;
|
|
62
|
+
readonly schema: SectionContainerSchema<"note">;
|
|
63
|
+
readonly tags: [import("../../tag.js").ToEruditTag<SectionContainerSchema<"note">, "ProblemNote", unknown>];
|
|
319
64
|
};
|
|
320
65
|
};
|
|
321
66
|
export declare const problemSolution: {
|
|
322
|
-
schema:
|
|
323
|
-
|
|
324
|
-
type: "block";
|
|
325
|
-
linkable: false;
|
|
326
|
-
Data: undefined;
|
|
327
|
-
Storage: undefined;
|
|
328
|
-
Children: AnySchema[];
|
|
329
|
-
};
|
|
330
|
-
tag: import("@jsprose/core").Tag<"ProblemSolution", {
|
|
331
|
-
name: "problemSolution";
|
|
332
|
-
type: "block";
|
|
333
|
-
linkable: false;
|
|
334
|
-
Data: undefined;
|
|
335
|
-
Storage: undefined;
|
|
336
|
-
Children: AnySchema[];
|
|
337
|
-
}, TagChildren>;
|
|
338
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
339
|
-
name: "problemSolution";
|
|
340
|
-
type: "block";
|
|
341
|
-
linkable: false;
|
|
342
|
-
Data: undefined;
|
|
343
|
-
Storage: undefined;
|
|
344
|
-
Children: AnySchema[];
|
|
345
|
-
}, {
|
|
346
|
-
ProblemSolution: import("@jsprose/core").Tag<"ProblemSolution", {
|
|
347
|
-
name: "problemSolution";
|
|
348
|
-
type: "block";
|
|
349
|
-
linkable: false;
|
|
350
|
-
Data: undefined;
|
|
351
|
-
Storage: undefined;
|
|
352
|
-
Children: AnySchema[];
|
|
353
|
-
}, TagChildren>;
|
|
354
|
-
}, undefined>;
|
|
67
|
+
schema: SectionContainerSchema<"solution">;
|
|
68
|
+
tag: import("../../tag.js").ToEruditTag<SectionContainerSchema<"solution">, "ProblemSolution", unknown>;
|
|
355
69
|
coreElement: {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
type: "block";
|
|
359
|
-
linkable: false;
|
|
360
|
-
Data: undefined;
|
|
361
|
-
Storage: undefined;
|
|
362
|
-
Children: AnySchema[];
|
|
363
|
-
}, {
|
|
364
|
-
ProblemSolution: import("@jsprose/core").Tag<"ProblemSolution", {
|
|
365
|
-
name: "problemSolution";
|
|
366
|
-
type: "block";
|
|
367
|
-
linkable: false;
|
|
368
|
-
Data: undefined;
|
|
369
|
-
Storage: undefined;
|
|
370
|
-
Children: AnySchema[];
|
|
371
|
-
}, TagChildren>;
|
|
372
|
-
}, undefined>;
|
|
70
|
+
readonly schema: SectionContainerSchema<"solution">;
|
|
71
|
+
readonly tags: [import("../../tag.js").ToEruditTag<SectionContainerSchema<"solution">, "ProblemSolution", unknown>];
|
|
373
72
|
};
|
|
374
73
|
};
|
|
375
74
|
export declare const problemAnswer: {
|
|
376
|
-
schema:
|
|
377
|
-
|
|
378
|
-
type: "block";
|
|
379
|
-
linkable: false;
|
|
380
|
-
Data: undefined;
|
|
381
|
-
Storage: undefined;
|
|
382
|
-
Children: AnySchema[];
|
|
383
|
-
};
|
|
384
|
-
tag: import("@jsprose/core").Tag<"ProblemAnswer", {
|
|
385
|
-
name: "problemAnswer";
|
|
386
|
-
type: "block";
|
|
387
|
-
linkable: false;
|
|
388
|
-
Data: undefined;
|
|
389
|
-
Storage: undefined;
|
|
390
|
-
Children: AnySchema[];
|
|
391
|
-
}, TagChildren>;
|
|
392
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
393
|
-
name: "problemAnswer";
|
|
394
|
-
type: "block";
|
|
395
|
-
linkable: false;
|
|
396
|
-
Data: undefined;
|
|
397
|
-
Storage: undefined;
|
|
398
|
-
Children: AnySchema[];
|
|
399
|
-
}, {
|
|
400
|
-
ProblemAnswer: import("@jsprose/core").Tag<"ProblemAnswer", {
|
|
401
|
-
name: "problemAnswer";
|
|
402
|
-
type: "block";
|
|
403
|
-
linkable: false;
|
|
404
|
-
Data: undefined;
|
|
405
|
-
Storage: undefined;
|
|
406
|
-
Children: AnySchema[];
|
|
407
|
-
}, TagChildren>;
|
|
408
|
-
}, undefined>;
|
|
75
|
+
schema: SectionContainerSchema<"answer">;
|
|
76
|
+
tag: import("../../tag.js").ToEruditTag<SectionContainerSchema<"answer">, "ProblemAnswer", unknown>;
|
|
409
77
|
coreElement: {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
type: "block";
|
|
413
|
-
linkable: false;
|
|
414
|
-
Data: undefined;
|
|
415
|
-
Storage: undefined;
|
|
416
|
-
Children: AnySchema[];
|
|
417
|
-
}, {
|
|
418
|
-
ProblemAnswer: import("@jsprose/core").Tag<"ProblemAnswer", {
|
|
419
|
-
name: "problemAnswer";
|
|
420
|
-
type: "block";
|
|
421
|
-
linkable: false;
|
|
422
|
-
Data: undefined;
|
|
423
|
-
Storage: undefined;
|
|
424
|
-
Children: AnySchema[];
|
|
425
|
-
}, TagChildren>;
|
|
426
|
-
}, undefined>;
|
|
78
|
+
readonly schema: SectionContainerSchema<"answer">;
|
|
79
|
+
readonly tags: [import("../../tag.js").ToEruditTag<SectionContainerSchema<"answer">, "ProblemAnswer", unknown>];
|
|
427
80
|
};
|
|
428
81
|
};
|
|
429
82
|
export type ProblemContentChild = typeof problemDescriptionSchema | typeof problemHintSchema | typeof problemNote.schema | typeof problemSolution.schema | typeof problemAnswer.schema | typeof problemCheckSchema;
|
|
@@ -1,78 +1,68 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSchema, ensureTagBlockChildren, ensureTagChildren, isRawBlock, isRawElement } from "tsprose";
|
|
2
2
|
import { defineEruditTag } from "../../tag.js";
|
|
3
|
-
import { defineEruditProseCoreElement } from "../../coreElement.js";
|
|
4
3
|
import { uppercaseFirst } from "../../utils/case.js";
|
|
5
|
-
import {
|
|
4
|
+
import { paragraphWrap } from "../../shared/paragraphWrap.js";
|
|
6
5
|
import { problemCheckSchema } from "./problemCheck.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const tag = defineEruditTag({
|
|
17
|
-
tagName: opts.tagName,
|
|
18
|
-
schema
|
|
19
|
-
})(({ element, tagName, children }) => {
|
|
20
|
-
ensureTagChildren(tagName, children);
|
|
21
|
-
element.children = tryParagraphWrap(children) ?? children;
|
|
22
|
-
});
|
|
23
|
-
const registryItem = defineRegistryItem({
|
|
24
|
-
schema,
|
|
25
|
-
tags: [tag]
|
|
26
|
-
});
|
|
27
|
-
const coreElement = defineEruditProseCoreElement({ registryItem });
|
|
28
|
-
return {
|
|
29
|
-
schema,
|
|
30
|
-
tag,
|
|
31
|
-
registryItem,
|
|
32
|
-
coreElement
|
|
33
|
-
};
|
|
6
|
+
import { defineProseCoreElement } from "../../coreElement.js";
|
|
7
|
+
import { EruditProseError } from "../../error.js";
|
|
8
|
+
function toBlockChildren(tagName, children) {
|
|
9
|
+
const wrap = paragraphWrap(children);
|
|
10
|
+
if (wrap) {
|
|
11
|
+
return wrap;
|
|
12
|
+
}
|
|
13
|
+
ensureTagBlockChildren(tagName, children);
|
|
14
|
+
return children;
|
|
34
15
|
}
|
|
35
|
-
|
|
36
|
-
/* description / hint */
|
|
37
|
-
/* --------------------------------------------------------- */
|
|
38
|
-
export const problemDescription = defineParagraphBlock({
|
|
16
|
+
export const problemDescriptionSchema = defineSchema({
|
|
39
17
|
name: "problemDescription",
|
|
18
|
+
type: "block",
|
|
19
|
+
linkable: false
|
|
20
|
+
});
|
|
21
|
+
export const ProblemDescription = defineEruditTag({
|
|
22
|
+
schema: problemDescriptionSchema,
|
|
40
23
|
tagName: "ProblemDescription"
|
|
24
|
+
})(({ element, tagName, children }) => {
|
|
25
|
+
element.children = toBlockChildren(tagName, children);
|
|
26
|
+
});
|
|
27
|
+
export const problemDescriptionCoreElement = defineProseCoreElement({
|
|
28
|
+
schema: problemDescriptionSchema,
|
|
29
|
+
tags: [ProblemDescription]
|
|
41
30
|
});
|
|
42
|
-
export const
|
|
31
|
+
export const problemHintSchema = defineSchema({
|
|
43
32
|
name: "problemHint",
|
|
33
|
+
type: "block",
|
|
34
|
+
linkable: false
|
|
35
|
+
});
|
|
36
|
+
export const ProblemHint = defineEruditTag({
|
|
37
|
+
schema: problemHintSchema,
|
|
44
38
|
tagName: "ProblemHint"
|
|
39
|
+
})(({ element, tagName, children }) => {
|
|
40
|
+
element.children = toBlockChildren(tagName, children);
|
|
41
|
+
});
|
|
42
|
+
export const problemHintCoreElement = defineProseCoreElement({
|
|
43
|
+
schema: problemHintSchema,
|
|
44
|
+
tags: [ProblemHint]
|
|
45
45
|
});
|
|
46
|
-
export const { schema: problemDescriptionSchema, tag: ProblemDescription, registryItem: problemDescriptionRegistryItem, coreElement: problemDescriptionCoreElement } = problemDescription;
|
|
47
|
-
export const { schema: problemHintSchema, tag: ProblemHint, registryItem: problemHintRegistryItem, coreElement: problemHintCoreElement } = problemHint;
|
|
48
|
-
/* --------------------------------------------------------- */
|
|
49
|
-
/* section */
|
|
50
|
-
/* --------------------------------------------------------- */
|
|
51
46
|
export const problemSectionSchema = defineSchema({
|
|
52
47
|
name: "problemSection",
|
|
53
48
|
type: "block",
|
|
54
49
|
linkable: false
|
|
55
|
-
})
|
|
50
|
+
});
|
|
56
51
|
export const ProblemSection = defineEruditTag({
|
|
57
52
|
tagName: "ProblemSection",
|
|
58
53
|
schema: problemSectionSchema
|
|
59
54
|
})(({ element, tagName, props, children }) => {
|
|
60
|
-
|
|
61
|
-
element.children = tryParagraphWrap(children) ?? children;
|
|
55
|
+
element.children = toBlockChildren(tagName, children);
|
|
62
56
|
const title = props.title.trim();
|
|
63
57
|
if (!title) {
|
|
64
|
-
throw new
|
|
58
|
+
throw new EruditProseError(`${tagName} title must be non-empty.`);
|
|
65
59
|
}
|
|
66
60
|
element.data = title;
|
|
67
61
|
});
|
|
68
|
-
export const
|
|
62
|
+
export const problemSectionCoreElement = defineProseCoreElement({
|
|
69
63
|
schema: problemSectionSchema,
|
|
70
64
|
tags: [ProblemSection]
|
|
71
65
|
});
|
|
72
|
-
export const problemSectionCoreElement = defineEruditProseCoreElement({ registryItem: problemSectionRegistryItem });
|
|
73
|
-
/* --------------------------------------------------------- */
|
|
74
|
-
/* section containers */
|
|
75
|
-
/* --------------------------------------------------------- */
|
|
76
66
|
function defineProblemSectionContainer(name) {
|
|
77
67
|
const cap = uppercaseFirst(name);
|
|
78
68
|
const schemaName = `problem${cap}`;
|
|
@@ -81,7 +71,7 @@ function defineProblemSectionContainer(name) {
|
|
|
81
71
|
name: schemaName,
|
|
82
72
|
type: "block",
|
|
83
73
|
linkable: false
|
|
84
|
-
})
|
|
74
|
+
});
|
|
85
75
|
const tag = defineEruditTag({
|
|
86
76
|
tagName,
|
|
87
77
|
schema
|
|
@@ -94,23 +84,24 @@ function defineProblemSectionContainer(name) {
|
|
|
94
84
|
seenSection = true;
|
|
95
85
|
sections.push(child);
|
|
96
86
|
} else {
|
|
87
|
+
if (!isRawBlock(child)) {
|
|
88
|
+
throw new EruditProseError(`${tagName} cannot have inline children (found "${child.schema.name}").`);
|
|
89
|
+
}
|
|
97
90
|
if (seenSection) {
|
|
98
|
-
throw new
|
|
91
|
+
throw new EruditProseError(`${tagName}: non-section children must come before <ProblemSection>.`);
|
|
99
92
|
}
|
|
100
93
|
head.push(child);
|
|
101
94
|
}
|
|
102
95
|
}
|
|
103
|
-
element.children = [...
|
|
96
|
+
element.children = [...head, ...sections];
|
|
104
97
|
});
|
|
105
|
-
const
|
|
98
|
+
const coreElement = defineProseCoreElement({
|
|
106
99
|
schema,
|
|
107
100
|
tags: [tag]
|
|
108
101
|
});
|
|
109
|
-
const coreElement = defineEruditProseCoreElement({ registryItem });
|
|
110
102
|
return {
|
|
111
103
|
schema,
|
|
112
104
|
tag,
|
|
113
|
-
registryItem,
|
|
114
105
|
coreElement
|
|
115
106
|
};
|
|
116
107
|
}
|
|
@@ -145,7 +136,7 @@ export function validateProblemContent(source, children) {
|
|
|
145
136
|
for (const { schema, label } of uniques) {
|
|
146
137
|
if (isRawElement(child, schema)) {
|
|
147
138
|
if (seen.has(label)) {
|
|
148
|
-
throw new
|
|
139
|
+
throw new EruditProseError(`Invalid problem content at ${source}: only one <${label}> allowed.`);
|
|
149
140
|
}
|
|
150
141
|
seen.add(label);
|
|
151
142
|
break;
|