Skip to content
Merged

master #3047

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,27 @@
"@jest/test-sequencer": "29.7.0",
"@types/d3-array": "3.0.3",
"@pie-lib/categorize": "2.0.2",
"@pie-lib/charting": "7.0.7",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/charting": "7.0.8",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/controller-utils": "2.0.2",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/drag": "4.0.4",
"@pie-lib/editable-html": "13.0.4",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/drag": "4.0.5",
"@pie-lib/editable-html": "13.0.5",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/feedback": "2.0.2",
"@pie-lib/graphing-solution-set": "4.0.7",
"@pie-lib/graphing-solution-set": "4.0.8",
"@pie-lib/graphing-utils": "3.0.2",
"@pie-lib/graphing": "4.0.8",
"@pie-lib/graphing": "4.0.9",
"@pie-lib/icons": "4.0.3",
"@pie-lib/mask-markup": "3.0.7",
"@pie-lib/mask-markup": "3.0.8",
"@pie-lib/math-evaluator": "4.0.2",
"@pie-lib/math-input": "8.1.1",
"@pie-lib/math-rendering-accessible": "5.0.2",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/math-toolbar": "3.0.4",
"@pie-lib/plot": "4.0.7",
"@pie-lib/plot": "4.0.8",
"@pie-lib/render-ui": "6.1.2",
"@pie-lib/rubric": "2.0.7",
"@pie-lib/rubric": "2.0.8",
"@pie-lib/scoring-config": "5.0.3",
"@pie-lib/style-utils": "2.0.2",
"@pie-lib/test-utils": "2.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/boilerplate-item-type/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/render-ui": "6.1.2",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
Expand Down
2 changes: 1 addition & 1 deletion packages/calculator/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@mui/material": "^7.3.4",
"@pie-framework/material-ui-calculator": "4.0.0",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/config-ui": "13.0.8",
"react": "18.3.1",
"react-dom": "18.3.1"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/categorize/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/categorize": "2.0.2",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/drag": "4.0.4",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/drag": "4.0.5",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"@pie-lib/translator": "4.0.2",
Expand Down
1 change: 1 addition & 0 deletions packages/categorize/configure/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export default class CategorizeConfigure extends HTMLElement {
disconnectedCallback() {
if (this._root) {
this._root.unmount();
this._root = null;
}
}
}
4 changes: 2 additions & 2 deletions packages/categorize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/categorize": "2.0.2",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/drag": "4.0.4",
"@pie-lib/drag": "4.0.5",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"@pie-lib/translator": "4.0.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/charting/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/charting": "7.0.7",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/charting": "7.0.8",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"debug": "^4.1.1",
Expand Down
13 changes: 8 additions & 5 deletions packages/charting/docs/demo/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ exports.model = (id, element) => ({
editable: false,
},
],
// domain: {
// label: 'Characters',
// },
domain: {
label:
'<div>Math in the bottom label: <span data-latex="" data-raw="3x^2">\\(3x^2\\)</span>\u200b</div>',
},
graph: {
width: 480,
height: 480,
Expand All @@ -53,11 +54,13 @@ exports.model = (id, element) => ({
promptEnabled: true,
rationale: 'Rationale goes here!',
range: {
label: 'Amount',
label:
'<div>Math in the left label: <span data-latex="" data-raw="\\frac{\\pi}{2}">\\(\\frac{\\pi}{2}\\)</span>\u200b</div>',
max: 3,
min: 0,
labelStep: 1,
},
// title: 'This is a chart!',
title:
'<div>Math in the title: <span data-latex="" data-raw="\\frac{x}{y}">\\(\\frac{x}{y}\\)</span>\u200b</div>',
rubricEnabled: false,
});
2 changes: 1 addition & 1 deletion packages/charting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/charting": "7.0.7",
"@pie-lib/charting": "7.0.8",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
Expand Down
44 changes: 41 additions & 3 deletions packages/charting/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,43 @@ export default class Graphing extends HTMLElement {
constructor() {
super();
this._root = null;
this._mathObserver = null;
this._mathRenderPending = false;
}

// The title and axis labels are injected synchronously via dangerouslySetInnerHTML,
// but createRoot().render() commits asynchronously, so a queueMicrotask(renderMath)
// would run before the LaTeX spans are in the DOM and leave raw LaTeX on first render.
// Observing the DOM and typesetting after each commit keeps math in sync regardless of timing.
_scheduleMathRender = () => {
if (this._mathRenderPending) return;
this._mathRenderPending = true;

requestAnimationFrame(() => {
if (this._mathObserver) {
this._mathObserver.disconnect();
}
renderMath(this);
this._mathRenderPending = false;
setTimeout(() => {
if (this._mathObserver) {
this._mathObserver.observe(this, { childList: true, subtree: true });
}
}, 50);
});
};

_initMathObserver() {
if (this._mathObserver) return;
this._mathObserver = new MutationObserver(this._scheduleMathRender);
this._mathObserver.observe(this, { childList: true, subtree: true });
}

_disconnectMathObserver() {
if (this._mathObserver) {
this._mathObserver.disconnect();
this._mathObserver = null;
}
}

set model(m) {
Expand All @@ -34,6 +71,7 @@ export default class Graphing extends HTMLElement {
}

connectedCallback() {
this._initMathObserver();
this._render();
}

Expand All @@ -52,6 +90,8 @@ export default class Graphing extends HTMLElement {
return;
}

this._initMathObserver();

const modelClone = {
...this._model,
data: this._model.data ? [...this._model.data] : this._model.data,
Expand All @@ -67,12 +107,10 @@ export default class Graphing extends HTMLElement {
this._root = createRoot(this);
}
this._root.render(el);
queueMicrotask(() => {
renderMath(this);
});
}

disconnectedCallback() {
this._disconnectMathObserver();
if (this._root) {
this._root.unmount();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/complex-rubric/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"@pie-element/multi-trait-rubric": "^8.1.0",
"@pie-element/rubric": "^8.1.0",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/render-ui": "6.1.2",
"@pie-lib/rubric": "2.0.7",
"@pie-lib/rubric": "2.0.8",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
Expand Down
1 change: 1 addition & 0 deletions packages/complex-rubric/configure/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export default class ComplexRubricConfigureElement extends HTMLElement {
this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);
if (this._root) {
this._root.unmount();
this._root = null;
}
}
}
2 changes: 1 addition & 1 deletion packages/complex-rubric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@pie-element/multi-trait-rubric": "^8.1.0",
"@pie-element/rubric": "^8.1.0",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/rubric": "2.0.7",
"@pie-lib/rubric": "2.0.8",
"classnames": "^2.2.6",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
Expand Down
6 changes: 3 additions & 3 deletions packages/drag-in-the-blank/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/drag": "4.0.4",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/drag": "4.0.5",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/math-rendering": "5.0.2",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
Expand Down
4 changes: 2 additions & 2 deletions packages/drag-in-the-blank/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/drag": "4.0.4",
"@pie-lib/mask-markup": "3.0.7",
"@pie-lib/drag": "4.0.5",
"@pie-lib/mask-markup": "3.0.8",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"lodash-es": "^4.17.23",
Expand Down
4 changes: 2 additions & 2 deletions packages/drawing-response/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/ebsr/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@mui/material": "^7.3.4",
"@pie-element/multiple-choice": "^13.2.0",
"@pie-framework/pie-configure-events": "^1.2.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/config-ui": "13.0.8",
"lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.3.1",
Expand Down
1 change: 1 addition & 0 deletions packages/ebsr/configure/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export default class EbsrConfigure extends HTMLElement {
this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);
if (this._root) {
this._root.unmount();
this._root = null;
}
}
}
4 changes: 2 additions & 2 deletions packages/explicit-constructed-response/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"classnames": "^2.2.6",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
Expand Down
2 changes: 1 addition & 1 deletion packages/explicit-constructed-response/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/mask-markup": "3.0.7",
"@pie-lib/mask-markup": "3.0.8",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"@pie-lib/translator": "4.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/extended-text-entry/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
"react": "18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/extended-text-entry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"classnames": "^2.2.6",
Expand Down
4 changes: 2 additions & 2 deletions packages/fraction-model/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"debug": "^4.1.1",
"lodash-es": "^4.17.23",
"prop-types": "^15.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/fraction-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/graphing-solution-set/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/graphing-solution-set": "4.0.7",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/graphing-solution-set": "4.0.8",
"@pie-lib/math-rendering": "5.0.2",
"classnames": "^2.2.6",
"debug": "^4.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/graphing-solution-set/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-player-events": "^0.1.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/correct-answer-toggle": "4.0.4",
"@pie-lib/graphing-solution-set": "4.0.7",
"@pie-lib/graphing-solution-set": "4.0.8",
"@pie-lib/math-rendering": "5.0.2",
"@pie-lib/render-ui": "6.1.2",
"classnames": "^2.2.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/graphing/configure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"@mui/icons-material": "^7.3.4",
"@mui/material": "^7.3.4",
"@pie-framework/pie-configure-events": "^1.3.0",
"@pie-lib/config-ui": "13.0.7",
"@pie-lib/editable-html-tip-tap": "2.1.5",
"@pie-lib/graphing": "4.0.8",
"@pie-lib/config-ui": "13.0.8",
"@pie-lib/editable-html-tip-tap": "2.1.6",
"@pie-lib/graphing": "4.0.9",
"@pie-lib/math-rendering": "5.0.2",
"classnames": "^2.2.6",
"debug": "^4.1.1",
Expand Down
Loading
Loading