@khanacademy/perseus 9.0.0 → 10.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 (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/info-tip.d.ts +2 -1
  3. package/dist/components/input-with-examples.d.ts +1 -1
  4. package/dist/components/sortable.d.ts +1 -1
  5. package/dist/es/index.css +3 -5
  6. package/dist/es/index.js +6 -16
  7. package/dist/es/index.js.map +1 -1
  8. package/dist/hint-renderer.d.ts +2 -1
  9. package/dist/hints-renderer.d.ts +2 -1
  10. package/dist/index.css +3 -5
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +6 -17
  13. package/dist/index.js.map +1 -1
  14. package/dist/item-renderer.d.ts +2 -1
  15. package/dist/multi-items/multi-renderer.d.ts +2 -1
  16. package/dist/renderer.d.ts +3 -8
  17. package/dist/types.d.ts +1 -6
  18. package/dist/widget-container.d.ts +2 -1
  19. package/dist/widgets/expression.d.ts +8 -8
  20. package/dist/widgets/grapher.d.ts +2 -1
  21. package/dist/widgets/passage-ref.d.ts +2 -1
  22. package/package.json +2 -2
  23. package/src/__tests__/renderer.test.tsx +0 -2
  24. package/src/__tests__/server-item-renderer.test.tsx +2 -4
  25. package/src/components/info-tip.tsx +3 -4
  26. package/src/components/input-with-examples.tsx +1 -1
  27. package/src/components/sortable.tsx +1 -1
  28. package/src/hint-renderer.tsx +2 -1
  29. package/src/hints-renderer.tsx +2 -9
  30. package/src/index.ts +0 -1
  31. package/src/item-renderer.tsx +2 -7
  32. package/src/multi-items/multi-renderer.tsx +2 -7
  33. package/src/renderer.tsx +3 -3
  34. package/src/server-item-renderer.tsx +0 -1
  35. package/src/types.ts +1 -8
  36. package/src/widget-container.tsx +2 -1
  37. package/src/widgets/__tests__/renderQuestion.tsx +3 -11
  38. package/src/widgets/expression.tsx +2 -7
  39. package/src/widgets/grapher.tsx +4 -12
  40. package/src/widgets/passage-ref.tsx +1 -1
  41. package/tsconfig-build.tsbuildinfo +1 -1
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import type { APIOptions, LinterContextProps } from "./types";
2
+ import type { APIOptions } from "./types";
3
+ import type { LinterContextProps } from "@khanacademy/perseus-linter";
3
4
  type Props = {
4
5
  apiOptions: APIOptions;
5
6
  className?: string;
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type Renderer from "./renderer";
3
3
  import type { APIOptionsWithDefaults } from "./types";
4
- type Props = JSX.LibraryManagedAttributes<Renderer, React.ComponentProps<typeof Renderer>> & {
4
+ import type { PropsFor } from "@khanacademy/wonder-blocks-core";
5
+ type Props = PropsFor<typeof Renderer> & {
5
6
  className?: string;
6
7
  hints: ReadonlyArray<any>;
7
8
  hintsVisible?: number;
package/dist/index.css CHANGED
@@ -3679,7 +3679,7 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
3679
3679
  outline: none !important;
3680
3680
  }
3681
3681
  .keypad-input .mq-editable-field .mq-root-block {
3682
- overflow-x: scroll;
3682
+ overflow-x: auto;
3683
3683
  }
3684
3684
  .keypad-input .mq-editable-field .mq-cursor:not(:only-child),
3685
3685
  .keypad-input .mq-editable-field .mq-root-block.mq-hasCursor > .mq-cursor:only-child {
@@ -3698,12 +3698,11 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
3698
3698
  margin-left: -1px !important;
3699
3699
  margin-right: -1px !important;
3700
3700
  opacity: 1 !important;
3701
- transition: opacity 500ms ease-out !important;
3701
+ transition: opacity 300ms ease !important;
3702
3702
  visibility: visible !important;
3703
3703
  }
3704
3704
  .keypad-input .mq-editable-field .mq-cursor.mq-blink {
3705
3705
  opacity: 0 !important;
3706
- transition: opacity 500ms ease-in !important;
3707
3706
  visibility: visible !important;
3708
3707
  }
3709
3708
  .keypad-input .mq-editable-field .mq-non-leaf .mq-cursor:only-child {
@@ -3712,12 +3711,11 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
3712
3711
  border-radius: 1px;
3713
3712
  opacity: 1 !important;
3714
3713
  padding: 0 4px 0 4px;
3715
- transition: border-color 500ms ease-out !important;
3714
+ transition: border-color 300ms ease !important;
3716
3715
  }
3717
3716
  .keypad-input .mq-editable-field .mq-non-leaf .mq-cursor:only-child.mq-blink {
3718
3717
  border-color: #1865f2 !important;
3719
3718
  opacity: 1 !important;
3720
- transition: border-color 500ms ease-in !important;
3721
3719
  }
3722
3720
  .keypad-input .mq-empty {
3723
3721
  background: transparent !important;
package/dist/index.d.ts CHANGED
@@ -86,7 +86,7 @@ export { default as WIDGET_PROP_DENYLIST } from "./mixins/widget-prop-denylist";
86
86
  export type { PerseusOptions } from "./init";
87
87
  export type { ILogger, LogErrorOptions, ErrorKind } from "./logging/log";
88
88
  export type { ServerItemRenderer as ServerItemRendererComponent } from "./server-item-renderer";
89
- export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, LinterContextProps, PerseusDependencies, PerseusScore, Version, VideoData, VideoKind, WidgetDict, WidgetExports, WidgetInfo, } from "./types";
89
+ export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, PerseusDependencies, PerseusScore, Version, VideoData, VideoKind, WidgetDict, WidgetExports, WidgetInfo, } from "./types";
90
90
  export type { ParsedValue } from "./util";
91
91
  export type { MathFormat, InputNumberWidget, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusRadioWidgetOptions, PerseusExpressionWidgetOptions, PerseusRenderer, } from "./perseus-types";
92
92
  export type { Coord } from "./interactive2/types";
package/dist/index.js CHANGED
@@ -19305,9 +19305,9 @@ class Renderer extends React__namespace.Component {
19305
19305
 
19306
19306
  // @ts-expect-error - TS2564 - Property 'widgetIds' has no initializer and is not definitely assigned in the constructor.
19307
19307
 
19308
- constructor(_props, context) {
19308
+ constructor(_props) {
19309
19309
  var _this;
19310
- super(_props, context);
19310
+ super(_props);
19311
19311
  _this = this;
19312
19312
  _defineProperty(this, "_currentFocus", void 0);
19313
19313
  _defineProperty(this, "_foundTextNodes", void 0);
@@ -44492,7 +44492,6 @@ class HintsRenderer extends React__namespace.Component {
44492
44492
  // false in hints.
44493
44493
  return {
44494
44494
  ...ApiOptions.defaults,
44495
- // @ts-expect-error - TS2339 - Property 'apiOptions' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
44496
44495
  ...this.props.apiOptions,
44497
44496
  readOnly: false
44498
44497
  };
@@ -44579,13 +44578,9 @@ class HintsRenderer extends React__namespace.Component {
44579
44578
  totalHints: this.props.hints.length,
44580
44579
  ref: "hintRenderer" + i,
44581
44580
  key: "hintRenderer" + i,
44582
- apiOptions: apiOptions
44583
- // @ts-expect-error - TS2339 - Property 'findExternalWidgets' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
44584
- ,
44581
+ apiOptions: apiOptions,
44585
44582
  findExternalWidgets: this.props.findExternalWidgets,
44586
- linterContext: PerseusLinter__namespace.pushContextStack(
44587
- // @ts-expect-error - TS2339 - Property 'linterContext' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
44588
- this.props.linterContext, "hints[" + i + "]")
44583
+ linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints[" + i + "]")
44589
44584
  });
44590
44585
  if (isFinalHelpPage) {
44591
44586
  hints.push(renderer);
@@ -44849,9 +44844,7 @@ class ItemRenderer extends React__namespace.Component {
44849
44844
  }, /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
44850
44845
  ref: node => this.hintsRenderer = node,
44851
44846
  hints: this.props.item.hints,
44852
- hintsVisible: this.state.hintsVisible
44853
- // @ts-expect-error - TS2769 - No overload matches this call.
44854
- ,
44847
+ hintsVisible: this.state.hintsVisible,
44855
44848
  apiOptions: apiOptions,
44856
44849
  linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints")
44857
44850
  })),
@@ -45390,9 +45383,7 @@ class ServerItemRenderer extends React__namespace.Component {
45390
45383
  }));
45391
45384
  const hintsRenderer = /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
45392
45385
  hints: this.props.item.hints,
45393
- hintsVisible: this.props.hintsVisible
45394
- // @ts-expect-error - TS2769 - No overload matches this call.
45395
- ,
45386
+ hintsVisible: this.props.hintsVisible,
45396
45387
  apiOptions: apiOptions,
45397
45388
  ref: elem => this.hintsRenderer = elem
45398
45389
  });
@@ -46566,7 +46557,6 @@ class MultiRenderer extends React__namespace.Component {
46566
46557
  // _annotateRendererArray() needs this
46567
46558
  ref: null,
46568
46559
  makeRenderer: () => /*#__PURE__*/React__namespace.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
46569
- // @ts-expect-error - TS2769 - No overload matches this call.
46570
46560
  findExternalWidgets: findExternalWidgets,
46571
46561
  hints: [hint]
46572
46562
  }))
@@ -46732,7 +46722,6 @@ class MultiRenderer extends React__namespace.Component {
46732
46722
  const hintRendererDatas = rendererDatas;
46733
46723
  renderers = [...renderers];
46734
46724
  renderers.firstN = n => /*#__PURE__*/React__namespace.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
46735
- // @ts-expect-error - TS2769 - No overload matches this call.
46736
46725
  findExternalWidgets: hintRendererDatas[0] ? hintRendererDatas[0].findExternalWidgets : undefined,
46737
46726
  hints: hintRendererDatas.map(d => d.hint),
46738
46727
  hintsVisible: n