@erudit-js/prose 4.1.1 → 4.2.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 (208) hide show
  1. package/dist/app/appElement.d.ts +7 -6
  2. package/dist/app/appElement.js +1 -1
  3. package/dist/app/composables/anchor.d.ts +7 -7
  4. package/dist/app/composables/appElement.d.ts +4 -4
  5. package/dist/app/composables/appElement.js +3 -3
  6. package/dist/app/composables/context.d.ts +3 -2
  7. package/dist/app/composables/elementIcon.d.ts +2 -2
  8. package/dist/app/composables/elementIcon.js +1 -1
  9. package/dist/app/composables/language.d.ts +2 -2
  10. package/dist/app/composables/language.js +1 -1
  11. package/dist/app/composables/storage.d.ts +4 -4
  12. package/dist/app/composables/storage.js +0 -4
  13. package/dist/app/default/Mix.vue +2 -2
  14. package/dist/app/default/Text.vue +2 -2
  15. package/dist/app/shared/Prose.vue +3 -3
  16. package/dist/app/shared/Render.vue +5 -14
  17. package/dist/app/shared/block/AsideMenu.vue +2 -2
  18. package/dist/app/shared/block/AsideMenuCopyLink.vue +1 -1
  19. package/dist/app/shared/block/Block.vue +4 -4
  20. package/dist/app/shared/inliner/Inliner.vue +2 -2
  21. package/dist/coreElement.d.ts +25 -7
  22. package/dist/coreElement.js +2 -2
  23. package/dist/elements/accent/Accent.vue +4 -4
  24. package/dist/elements/accent/AccentColumnSection.vue +2 -2
  25. package/dist/elements/accent/AccentRowSections.vue +2 -2
  26. package/dist/elements/accent/app.d.ts +3 -3
  27. package/dist/elements/accent/app.js +2 -2
  28. package/dist/elements/accent/core.d.ts +61 -300
  29. package/dist/elements/accent/core.js +83 -68
  30. package/dist/elements/callout/Callout.vue +4 -4
  31. package/dist/elements/callout/app.d.ts +1 -8
  32. package/dist/elements/callout/app.js +2 -2
  33. package/dist/elements/callout/core.d.ts +21 -59
  34. package/dist/elements/callout/core.js +18 -17
  35. package/dist/elements/caption/Caption.vue +3 -3
  36. package/dist/elements/caption/app.d.ts +1 -8
  37. package/dist/elements/caption/app.js +2 -2
  38. package/dist/elements/caption/core.d.ts +21 -99
  39. package/dist/elements/caption/core.js +18 -22
  40. package/dist/elements/details/Details.vue +3 -3
  41. package/dist/elements/details/app.d.ts +1 -8
  42. package/dist/elements/details/app.js +2 -2
  43. package/dist/elements/details/core.d.ts +18 -61
  44. package/dist/elements/details/core.js +16 -11
  45. package/dist/elements/diagram/Diagram.vue +14 -11
  46. package/dist/elements/diagram/app.d.ts +1 -29
  47. package/dist/elements/diagram/app.js +2 -2
  48. package/dist/elements/diagram/core.d.ts +14 -177
  49. package/dist/elements/diagram/core.js +5 -8
  50. package/dist/elements/emphasis/Emphasis.vue +3 -3
  51. package/dist/elements/emphasis/app.d.ts +1 -8
  52. package/dist/elements/emphasis/app.js +2 -2
  53. package/dist/elements/emphasis/core.d.ts +13 -76
  54. package/dist/elements/emphasis/core.js +8 -9
  55. package/dist/elements/flex/Flex.vue +3 -3
  56. package/dist/elements/flex/app.d.ts +1 -8
  57. package/dist/elements/flex/app.js +2 -2
  58. package/dist/elements/flex/core.d.ts +16 -58
  59. package/dist/elements/flex/core.js +6 -7
  60. package/dist/elements/gallery/Gallery.vue +3 -3
  61. package/dist/elements/gallery/app.d.ts +1 -22
  62. package/dist/elements/gallery/app.js +2 -2
  63. package/dist/elements/gallery/core.d.ts +11 -132
  64. package/dist/elements/gallery/core.js +4 -5
  65. package/dist/elements/heading/Heading.vue +3 -3
  66. package/dist/elements/heading/_global.d.ts +2 -2
  67. package/dist/elements/heading/app.d.ts +1 -8
  68. package/dist/elements/heading/app.js +2 -2
  69. package/dist/elements/heading/core.d.ts +13 -97
  70. package/dist/elements/heading/core.js +8 -8
  71. package/dist/elements/horizontalLine/app.d.ts +1 -8
  72. package/dist/elements/horizontalLine/app.js +2 -2
  73. package/dist/elements/horizontalLine/core.d.ts +9 -47
  74. package/dist/elements/horizontalLine/core.js +4 -5
  75. package/dist/elements/image/Image.vue +3 -3
  76. package/dist/elements/image/ImageElement.vue +4 -4
  77. package/dist/elements/image/app.d.ts +1 -15
  78. package/dist/elements/image/app.js +2 -2
  79. package/dist/elements/image/core.d.ts +29 -108
  80. package/dist/elements/image/core.js +12 -19
  81. package/dist/elements/image/storage.d.ts +1 -1
  82. package/dist/elements/image/storage.js +6 -6
  83. package/dist/elements/lineBreak/app.d.ts +1 -8
  84. package/dist/elements/lineBreak/app.js +2 -2
  85. package/dist/elements/lineBreak/core.d.ts +9 -47
  86. package/dist/elements/lineBreak/core.js +4 -5
  87. package/dist/elements/link/BlockLink.vue +4 -6
  88. package/dist/elements/link/Link.vue +4 -4
  89. package/dist/elements/link/core.d.ts +6 -6
  90. package/dist/elements/link/core.js +4 -3
  91. package/dist/elements/link/dependency/app.d.ts +1 -15
  92. package/dist/elements/link/dependency/app.js +3 -3
  93. package/dist/elements/link/dependency/core.d.ts +27 -105
  94. package/dist/elements/link/dependency/core.js +6 -8
  95. package/dist/elements/link/hook.d.ts +12 -0
  96. package/dist/elements/link/hook.js +45 -0
  97. package/dist/elements/link/reference/app.d.ts +1 -15
  98. package/dist/elements/link/reference/app.js +3 -3
  99. package/dist/elements/link/reference/core.d.ts +24 -103
  100. package/dist/elements/link/reference/core.js +6 -8
  101. package/dist/elements/link/storage.js +1 -1
  102. package/dist/elements/list/List.vue +7 -5
  103. package/dist/elements/list/_global.d.ts +3 -3
  104. package/dist/elements/list/app.d.ts +1 -15
  105. package/dist/elements/list/app.js +2 -2
  106. package/dist/elements/list/core.d.ts +33 -155
  107. package/dist/elements/list/core.js +20 -18
  108. package/dist/elements/math/app.d.ts +1 -15
  109. package/dist/elements/math/app.js +3 -3
  110. package/dist/elements/math/block.d.ts +31 -43
  111. package/dist/elements/math/block.js +10 -9
  112. package/dist/elements/math/components/BlockMath.vue +4 -4
  113. package/dist/elements/math/components/InlinerMath.vue +4 -4
  114. package/dist/elements/math/core.d.ts +25 -53
  115. package/dist/elements/math/core.js +3 -11
  116. package/dist/elements/math/inliner.d.ts +24 -36
  117. package/dist/elements/math/inliner.js +10 -12
  118. package/dist/elements/paragraph/Paragraph.vue +3 -3
  119. package/dist/elements/paragraph/app.d.ts +1 -8
  120. package/dist/elements/paragraph/app.js +2 -2
  121. package/dist/elements/paragraph/core.d.ts +12 -53
  122. package/dist/elements/paragraph/core.js +6 -7
  123. package/dist/elements/problem/app.d.ts +1 -29
  124. package/dist/elements/problem/app.js +4 -4
  125. package/dist/elements/problem/components/Problem.vue +3 -3
  126. package/dist/elements/problem/components/ProblemContent.vue +15 -21
  127. package/dist/elements/problem/components/ProblemExpanderSection.vue +2 -2
  128. package/dist/elements/problem/components/Problems.vue +11 -7
  129. package/dist/elements/problem/components/SubProblem.vue +3 -4
  130. package/dist/elements/problem/components/expanders/Check.vue +3 -3
  131. package/dist/elements/problem/components/expanders/Checks.vue +6 -3
  132. package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +3 -7
  133. package/dist/elements/problem/components/expanders/Hint.vue +3 -3
  134. package/dist/elements/problem/composables/problemScript.d.ts +2 -2
  135. package/dist/elements/problem/core.d.ts +63 -299
  136. package/dist/elements/problem/core.js +9 -11
  137. package/dist/elements/problem/hook.d.ts +1 -0
  138. package/dist/elements/problem/hook.js +14 -0
  139. package/dist/elements/problem/problem.d.ts +20 -77
  140. package/dist/elements/problem/problem.js +6 -6
  141. package/dist/elements/problem/problemCheck.d.ts +33 -83
  142. package/dist/elements/problem/problemCheck.js +16 -10
  143. package/dist/elements/problem/problemContent.d.ts +54 -401
  144. package/dist/elements/problem/problemContent.js +47 -58
  145. package/dist/elements/problem/problemScript.d.ts +18 -10
  146. package/dist/elements/problem/problemScript.js +15 -26
  147. package/dist/elements/problem/problems.d.ts +29 -188
  148. package/dist/elements/problem/problems.js +11 -15
  149. package/dist/elements/problem/storage.d.ts +1 -1
  150. package/dist/elements/problem/storage.js +2 -3
  151. package/dist/elements/table/Table.vue +3 -3
  152. package/dist/elements/table/app.d.ts +1 -29
  153. package/dist/elements/table/app.js +2 -2
  154. package/dist/elements/table/core.d.ts +28 -309
  155. package/dist/elements/table/core.js +17 -29
  156. package/dist/elements/video/Video.vue +4 -4
  157. package/dist/elements/video/app.d.ts +1 -15
  158. package/dist/elements/video/app.js +2 -2
  159. package/dist/elements/video/core.d.ts +26 -106
  160. package/dist/elements/video/core.js +11 -16
  161. package/dist/elements/video/storage.d.ts +1 -1
  162. package/dist/elements/video/storage.js +2 -3
  163. package/dist/error.d.ts +3 -0
  164. package/dist/error.js +6 -0
  165. package/dist/include.d.ts +4 -4
  166. package/dist/include.js +6 -12
  167. package/dist/index.d.ts +11 -11
  168. package/dist/index.js +11 -11
  169. package/dist/rawElement.d.ts +9 -6
  170. package/dist/rawElement.js +4 -0
  171. package/dist/rawToProse/countSchemas.d.ts +1 -0
  172. package/dist/rawToProse/countSchemas.js +11 -0
  173. package/dist/rawToProse/hook.d.ts +39 -0
  174. package/dist/rawToProse/hook.js +6 -0
  175. package/dist/rawToProse/index.d.ts +34 -0
  176. package/dist/rawToProse/index.js +92 -0
  177. package/dist/rawToProse/uniqueTitles.d.ts +1 -0
  178. package/dist/rawToProse/uniqueTitles.js +11 -0
  179. package/dist/shared/filePath.js +31 -4
  180. package/dist/shared/paragraphWrap.d.ts +3 -3
  181. package/dist/shared/paragraphWrap.js +7 -12
  182. package/dist/slugify/index.d.ts +3 -1
  183. package/dist/slugify/index.js +5 -6
  184. package/dist/slugify/languages/en.js +1 -1
  185. package/dist/slugify/languages/ru.js +1 -1
  186. package/dist/snippet.d.ts +39 -33
  187. package/dist/snippet.js +139 -73
  188. package/dist/tag.d.ts +22 -19
  189. package/dist/tag.js +19 -15
  190. package/dist/toc.d.ts +12 -18
  191. package/dist/toc.js +120 -42
  192. package/package.json +8 -7
  193. package/dist/app/default/Inliners.vue +0 -11
  194. package/dist/context.d.ts +0 -4
  195. package/dist/context.js +0 -1
  196. package/dist/elements/link/step.d.ts +0 -16
  197. package/dist/elements/link/step.js +0 -36
  198. package/dist/elements/problem/step.d.ts +0 -5
  199. package/dist/elements/problem/step.js +0 -13
  200. package/dist/resolve.d.ts +0 -21
  201. package/dist/resolve.js +0 -102
  202. package/dist/resolveStep.d.ts +0 -9
  203. package/dist/resolveStep.js +0 -3
  204. package/dist/title.d.ts +0 -8
  205. package/dist/title.js +0 -6
  206. package/dist/utils/docs.d.ts +0 -1
  207. package/dist/utils/docs.js +0 -22
  208. /package/{types.d.ts → raw.d.ts} +0 -0
@@ -1,429 +1,82 @@
1
- import { type AnySchema, type NormalizedChildren, type TagChildren } from '@jsprose/core';
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 declare const problemDescription: {
4
- schema: {
5
- name: "problemDescription";
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: AnySchema[];
132
- }, {
133
- ProblemDescription: import("@jsprose/core").Tag<"ProblemDescription", {
134
- name: "problemDescription";
135
- type: "block";
136
- linkable: false;
137
- Data: undefined;
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 declare const problemHintSchema: {
161
- name: "problemHint";
162
- type: "block";
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: AnySchema[];
167
- }, ProblemHint: import("@jsprose/core").Tag<"ProblemHint", {
168
- name: "problemHint";
169
- type: "block";
170
- linkable: false;
171
- Data: undefined;
172
- Storage: undefined;
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 declare const problemSectionSchema: {
210
- name: "problemSection";
211
- type: "block";
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: AnySchema[];
216
- };
217
- export declare const ProblemSection: import("@jsprose/core").Tag<"ProblemSection", {
218
- name: "problemSection";
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
- } & TagChildren>;
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
- registryItem: import("@jsprose/core").RegistryItem<{
248
- name: "problemSection";
249
- type: "block";
250
- linkable: false;
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
- name: "problemNote";
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
- registryItem: import("@jsprose/core").RegistryItem<{
303
- name: "problemNote";
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
- name: "problemSolution";
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
- registryItem: import("@jsprose/core").RegistryItem<{
357
- name: "problemSolution";
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
- name: "problemAnswer";
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
- registryItem: import("@jsprose/core").RegistryItem<{
411
- name: "problemAnswer";
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 { defineRegistryItem, defineSchema, ensureTagChildren, isRawElement, ProseError } from "@jsprose/core";
1
+ import { defineSchema, ensureTagBlockChildren, ensureTagChildren, 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 { tryParagraphWrap } from "../../shared/paragraphWrap.js";
4
+ import { paragraphWrap } from "../../shared/paragraphWrap.js";
6
5
  import { problemCheckSchema } from "./problemCheck.js";
7
- /* --------------------------------------------------------- */
8
- /* shared helpers */
9
- /* --------------------------------------------------------- */
10
- function defineParagraphBlock(opts) {
11
- const schema = defineSchema({
12
- name: opts.name,
13
- type: "block",
14
- linkable: false
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 problemHint = defineParagraphBlock({
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
- ensureTagChildren(tagName, children);
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 ProseError(`${tagName} title must be non-empty.`);
58
+ throw new EruditProseError(`${tagName} title must be non-empty.`);
65
59
  }
66
60
  element.data = title;
67
61
  });
68
- export const problemSectionRegistryItem = defineRegistryItem({
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,12 +71,12 @@ 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
88
78
  })(({ element, children }) => {
89
- const head = [];
79
+ const headRaw = [];
90
80
  const sections = [];
91
81
  let seenSection = false;
92
82
  for (const child of children) {
@@ -95,22 +85,21 @@ function defineProblemSectionContainer(name) {
95
85
  sections.push(child);
96
86
  } else {
97
87
  if (seenSection) {
98
- throw new ProseError(`${tagName}: non-section children must come before <ProblemSection>.`);
88
+ throw new EruditProseError(`${tagName}: non-section children must come before <ProblemSection>.`);
99
89
  }
100
- head.push(child);
90
+ headRaw.push(child);
101
91
  }
102
92
  }
103
- element.children = [...tryParagraphWrap(head) ?? head, ...sections];
93
+ const head = headRaw.length > 0 ? toBlockChildren(tagName, headRaw) : [];
94
+ element.children = [...head, ...sections];
104
95
  });
105
- const registryItem = defineRegistryItem({
96
+ const coreElement = defineProseCoreElement({
106
97
  schema,
107
98
  tags: [tag]
108
99
  });
109
- const coreElement = defineEruditProseCoreElement({ registryItem });
110
100
  return {
111
101
  schema,
112
102
  tag,
113
- registryItem,
114
103
  coreElement
115
104
  };
116
105
  }
@@ -145,7 +134,7 @@ export function validateProblemContent(source, children) {
145
134
  for (const { schema, label } of uniques) {
146
135
  if (isRawElement(child, schema)) {
147
136
  if (seen.has(label)) {
148
- throw new ProseError(`Invalid problem content at ${source}: only one <${label}> allowed.`);
137
+ throw new EruditProseError(`Invalid problem content at ${source}: only one <${label}> allowed.`);
149
138
  }
150
139
  seen.add(label);
151
140
  break;