@pie-element/matrix 4.4.0-beta.6 → 5.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/HeaderCommon.d.ts +20 -0
- package/dist/author/HeaderCommon.js +20 -0
- package/dist/author/Main.d.ts +27 -0
- package/dist/author/Main.js +134 -0
- package/dist/author/MatrixColumnsSizeHeaderInput.d.ts +21 -0
- package/dist/author/MatrixColumnsSizeHeaderInput.js +39 -0
- package/dist/author/MatrixLabelEditableButton.d.ts +27 -0
- package/dist/author/MatrixLabelEditableButton.js +191 -0
- package/dist/author/MatrixLabelTypeHeaderInput.d.ts +21 -0
- package/dist/author/MatrixLabelTypeHeaderInput.js +96 -0
- package/dist/author/MatrixRowsSizeHeaderInput.d.ts +21 -0
- package/dist/author/MatrixRowsSizeHeaderInput.js +39 -0
- package/dist/author/MatrixValues.d.ts +51 -0
- package/dist/author/MatrixValues.js +156 -0
- package/dist/author/NumberInput.d.ts +20 -0
- package/dist/author/NumberInput.js +61 -0
- package/dist/author/columnLabelsGenerator.d.ts +11 -0
- package/dist/author/columnLabelsGenerator.js +101 -0
- package/dist/author/defaults.d.ts +88 -0
- package/dist/author/defaults.js +56 -0
- package/dist/author/index.d.ts +32 -0
- package/dist/author/index.js +69 -0
- package/dist/author/isNumeric.d.ts +10 -0
- package/dist/author/isNumeric.js +4 -0
- package/dist/author/matrixEntities.d.ts +17 -0
- package/dist/author/matrixEntities.js +12 -0
- package/dist/browser/Radio-DLeU-nFF.js +10320 -0
- package/dist/browser/Radio-DLeU-nFF.js.map +1 -0
- package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/author/index.js +35158 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +60 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +205 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-Do2L8-B6.js +96 -0
- package/dist/browser/dist-Do2L8-B6.js.map +1 -0
- package/dist/browser/editor-runtime/Radio-BYWp5gmo.js +10320 -0
- package/dist/browser/editor-runtime/Radio-BYWp5gmo.js.map +1 -0
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +18749 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +60 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +205 -0
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
- package/dist/browser/editor-runtime/dist-Do2L8-B6.js +96 -0
- package/dist/browser/editor-runtime/dist-Do2L8-B6.js.map +1 -0
- package/dist/browser/editor-runtime/rolldown-runtime-CHQKHQ89.js +32 -0
- package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
- package/dist/controller/defaults.d.ts +19 -0
- package/dist/controller/defaults.js +17 -0
- package/dist/controller/index.d.ts +19 -0
- package/dist/controller/index.js +46 -0
- package/dist/delivery/ChoiceInput.d.ts +25 -0
- package/dist/delivery/ChoiceInput.js +36 -0
- package/dist/delivery/Main.d.ts +23 -0
- package/dist/delivery/Main.js +37 -0
- package/dist/delivery/Matrix.d.ts +29 -0
- package/dist/delivery/Matrix.js +81 -0
- package/dist/delivery/index.d.ts +22 -0
- package/dist/delivery/index.js +45 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +163 -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 +92 -19
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -1454
- package/LICENSE.md +0 -5
- package/README.md +0 -59
- package/configure/CHANGELOG.json +0 -1
- package/configure/CHANGELOG.md +0 -1380
- package/configure/lib/HeaderCommon.js +0 -28
- package/configure/lib/HeaderCommon.js.map +0 -1
- package/configure/lib/Main.js +0 -179
- package/configure/lib/Main.js.map +0 -1
- package/configure/lib/MatrixColumnsSizeHeaderInput.js +0 -56
- package/configure/lib/MatrixColumnsSizeHeaderInput.js.map +0 -1
- package/configure/lib/MatrixLabelEditableButton.js +0 -224
- package/configure/lib/MatrixLabelEditableButton.js.map +0 -1
- package/configure/lib/MatrixLabelTypeHeaderInput.js +0 -98
- package/configure/lib/MatrixLabelTypeHeaderInput.js.map +0 -1
- package/configure/lib/MatrixRowsSizeHeaderInput.js +0 -56
- package/configure/lib/MatrixRowsSizeHeaderInput.js.map +0 -1
- package/configure/lib/MatrixValues.js +0 -217
- package/configure/lib/MatrixValues.js.map +0 -1
- package/configure/lib/NumberInput.js +0 -77
- package/configure/lib/NumberInput.js.map +0 -1
- package/configure/lib/columnLabelsGenerator.js +0 -49
- package/configure/lib/columnLabelsGenerator.js.map +0 -1
- package/configure/lib/defaults.js +0 -86
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -102
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/isNumeric.js +0 -11
- package/configure/lib/isNumeric.js.map +0 -1
- package/configure/lib/matrixEntities.js +0 -16
- package/configure/lib/matrixEntities.js.map +0 -1
- package/configure/package.json +0 -28
- package/controller/CHANGELOG.json +0 -1
- package/controller/CHANGELOG.md +0 -124
- package/controller/lib/defaults.js +0 -17
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -96
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -17
- package/docs/config-schema.json +0 -1475
- package/docs/config-schema.json.md +0 -1093
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -9
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -6
- package/docs/pie-schema.json +0 -1
- package/docs/pie-schema.json.md +0 -1
- package/lib/ChoiceInput.js +0 -59
- package/lib/ChoiceInput.js.map +0 -1
- package/lib/Main.js +0 -42
- package/lib/Main.js.map +0 -1
- package/lib/Matrix.js +0 -104
- package/lib/Matrix.js.map +0 -1
- package/lib/index.js +0 -81
- package/lib/index.js.map +0 -1
- package/lib/session-updater.js +0 -10
- package/lib/session-updater.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { color as t } from "@pie-lib/render-ui";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { styled as r } from "@mui/material/styles";
|
|
6
|
+
import i from "@mui/material/Radio";
|
|
7
|
+
//#region src/delivery/ChoiceInput.tsx
|
|
8
|
+
var a = r(i)({
|
|
9
|
+
"&.MuiRadio-root": { color: `var(--choice-input-color, ${t.text()})` },
|
|
10
|
+
"&.MuiRadio-root.Mui-checked": { color: `var(--choice-input-selected-color, ${t.primary()})` },
|
|
11
|
+
"&.MuiRadio-root.Mui-disabled": { color: `var(--choice-input-disabled-color, ${t.defaults.DISABLED})` }
|
|
12
|
+
}), o = (e) => {
|
|
13
|
+
let { disabled: t, checked: r, matrixKey: i, matrixValue: o, onChange: s } = e;
|
|
14
|
+
return /* @__PURE__ */ n(a, {
|
|
15
|
+
checked: r,
|
|
16
|
+
onChange: () => {
|
|
17
|
+
t || s({
|
|
18
|
+
matrixValue: o,
|
|
19
|
+
matrixKey: i
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
disabled: t
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
o.propTypes = {
|
|
26
|
+
checked: e.bool.isRequired,
|
|
27
|
+
disabled: e.bool.isRequired,
|
|
28
|
+
matrixValue: e.number.isRequired,
|
|
29
|
+
matrixKey: e.string.isRequired,
|
|
30
|
+
onChange: e.func.isRequired
|
|
31
|
+
}, o.defaultProps = {
|
|
32
|
+
checked: !1,
|
|
33
|
+
disabled: !1
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { o as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/matrix/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
|
+
declare class Main extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
model: PropTypes.Requireable<object>;
|
|
14
|
+
session: PropTypes.Requireable<object>;
|
|
15
|
+
onSessionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
static defaultProps: {
|
|
18
|
+
model: {};
|
|
19
|
+
session: {};
|
|
20
|
+
};
|
|
21
|
+
render(): React.JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
export default Main;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import e from "./Matrix.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import * as r from "@pie-lib/render-ui";
|
|
5
|
+
import { PreviewLayout as i } from "@pie-lib/render-ui";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/delivery/Main.tsx
|
|
8
|
+
function o(e) {
|
|
9
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
10
|
+
}
|
|
11
|
+
function s(e, t) {
|
|
12
|
+
return !e || o(e) ? e : o(e.default) ? e.default : t && o(e[t]) ? e[t] : t && o(e[t]?.default) ? e[t].default : e;
|
|
13
|
+
}
|
|
14
|
+
var c = s(i, "PreviewLayout") || s(d.PreviewLayout, "PreviewLayout"), l = r, u = l.default, d = u && typeof u == "object" ? u : l, f = class extends t.Component {
|
|
15
|
+
static propTypes = {
|
|
16
|
+
model: n.object,
|
|
17
|
+
session: n.object,
|
|
18
|
+
onSessionChange: n.func
|
|
19
|
+
};
|
|
20
|
+
static defaultProps = {
|
|
21
|
+
model: {},
|
|
22
|
+
session: {}
|
|
23
|
+
};
|
|
24
|
+
render() {
|
|
25
|
+
let { model: t, onSessionChange: n, session: r } = this.props, { extraCSSRules: i } = t;
|
|
26
|
+
return /* @__PURE__ */ a(c, {
|
|
27
|
+
extraCSSRules: i,
|
|
28
|
+
children: /* @__PURE__ */ a(e, {
|
|
29
|
+
...t,
|
|
30
|
+
session: r,
|
|
31
|
+
onSessionChange: n
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { f as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/matrix/src/Matrix.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
|
+
declare const Matrix: {
|
|
12
|
+
(props: any): React.JSX.Element;
|
|
13
|
+
propTypes: {
|
|
14
|
+
prompt: PropTypes.Requireable<string>;
|
|
15
|
+
teacherInstructions: PropTypes.Requireable<string>;
|
|
16
|
+
session: PropTypes.Requireable<object>;
|
|
17
|
+
matrixValues: PropTypes.Requireable<object>;
|
|
18
|
+
rowLabels: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
19
|
+
columnLabels: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
20
|
+
disabled: PropTypes.Validator<boolean>;
|
|
21
|
+
onSessionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
+
};
|
|
23
|
+
defaultProps: {
|
|
24
|
+
session: {
|
|
25
|
+
value: {};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default Matrix;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import e from "./ChoiceInput.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import t from "prop-types";
|
|
4
|
+
import * as n from "@pie-lib/render-ui";
|
|
5
|
+
import { Collapsible as r, PreviewPrompt as i, color as a } from "@pie-lib/render-ui";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import c from "styled-components";
|
|
8
|
+
//#region src/delivery/Matrix.tsx
|
|
9
|
+
function l(e) {
|
|
10
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
11
|
+
}
|
|
12
|
+
function u(e, t) {
|
|
13
|
+
return !e || l(e) ? e : l(e.default) ? e.default : t && l(e[t]) ? e[t] : t && l(e[t]?.default) ? e[t].default : e;
|
|
14
|
+
}
|
|
15
|
+
var d = u(i, "PreviewPrompt") || u(h.PreviewPrompt, "PreviewPrompt"), f = u(r, "Collapsible") || u(h.Collapsible, "Collapsible"), p = n, m = p.default, h = m && typeof m == "object" ? m : p, g = c.div`
|
|
16
|
+
color: ${a.text()};
|
|
17
|
+
background-color: ${a.background()};
|
|
18
|
+
font-family: Roboto, Arial, Helvetica, sans-serif;
|
|
19
|
+
`, _ = c.div`
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-template-columns: ${(e) => e.gridTemplateColumns};
|
|
22
|
+
grid-column-gap: 30px;
|
|
23
|
+
grid-row-gap: 20px;
|
|
24
|
+
margin-top: 20px;
|
|
25
|
+
`, v = c(f)`
|
|
26
|
+
margin-bottom: 16px;
|
|
27
|
+
`, y = c.div`
|
|
28
|
+
align-self: center;
|
|
29
|
+
justify-self: center;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
`, b = (t) => {
|
|
32
|
+
let { disabled: n, prompt: r, onSessionChange: i, columnLabels: a, matrixValues: c, rowLabels: l, session: u, teacherInstructions: f } = t, p = [];
|
|
33
|
+
for (let t = 0; t < l.length + 1; t++) for (let r = 0; r < a.length + 1; r++) {
|
|
34
|
+
let s;
|
|
35
|
+
if (t === 0 && r === 0) s = null;
|
|
36
|
+
else if (t === 0) s = a[r - 1];
|
|
37
|
+
else if (r === 0) s = l[t - 1];
|
|
38
|
+
else {
|
|
39
|
+
let a = `${t - 1}-${r - 1}`, l = c[a];
|
|
40
|
+
s = /* @__PURE__ */ o(e, {
|
|
41
|
+
matrixKey: a,
|
|
42
|
+
matrixValue: l || 0,
|
|
43
|
+
disabled: n,
|
|
44
|
+
onChange: i,
|
|
45
|
+
checked: u.value && Object.prototype.hasOwnProperty.call(u.value, a)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
p.push(s);
|
|
49
|
+
}
|
|
50
|
+
let m = [...a, {}].map(() => "min-content").join(" ");
|
|
51
|
+
return /* @__PURE__ */ s(g, { children: [
|
|
52
|
+
f && /* @__PURE__ */ o(v, {
|
|
53
|
+
className: f,
|
|
54
|
+
labels: {
|
|
55
|
+
hidden: "Show Teacher Instructions",
|
|
56
|
+
visible: "Hide Teacher Instructions"
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ o(d, { prompt: f })
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ o(d, {
|
|
61
|
+
className: "prompt",
|
|
62
|
+
prompt: r
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ o(_, {
|
|
65
|
+
gridTemplateColumns: m,
|
|
66
|
+
children: p.map((e, t) => /* @__PURE__ */ o(y, { children: e }, `${t}`))
|
|
67
|
+
})
|
|
68
|
+
] });
|
|
69
|
+
};
|
|
70
|
+
b.propTypes = {
|
|
71
|
+
prompt: t.string,
|
|
72
|
+
teacherInstructions: t.string,
|
|
73
|
+
session: t.object,
|
|
74
|
+
matrixValues: t.object,
|
|
75
|
+
rowLabels: t.arrayOf(t.string),
|
|
76
|
+
columnLabels: t.arrayOf(t.string),
|
|
77
|
+
disabled: t.bool.isRequired,
|
|
78
|
+
onSessionChange: t.func.isRequired
|
|
79
|
+
}, b.defaultProps = { session: { value: {} } };
|
|
80
|
+
//#endregion
|
|
81
|
+
export { b as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/matrix/src/index.js
|
|
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
|
+
export declare const isComplete: (session: any) => boolean;
|
|
10
|
+
export default class Matrix extends HTMLElement {
|
|
11
|
+
constructor();
|
|
12
|
+
set model(m: any);
|
|
13
|
+
set session(s: any);
|
|
14
|
+
get session(): any;
|
|
15
|
+
sessionChanged({ matrixKey, matrixValue }: {
|
|
16
|
+
matrixKey: any;
|
|
17
|
+
matrixValue: any;
|
|
18
|
+
}): void;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
_render(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import 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 = (e) => !e || !e.value ? !1 : !!Object.keys(e.value).length, o = class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this._root = null;
|
|
10
|
+
}
|
|
11
|
+
set model(e) {
|
|
12
|
+
this._model = e, this._render();
|
|
13
|
+
}
|
|
14
|
+
set session(e) {
|
|
15
|
+
this._session = e, this._render();
|
|
16
|
+
}
|
|
17
|
+
get session() {
|
|
18
|
+
return this._session;
|
|
19
|
+
}
|
|
20
|
+
sessionChanged({ matrixKey: e, matrixValue: t }) {
|
|
21
|
+
let n = e.split("-")[0], i = Object.keys(this._session.value || {}).reduce((e, t) => (t.startsWith(n) || (e[t] = this._session.value[t]), e), {});
|
|
22
|
+
i[e] = t, this._session.value = i;
|
|
23
|
+
let o = a(this._session, this._model);
|
|
24
|
+
this.dispatchEvent(new r(this.tagName.toLowerCase(), o)), this._render();
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
this._render();
|
|
28
|
+
}
|
|
29
|
+
_render() {
|
|
30
|
+
if (!this._model || !this._session) return;
|
|
31
|
+
let r = t.createElement(e, {
|
|
32
|
+
model: this._model,
|
|
33
|
+
session: this._session,
|
|
34
|
+
onSessionChange: this.sessionChanged.bind(this)
|
|
35
|
+
});
|
|
36
|
+
this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
|
|
37
|
+
i(this);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
this._root &&= (this._root.unmount(), null);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { o as default, a as isComplete };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './delivery/index.js';
|