@khanacademy/perseus 2.0.0 → 2.1.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.
- package/CHANGELOG.md +17 -0
- package/dist/es/index.css +3 -67
- package/dist/es/index.js +67 -102
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +3 -67
- package/dist/index.js +67 -102
- package/dist/index.js.map +1 -1
- package/package.json +34 -34
- package/src/components/graph.jsx +0 -2
- package/src/components/math-input.jsx +163 -152
- package/src/components/tex-buttons.jsx +7 -9
- package/src/components/tooltip.jsx +0 -3
- package/src/components/zoomable.jsx +0 -10
- package/src/interactive2/movable-point.jsx +0 -4
- package/src/interactive2/wrapped-ellipse.js +0 -1
- package/src/styles/articles.less +6 -5
- package/src/styles/khan-exercise.css +1 -33
- package/src/styles/perseus-renderer.less +1 -10
- package/src/styles/widgets/expression.less +0 -2
- package/src/styles/widgets/orderer.less +1 -1
- package/src/styles/widgets/plotter.less +0 -4
- package/src/styles/widgets/sortable.less +0 -14
- package/src/widget-container.jsx +4 -0
- package/src/widgets/__stories__/definition.stories.jsx +27 -1
- package/src/widgets/__tests__/__snapshots__/definition_test.js.snap +2 -2
- package/src/widgets/__tests__/__snapshots__/number-line_test.jsx.snap +1 -1
- package/src/widgets/__tests__/__snapshots__/video_test.jsx.snap +2 -2
- package/src/widgets/simulator.jsx +0 -2
|
@@ -16,8 +16,6 @@ div.subhint {
|
|
|
16
16
|
border: 1px solid #aaaaaa;
|
|
17
17
|
background: #f9f9f9;
|
|
18
18
|
display: none;
|
|
19
|
-
-moz-border-radius: 4px;
|
|
20
|
-
-webkit-border-radius: 4px;
|
|
21
19
|
border-radius: 4px;
|
|
22
20
|
margin-left: 20px;
|
|
23
21
|
margin-right: 20px;
|
|
@@ -39,8 +37,6 @@ div.definition {
|
|
|
39
37
|
border: 1px solid #aaaaaa;
|
|
40
38
|
background: #f9f9f9;
|
|
41
39
|
display: none;
|
|
42
|
-
-moz-border-radius: 4px;
|
|
43
|
-
-webkit-border-radius: 4px;
|
|
44
40
|
border-radius: 4px;
|
|
45
41
|
margin-left: 20px;
|
|
46
42
|
margin-right: 20px;
|
|
@@ -152,9 +148,6 @@ body.debug .graphie { outline: 1px dashed #fdd; }
|
|
|
152
148
|
padding-bottom: 40px;
|
|
153
149
|
}
|
|
154
150
|
#scratchpad div {
|
|
155
|
-
-moz-box-sizing: border-box;
|
|
156
|
-
-ms-box-sizing: border-box;
|
|
157
|
-
-webkit-box-sizing: border-box;
|
|
158
151
|
box-sizing: border-box;
|
|
159
152
|
border: 1px solid #ccc;
|
|
160
153
|
height: 100%;
|
|
@@ -232,7 +225,6 @@ body.debug .graphie { outline: 1px dashed #fdd; }
|
|
|
232
225
|
|
|
233
226
|
#answer_area .calculator .history input {
|
|
234
227
|
box-sizing: border-box;
|
|
235
|
-
-moz-box-sizing: border-box;
|
|
236
228
|
display: block;
|
|
237
229
|
font: inherit;
|
|
238
230
|
margin: 5px 3px 3px;
|
|
@@ -362,8 +354,6 @@ body.debug .graphie { outline: 1px dashed #fdd; }
|
|
|
362
354
|
list-style: none;
|
|
363
355
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
|
364
356
|
padding-left: 10px;
|
|
365
|
-
-moz-border-radius: 5px;
|
|
366
|
-
-webkit-border-radius: 5px;
|
|
367
357
|
border-radius: 5px;
|
|
368
358
|
line-height: 22px;
|
|
369
359
|
margin-bottom: 3px;
|
|
@@ -407,8 +397,6 @@ var, div.graphie {
|
|
|
407
397
|
padding: 2px 5px;
|
|
408
398
|
border: 1px solid #999;
|
|
409
399
|
border-radius: 4px;
|
|
410
|
-
-webkit-border-radius: 4px;
|
|
411
|
-
-moz-border-radius: 4px;
|
|
412
400
|
float: left;
|
|
413
401
|
cursor: pointer;
|
|
414
402
|
color: white;
|
|
@@ -606,7 +594,7 @@ html.exercise-browser {
|
|
|
606
594
|
top: 12px;
|
|
607
595
|
padding: 0px;
|
|
608
596
|
border: none;
|
|
609
|
-
|
|
597
|
+
box-shadow: none;
|
|
610
598
|
overflow: visible;
|
|
611
599
|
}
|
|
612
600
|
|
|
@@ -729,9 +717,6 @@ html.exercise-browser {
|
|
|
729
717
|
|
|
730
718
|
#timelinecontainer .simple-button {
|
|
731
719
|
-webkit-user-select: none;
|
|
732
|
-
-khtml-user-select: none;
|
|
733
|
-
-moz-user-select: none;
|
|
734
|
-
-o-user-select: none;
|
|
735
720
|
user-select: none;
|
|
736
721
|
white-space: nowrap;
|
|
737
722
|
}
|
|
@@ -754,8 +739,6 @@ html.exercise-browser {
|
|
|
754
739
|
width: 200px;
|
|
755
740
|
height: 100px;
|
|
756
741
|
border: 1px solid #aaa;
|
|
757
|
-
-webkit-box-shadow: 0 0 3px #ccc;
|
|
758
|
-
-moz-box-shadow: 0 0 3px #ccc;
|
|
759
742
|
box-shadow: 0 0 3px #ccc;
|
|
760
743
|
margin-left: 14px; /* to line up with other titles */
|
|
761
744
|
margin-bottom: 8px;
|
|
@@ -800,8 +783,6 @@ html.exercise-browser {
|
|
|
800
783
|
z-index: 2;
|
|
801
784
|
|
|
802
785
|
box-shadow: 0 1px 2px #ccc;
|
|
803
|
-
-moz-box-shadow: 0 1px 2px #ccc;
|
|
804
|
-
-webkit-box-shadow: 0 1px 2px #ccc;
|
|
805
786
|
}
|
|
806
787
|
|
|
807
788
|
.sortable > ul {
|
|
@@ -813,8 +794,6 @@ html.exercise-browser {
|
|
|
813
794
|
border: 1px solid #b9b9b9;
|
|
814
795
|
border-bottom-color: #939393;
|
|
815
796
|
border-radius: 4px;
|
|
816
|
-
-moz-border-radius: 4px;
|
|
817
|
-
-webkit-border-radius: 4px;
|
|
818
797
|
cursor: pointer;
|
|
819
798
|
margin-right: 4px;
|
|
820
799
|
min-width: 65px;
|
|
@@ -823,9 +802,6 @@ html.exercise-browser {
|
|
|
823
802
|
font-size: 1.2em;
|
|
824
803
|
float: left;
|
|
825
804
|
-webkit-user-select: none;
|
|
826
|
-
-khtml-user-select: none;
|
|
827
|
-
-moz-user-select: none;
|
|
828
|
-
-o-user-select: none;
|
|
829
805
|
user-select: none;
|
|
830
806
|
}
|
|
831
807
|
|
|
@@ -844,10 +820,6 @@ html.exercise-browser {
|
|
|
844
820
|
.sortable > ul > li:hover {
|
|
845
821
|
border-color: #ffa500;
|
|
846
822
|
box-shadow: 0 0 4px #c56f00;
|
|
847
|
-
-moz-box-shadow: 0 0 4px #c56f00;
|
|
848
|
-
-ms-box-shadow: 0 0 4px #c56f00;
|
|
849
|
-
-o-box-shadow: 0 0 4px #c56f00;
|
|
850
|
-
-webkit-box-shadow: 0 0 4px #c56f00;
|
|
851
823
|
}
|
|
852
824
|
|
|
853
825
|
.sortable > ul > li:active, .sortable > ul > li.dragging {
|
|
@@ -861,8 +833,6 @@ html.exercise-browser {
|
|
|
861
833
|
border: 0;
|
|
862
834
|
border-bottom: 0;
|
|
863
835
|
box-shadow: 0 0 0;
|
|
864
|
-
-moz-box-shadow: 0 0 0;
|
|
865
|
-
-webkit-box-shadow: 0 0 0;
|
|
866
836
|
padding-right: 0;
|
|
867
837
|
}
|
|
868
838
|
|
|
@@ -895,8 +865,6 @@ html.exercise-browser {
|
|
|
895
865
|
.qhint {
|
|
896
866
|
border: 1px solid #aaaaaa;
|
|
897
867
|
background: #f9f9f9;
|
|
898
|
-
-moz-border-radius: 4px;
|
|
899
|
-
-webkit-border-radius: 4px;
|
|
900
868
|
border-radius: 4px;
|
|
901
869
|
margin-right: 20px;
|
|
902
870
|
margin-bottom: 20px;
|
|
@@ -23,10 +23,7 @@
|
|
|
23
23
|
// often, allowing selection makes for an awkward mobile experience
|
|
24
24
|
// where you constantly highlight elements unintentionally.
|
|
25
25
|
.no-select {
|
|
26
|
-
|
|
27
|
-
-khtml-user-select: none;
|
|
28
|
-
-webkit-user-select: none;
|
|
29
|
-
-o-user-select: none;
|
|
26
|
+
-webkit-user-select: none;
|
|
30
27
|
user-select: none;
|
|
31
28
|
}
|
|
32
29
|
|
|
@@ -472,8 +469,6 @@
|
|
|
472
469
|
|
|
473
470
|
&.widget-highlight {
|
|
474
471
|
@highlight: 0px 0px 0px 2px rgba(255, 165, 0, 1);
|
|
475
|
-
-webkit-box-shadow: @highlight;
|
|
476
|
-
-moz-box-shadow: @highlight;
|
|
477
472
|
box-shadow: @highlight;
|
|
478
473
|
transition: all 0.15s;
|
|
479
474
|
}
|
|
@@ -594,10 +589,6 @@
|
|
|
594
589
|
|
|
595
590
|
.box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) {
|
|
596
591
|
box-shadow: @shadow;
|
|
597
|
-
-o-box-shadow: @shadow;
|
|
598
|
-
-ms-box-shadow: @shadow;
|
|
599
|
-
-moz-box-shadow: @shadow;
|
|
600
|
-
-webkit-box-shadow: @shadow;
|
|
601
592
|
}
|
|
602
593
|
|
|
603
594
|
.perseus-math-input.mq-editable-field.mq-math-mode {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
padding: 0 10px;
|
|
12
12
|
cursor: pointer;
|
|
13
13
|
position: relative;
|
|
14
|
+
-webkit-user-select: none;
|
|
14
15
|
user-select: none;
|
|
15
16
|
width: auto;
|
|
16
17
|
|
|
@@ -69,7 +70,6 @@
|
|
|
69
70
|
|
|
70
71
|
&.layout-vertical .bank, &.layout-vertical .draggable-box {
|
|
71
72
|
box-sizing: border-box;
|
|
72
|
-
-moz-box-sizing: border-box;
|
|
73
73
|
float: left;
|
|
74
74
|
max-width: 50%;
|
|
75
75
|
}
|
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
position: absolute;
|
|
4
4
|
}
|
|
5
5
|
span.rotate {
|
|
6
|
-
-moz-transform: rotate(-90deg);
|
|
7
|
-
-o-transform: rotate(-90deg);
|
|
8
|
-
-webkit-transform: rotate(-90deg);
|
|
9
6
|
transform: rotate(-90deg);
|
|
10
|
-
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
|
|
11
7
|
}
|
|
12
8
|
}
|
|
13
9
|
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
border-color: @color;
|
|
3
3
|
@darker: darken(@color, 11%);
|
|
4
4
|
box-shadow: 0 0 4px @darker;
|
|
5
|
-
-moz-box-shadow: 0 0 4px @darker;
|
|
6
|
-
-ms-box-shadow: 0 0 4px @darker;
|
|
7
|
-
-o-box-shadow: 0 0 4px @darker;
|
|
8
|
-
-webkit-box-shadow: 0 0 4px @darker;
|
|
9
5
|
}
|
|
10
6
|
|
|
11
7
|
.draggy-boxy-thing {
|
|
@@ -16,8 +12,6 @@
|
|
|
16
12
|
border-bottom: 1px solid #aaa;
|
|
17
13
|
|
|
18
14
|
box-shadow: 0 1px 2px #ccc;
|
|
19
|
-
-moz-box-shadow: 0 1px 2px #ccc;
|
|
20
|
-
-webkit-box-shadow: 0 1px 2px #ccc;
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
// TODO(jack): Make this work for the orderer too.
|
|
@@ -34,12 +28,6 @@
|
|
|
34
28
|
border: 1px solid #b9b9b9;
|
|
35
29
|
border-bottom-color: #939393;
|
|
36
30
|
border-radius: 4px;
|
|
37
|
-
-moz-border-radius: 4px;
|
|
38
|
-
-webkit-border-radius: 4px;
|
|
39
|
-
-webkit-user-select: none;
|
|
40
|
-
-khtml-user-select: none;
|
|
41
|
-
-moz-user-select: none;
|
|
42
|
-
-o-user-select: none;
|
|
43
31
|
cursor: pointer;
|
|
44
32
|
touch-action: none;
|
|
45
33
|
|
|
@@ -73,8 +61,6 @@
|
|
|
73
61
|
border: 1px solid #b9b9b9;
|
|
74
62
|
border-bottom-color: #939393;
|
|
75
63
|
border-radius: 4px;
|
|
76
|
-
-moz-border-radius: 4px;
|
|
77
|
-
-webkit-border-radius: 4px;
|
|
78
64
|
height: 100%;
|
|
79
65
|
width: 100%;
|
|
80
66
|
z-index: -1;
|
package/src/widget-container.jsx
CHANGED
|
@@ -68,6 +68,10 @@ class WidgetContainer extends React.Component<Props, State> {
|
|
|
68
68
|
"perseus-widget-container": true,
|
|
69
69
|
"widget-highlight": this.props.shouldHighlight,
|
|
70
70
|
"widget-nohighlight": !this.props.shouldHighlight,
|
|
71
|
+
// HACK(matthewc): perseus-widget-container is setting a font-size
|
|
72
|
+
// but we want the definition prompt to match the surrounding font
|
|
73
|
+
// I'm sorry, but there's a time crunch
|
|
74
|
+
"perseus-widget__definition": this.props.type === "definition",
|
|
71
75
|
});
|
|
72
76
|
|
|
73
77
|
const type = this.props.type;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
4
|
import {RendererWithDebugUI} from "../../../../../testing/renderer-with-debug-ui.jsx";
|
|
5
|
+
import ArticleRenderer from "../../article-renderer.jsx";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Perseus/Widgets/Definition",
|
|
@@ -71,12 +72,37 @@ const question2 = {
|
|
|
71
72
|
},
|
|
72
73
|
};
|
|
73
74
|
|
|
75
|
+
const article = {
|
|
76
|
+
content:
|
|
77
|
+
"###Backstory\n\nDuring World War II, in August of 1943, the [[☃ definition 1]] launched a massive bombing campaign on Milan and its outskirts. The explosions and the ensuing fires killed over 700 people and destroyed many of the city’s most important buildings and monuments, including a significant portion of Santa Maria delle Grazie. Miraculously, the wall with the painting survived, probably because it had been shored up with sandbags and mattresses, but the roof of the refectory was blown off and the other walls were decimated. The _Last Supper_ remained exposed to the elements, covered only with a tarp, for several months, until the refectory (the dining room of the monastery where the _Last Supper_ was painted), was rebuilt and a team of restorers began working to preserve and restore the painting.",
|
|
78
|
+
images: {},
|
|
79
|
+
widgets: {
|
|
80
|
+
"definition 1": {
|
|
81
|
+
alignment: "default",
|
|
82
|
+
graded: true,
|
|
83
|
+
options: {
|
|
84
|
+
definition:
|
|
85
|
+
"The Allies, led by the United Kingdom, the United States, and the Soviet Union, were the group of countries who opposed the Axis powers (Germany, Japan, and Italy) during World War II.",
|
|
86
|
+
static: false,
|
|
87
|
+
togglePrompt: "Allies",
|
|
88
|
+
},
|
|
89
|
+
static: false,
|
|
90
|
+
type: "definition",
|
|
91
|
+
version: {major: 0, minor: 0},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
74
96
|
type StoryArgs = {||};
|
|
75
97
|
|
|
76
98
|
export const Question1 = (args: StoryArgs): React.Node => {
|
|
77
99
|
return <RendererWithDebugUI question={question1} />;
|
|
78
100
|
};
|
|
79
101
|
|
|
80
|
-
export const
|
|
102
|
+
export const MultipleDefinitions = (args: StoryArgs): React.Node => {
|
|
81
103
|
return <RendererWithDebugUI question={question2} />;
|
|
82
104
|
};
|
|
105
|
+
|
|
106
|
+
export const ArticleDefintion = (args: StoryArgs): React.Node => {
|
|
107
|
+
return <ArticleRenderer json={article} useNewStyles />;
|
|
108
|
+
};
|
|
@@ -27,7 +27,7 @@ exports[`Definition widget should have a default snapshot: first render 1`] = `
|
|
|
27
27
|
>
|
|
28
28
|
The Governor and Council of the Massachusetts had much conference many days; and at last . . . . concluded a peace and friendship with
|
|
29
29
|
<div
|
|
30
|
-
class="perseus-widget-container widget-nohighlight widget-inline"
|
|
30
|
+
class="perseus-widget-container widget-nohighlight perseus-widget__definition widget-inline"
|
|
31
31
|
>
|
|
32
32
|
<button
|
|
33
33
|
aria-controls="uid-popover-0-wb-id"
|
|
@@ -79,7 +79,7 @@ exports[`Definition widget should have an open state snapshot: open state 1`] =
|
|
|
79
79
|
>
|
|
80
80
|
The Governor and Council of the Massachusetts had much conference many days; and at last . . . . concluded a peace and friendship with
|
|
81
81
|
<div
|
|
82
|
-
class="perseus-widget-container widget-nohighlight widget-inline"
|
|
82
|
+
class="perseus-widget-container widget-nohighlight perseus-widget__definition widget-inline"
|
|
83
83
|
>
|
|
84
84
|
<button
|
|
85
85
|
aria-controls="uid-popover-1-wb-id"
|
|
@@ -236,7 +236,7 @@ exports[`number-line widget should snapshot on mobile: first mobile render 1`] =
|
|
|
236
236
|
style="position: absolute; left: 0px; top: 0px;"
|
|
237
237
|
>
|
|
238
238
|
<div
|
|
239
|
-
style="position: absolute; width: 24px; height: 24px; left: 17.999999999999993px; top: 28px;
|
|
239
|
+
style="position: absolute; width: 24px; height: 24px; left: 17.999999999999993px; top: 28px; filter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.5)); transform: translateX(0px) translateY(0px) translateZ(0);"
|
|
240
240
|
>
|
|
241
241
|
<svg
|
|
242
242
|
height="24"
|
|
@@ -63,7 +63,7 @@ exports[`video widget should snapshot on mobile: first mobile render 1`] = `
|
|
|
63
63
|
class="default_xu2jcg-o_O-inlineStyles_sc01dy"
|
|
64
64
|
/>
|
|
65
65
|
<a
|
|
66
|
-
class="
|
|
66
|
+
class="shared_htyo3s-o_O-resting_nelfll visited-no-recolor"
|
|
67
67
|
href="/transcript/videoNotFound"
|
|
68
68
|
rel="noopener noreferrer"
|
|
69
69
|
target="_blank"
|
|
@@ -143,7 +143,7 @@ exports[`video widget should snapshot: first render 1`] = `
|
|
|
143
143
|
class="default_xu2jcg-o_O-inlineStyles_sc01dy"
|
|
144
144
|
/>
|
|
145
145
|
<a
|
|
146
|
-
class="
|
|
146
|
+
class="shared_htyo3s-o_O-resting_nelfll visited-no-recolor"
|
|
147
147
|
href="/transcript/videoNotFound"
|
|
148
148
|
rel="noopener noreferrer"
|
|
149
149
|
target="_blank"
|
|
@@ -448,8 +448,6 @@ class Simulator extends React.Component<$FlowFixMe, $FlowFixMe> {
|
|
|
448
448
|
|
|
449
449
|
const highlight = "0px 0px 0px 2px rgba(255, 165, 0, 1)";
|
|
450
450
|
const highlightStyle = _.extend({}, inputStyle, {
|
|
451
|
-
WebkitBoxShadow: highlight,
|
|
452
|
-
MozBoxShadow: highlight,
|
|
453
451
|
boxShadow: highlight,
|
|
454
452
|
transition: "all 0.15s",
|
|
455
453
|
});
|