@khanacademy/perseus 7.1.1 → 7.2.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/CHANGELOG.md +18 -0
- package/dist/es/index.css +61 -61
- package/dist/es/index.js +100 -168
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +61 -61
- package/dist/index.js +89 -126
- package/dist/index.js.map +1 -1
- package/dist/util.d.ts +7 -12
- package/dist/util.graphie.d.ts +6 -0
- package/dist/util.graphie.js.flow +14 -0
- package/dist/util.js.flow +7 -12
- package/dist/widgets/plotter.d.ts +47 -13
- package/dist/widgets/plotter.js.flow +47 -13
- package/package.json +2 -2
- package/src/__tests__/item-renderer.test.tsx +1 -1
- package/src/components/__stories__/image-loader.stories.tsx +1 -0
- package/src/components/graph.tsx +1 -0
- package/src/components/icon.tsx +1 -0
- package/src/components/image-loader.tsx +1 -0
- package/src/components/number-input.tsx +1 -0
- package/src/components/sortable.tsx +1 -0
- package/src/components/svg-image.tsx +1 -0
- package/src/components/tex-buttons.tsx +1 -0
- package/src/components/text-input.tsx +1 -0
- package/src/components/text-list-editor.tsx +1 -0
- package/src/components/zoomable.tsx +1 -0
- package/src/hints-renderer.tsx +1 -0
- package/src/index.ts +1 -0
- package/src/item-renderer.tsx +1 -0
- package/src/mixins/provide-keypad.tsx +1 -0
- package/src/multi-items/multi-renderer.tsx +1 -0
- package/src/renderer.tsx +1 -0
- package/src/server-item-renderer.tsx +1 -0
- package/src/styles/articles.less +8 -4
- package/src/styles/perseus-renderer.less +47 -38
- package/src/styles/util.less +1 -1
- package/src/styles/variables.boostrap.less +158 -182
- package/src/styles/variables.less +20 -20
- package/src/styles/variables.shared.less +162 -168
- package/src/styles/widgets/categorizer.less +1 -2
- package/src/styles/widgets/expression.less +7 -4
- package/src/styles/widgets/grapher.less +2 -1
- package/src/styles/widgets/image.less +3 -2
- package/src/styles/widgets/interactive-graph.less +4 -2
- package/src/styles/widgets/label-image.less +2 -1
- package/src/styles/widgets/matrix.less +11 -7
- package/src/styles/widgets/orderer.less +2 -1
- package/src/styles/widgets/passage.less +2 -1
- package/src/styles/widgets/plotter.less +4 -3
- package/src/styles/widgets/radio.less +4 -2
- package/src/styles/widgets/sortable.less +1 -1
- package/src/styles/widgets/table.less +2 -1
- package/src/styles/widgets/transformer.less +2 -1
- package/src/styles/widgets/unit.less +2 -1
- package/src/util.graphie.test.ts +45 -0
- package/src/util.graphie.ts +59 -0
- package/src/util.ts +8 -63
- package/src/widgets/__stories__/plotter.stories.tsx +27 -0
- package/src/widgets/__testdata__/plotter.testdata.ts +36 -0
- package/src/widgets/__tests__/__snapshots__/plotter.test.tsx.snap +863 -0
- package/src/widgets/__tests__/plotter.test.tsx +65 -0
- package/src/widgets/categorizer.tsx +1 -0
- package/src/widgets/graded-group-set.tsx +1 -0
- package/src/widgets/graded-group.tsx +1 -0
- package/src/widgets/interaction.tsx +1 -0
- package/src/widgets/label-image/marker.tsx +1 -0
- package/src/widgets/matcher.tsx +1 -0
- package/src/widgets/orderer.tsx +1 -0
- package/src/widgets/passage-ref-target.tsx +1 -0
- package/src/widgets/plotter.tsx +108 -98
- package/src/widgets/radio/base-radio.tsx +1 -0
- package/src/widgets/radio/choice-icon/choice-icon.tsx +1 -0
- package/src/widgets/sorter.tsx +1 -0
- package/src/widgets/transformer.tsx +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
|
@@ -23,7 +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
|
-
|
|
26
|
+
-webkit-user-select: none;
|
|
27
27
|
user-select: none;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
// counterintuitive, so we simply don't let you see anything you draw under
|
|
35
35
|
// a widget.
|
|
36
36
|
.blank-background {
|
|
37
|
-
background-color: #
|
|
37
|
+
background-color: #fdfdfd; // Keep in sync with KhanUtil._BACKGROUND
|
|
38
38
|
}
|
|
39
39
|
// There is no scratchpad in the answer_area, and it has a different color
|
|
40
40
|
// background, so just make it transparent
|
|
@@ -74,8 +74,7 @@
|
|
|
74
74
|
#answercontent input[type=number],
|
|
75
75
|
.framework-perseus input[type=text],
|
|
76
76
|
.framework-perseus input[type=number] {
|
|
77
|
-
&.perseus-input-size-normal
|
|
78
|
-
{
|
|
77
|
+
&.perseus-input-size-normal {
|
|
79
78
|
border: 1px solid #ccc;
|
|
80
79
|
width: 80px;
|
|
81
80
|
}
|
|
@@ -98,7 +97,8 @@
|
|
|
98
97
|
|
|
99
98
|
.framework-perseus {
|
|
100
99
|
#problemarea {
|
|
101
|
-
input,
|
|
100
|
+
input,
|
|
101
|
+
button {
|
|
102
102
|
.perseus-interactive;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -111,20 +111,20 @@
|
|
|
111
111
|
margin: 22px 0px;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
// HACK(yejia): Override the font size and line height for blurbs
|
|
115
|
+
//
|
|
116
|
+
// NOTE(yejia): Minion Pro is only loaded on GTP pages, because those
|
|
117
|
+
// are the main call sites for blurbs and the passage widget. We
|
|
118
|
+
// considered inserting the relevant stylesheet whenever the passage
|
|
119
|
+
// widget loads, but this approach produced a "flash of unstyled
|
|
120
|
+
// text", so we decided to embed the stylesheet into the relevant
|
|
121
|
+
// page templates instead.
|
|
122
|
+
//
|
|
123
|
+
// NOTE(yejia): Minion Pro will not be available on ZNDs, due to
|
|
124
|
+
// restrictions in our Adobe TypeKit configuration.
|
|
125
|
+
//
|
|
126
|
+
// TODO(TP-3315): Remove once Perseus uses Wonder Blocks BodySerif
|
|
127
|
+
.test-prep-blurb div.paragraph {
|
|
128
128
|
font-size: 16px;
|
|
129
129
|
line-height: 20px;
|
|
130
130
|
}
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
|
|
141
141
|
.perseus-renderer > .paragraph > ul:not(.perseus-widget-radio),
|
|
142
142
|
.perseus-renderer > .paragraph > ol {
|
|
143
|
-
margin: -11px 0px 22px 0px;
|
|
143
|
+
margin: -11px 0px 22px 0px; // first-level lists need padding
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
.paragraph ul:not(.perseus-widget-radio) {
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
.zoomable {
|
|
162
|
-
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
|
162
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
163
163
|
-webkit-touch-callout: none;
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -257,11 +257,14 @@
|
|
|
257
257
|
position: relative;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
.graph-settings,
|
|
260
|
+
.graph-settings,
|
|
261
|
+
.image-settings,
|
|
262
|
+
.misc-settings {
|
|
261
263
|
padding-bottom: 5px;
|
|
262
264
|
}
|
|
263
265
|
|
|
264
|
-
.misc-settings,
|
|
266
|
+
.misc-settings,
|
|
267
|
+
.type-settings {
|
|
265
268
|
border-top: 1px solid black;
|
|
266
269
|
padding-top: 5px;
|
|
267
270
|
}
|
|
@@ -270,7 +273,8 @@
|
|
|
270
273
|
display: inline-block;
|
|
271
274
|
}
|
|
272
275
|
|
|
273
|
-
.unresponsive-svg-image,
|
|
276
|
+
.unresponsive-svg-image,
|
|
277
|
+
.perseus-rendered-radio .unresponsive-svg-image {
|
|
274
278
|
display: inline-block;
|
|
275
279
|
position: relative;
|
|
276
280
|
|
|
@@ -305,15 +309,16 @@
|
|
|
305
309
|
table {
|
|
306
310
|
.legacy-typography;
|
|
307
311
|
|
|
308
|
-
th,
|
|
312
|
+
th,
|
|
313
|
+
td {
|
|
309
314
|
padding: 5px 10px;
|
|
310
315
|
text-align: left;
|
|
311
316
|
|
|
312
|
-
&[align=center] {
|
|
317
|
+
&[align="center"] {
|
|
313
318
|
text-align: center;
|
|
314
319
|
}
|
|
315
320
|
|
|
316
|
-
&[align=right] {
|
|
321
|
+
&[align="right"] {
|
|
317
322
|
text-align: right;
|
|
318
323
|
}
|
|
319
324
|
}
|
|
@@ -355,7 +360,8 @@
|
|
|
355
360
|
}
|
|
356
361
|
}
|
|
357
362
|
|
|
358
|
-
th,
|
|
363
|
+
th,
|
|
364
|
+
td {
|
|
359
365
|
border-width: 0;
|
|
360
366
|
}
|
|
361
367
|
}
|
|
@@ -387,11 +393,11 @@
|
|
|
387
393
|
padding: 16px;
|
|
388
394
|
text-align: left;
|
|
389
395
|
|
|
390
|
-
&[align=center] {
|
|
396
|
+
&[align="center"] {
|
|
391
397
|
text-align: center;
|
|
392
398
|
}
|
|
393
399
|
|
|
394
|
-
&[align=right] {
|
|
400
|
+
&[align="right"] {
|
|
395
401
|
text-align: right;
|
|
396
402
|
}
|
|
397
403
|
}
|
|
@@ -469,7 +475,7 @@
|
|
|
469
475
|
|
|
470
476
|
&.widget-highlight {
|
|
471
477
|
@highlight: 0px 0px 0px 2px rgba(255, 165, 0, 1);
|
|
472
|
-
box-shadow:
|
|
478
|
+
box-shadow: @highlight;
|
|
473
479
|
transition: all 0.15s;
|
|
474
480
|
}
|
|
475
481
|
|
|
@@ -482,7 +488,6 @@
|
|
|
482
488
|
}
|
|
483
489
|
}
|
|
484
490
|
|
|
485
|
-
|
|
486
491
|
// Hide new hints styling everywhere except Bibliotron. Note that the Bibliotron
|
|
487
492
|
// styles are used both in webapp and in the mobile native apps.
|
|
488
493
|
.bibliotron-exercise .perseus-hint-renderer {
|
|
@@ -562,7 +567,9 @@
|
|
|
562
567
|
}
|
|
563
568
|
|
|
564
569
|
@media (max-width: @pure-sm-max) {
|
|
565
|
-
.bibliotron-exercise
|
|
570
|
+
.bibliotron-exercise
|
|
571
|
+
.perseus-hint-renderer.last-rendered
|
|
572
|
+
.perseus-hint-label {
|
|
566
573
|
display: none;
|
|
567
574
|
}
|
|
568
575
|
}
|
|
@@ -587,8 +594,8 @@
|
|
|
587
594
|
}
|
|
588
595
|
}
|
|
589
596
|
|
|
590
|
-
.box-shadow(@shadow: 0 1px 3px rgba(0,0,0
|
|
591
|
-
|
|
597
|
+
.box-shadow(@shadow: 0 1px 3px rgba(0,0,0,0.25)) {
|
|
598
|
+
box-shadow: @shadow;
|
|
592
599
|
}
|
|
593
600
|
|
|
594
601
|
.perseus-math-input.mq-editable-field.mq-math-mode {
|
|
@@ -645,7 +652,9 @@
|
|
|
645
652
|
}
|
|
646
653
|
|
|
647
654
|
// override normal 5px border radius for the editor only
|
|
648
|
-
.perseus-widget-editor
|
|
655
|
+
.perseus-widget-editor
|
|
656
|
+
.perseus-math-input.mq-editable-field.mq-math-mode
|
|
657
|
+
> .mq-root-block {
|
|
649
658
|
border-radius: 0;
|
|
650
659
|
}
|
|
651
660
|
|
|
@@ -659,7 +668,7 @@
|
|
|
659
668
|
margin-top: 5px;
|
|
660
669
|
padding: 2px;
|
|
661
670
|
// each button is 35 + 4 px, plus 4 padding, plus 2 border
|
|
662
|
-
width: 39px*5 + 4px + 2px; // (201)
|
|
671
|
+
width: 39px * 5 + 4px + 2px; // (201)
|
|
663
672
|
|
|
664
673
|
&.absolute {
|
|
665
674
|
left: -2px;
|
|
@@ -667,7 +676,7 @@
|
|
|
667
676
|
top: -3px;
|
|
668
677
|
z-index: @zIndexCalculator;
|
|
669
678
|
}
|
|
670
|
-
}
|
|
679
|
+
}
|
|
671
680
|
|
|
672
681
|
// Math domain color
|
|
673
682
|
@borderColor: #1c758a;
|
package/src/styles/util.less
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// We use this as both a physical class and as a mixin.
|
|
7
7
|
.perseus-sr-only {
|
|
8
8
|
border: 0;
|
|
9
|
-
clip: rect(0,0,0,0);
|
|
9
|
+
clip: rect(0, 0, 0, 0);
|
|
10
10
|
|
|
11
11
|
// HACK(mdr): With a nonzero font size, our highlighting library's call to
|
|
12
12
|
// `Range.prototype.getClientRects` will yield rectangles for the
|