@pie-element/matrix 4.4.0-beta.7 → 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.
Files changed (130) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/HeaderCommon.d.ts +20 -0
  5. package/dist/author/HeaderCommon.js +20 -0
  6. package/dist/author/Main.d.ts +27 -0
  7. package/dist/author/Main.js +134 -0
  8. package/dist/author/MatrixColumnsSizeHeaderInput.d.ts +21 -0
  9. package/dist/author/MatrixColumnsSizeHeaderInput.js +39 -0
  10. package/dist/author/MatrixLabelEditableButton.d.ts +27 -0
  11. package/dist/author/MatrixLabelEditableButton.js +191 -0
  12. package/dist/author/MatrixLabelTypeHeaderInput.d.ts +21 -0
  13. package/dist/author/MatrixLabelTypeHeaderInput.js +96 -0
  14. package/dist/author/MatrixRowsSizeHeaderInput.d.ts +21 -0
  15. package/dist/author/MatrixRowsSizeHeaderInput.js +39 -0
  16. package/dist/author/MatrixValues.d.ts +51 -0
  17. package/dist/author/MatrixValues.js +156 -0
  18. package/dist/author/NumberInput.d.ts +20 -0
  19. package/dist/author/NumberInput.js +61 -0
  20. package/dist/author/columnLabelsGenerator.d.ts +11 -0
  21. package/dist/author/columnLabelsGenerator.js +101 -0
  22. package/dist/author/defaults.d.ts +88 -0
  23. package/dist/author/defaults.js +56 -0
  24. package/dist/author/index.d.ts +32 -0
  25. package/dist/author/index.js +69 -0
  26. package/dist/author/isNumeric.d.ts +10 -0
  27. package/dist/author/isNumeric.js +4 -0
  28. package/dist/author/matrixEntities.d.ts +17 -0
  29. package/dist/author/matrixEntities.js +12 -0
  30. package/dist/browser/Radio-DLeU-nFF.js +10320 -0
  31. package/dist/browser/Radio-DLeU-nFF.js.map +1 -0
  32. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  33. package/dist/browser/author/index.js +35158 -0
  34. package/dist/browser/author/index.js.map +1 -0
  35. package/dist/browser/controller/index.js +60 -0
  36. package/dist/browser/controller/index.js.map +1 -0
  37. package/dist/browser/delivery/index.js +205 -0
  38. package/dist/browser/delivery/index.js.map +1 -0
  39. package/dist/browser/dist-Do2L8-B6.js +96 -0
  40. package/dist/browser/dist-Do2L8-B6.js.map +1 -0
  41. package/dist/browser/editor-runtime/Radio-BYWp5gmo.js +10320 -0
  42. package/dist/browser/editor-runtime/Radio-BYWp5gmo.js.map +1 -0
  43. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  44. package/dist/browser/editor-runtime/author/index.js +18749 -0
  45. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  46. package/dist/browser/editor-runtime/controller/index.js +60 -0
  47. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  48. package/dist/browser/editor-runtime/delivery/index.js +205 -0
  49. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  50. package/dist/browser/editor-runtime/dist-Do2L8-B6.js +96 -0
  51. package/dist/browser/editor-runtime/dist-Do2L8-B6.js.map +1 -0
  52. package/dist/browser/editor-runtime/rolldown-runtime-CHQKHQ89.js +32 -0
  53. package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
  54. package/dist/controller/defaults.d.ts +19 -0
  55. package/dist/controller/defaults.js +17 -0
  56. package/dist/controller/index.d.ts +19 -0
  57. package/dist/controller/index.js +46 -0
  58. package/dist/delivery/ChoiceInput.d.ts +25 -0
  59. package/dist/delivery/ChoiceInput.js +36 -0
  60. package/dist/delivery/Main.d.ts +23 -0
  61. package/dist/delivery/Main.js +37 -0
  62. package/dist/delivery/Matrix.d.ts +29 -0
  63. package/dist/delivery/Matrix.js +81 -0
  64. package/dist/delivery/index.d.ts +22 -0
  65. package/dist/delivery/index.js +45 -0
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.iife.d.ts +8 -0
  68. package/dist/index.iife.js +163 -0
  69. package/dist/index.js +2 -0
  70. package/dist/runtime-support.d.ts +12 -0
  71. package/dist/runtime-support.js +12 -0
  72. package/package.json +92 -19
  73. package/CHANGELOG.json +0 -1
  74. package/CHANGELOG.md +0 -1458
  75. package/LICENSE.md +0 -5
  76. package/README.md +0 -59
  77. package/configure/CHANGELOG.json +0 -1
  78. package/configure/CHANGELOG.md +0 -1384
  79. package/configure/lib/HeaderCommon.js +0 -28
  80. package/configure/lib/HeaderCommon.js.map +0 -1
  81. package/configure/lib/Main.js +0 -179
  82. package/configure/lib/Main.js.map +0 -1
  83. package/configure/lib/MatrixColumnsSizeHeaderInput.js +0 -56
  84. package/configure/lib/MatrixColumnsSizeHeaderInput.js.map +0 -1
  85. package/configure/lib/MatrixLabelEditableButton.js +0 -224
  86. package/configure/lib/MatrixLabelEditableButton.js.map +0 -1
  87. package/configure/lib/MatrixLabelTypeHeaderInput.js +0 -98
  88. package/configure/lib/MatrixLabelTypeHeaderInput.js.map +0 -1
  89. package/configure/lib/MatrixRowsSizeHeaderInput.js +0 -56
  90. package/configure/lib/MatrixRowsSizeHeaderInput.js.map +0 -1
  91. package/configure/lib/MatrixValues.js +0 -217
  92. package/configure/lib/MatrixValues.js.map +0 -1
  93. package/configure/lib/NumberInput.js +0 -77
  94. package/configure/lib/NumberInput.js.map +0 -1
  95. package/configure/lib/columnLabelsGenerator.js +0 -49
  96. package/configure/lib/columnLabelsGenerator.js.map +0 -1
  97. package/configure/lib/defaults.js +0 -86
  98. package/configure/lib/defaults.js.map +0 -1
  99. package/configure/lib/index.js +0 -102
  100. package/configure/lib/index.js.map +0 -1
  101. package/configure/lib/isNumeric.js +0 -11
  102. package/configure/lib/isNumeric.js.map +0 -1
  103. package/configure/lib/matrixEntities.js +0 -16
  104. package/configure/lib/matrixEntities.js.map +0 -1
  105. package/configure/package.json +0 -28
  106. package/controller/CHANGELOG.json +0 -1
  107. package/controller/CHANGELOG.md +0 -128
  108. package/controller/lib/defaults.js +0 -17
  109. package/controller/lib/defaults.js.map +0 -1
  110. package/controller/lib/index.js +0 -96
  111. package/controller/lib/index.js.map +0 -1
  112. package/controller/package.json +0 -17
  113. package/docs/config-schema.json +0 -1475
  114. package/docs/config-schema.json.md +0 -1093
  115. package/docs/demo/config.js +0 -8
  116. package/docs/demo/generate.js +0 -9
  117. package/docs/demo/index.html +0 -1
  118. package/docs/demo/session.js +0 -6
  119. package/docs/pie-schema.json +0 -1
  120. package/docs/pie-schema.json.md +0 -1
  121. package/lib/ChoiceInput.js +0 -59
  122. package/lib/ChoiceInput.js.map +0 -1
  123. package/lib/Main.js +0 -42
  124. package/lib/Main.js.map +0 -1
  125. package/lib/Matrix.js +0 -104
  126. package/lib/Matrix.js.map +0 -1
  127. package/lib/index.js +0 -81
  128. package/lib/index.js.map +0 -1
  129. package/lib/session-updater.js +0 -10
  130. 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 };
@@ -0,0 +1 @@
1
+ export { default } from './delivery/index.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * IIFE entry point for matrix element
3
+ * This file is only used for IIFE builds and includes auto-registration
4
+ *
5
+ * @sync-generated - Auto-generated during sync from pie-elements
6
+ */
7
+ import Element from './index.js';
8
+ export default Element;