@pie-element/graphing 10.4.0-beta.7 → 11.0.0-next.20261002094057
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/author.js +2 -0
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/configure.d.ts +26 -0
- package/dist/author/configure.js +208 -0
- package/dist/author/correct-response.d.ts +54 -0
- package/dist/author/correct-response.js +304 -0
- package/dist/author/defaults.d.ts +294 -0
- package/dist/author/defaults.js +415 -0
- package/dist/author/graphing-config.d.ts +34 -0
- package/dist/author/graphing-config.js +244 -0
- package/dist/author/index.d.ts +60 -0
- package/dist/author/index.js +101 -0
- package/dist/author/utils.d.ts +43 -0
- package/dist/author/utils.js +260 -0
- package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/author/index.js +4485 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/container-LlFpafQ0.js +54122 -0
- package/dist/browser/container-LlFpafQ0.js.map +1 -0
- package/dist/browser/controller/index.js +353 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +700 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-BWfnGHRk.js +551 -0
- package/dist/browser/dist-BWfnGHRk.js.map +1 -0
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +4485 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/container-DdI5r8sq.js +37713 -0
- package/dist/browser/editor-runtime/container-DdI5r8sq.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +353 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +700 -0
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
- package/dist/browser/editor-runtime/dist-DFbF_Nd-.js +551 -0
- package/dist/browser/editor-runtime/dist-DFbF_Nd-.js.map +1 -0
- package/dist/controller/defaults.d.ts +59 -0
- package/dist/controller/defaults.js +61 -0
- package/dist/controller/index.d.ts +34 -0
- package/dist/controller/index.js +179 -0
- package/dist/controller/utils.d.ts +37 -0
- package/dist/controller/utils.js +111 -0
- package/dist/delivery/index.d.ts +24 -0
- package/dist/delivery/index.js +61 -0
- package/dist/delivery/main.d.ts +23 -0
- package/dist/delivery/main.js +107 -0
- package/dist/graphing.css +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +370 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +96 -21
- package/CHANGELOG.json +0 -652
- package/CHANGELOG.md +0 -2094
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -382
- package/configure/CHANGELOG.md +0 -1883
- package/configure/lib/configure.js +0 -328
- package/configure/lib/configure.js.map +0 -1
- package/configure/lib/correct-response.js +0 -484
- package/configure/lib/correct-response.js.map +0 -1
- package/configure/lib/defaults.js +0 -448
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/graphing-config.js +0 -388
- package/configure/lib/graphing-config.js.map +0 -1
- package/configure/lib/index.js +0 -177
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/utils.js +0 -122
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -30
- package/controller/CHANGELOG.json +0 -412
- package/controller/CHANGELOG.md +0 -1310
- package/controller/lib/defaults.js +0 -64
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -459
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -451
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -24
- package/docs/config-schema.json +0 -3164
- package/docs/config-schema.json.md +0 -2293
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -205
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -20
- package/docs/pie-schema.json +0 -3495
- package/docs/pie-schema.json.md +0 -1345
- package/lib/index.js +0 -109
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -161
- package/lib/main.js.map +0 -1
- package/lib/utils.js +0 -24
- package/lib/utils.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Main as e } from "./main.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { createRoot as n } from "react-dom/client";
|
|
4
|
+
import { SessionChangedEvent as r } from "@pie-element/shared-player-events";
|
|
5
|
+
import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
|
+
//#region src/delivery/index.ts
|
|
7
|
+
var a = class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
10
|
+
}
|
|
11
|
+
_scheduleMathRender = () => {
|
|
12
|
+
this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
|
|
13
|
+
this._mathObserver && this._mathObserver.disconnect(), i(this), this._mathRenderPending = !1, setTimeout(() => {
|
|
14
|
+
this._mathObserver && this._mathObserver.observe(this, {
|
|
15
|
+
childList: !0,
|
|
16
|
+
subtree: !0
|
|
17
|
+
});
|
|
18
|
+
}, 50);
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
_initMathObserver() {
|
|
22
|
+
this._mathObserver || (this._mathObserver = new MutationObserver(this._scheduleMathRender), this._mathObserver.observe(this, {
|
|
23
|
+
childList: !0,
|
|
24
|
+
subtree: !0
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
_disconnectMathObserver() {
|
|
28
|
+
this._mathObserver &&= (this._mathObserver.disconnect(), null);
|
|
29
|
+
}
|
|
30
|
+
set model(e) {
|
|
31
|
+
this._model = e, this._render();
|
|
32
|
+
}
|
|
33
|
+
set session(e) {
|
|
34
|
+
this._session = e, this._render();
|
|
35
|
+
}
|
|
36
|
+
get session() {
|
|
37
|
+
return this._session;
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
this._initMathObserver(), this._render();
|
|
41
|
+
}
|
|
42
|
+
isComplete = (e) => Array.isArray(e) && e.length > 0;
|
|
43
|
+
changeAnswers = (e) => {
|
|
44
|
+
this._session.answer = e, this.dispatchEvent(new r(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
|
|
45
|
+
};
|
|
46
|
+
_render() {
|
|
47
|
+
if (!this._model || !this._session) return;
|
|
48
|
+
this._initMathObserver();
|
|
49
|
+
let r = t.createElement(e, {
|
|
50
|
+
model: this._model,
|
|
51
|
+
session: this._session,
|
|
52
|
+
onAnswersChange: this.changeAnswers
|
|
53
|
+
});
|
|
54
|
+
this._root ||= n(this), this._root.render(r);
|
|
55
|
+
}
|
|
56
|
+
disconnectedCallback() {
|
|
57
|
+
this._disconnectMathObserver(), this._root &&= (this._root.unmount(), null);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { e as Component, a as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/graphing/src/main.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class Main extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
model: PropTypes.Validator<object>;
|
|
14
|
+
session: PropTypes.Validator<object>;
|
|
15
|
+
onAnswersChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
state: {
|
|
18
|
+
showingCorrect: boolean;
|
|
19
|
+
};
|
|
20
|
+
toggleCorrect: (showingCorrect: any) => void;
|
|
21
|
+
render(): React.JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
export default Main;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import { GraphContainer as r, KeyLegend as i } from "@pie-lib/graphing";
|
|
5
|
+
import * as a from "@pie-lib/render-ui";
|
|
6
|
+
import { Collapsible as o, PreviewPrompt as s, UiLayout as c, color as l, hasMedia as u, hasText as d } from "@pie-lib/render-ui";
|
|
7
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
|
+
import m from "@pie-lib/correct-answer-toggle";
|
|
9
|
+
//#region src/delivery/main.tsx
|
|
10
|
+
function h(e) {
|
|
11
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
12
|
+
}
|
|
13
|
+
function g(e, t) {
|
|
14
|
+
return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
|
|
15
|
+
}
|
|
16
|
+
var _ = g(c, "UiLayout") || g(S.UiLayout, "UiLayout"), v = g(s, "PreviewPrompt") || g(S.PreviewPrompt, "PreviewPrompt"), y = g(o, "Collapsible") || g(S.Collapsible, "Collapsible"), b = a, x = b.default, S = x && typeof x == "object" ? x : b, C = n(_)({
|
|
17
|
+
color: l.text(),
|
|
18
|
+
backgroundColor: l.background()
|
|
19
|
+
}), w = n(y)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), T = n(r)(({ theme: e }) => ({
|
|
20
|
+
marginTop: e.spacing(2),
|
|
21
|
+
marginBottom: e.spacing(2)
|
|
22
|
+
})), E = class extends e.Component {
|
|
23
|
+
static propTypes = {
|
|
24
|
+
model: t.object.isRequired,
|
|
25
|
+
session: t.object.isRequired,
|
|
26
|
+
onAnswersChange: t.func
|
|
27
|
+
};
|
|
28
|
+
state = { showingCorrect: !1 };
|
|
29
|
+
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
30
|
+
render() {
|
|
31
|
+
let { model: e, onAnswersChange: t, session: n } = this.props, { showingCorrect: r } = this.state, { answer: a } = n || {}, { answersCorrected: o, arrows: s, backgroundMarks: c, coordinatesOnHover: l, correctResponse: h, defaultTool: g, disabled: _, domain: b, extraCSSRules: x, labels: S, labelsEnabled: E, prompt: D, range: O, rationale: k, showKeyLegend: A, showToggle: j, title: M, titleEnabled: N, teacherInstructions: P, toolbarTools: F, language: I } = e || {}, L = e?.size || e?.graph || {}, R = o || a || [], z = F?.includes("label") || !1, B = e.rationale && (d(e.rationale) || u(e.rationale));
|
|
32
|
+
return /* @__PURE__ */ p(C, {
|
|
33
|
+
extraCSSRules: x,
|
|
34
|
+
children: [
|
|
35
|
+
e.teacherInstructions && (d(e.teacherInstructions) || u(e.teacherInstructions)) && /* @__PURE__ */ f(w, {
|
|
36
|
+
labels: {
|
|
37
|
+
hidden: "Show Teacher Instructions",
|
|
38
|
+
visible: "Hide Teacher Instructions"
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ f(v, { prompt: P })
|
|
41
|
+
}),
|
|
42
|
+
D && /* @__PURE__ */ f(v, {
|
|
43
|
+
className: "prompt",
|
|
44
|
+
prompt: D
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ f(m, {
|
|
47
|
+
show: j,
|
|
48
|
+
toggled: r,
|
|
49
|
+
onToggle: this.toggleCorrect,
|
|
50
|
+
language: I
|
|
51
|
+
}),
|
|
52
|
+
r && j ? /* @__PURE__ */ f(T, {
|
|
53
|
+
axesSettings: { includeArrows: s },
|
|
54
|
+
backgroundMarks: c.filter((e) => !e.building),
|
|
55
|
+
coordinatesOnHover: l,
|
|
56
|
+
disabled: !0,
|
|
57
|
+
disabledLabels: !0,
|
|
58
|
+
disabledTitle: !0,
|
|
59
|
+
domain: b,
|
|
60
|
+
labels: S,
|
|
61
|
+
marks: h.map((e) => ({
|
|
62
|
+
...e,
|
|
63
|
+
correctness: "correct"
|
|
64
|
+
})),
|
|
65
|
+
onChangeMarks: t,
|
|
66
|
+
range: O,
|
|
67
|
+
showLabels: E,
|
|
68
|
+
showTitle: N,
|
|
69
|
+
size: L,
|
|
70
|
+
title: M,
|
|
71
|
+
toolbarTools: F,
|
|
72
|
+
language: I
|
|
73
|
+
}) : /* @__PURE__ */ f(T, {
|
|
74
|
+
axesSettings: { includeArrows: s },
|
|
75
|
+
backgroundMarks: c.filter((e) => !e.building),
|
|
76
|
+
coordinatesOnHover: l,
|
|
77
|
+
defaultTool: g,
|
|
78
|
+
disabled: _,
|
|
79
|
+
disabledLabels: !0,
|
|
80
|
+
disabledTitle: !0,
|
|
81
|
+
domain: b,
|
|
82
|
+
labels: S,
|
|
83
|
+
marks: R,
|
|
84
|
+
onChangeMarks: t,
|
|
85
|
+
range: O,
|
|
86
|
+
showLabels: E,
|
|
87
|
+
showTitle: N,
|
|
88
|
+
size: L,
|
|
89
|
+
title: M,
|
|
90
|
+
toolbarTools: F,
|
|
91
|
+
language: I,
|
|
92
|
+
limitLabeling: !0
|
|
93
|
+
}),
|
|
94
|
+
A && !r && /* @__PURE__ */ f(i, { isLabelAvailable: z }),
|
|
95
|
+
B && /* @__PURE__ */ f(y, {
|
|
96
|
+
labels: {
|
|
97
|
+
hidden: "Show Rationale",
|
|
98
|
+
visible: "Hide Rationale"
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ f(v, { prompt: k })
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { E as Main, E as default };
|