@pie-element/likert 4.1.2-next.1 → 4.1.2

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 (87) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +1462 -0
  3. package/LICENSE.md +5 -0
  4. package/configure/CHANGELOG.json +1 -0
  5. package/configure/CHANGELOG.md +1379 -0
  6. package/configure/lib/choiceGenerator.js +219 -0
  7. package/configure/lib/choiceGenerator.js.map +1 -0
  8. package/configure/lib/defaults.js +100 -0
  9. package/configure/lib/defaults.js.map +1 -0
  10. package/configure/lib/index.js +106 -0
  11. package/configure/lib/index.js.map +1 -0
  12. package/configure/lib/likertEntities.js +24 -0
  13. package/configure/lib/likertEntities.js.map +1 -0
  14. package/configure/lib/main.js +388 -0
  15. package/configure/lib/main.js.map +1 -0
  16. package/configure/package.json +27 -0
  17. package/controller/CHANGELOG.json +1 -0
  18. package/controller/CHANGELOG.md +90 -0
  19. package/controller/lib/defaults.js +17 -0
  20. package/controller/lib/defaults.js.map +1 -0
  21. package/controller/lib/index.js +81 -0
  22. package/controller/lib/index.js.map +1 -0
  23. package/controller/package.json +17 -0
  24. package/docs/config-schema.json +2011 -0
  25. package/docs/config-schema.json.md +1487 -0
  26. package/docs/demo/config.js +8 -0
  27. package/docs/demo/generate.js +22 -0
  28. package/docs/demo/index.html +1 -0
  29. package/docs/demo/session.js +6 -0
  30. package/docs/pie-schema.json +966 -0
  31. package/docs/pie-schema.json.md +711 -0
  32. package/lib/choice-input.js +90 -0
  33. package/lib/choice-input.js.map +1 -0
  34. package/lib/index.js +64 -0
  35. package/lib/index.js.map +1 -0
  36. package/lib/likert.js +97 -0
  37. package/lib/likert.js.map +1 -0
  38. package/lib/likertEntities.js +11 -0
  39. package/lib/likertEntities.js.map +1 -0
  40. package/lib/main.js +42 -0
  41. package/lib/main.js.map +1 -0
  42. package/lib/session-updater.js +15 -0
  43. package/lib/session-updater.js.map +1 -0
  44. package/package.json +21 -84
  45. package/readme.md +55 -0
  46. package/configure.js +0 -2
  47. package/controller.js +0 -1
  48. package/dist/author/choiceGenerator.d.ts +0 -13
  49. package/dist/author/choiceGenerator.js +0 -255
  50. package/dist/author/defaults.d.ts +0 -102
  51. package/dist/author/defaults.js +0 -60
  52. package/dist/author/index.d.ts +0 -31
  53. package/dist/author/index.js +0 -73
  54. package/dist/author/likertEntities.d.ts +0 -25
  55. package/dist/author/likertEntities.js +0 -18
  56. package/dist/author/main.d.ts +0 -27
  57. package/dist/author/main.js +0 -298
  58. package/dist/browser/Radio-CAjl01LA.js +0 -9447
  59. package/dist/browser/Radio-CAjl01LA.js.map +0 -1
  60. package/dist/browser/author/index.js +0 -39374
  61. package/dist/browser/author/index.js.map +0 -1
  62. package/dist/browser/controller/index.js +0 -51
  63. package/dist/browser/controller/index.js.map +0 -1
  64. package/dist/browser/delivery/index.js +0 -219
  65. package/dist/browser/delivery/index.js.map +0 -1
  66. package/dist/browser/likert.css +0 -2
  67. package/dist/controller/defaults.d.ts +0 -19
  68. package/dist/controller/defaults.js +0 -13
  69. package/dist/controller/index.d.ts +0 -19
  70. package/dist/controller/index.js +0 -41
  71. package/dist/delivery/choice-input.d.ts +0 -27
  72. package/dist/delivery/choice-input.js +0 -59
  73. package/dist/delivery/index.d.ts +0 -19
  74. package/dist/delivery/index.js +0 -44
  75. package/dist/delivery/likert.d.ts +0 -26
  76. package/dist/delivery/likert.js +0 -70
  77. package/dist/delivery/likertEntities.d.ts +0 -12
  78. package/dist/delivery/likertEntities.js +0 -7
  79. package/dist/delivery/main.d.ts +0 -23
  80. package/dist/delivery/main.js +0 -37
  81. package/dist/delivery/session-updater.d.ts +0 -9
  82. package/dist/index.d.ts +0 -1
  83. package/dist/index.iife.d.ts +0 -8
  84. package/dist/index.iife.js +0 -145
  85. package/dist/index.js +0 -2
  86. package/dist/runtime-support.d.ts +0 -12
  87. package/dist/runtime-support.js +0 -12
@@ -1,19 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/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
- choices: never[];
11
- likertOrientation: string;
12
- likertScale: string;
13
- likertType: string;
14
- prompt: string;
15
- promptEnabled: boolean;
16
- teacherInstructions: string;
17
- teacherInstructionsEnabled: boolean;
18
- };
19
- export default _default;
@@ -1,13 +0,0 @@
1
- //#region src/controller/defaults.ts
2
- var e = {
3
- choices: [],
4
- likertOrientation: "horizontal",
5
- likertScale: "likert3",
6
- likertType: "agreement",
7
- prompt: "",
8
- promptEnabled: !0,
9
- teacherInstructions: "",
10
- teacherInstructionsEnabled: !0
11
- };
12
- //#endregion
13
- export { e as default };
@@ -1,19 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/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 createDefaultModel(model?: {}): Promise<unknown>;
10
- export declare const normalize: (question: any) => any;
11
- /**
12
- *
13
- * @param {*} question
14
- * @param {*} session
15
- * @param {*} env
16
- */
17
- export declare function model(question: any, session: any, env: any): Promise<any>;
18
- export declare function outcome(): Promise<unknown>;
19
- export declare const validate: (model?: {}, config?: {}) => {};
@@ -1,41 +0,0 @@
1
- import e from "./defaults.js";
2
- //#region src/controller/index.ts
3
- var t = (e) => ({
4
- label: e.label,
5
- value: e.value
6
- });
7
- function n(t = {}) {
8
- return new Promise((n) => n({
9
- ...e,
10
- ...t
11
- }));
12
- }
13
- var r = (t) => ({
14
- ...e,
15
- ...t
16
- });
17
- async function i(e, n, i) {
18
- let a = r(e), o = a.choices.map(t), s = {
19
- ...a,
20
- choices: o,
21
- disabled: i.mode !== "gather",
22
- mode: i.mode
23
- }, { role: c, mode: l } = i || {};
24
- return c === "instructor" && (l === "view" || l === "evaluate") ? s.teacherInstructions = a.teacherInstructionsEnabled ? a.teacherInstructions : null : s.teacherInstructions = null, s;
25
- }
26
- function a() {
27
- return new Promise((e) => {
28
- e({
29
- score: 0,
30
- empty: !1
31
- });
32
- });
33
- }
34
- var o = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), s = (e = {}, t = {}) => {
35
- let n = {};
36
- return ["teacherInstructions", "prompt"].forEach((r) => {
37
- t[r]?.required && !o(e[r]) && (n[r] = "This field is required.");
38
- }), n;
39
- };
40
- //#endregion
41
- export { n as createDefaultModel, i as model, r as normalize, a as outcome, s as validate };
@@ -1,27 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/src/choice-input.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 RadioStyled: any;
12
- export declare class ChoiceInput extends React.Component {
13
- static propTypes: {
14
- checked: PropTypes.Validator<boolean>;
15
- disabled: PropTypes.Validator<boolean>;
16
- label: PropTypes.Validator<string>;
17
- likertOrientation: PropTypes.Validator<string>;
18
- onChange: PropTypes.Validator<(...args: any[]) => any>;
19
- value: PropTypes.Validator<number>;
20
- };
21
- static defaultProps: {
22
- checked: boolean;
23
- };
24
- onToggleChoice: any;
25
- render(): React.JSX.Element;
26
- }
27
- export default ChoiceInput;
@@ -1,59 +0,0 @@
1
- import { LIKERT_ORIENTATION as e } from "./likertEntities.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import { color as r } from "@pie-lib/render-ui";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import o from "@mui/material/FormControlLabel";
7
- import { styled as s } from "@mui/material/styles";
8
- import c from "@mui/material/Radio";
9
- //#region src/delivery/choice-input.tsx
10
- var l = s(c)({
11
- color: `var(--choice-input-color, ${r.text()})`,
12
- "&.Mui-checked": { color: `var(--choice-input-selected-color, ${r.primary()})` },
13
- "&.Mui-disabled": { color: `var(--choice-input-disabled-color, ${r.defaults.DISABLED})` }
14
- }), u = s("p")({
15
- color: r.text(),
16
- textAlign: "center",
17
- cursor: "pointer"
18
- }), d = s("div")({
19
- display: "flex",
20
- alignItems: "center",
21
- flex: 1,
22
- padding: "0 5px",
23
- "& label": {}
24
- }), f = s(o)({ margin: 0 }), p = class extends t.Component {
25
- static propTypes = {
26
- checked: n.bool.isRequired,
27
- disabled: n.bool.isRequired,
28
- label: n.string.isRequired,
29
- likertOrientation: n.string.isRequired,
30
- onChange: n.func.isRequired,
31
- value: n.number.isRequired
32
- };
33
- static defaultProps = { checked: !1 };
34
- onToggleChoice = () => {
35
- this.props.onChange({
36
- value: this.props.value,
37
- selected: !this.props.checked
38
- });
39
- };
40
- render() {
41
- let { disabled: t, label: n, checked: r, likertOrientation: o } = this.props;
42
- return /* @__PURE__ */ a(d, {
43
- style: { flexDirection: o === e.vertical ? "row" : "column" },
44
- children: [/* @__PURE__ */ i(f, {
45
- disabled: t,
46
- control: /* @__PURE__ */ i(l, {
47
- checked: r,
48
- onChange: this.onToggleChoice,
49
- disabled: t
50
- })
51
- }), /* @__PURE__ */ i(u, {
52
- onClick: this.onToggleChoice,
53
- dangerouslySetInnerHTML: { __html: n }
54
- })]
55
- });
56
- }
57
- };
58
- //#endregion
59
- export { p as default };
@@ -1,19 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/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 Likert extends HTMLElement {
11
- constructor();
12
- set model(m: any);
13
- set session(s: any);
14
- get session(): any;
15
- sessionChanged(s: any): void;
16
- connectedCallback(): void;
17
- _render(): void;
18
- disconnectedCallback(): void;
19
- }
@@ -1,44 +0,0 @@
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 && 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(e) {
21
- this._session.value = e.value;
22
- let t = a(this._session, this._model);
23
- this.dispatchEvent(new r(this.tagName.toLowerCase(), t)), this._render();
24
- }
25
- connectedCallback() {
26
- this._render();
27
- }
28
- _render() {
29
- if (!this._model || !this._session) return;
30
- let r = t.createElement(e, {
31
- model: this._model,
32
- session: this._session,
33
- onSessionChange: this.sessionChanged.bind(this)
34
- });
35
- this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
36
- i(this);
37
- });
38
- }
39
- disconnectedCallback() {
40
- this._root && this._root.unmount();
41
- }
42
- };
43
- //#endregion
44
- export { o as default, a as isComplete };
@@ -1,26 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/src/likert.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 Likert extends React.Component {
12
- static propTypes: {
13
- className: PropTypes.Requireable<string>;
14
- choices: PropTypes.Requireable<any[]>;
15
- prompt: PropTypes.Requireable<string>;
16
- teacherInstructions: PropTypes.Requireable<string>;
17
- session: PropTypes.Requireable<object>;
18
- disabled: PropTypes.Validator<boolean>;
19
- onSessionChange: PropTypes.Validator<(...args: any[]) => any>;
20
- likertOrientation: PropTypes.Validator<string>;
21
- };
22
- UNSAFE_componentWillReceiveProps(): void;
23
- isSelected(value: any): any;
24
- render(): React.JSX.Element;
25
- }
26
- export default Likert;
@@ -1,70 +0,0 @@
1
- import { LIKERT_ORIENTATION as e } from "./likertEntities.js";
2
- import t from "./choice-input.js";
3
- import n from "react";
4
- import r from "prop-types";
5
- import * as i from "@pie-lib/render-ui";
6
- import { Collapsible as a, PreviewPrompt as o, color as s } from "@pie-lib/render-ui";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- import { styled as u } from "@mui/material/styles";
9
- //#region src/delivery/likert.tsx
10
- function d(e) {
11
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
12
- }
13
- function f(e, t) {
14
- 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;
15
- }
16
- var p = f(o, "PreviewPrompt") || f(_.PreviewPrompt, "PreviewPrompt"), m = f(a, "Collapsible") || f(_.Collapsible, "Collapsible"), h = i, g = h.default, _ = g && typeof g == "object" ? g : h, v = u("div")({
17
- color: s.text(),
18
- backgroundColor: s.background(),
19
- "& *": { "-webkit-font-smoothing": "antialiased" }
20
- }), y = u(m)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), b = u("div")(({ theme: e }) => ({
21
- verticalAlign: "middle",
22
- color: "var(--pie-primary-text, var(--pie-text, #000000))",
23
- paddingBottom: e.spacing(2)
24
- })), x = u("div")({ display: "flex" }), S = class extends n.Component {
25
- static propTypes = {
26
- className: r.string,
27
- choices: r.array,
28
- prompt: r.string,
29
- teacherInstructions: r.string,
30
- session: r.object,
31
- disabled: r.bool.isRequired,
32
- onSessionChange: r.func.isRequired,
33
- likertOrientation: r.string.isRequired
34
- };
35
- UNSAFE_componentWillReceiveProps() {}
36
- isSelected(e) {
37
- return this.props.session && this.props.session.value === e;
38
- }
39
- render() {
40
- let { disabled: n, choices: r = [], prompt: i, onSessionChange: a, teacherInstructions: o, className: s, likertOrientation: u } = this.props, d = u === e.vertical ? "column" : "row";
41
- return /* @__PURE__ */ l(v, {
42
- className: s,
43
- children: [
44
- o && /* @__PURE__ */ c(y, {
45
- labels: {
46
- hidden: "Show Teacher Instructions",
47
- visible: "Hide Teacher Instructions"
48
- },
49
- children: /* @__PURE__ */ c(p, { prompt: o })
50
- }),
51
- i && /* @__PURE__ */ c(b, { children: /* @__PURE__ */ c(p, { prompt: i }) }),
52
- /* @__PURE__ */ c(x, {
53
- style: { flexDirection: d },
54
- children: r.map((e, r) => /* @__PURE__ */ c(t, {
55
- label: e.label,
56
- value: e.value,
57
- index: r,
58
- disabled: n,
59
- onChange: a,
60
- likertOrientation: u,
61
- checked: this.isSelected(e.value)
62
- }, `choice-${r}`))
63
- })
64
- ]
65
- });
66
- }
67
- };
68
- S.defaultProps = { session: { value: [] } };
69
- //#endregion
70
- export { S as default };
@@ -1,12 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/src/likertEntities.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 LIKERT_ORIENTATION: {
10
- horizontal: string;
11
- vertical: string;
12
- };
@@ -1,7 +0,0 @@
1
- //#region src/delivery/likertEntities.ts
2
- var e = {
3
- horizontal: "horizontal",
4
- vertical: "vertical"
5
- };
6
- //#endregion
7
- export { e as LIKERT_ORIENTATION };
@@ -1,23 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/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;
@@ -1,37 +0,0 @@
1
- import e from "./likert.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 };
@@ -1,9 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/likert/src/session-updater.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 updateSessionValue(session: any, data: any): void;
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 likert 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;