@khanacademy/perseus 46.0.1 → 47.0.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/es/index.js +233 -1370
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +3 -13
- package/dist/index.js +218 -1364
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +33 -15
- package/dist/types.d.ts +0 -2
- package/dist/widget-type-utils.d.ts +0 -2
- package/package.json +1 -1
- package/dist/multi-items/item-types.d.ts +0 -33
- package/dist/multi-items/items.d.ts +0 -53
- package/dist/multi-items/multi-renderer.d.ts +0 -159
- package/dist/multi-items/prop-type-builders.d.ts +0 -14
- package/dist/multi-items/shape-types.d.ts +0 -47
- package/dist/multi-items/shapes.d.ts +0 -23
- package/dist/multi-items/tree-types.d.ts +0 -34
- package/dist/multi-items/trees.d.ts +0 -146
- package/dist/multi-items.d.ts +0 -73
package/dist/multi-items.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This library provides support for Perseus multi-items: structured Perseus
|
|
3
|
-
* content that content creators can easily create, and that applications can
|
|
4
|
-
* easily render into different parts of the layout.
|
|
5
|
-
*
|
|
6
|
-
* For more details about application and motivation, see:
|
|
7
|
-
* https://sites.google.com/a/khanacademy.org/forge/for-developers/perseus-items-and-multi-items
|
|
8
|
-
*
|
|
9
|
-
* This file primarily exposes the `MultiRenderer` component, which performs
|
|
10
|
-
* multi-rendering. To multi-render a question, pass in the content of the item
|
|
11
|
-
* to the `MultiRenderer` component as a props. Then, pass in a function which
|
|
12
|
-
* takes an object of renderers (in the same structure as the content), and
|
|
13
|
-
* return a render tree. The `MultiRenderer` component will allow you to
|
|
14
|
-
* combine scores, serialized state, etc. without having to manually call on
|
|
15
|
-
* each of the functions. It also handles inter-widgets requests between the
|
|
16
|
-
* different renderers.
|
|
17
|
-
* For more details, see `multi-items/multi-renderer.jsx`.
|
|
18
|
-
*
|
|
19
|
-
* Example:
|
|
20
|
-
*
|
|
21
|
-
* item = {_multi: {
|
|
22
|
-
* left: <content data>,
|
|
23
|
-
* right: [<content data>, <content data>],
|
|
24
|
-
* }}
|
|
25
|
-
* shape = shapes.shape({
|
|
26
|
-
* left: shapes.content,
|
|
27
|
-
* right: shapes.arrayOf(shapes.content),
|
|
28
|
-
* })
|
|
29
|
-
*
|
|
30
|
-
* <MultiRenderer item={item} shape={shape}>
|
|
31
|
-
* {({renderers}) =>
|
|
32
|
-
* <div>
|
|
33
|
-
* <div id="left">{renderers.left}</div>
|
|
34
|
-
* <ul id="right">
|
|
35
|
-
* {renderers.right.map(r => <li>{r}</li>)}
|
|
36
|
-
* </ul>
|
|
37
|
-
* </div>
|
|
38
|
-
* }
|
|
39
|
-
* </MultiRenderer>
|
|
40
|
-
*
|
|
41
|
-
* This file also exposes `shapes`, which helps you construct a runtime type
|
|
42
|
-
* declaration for your particular class of multi-item. This can then be used
|
|
43
|
-
* to create a MultirendererEditor for your multi-item shape, and to validate
|
|
44
|
-
* that a multi-item conforms to the shape via `buildPropTypeForShape`.
|
|
45
|
-
* For more details, see `multi-items/shapes.js`.
|
|
46
|
-
*
|
|
47
|
-
* This file also exposes some utility functions for working with generic
|
|
48
|
-
* multi-items, like `findContentNodesInItem`, `findHintNodesInItem`,
|
|
49
|
-
* `inferItemShape`, and `buildEmptyItemForShape`.
|
|
50
|
-
* For more details, see `multi-items/items.js`.
|
|
51
|
-
*/
|
|
52
|
-
import { buildEmptyItemForShape, findContentNodesInItem, findHintNodesInItem, inferItemShape } from "./multi-items/items";
|
|
53
|
-
import MultiRenderer from "./multi-items/multi-renderer";
|
|
54
|
-
import { buildPropTypeForShape } from "./multi-items/prop-type-builders";
|
|
55
|
-
declare const _default: {
|
|
56
|
-
MultiRenderer: typeof MultiRenderer;
|
|
57
|
-
shapes: {
|
|
58
|
-
content: import(".").ContentShape;
|
|
59
|
-
hint: import(".").HintShape;
|
|
60
|
-
hints: import(".").ArrayShape;
|
|
61
|
-
tags: import(".").TagsShape;
|
|
62
|
-
arrayOf: (elementShape: import(".").Shape) => import(".").ArrayShape;
|
|
63
|
-
shape: (shape: {
|
|
64
|
-
[k: string]: import(".").Shape;
|
|
65
|
-
}) => import(".").ObjectShape;
|
|
66
|
-
};
|
|
67
|
-
buildPropTypeForShape: typeof buildPropTypeForShape;
|
|
68
|
-
buildEmptyItemForShape: typeof buildEmptyItemForShape;
|
|
69
|
-
findContentNodesInItem: typeof findContentNodesInItem;
|
|
70
|
-
findHintNodesInItem: typeof findHintNodesInItem;
|
|
71
|
-
inferItemShape: typeof inferItemShape;
|
|
72
|
-
};
|
|
73
|
-
export default _default;
|