@khanacademy/perseus 2.0.1 → 3.0.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 (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/es/index.css +2 -66
  3. package/dist/es/index.js +18698 -18817
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +2 -66
  6. package/dist/index.js +18750 -18869
  7. package/dist/index.js.map +1 -1
  8. package/package.json +34 -34
  9. package/src/components/graph.jsx +0 -2
  10. package/src/components/math-input.jsx +163 -152
  11. package/src/components/tex-buttons.jsx +7 -9
  12. package/src/components/tooltip.jsx +0 -3
  13. package/src/components/zoomable.jsx +0 -10
  14. package/src/hint-renderer.jsx +4 -7
  15. package/src/interactive2/movable-point.jsx +0 -4
  16. package/src/interactive2/wrapped-ellipse.js +0 -1
  17. package/src/perseus-api.jsx +0 -7
  18. package/src/styles/articles.less +0 -4
  19. package/src/styles/khan-exercise.css +1 -33
  20. package/src/styles/perseus-renderer.less +1 -10
  21. package/src/styles/widgets/expression.less +0 -2
  22. package/src/styles/widgets/orderer.less +1 -1
  23. package/src/styles/widgets/plotter.less +0 -4
  24. package/src/styles/widgets/sortable.less +0 -14
  25. package/src/types.js +0 -6
  26. package/src/widgets/__stories__/unit.stories.jsx +0 -16
  27. package/src/widgets/__tests__/__snapshots__/input-number_test.jsx.snap +0 -481
  28. package/src/widgets/__tests__/__snapshots__/number-line_test.jsx.snap +1 -1
  29. package/src/widgets/__tests__/__snapshots__/unit_test.jsx.snap +20 -0
  30. package/src/widgets/__tests__/__snapshots__/video_test.jsx.snap +2 -2
  31. package/src/widgets/__tests__/expression_test.jsx +0 -10
  32. package/src/widgets/__tests__/input-number_test.jsx +0 -8
  33. package/src/widgets/__tests__/numeric-input_test.jsx +0 -11
  34. package/src/widgets/__tests__/unit_test.jsx +146 -121
  35. package/src/widgets/expression.jsx +2 -25
  36. package/src/widgets/input-number.jsx +2 -12
  37. package/src/widgets/matrix.jsx +4 -20
  38. package/src/widgets/number-line.jsx +0 -3
  39. package/src/widgets/numeric-input.jsx +1 -8
  40. package/src/widgets/radio/choice.jsx +2 -11
  41. package/src/widgets/simulator.jsx +2 -8
  42. package/src/widgets/table.jsx +0 -8
  43. package/src/widgets/transformer.jsx +0 -4
  44. package/src/widgets/unit.jsx +36 -51
  45. package/src/widgets/__tests__/__snapshots__/expression_test.jsx.snap +0 -38
@@ -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
- -webkit-box-shadow: none;
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
- -moz-user-select: -moz-none;
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 {
@@ -113,8 +113,6 @@
113
113
  }
114
114
 
115
115
  .perseus-widget-expression-old > .output > .placeholder > .error {
116
- -webkit-border-radius: 10px;
117
- -moz-border-radius: 10px;
118
116
  border-radius: 10px;
119
117
  background: #f7f7f7;
120
118
  border: 1px solid #ddd;
@@ -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/types.js CHANGED
@@ -157,7 +157,6 @@ export type APIOptions = $ReadOnly<{|
157
157
  keypadElement?: HTMLElement,
158
158
  focusedElement?: HTMLElement,
159
159
  ) => mixed,
160
- staticRender?: boolean,
161
160
  GroupMetadataEditor?: React.ComponentType<StubTagEditorType>,
162
161
  showAlignmentOptions?: boolean,
163
162
  readOnly?: boolean,
@@ -206,10 +205,6 @@ export type APIOptions = $ReadOnly<{|
206
205
  // component. In this situation we use the MathInput component
207
206
  // from the math-input repo instead of the existing perseus math
208
207
  // input components.
209
- // TODO(charlie): Make this mutually exclusive with `staticRender`.
210
- // Internally, we defer to `customKeypad` over `staticRender`, but
211
- // they should really be represented as an enum or some other data
212
- // structure that forbids them both being enabled at once.
213
208
  customKeypad?: boolean,
214
209
 
215
210
  // If this is provided, it is called instead of appending an instance
@@ -389,7 +384,6 @@ export type APIOptionsWithDefaults = $ReadOnly<{|
389
384
  APIOptions["setDrawingAreaAvailable"],
390
385
  >,
391
386
  showAlignmentOptions: $NonMaybeType<APIOptions["showAlignmentOptions"]>,
392
- staticRender: $NonMaybeType<APIOptions["staticRender"]>,
393
387
  useDraftEditor: $NonMaybeType<APIOptions["useDraftEditor"]>,
394
388
  |}>;
395
389
 
@@ -14,27 +14,11 @@ export default ({
14
14
  title: "Perseus/Widgets/Unit",
15
15
  }: Story);
16
16
 
17
- export const StaticRender = (args: StoryArgs): React.Node => {
18
- return (
19
- <OldUnitInput
20
- apiOptions={{
21
- ...ApiOptions.defaults,
22
- staticRender: true,
23
- }}
24
- value="2 tbsp"
25
- onFocus={() => {}}
26
- onBlur={() => {}}
27
- onChange={({value}) => {}}
28
- />
29
- );
30
- };
31
-
32
17
  export const NonStaticRender = (args: StoryArgs): React.Node => {
33
18
  return (
34
19
  <OldUnitInput
35
20
  apiOptions={{
36
21
  ...ApiOptions.defaults,
37
- staticRender: false,
38
22
  }}
39
23
  value="2 tbsp"
40
24
  onFocus={() => {}}