@pie-element/rubric 8.1.2-next.5 → 8.1.3

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 (93) hide show
  1. package/CHANGELOG.json +257 -0
  2. package/CHANGELOG.md +1731 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +3 -0
  5. package/configure/CHANGELOG.json +197 -0
  6. package/configure/CHANGELOG.md +1571 -0
  7. package/configure/lib/defaults.js +70 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/index.js +135 -0
  10. package/configure/lib/index.js.map +1 -0
  11. package/configure/lib/main.js +103 -0
  12. package/configure/lib/main.js.map +1 -0
  13. package/configure/package.json +23 -0
  14. package/configure/src/__tests__/index.test.jsx +192 -0
  15. package/configure/src/defaults.js +43 -0
  16. package/configure/src/index.js +139 -0
  17. package/configure/src/main.jsx +87 -0
  18. package/controller/CHANGELOG.json +17 -0
  19. package/controller/CHANGELOG.md +901 -0
  20. package/controller/lib/defaults.js +15 -0
  21. package/controller/lib/defaults.js.map +1 -0
  22. package/controller/lib/index.js +46 -0
  23. package/controller/lib/index.js.map +1 -0
  24. package/controller/package.json +12 -0
  25. package/controller/src/__tests__/index.test.js +33 -0
  26. package/controller/src/defaults.js +8 -0
  27. package/controller/src/index.js +41 -0
  28. package/docs/config-schema.json +712 -0
  29. package/docs/config-schema.json.md +532 -0
  30. package/docs/demo/config.js +8 -0
  31. package/docs/demo/generate.js +8 -0
  32. package/docs/demo/index.html +2 -0
  33. package/docs/pie-schema.json +391 -0
  34. package/docs/pie-schema.json.md +281 -0
  35. package/lib/index.js +52 -0
  36. package/lib/index.js.map +1 -0
  37. package/lib/main.js +208 -0
  38. package/lib/main.js.map +1 -0
  39. package/lib/print.js +71 -0
  40. package/lib/print.js.map +1 -0
  41. package/module/configure.js +1 -0
  42. package/module/controller.js +73 -0
  43. package/module/demo.js +33 -0
  44. package/module/element.js +1 -0
  45. package/module/index.html +21 -0
  46. package/module/manifest.json +14 -0
  47. package/module/print-demo.js +71 -0
  48. package/module/print.html +18 -0
  49. package/module/print.js +1 -0
  50. package/package.json +25 -87
  51. package/src/__tests__/rubric-view.test.jsx +37 -0
  52. package/src/index.js +48 -0
  53. package/src/main.jsx +226 -0
  54. package/src/print.js +74 -0
  55. package/configure.js +0 -2
  56. package/controller.js +0 -1
  57. package/dist/author/defaults.d.ts +0 -71
  58. package/dist/author/defaults.js +0 -53
  59. package/dist/author/index.d.ts +0 -21
  60. package/dist/author/index.js +0 -72
  61. package/dist/author/main.d.ts +0 -14
  62. package/dist/author/main.js +0 -51
  63. package/dist/browser/author/index.js +0 -50284
  64. package/dist/browser/author/index.js.map +0 -1
  65. package/dist/browser/controller/index.js +0 -41
  66. package/dist/browser/controller/index.js.map +0 -1
  67. package/dist/browser/delivery/index.js +0 -34
  68. package/dist/browser/delivery/index.js.map +0 -1
  69. package/dist/browser/dist-B6elSZkE.js +0 -9091
  70. package/dist/browser/dist-B6elSZkE.js.map +0 -1
  71. package/dist/browser/dist-Bs_ywPM1.js +0 -102
  72. package/dist/browser/dist-Bs_ywPM1.js.map +0 -1
  73. package/dist/browser/main-C0Q1SfKi.js +0 -153
  74. package/dist/browser/main-C0Q1SfKi.js.map +0 -1
  75. package/dist/browser/print/index.js +0 -34
  76. package/dist/browser/print/index.js.map +0 -1
  77. package/dist/browser/rubric.css +0 -2
  78. package/dist/controller/defaults.d.ts +0 -17
  79. package/dist/controller/defaults.js +0 -21
  80. package/dist/controller/index.d.ts +0 -10
  81. package/dist/controller/index.js +0 -23
  82. package/dist/delivery/index.d.ts +0 -16
  83. package/dist/delivery/index.js +0 -33
  84. package/dist/delivery/main.d.ts +0 -34
  85. package/dist/delivery/main.js +0 -156
  86. package/dist/index.d.ts +0 -1
  87. package/dist/index.iife.d.ts +0 -8
  88. package/dist/index.iife.js +0 -145
  89. package/dist/index.js +0 -2
  90. package/dist/print/index.d.ts +0 -15
  91. package/dist/print/index.js +0 -34
  92. package/dist/runtime-support.d.ts +0 -12
  93. package/dist/runtime-support.js +0 -12
@@ -1,17 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/rubric/controller/src/defaults.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
- declare const _default: {
10
- points: string[];
11
- sampleAnswers: null[];
12
- maxPoints: number;
13
- maxPointsEnabled: boolean;
14
- excludeZero: boolean;
15
- excludeZeroEnabled: boolean;
16
- };
17
- export default _default;
@@ -1,21 +0,0 @@
1
- //#region src/controller/defaults.ts
2
- var e = {
3
- points: [
4
- "",
5
- "",
6
- "",
7
- ""
8
- ],
9
- sampleAnswers: [
10
- null,
11
- null,
12
- null,
13
- null
14
- ],
15
- maxPoints: 3,
16
- maxPointsEnabled: !0,
17
- excludeZero: !1,
18
- excludeZeroEnabled: !0
19
- };
20
- //#endregion
21
- export { e as default };
@@ -1,10 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/rubric/controller/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 function model(model: any, session: any, env: any): Promise<unknown>;
10
- export declare function validate(model: any): {};
@@ -1,23 +0,0 @@
1
- import e from "./defaults.js";
2
- //#region src/controller/index.ts
3
- var t = (t) => ({
4
- ...e,
5
- ...t
6
- });
7
- function n(e, n, r) {
8
- return new Promise((n) => {
9
- let i = t(e || {});
10
- n(r && r.role && r.role === "instructor" ? i : {});
11
- });
12
- }
13
- function r(e) {
14
- return (e || "").replace(/(<([^>]+)>)/gi, "");
15
- }
16
- function i(e) {
17
- let { points: t } = e, n = {}, i = {};
18
- return (t || []).forEach((e, n) => {
19
- !e || e === "<div></div>" ? i[n] = "Points descriptors cannot be empty." : t.slice(n + 1).some((t) => r(t) === r(e)) && (i[n] = "Points descriptors should be unique.");
20
- }), Object.keys(i).length > 0 && (n.pointsDescriptorsErrors = i), n;
21
- }
22
- //#endregion
23
- export { n as model, i as validate };
@@ -1,16 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/rubric/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 default class RubricRender extends HTMLElement {
10
- constructor();
11
- set model(s: any);
12
- onModelChanged(m: any): void;
13
- connectedCallback(): void;
14
- _render(): void;
15
- disconnectedCallback(): void;
16
- }
@@ -1,33 +0,0 @@
1
- import e from "./main.js";
2
- import t from "react";
3
- import { createRoot as n } from "react-dom/client";
4
- import r from "debug";
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(), r.log("constructor called"), this.onModelChanged = this.onModelChanged.bind(this), this._root = null;
10
- }
11
- set model(e) {
12
- this._model = e, this._render();
13
- }
14
- onModelChanged(e) {
15
- this._model = e, this._render();
16
- }
17
- connectedCallback() {
18
- this._render();
19
- }
20
- _render() {
21
- if (this._model) {
22
- let r = t.createElement(e, { value: this._model });
23
- this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
24
- i(this);
25
- });
26
- }
27
- }
28
- disconnectedCallback() {
29
- this._root && this._root.unmount();
30
- }
31
- };
32
- //#endregion
33
- export { a as default };
@@ -1,34 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/rubric/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 const RubricType: PropTypes.Requireable<PropTypes.InferProps<{
12
- excludeZero: PropTypes.Requireable<boolean>;
13
- points: PropTypes.Requireable<(string | null | undefined)[]>;
14
- sampleAnswers: PropTypes.Requireable<(string | null | undefined)[]>;
15
- animationsDisabled: PropTypes.Requireable<boolean>;
16
- }>>;
17
- declare class Rubric extends React.Component {
18
- dudUrl: string;
19
- constructor(props: any);
20
- static propTypes: {
21
- model: PropTypes.Validator<object>;
22
- animationsDisabled: PropTypes.Requireable<boolean>;
23
- value: PropTypes.Requireable<PropTypes.InferProps<{
24
- excludeZero: PropTypes.Requireable<boolean>;
25
- points: PropTypes.Requireable<(string | null | undefined)[]>;
26
- sampleAnswers: PropTypes.Requireable<(string | null | undefined)[]>;
27
- animationsDisabled: PropTypes.Requireable<boolean>;
28
- }>>;
29
- };
30
- toggleRubric(): void;
31
- shouldRenderPoint: any;
32
- render(): React.JSX.Element | null;
33
- }
34
- export default Rubric;
@@ -1,156 +0,0 @@
1
- import e from "react";
2
- import { styled as t } from "@mui/material/styles";
3
- import n from "@mui/material/ListItem";
4
- import r from "@mui/material/List";
5
- import i from "@mui/material/Collapse";
6
- import * as a from "@pie-lib/render-ui";
7
- import { UiLayout as o, color as s } from "@pie-lib/render-ui";
8
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import u from "prop-types";
10
- //#region src/delivery/main.tsx
11
- function d(e) {
12
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
13
- }
14
- function f(e, t) {
15
- return !e || d(e) ? e : d(e.default) ? e.default : t && d(e[t]) ? e[t] : t && d(e[t]?.default) ? e[t].default : e;
16
- }
17
- var p = f(o, "UiLayout") || f(g.UiLayout, "UiLayout"), m = a, h = m.default, g = h && typeof h == "object" ? h : m, _ = t(p)({
18
- color: s.text(),
19
- backgroundColor: s.background(),
20
- "&:not(.MathJax) table": { borderCollapse: "collapse" },
21
- "&:not(.MathJax) table td, &:not(.MathJax) table th": {
22
- padding: "8px 12px",
23
- textAlign: "left"
24
- },
25
- "& ul p, & ol p": {
26
- marginBottom: 0,
27
- marginTop: 0,
28
- lineHeight: "normal"
29
- }
30
- }), v = t(n)({
31
- display: "flex",
32
- flexDirection: "column",
33
- alignItems: "flex-start",
34
- padding: "12px 0px"
35
- }), y = t("div")({ color: s.text() }), b = t("h3")({
36
- color: s.text(),
37
- fontSize: "16px",
38
- fontWeight: "700",
39
- margin: 0,
40
- paddingBottom: "6px"
41
- }), x = t("h4")({
42
- color: s.text(),
43
- fontSize: "16px",
44
- fontWeight: "normal",
45
- margin: 0,
46
- paddingBottom: "6px"
47
- }), S = t("h2")(({ theme: e }) => ({
48
- display: "flex",
49
- alignItems: "center",
50
- cursor: "pointer",
51
- userSelect: "none",
52
- fontSize: e.typography.fontSize,
53
- fontWeight: "500",
54
- color: s.tertiary(),
55
- margin: 0
56
- })), C = t("span")({
57
- display: "inline-flex",
58
- transition: "transform 0.2s",
59
- marginLeft: 2,
60
- alignSelf: "center"
61
- }), w = t("h2")({
62
- position: "absolute",
63
- width: "1px",
64
- height: "1px",
65
- padding: 0,
66
- margin: "-1px",
67
- overflow: "hidden",
68
- clip: "rect(0,0,0,0)",
69
- border: 0,
70
- whiteSpace: "nowrap"
71
- }), T = u.shape({
72
- excludeZero: u.bool,
73
- points: u.arrayOf(u.string),
74
- sampleAnswers: u.arrayOf(u.string),
75
- animationsDisabled: u.bool
76
- }), E = class extends e.Component {
77
- dudUrl = "javascript:;";
78
- constructor(e) {
79
- super(e), this.state = {
80
- rubricOpen: !1,
81
- linkPrefix: "Show"
82
- }, this.toggleRubric = this.toggleRubric.bind(this);
83
- }
84
- static propTypes = {
85
- model: u.object.isRequired,
86
- animationsDisabled: u.bool,
87
- value: T
88
- };
89
- toggleRubric() {
90
- this.setState({ rubricOpen: !this.state.rubricOpen }), this.setState({ linkPrefix: this.state.rubricOpen ? "Show" : "Hide" });
91
- }
92
- shouldRenderPoint = (e, t) => t.excludeZero ? e !== 0 : !0;
93
- render() {
94
- let { model: t, value: n } = this.props, { animationsDisabled: a } = this.props;
95
- if (a ||= n.animationsDisabled, n && n.points) {
96
- let { extraCSSRules: o } = t || {}, { points: s, sampleAnswers: u } = n, d = /* @__PURE__ */ c(r, {
97
- component: "nav",
98
- children: s.slice(0).reverse().map((t, r) => {
99
- r = s.length - r - 1;
100
- let i = n.excludeZero ? r + 1 : r;
101
- return /* @__PURE__ */ l(e.Fragment, { children: [/* @__PURE__ */ l(v, { children: [/* @__PURE__ */ c(b, { children: i === 1 ? `${i} PT` : `${i} PTS` }), /* @__PURE__ */ c(y, { dangerouslySetInnerHTML: { __html: t } })] }, `P${r}`), u && u[r] && /* @__PURE__ */ l(v, { children: [/* @__PURE__ */ c(x, { children: "Sample Answer" }), /* @__PURE__ */ c(y, { dangerouslySetInnerHTML: { __html: u[r] } })] }, `S${r}`)] }, r);
102
- })
103
- });
104
- return /* @__PURE__ */ l(_, {
105
- extraCSSRules: o,
106
- children: [/* @__PURE__ */ c(w, { children: "Rubric" }), a ? d : /* @__PURE__ */ l(e.Fragment, { children: [/* @__PURE__ */ l(S, {
107
- id: "rubric-toggle",
108
- tabIndex: 0,
109
- role: "button",
110
- "aria-expanded": this.state.rubricOpen,
111
- onClick: this.toggleRubric,
112
- onKeyPress: (e) => {
113
- (e.key === "Enter" || e.key === " ") && this.toggleRubric();
114
- },
115
- children: [
116
- this.state.linkPrefix,
117
- " Rubric",
118
- /* @__PURE__ */ c(C, {
119
- "aria-hidden": "true",
120
- children: this.state.rubricOpen ? /* @__PURE__ */ c("svg", {
121
- width: "20",
122
- height: "20",
123
- viewBox: "0 0 24 24",
124
- fill: "none",
125
- stroke: "currentColor",
126
- strokeWidth: "2",
127
- strokeLinecap: "round",
128
- strokeLinejoin: "round",
129
- children: /* @__PURE__ */ c("polyline", { points: "18 15 12 9 6 15" })
130
- }) : /* @__PURE__ */ c("svg", {
131
- width: "20",
132
- height: "20",
133
- viewBox: "0 0 24 24",
134
- fill: "none",
135
- stroke: "currentColor",
136
- strokeWidth: "2",
137
- strokeLinecap: "round",
138
- strokeLinejoin: "round",
139
- children: /* @__PURE__ */ c("polyline", { points: "6 9 12 15 18 9" })
140
- })
141
- })
142
- ]
143
- }), /* @__PURE__ */ c(i, {
144
- in: this.state.rubricOpen,
145
- timeout: {
146
- enter: 225,
147
- exit: 195
148
- },
149
- children: d
150
- })] })]
151
- });
152
- } else return null;
153
- }
154
- };
155
- //#endregion
156
- export { E as default };
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default } from './delivery/index.js';
@@ -1,8 +0,0 @@
1
- /**
2
- * IIFE entry point for rubric 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;