@khanacademy/perseus-editor 13.0.0 → 13.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.
@@ -27,7 +27,7 @@ import OrdererEditor from "./widgets/orderer-editor";
27
27
  import PassageEditor from "./widgets/passage-editor";
28
28
  import PassageRefEditor from "./widgets/passage-ref-editor";
29
29
  import PassageRefTargetEditor from "./widgets/passage-ref-target-editor";
30
- import PhetSimEditor from "./widgets/phet-sim-editor";
30
+ import PhetSimulationEditor from "./widgets/phet-simulation-editor";
31
31
  import PlotterEditor from "./widgets/plotter-editor";
32
32
  import PythonProgramEditor from "./widgets/python-program-editor";
33
33
  import RadioEditor from "./widgets/radio/editor";
@@ -35,5 +35,5 @@ import SimpleMarkdownTesterEditor from "./widgets/simple-markdown-tester-editor"
35
35
  import SorterEditor from "./widgets/sorter-editor";
36
36
  import TableEditor from "./widgets/table-editor";
37
37
  import VideoEditor from "./widgets/video-editor";
38
- declare const _default: (typeof CategorizerEditor | typeof CSProgramEditor | typeof DefinitionEditor | typeof DeprecatedStandinEditor | typeof DropdownEditor | typeof ExampleGraphieWidgetEditor | typeof ExampleWidgetEditor | typeof ExplanationEditor | typeof ExpressionEditor | typeof GradedGroupEditor | typeof GradedGroupSetEditor | typeof GrapherEditor | typeof GroupEditor | typeof IframeEditor | typeof ImageEditor | typeof InputNumberEditor | typeof InteractionEditor | typeof InteractiveGraphEditor | typeof LabelImageEditor | typeof MatcherEditor | typeof MatrixEditor | typeof MeasurerEditor | typeof MoleculeEditor | typeof NumberLineEditor | typeof NumericInputEditor | typeof OrdererEditor | typeof PassageEditor | typeof PassageRefEditor | typeof PassageRefTargetEditor | typeof PhetSimEditor | typeof PlotterEditor | typeof PythonProgramEditor | typeof RadioEditor | typeof SimpleMarkdownTesterEditor | typeof SorterEditor | typeof TableEditor | typeof VideoEditor)[];
38
+ declare const _default: (typeof CategorizerEditor | typeof CSProgramEditor | typeof DefinitionEditor | typeof DeprecatedStandinEditor | typeof DropdownEditor | typeof ExampleGraphieWidgetEditor | typeof ExampleWidgetEditor | typeof ExplanationEditor | typeof ExpressionEditor | typeof GradedGroupEditor | typeof GradedGroupSetEditor | typeof GrapherEditor | typeof GroupEditor | typeof IframeEditor | typeof ImageEditor | typeof InputNumberEditor | typeof InteractionEditor | typeof InteractiveGraphEditor | typeof LabelImageEditor | typeof MatcherEditor | typeof MatrixEditor | typeof MeasurerEditor | typeof MoleculeEditor | typeof NumberLineEditor | typeof NumericInputEditor | typeof OrdererEditor | typeof PassageEditor | typeof PassageRefEditor | typeof PassageRefTargetEditor | typeof PhetSimulationEditor | typeof PlotterEditor | typeof PythonProgramEditor | typeof RadioEditor | typeof SimpleMarkdownTesterEditor | typeof SorterEditor | typeof TableEditor | typeof VideoEditor)[];
39
39
  export default _default;
@@ -21,7 +21,7 @@ declare class WidgetEditor extends React.Component<WidgetEditorProps, WidgetEdit
21
21
  _handleAlignmentChange: (e: React.SyntheticEvent<HTMLSelectElement>) => void;
22
22
  getSaveWarnings: () => any;
23
23
  serialize: () => {
24
- type: "definition" | "group" | "radio" | "table" | "categorizer" | "iframe" | "video" | "image" | "cs-program" | "dropdown" | "example-graphie-widget" | "example-widget" | "explanation" | "expression" | "graded-group-set" | "graded-group" | "grapher" | "input-number" | "interaction" | "interactive-graph" | "label-image" | "matcher" | "matrix" | "measurer" | "molecule-renderer" | "number-line" | "numeric-input" | "orderer" | "passage-ref" | "passage" | "phet-sim" | "plotter" | "python-program" | "passage-ref-target" | "simple-markdown-tester" | "sorter" | "deprecated-standin";
24
+ type: "definition" | "group" | "radio" | "table" | "categorizer" | "iframe" | "video" | "image" | "cs-program" | "dropdown" | "example-graphie-widget" | "example-widget" | "explanation" | "expression" | "graded-group-set" | "graded-group" | "grapher" | "input-number" | "interaction" | "interactive-graph" | "label-image" | "matcher" | "matrix" | "measurer" | "molecule-renderer" | "number-line" | "numeric-input" | "orderer" | "passage-ref" | "passage" | "phet-simulation" | "plotter" | "python-program" | "passage-ref-target" | "simple-markdown-tester" | "sorter" | "deprecated-standin";
25
25
  alignment: string | undefined;
26
26
  static: boolean | undefined;
27
27
  graded: boolean | undefined;
@@ -0,0 +1,22 @@
1
+ import { type APIOptions, type DeviceType, type PerseusRenderer } from "@khanacademy/perseus";
2
+ import * as React from "react";
3
+ import type { LinterContextProps } from "@khanacademy/perseus-linter";
4
+ /**
5
+ * The `ContentPreview` component provides a simple preview system for Perseus
6
+ * Content. Due to how Persus styles are built, the preview styling matches the
7
+ * current device based on the viewport width (using `@media` queries for
8
+ * `min-width` and `max-width`).
9
+ *
10
+ * The preview will render the mobile variant (styling and layout) when the
11
+ * `previewDevice` is phone or tablet. Note that the styling cannot be matched
12
+ * 100% due to the above `@media` query limitation.
13
+ */
14
+ declare function ContentPreview({ question, apiOptions, seamless, linterContext, legacyPerseusLint, previewDevice, }: {
15
+ question?: PerseusRenderer;
16
+ apiOptions?: APIOptions;
17
+ seamless?: boolean;
18
+ linterContext?: LinterContextProps;
19
+ legacyPerseusLint?: ReadonlyArray<string>;
20
+ previewDevice: DeviceType;
21
+ }): React.JSX.Element;
22
+ export default ContentPreview;
package/dist/es/index.js CHANGED
@@ -41,22 +41,17 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
41
41
 
42
42
  // This file is processed by a Rollup plugin (replace) to inject the production
43
43
  const libName = "@khanacademy/perseus-editor";
44
- const libVersion = "13.0.0";
44
+ const libVersion = "13.1.0";
45
45
  addLibraryVersionToPerseusDebug(libName, libVersion);
46
46
 
47
47
  function _extends() {
48
- _extends = Object.assign ? Object.assign.bind() : function (target) {
49
- for (var i = 1; i < arguments.length; i++) {
50
- var source = arguments[i];
51
- for (var key in source) {
52
- if (Object.prototype.hasOwnProperty.call(source, key)) {
53
- target[key] = source[key];
54
- }
55
- }
48
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
49
+ for (var e = 1; e < arguments.length; e++) {
50
+ var t = arguments[e];
51
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
56
52
  }
57
- return target;
58
- };
59
- return _extends.apply(this, arguments);
53
+ return n;
54
+ }, _extends.apply(null, arguments);
60
55
  }
61
56
 
62
57
  const SCREEN_SIZES = {
@@ -20561,17 +20556,14 @@ const DragTarget = createReactClass({
20561
20556
  }
20562
20557
  });
20563
20558
 
20564
- function _objectWithoutPropertiesLoose(source, excluded) {
20565
- if (source == null) return {};
20566
- var target = {};
20567
- var sourceKeys = Object.keys(source);
20568
- var key, i;
20569
- for (i = 0; i < sourceKeys.length; i++) {
20570
- key = sourceKeys[i];
20571
- if (excluded.indexOf(key) >= 0) continue;
20572
- target[key] = source[key];
20573
- }
20574
- return target;
20559
+ function _objectWithoutPropertiesLoose(r, e) {
20560
+ if (null == r) return {};
20561
+ var t = {};
20562
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
20563
+ if (e.includes(n)) continue;
20564
+ t[n] = r[n];
20565
+ }
20566
+ return t;
20575
20567
  }
20576
20568
 
20577
20569
  const mediaDefaultSpecLargeMarginWidth = spacing.large_24;
@@ -31585,12 +31577,6 @@ const LockedFiguresSection = props => {
31585
31577
  onToggle: () => setIsExpanded(!isExpanded),
31586
31578
  isCollapsible: true
31587
31579
  }), isExpanded && /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
31588
- if (figure.type === "label") {
31589
- // TODO(LEMS-1795): Add locked label settings.
31590
- // Remove this block once label locked figure
31591
- // settings are implemented.
31592
- return;
31593
- }
31594
31580
  return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
31595
31581
  key: `${uniqueId}-locked-${figure}-${index}`,
31596
31582
  showM2bFeatures: props.showM2bFeatures,
@@ -35920,7 +35906,7 @@ PassageRefTargetEditor.defaultProps = {
35920
35906
  };
35921
35907
 
35922
35908
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
35923
- class PhetSimEditor extends React.Component {
35909
+ class PhetSimulationEditor extends React.Component {
35924
35910
  render() {
35925
35911
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LabeledTextField, {
35926
35912
  label: "URL",
@@ -35943,11 +35929,11 @@ class PhetSimEditor extends React.Component {
35943
35929
  };
35944
35930
  }
35945
35931
  }
35946
- PhetSimEditor.defaultProps = {
35932
+ PhetSimulationEditor.defaultProps = {
35947
35933
  url: "",
35948
35934
  description: ""
35949
35935
  };
35950
- PhetSimEditor.widgetName = "phet-sim";
35936
+ PhetSimulationEditor.widgetName = "phet-simulation";
35951
35937
 
35952
35938
  const {
35953
35939
  InfoTip: InfoTip$3,
@@ -36895,7 +36881,7 @@ VideoEditor.defaultProps = {
36895
36881
  location: ""
36896
36882
  };
36897
36883
 
36898
- var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PhetSimEditor, PlotterEditor, PythonProgramEditor, SimpleMarkdownTesterEditor, SorterEditor, TableEditor, VideoEditor, RadioEditor, DeprecatedStandinEditor];
36884
+ var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PhetSimulationEditor, PlotterEditor, PythonProgramEditor, SimpleMarkdownTesterEditor, SorterEditor, TableEditor, VideoEditor, RadioEditor, DeprecatedStandinEditor];
36899
36885
 
36900
36886
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
36901
36887
  class TextInput extends React.Component {