@pie-element/extended-text-entry 15.1.2-next.2 → 15.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 (100) hide show
  1. package/CHANGELOG.json +1282 -0
  2. package/CHANGELOG.md +2270 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +922 -0
  6. package/configure/CHANGELOG.md +1959 -0
  7. package/configure/lib/defaults.js +224 -0
  8. package/configure/lib/defaults.js.map +1 -0
  9. package/configure/lib/index.js +125 -0
  10. package/configure/lib/index.js.map +1 -0
  11. package/configure/lib/main.js +247 -0
  12. package/configure/lib/main.js.map +1 -0
  13. package/configure/package.json +23 -0
  14. package/controller/CHANGELOG.json +362 -0
  15. package/controller/CHANGELOG.md +1183 -0
  16. package/controller/lib/defaults.js +91 -0
  17. package/controller/lib/defaults.js.map +1 -0
  18. package/controller/lib/index.js +101 -0
  19. package/controller/lib/index.js.map +1 -0
  20. package/controller/package.json +16 -0
  21. package/docs/config-schema.json +1782 -0
  22. package/docs/config-schema.json.md +1333 -0
  23. package/docs/demo/config.js +7 -0
  24. package/docs/demo/generate.js +14 -0
  25. package/docs/demo/index.html +3 -0
  26. package/docs/demo/session.js +7 -0
  27. package/docs/pie-schema.json +954 -0
  28. package/docs/pie-schema.json.md +717 -0
  29. package/lib/annotation/annotation-editor.js +636 -0
  30. package/lib/annotation/annotation-editor.js.map +1 -0
  31. package/lib/annotation/annotation-menu.js +147 -0
  32. package/lib/annotation/annotation-menu.js.map +1 -0
  33. package/lib/annotation/annotation-utils.js +205 -0
  34. package/lib/annotation/annotation-utils.js.map +1 -0
  35. package/lib/annotation/freeform-editor.js +241 -0
  36. package/lib/annotation/freeform-editor.js.map +1 -0
  37. package/lib/index.js +108 -0
  38. package/lib/index.js.map +1 -0
  39. package/lib/main.js +205 -0
  40. package/lib/main.js.map +1 -0
  41. package/lib/print.js +86 -0
  42. package/lib/print.js.map +1 -0
  43. package/module/configure.js +1 -0
  44. package/module/controller.js +139 -0
  45. package/module/demo.js +38 -0
  46. package/module/element.js +1 -0
  47. package/module/index.html +21 -0
  48. package/module/manifest.json +22 -0
  49. package/module/print-demo.js +76 -0
  50. package/module/print.html +18 -0
  51. package/module/print.js +1 -0
  52. package/package.json +22 -87
  53. package/configure.js +0 -2
  54. package/controller.js +0 -1
  55. package/dist/author/defaults.d.ts +0 -166
  56. package/dist/author/defaults.js +0 -209
  57. package/dist/author/index.d.ts +0 -52
  58. package/dist/author/index.js +0 -74
  59. package/dist/author/main.d.ts +0 -26
  60. package/dist/author/main.js +0 -166
  61. package/dist/browser/author/index.js +0 -495
  62. package/dist/browser/author/index.js.map +0 -1
  63. package/dist/browser/browser-kkT1XVKw.js +0 -219
  64. package/dist/browser/browser-kkT1XVKw.js.map +0 -1
  65. package/dist/browser/controller/index.js +0 -184
  66. package/dist/browser/controller/index.js.map +0 -1
  67. package/dist/browser/delivery/index.js +0 -98
  68. package/dist/browser/delivery/index.js.map +0 -1
  69. package/dist/browser/dist-BCJzhghM.js +0 -47879
  70. package/dist/browser/dist-BCJzhghM.js.map +0 -1
  71. package/dist/browser/extended-text-entry.css +0 -2
  72. package/dist/browser/main-VcQEFn-b.js +0 -714
  73. package/dist/browser/main-VcQEFn-b.js.map +0 -1
  74. package/dist/browser/print/index.js +0 -48
  75. package/dist/browser/print/index.js.map +0 -1
  76. package/dist/controller/defaults.d.ts +0 -33
  77. package/dist/controller/defaults.js +0 -104
  78. package/dist/controller/index.d.ts +0 -59
  79. package/dist/controller/index.js +0 -72
  80. package/dist/delivery/annotation/annotation-editor.d.ts +0 -47
  81. package/dist/delivery/annotation/annotation-editor.js +0 -296
  82. package/dist/delivery/annotation/annotation-menu.d.ts +0 -25
  83. package/dist/delivery/annotation/annotation-menu.js +0 -113
  84. package/dist/delivery/annotation/annotation-utils.d.ts +0 -20
  85. package/dist/delivery/annotation/annotation-utils.js +0 -65
  86. package/dist/delivery/annotation/freeform-editor.d.ts +0 -30
  87. package/dist/delivery/annotation/freeform-editor.js +0 -143
  88. package/dist/delivery/index.d.ts +0 -23
  89. package/dist/delivery/index.js +0 -68
  90. package/dist/delivery/main.d.ts +0 -27
  91. package/dist/delivery/main.js +0 -134
  92. package/dist/extended-text-entry.css +0 -2
  93. package/dist/index.d.ts +0 -1
  94. package/dist/index.iife.d.ts +0 -8
  95. package/dist/index.iife.js +0 -403
  96. package/dist/index.js +0 -2
  97. package/dist/print/index.d.ts +0 -15
  98. package/dist/print/index.js +0 -48
  99. package/dist/runtime-support.d.ts +0 -12
  100. package/dist/runtime-support.js +0 -12
@@ -1,143 +0,0 @@
1
- import e from "react";
2
- import t from "prop-types";
3
- import { styled as n } from "@mui/material/styles";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { Popover as a, TextField as o } from "@mui/material";
6
- //#region src/delivery/annotation/freeform-editor.tsx
7
- var s = n(a)(({ theme: e, annotationType: t }) => ({ "& .MuiPaper-root": {
8
- overflowX: "unset",
9
- overflowY: "unset",
10
- marginLeft: "16px",
11
- "&::before": {
12
- position: "absolute",
13
- right: "100%",
14
- top: "13px",
15
- border: "solid transparent",
16
- content: "\"\"",
17
- height: 0,
18
- width: 0,
19
- pointerEvents: "none",
20
- borderWidth: "7px",
21
- borderRightColor: e.palette.grey[100]
22
- },
23
- ...t === "negative" && { "&::before": { borderRightColor: "rgb(255, 204, 238) !important" } },
24
- ...t === "positive" && { "&::before": { borderRightColor: "rgb(153, 255, 153) !important" } }
25
- } })), c = n("div")(({ theme: e, annotationType: t }) => ({
26
- width: "200px",
27
- overflow: "hidden",
28
- borderRadius: "4px",
29
- backgroundColor: "#ffffff",
30
- border: `4px solid ${e.palette.grey[100]}`,
31
- ...t === "negative" && { borderColor: "rgb(255, 204, 238) !important" },
32
- ...t === "positive" && { borderColor: "rgb(153, 255, 153) !important" }
33
- })), l = n("div")(({ theme: e }) => ({
34
- display: "flex",
35
- flexWrap: "wrap",
36
- borderTop: `2px solid ${e.palette.grey[100]}`
37
- })), u = n("div")(({ theme: e, variant: t, annotationType: n }) => ({
38
- flexGrow: 1,
39
- width: "28%",
40
- textAlign: "center",
41
- padding: "4px",
42
- cursor: "pointer",
43
- "&:not(:nth-child(3n))": { borderRight: `1px solid ${e.palette.grey[100]}` },
44
- "&:hover": { backgroundColor: e.palette.grey[100] },
45
- ...t === "positive" && {
46
- backgroundColor: "rgb(153, 255, 153) !important",
47
- "&:hover": { filter: "brightness(85%)" }
48
- },
49
- ...t === "negative" && {
50
- backgroundColor: "rgb(255, 204, 238) !important",
51
- "&:hover": { filter: "brightness(85%)" }
52
- },
53
- ...t === "typeChange" && n === "negative" && { "&:hover": { backgroundColor: "rgb(153, 255, 153) !important" } },
54
- ...t === "typeChange" && n === "positive" && { "&:hover": { backgroundColor: "rgb(255, 204, 238) !important" } }
55
- })), d = class extends e.Component {
56
- static propTypes = {
57
- anchorEl: t.object,
58
- open: t.bool,
59
- offset: t.number,
60
- value: t.string,
61
- type: t.string,
62
- onClose: t.func,
63
- onDelete: t.func,
64
- onSave: t.func,
65
- onTypeChange: t.func
66
- };
67
- constructor(e) {
68
- super(e), this.state = { value: e.value };
69
- }
70
- UNSAFE_componentWillReceiveProps(e) {
71
- let { value: t } = e, { value: n } = this.props;
72
- t !== n && this.setState({ value: t });
73
- }
74
- onValueChange = (e) => this.setState({ value: e.target.value });
75
- handleSave = () => {
76
- let { value: e, onSave: t, onClose: n, onDelete: r } = this.props, { value: i } = this.state;
77
- i === "" && r(), e !== i && t(e, i), this.setState({ value: "" }), n();
78
- };
79
- handleTypeChange = () => {
80
- let { onTypeChange: e, onDelete: t } = this.props, { value: n } = this.state;
81
- n === "" ? t() : e(n), this.setState({ value: "" });
82
- };
83
- render() {
84
- let { anchorEl: e, offset: t, onDelete: n, open: a, type: d } = this.props, { value: f } = this.state;
85
- return /* @__PURE__ */ r(s, {
86
- anchorEl: e,
87
- elevation: 2,
88
- open: a,
89
- onClose: this.handleSave,
90
- annotationType: d,
91
- style: {
92
- marginTop: `${t}px`,
93
- transition: "margin-top 2s ease-out"
94
- },
95
- transitionDuration: {
96
- enter: 225,
97
- exit: 195
98
- },
99
- anchorOrigin: {
100
- vertical: "top",
101
- horizontal: "right"
102
- },
103
- transformOrigin: {
104
- vertical: "top",
105
- horizontal: "left"
106
- },
107
- children: /* @__PURE__ */ i(c, {
108
- annotationType: d,
109
- children: [/* @__PURE__ */ r(o, {
110
- id: "annotation-editor",
111
- style: {
112
- padding: "2px 5px",
113
- width: "95%"
114
- },
115
- autoFocus: !0,
116
- multiline: !0,
117
- rows: 1,
118
- maxRows: 4,
119
- value: f,
120
- onChange: this.onValueChange,
121
- InputProps: { disableUnderline: !0 }
122
- }), /* @__PURE__ */ i(l, { children: [
123
- /* @__PURE__ */ r(u, {
124
- onClick: n,
125
- children: "Delete"
126
- }),
127
- /* @__PURE__ */ r(u, {
128
- variant: "typeChange",
129
- annotationType: d,
130
- onClick: this.handleTypeChange,
131
- children: d === "negative" ? "Green" : "Pink"
132
- }),
133
- /* @__PURE__ */ r(u, {
134
- onClick: this.handleSave,
135
- children: "Save"
136
- })
137
- ] })]
138
- })
139
- });
140
- }
141
- };
142
- //#endregion
143
- export { d as default };
@@ -1,23 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/extended-text-entry/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 textContent(value: any): any;
10
- export declare function isComplete(value: any): boolean;
11
- export default class RootExtendedTextEntry extends HTMLElement {
12
- constructor();
13
- setLangAttribute(): void;
14
- set model(m: any);
15
- set session(s: any);
16
- get session(): any;
17
- valueChange(value: any): void;
18
- annotationsChange(annotations: any): void;
19
- commentChange(comment: any): void;
20
- connectedCallback(): void;
21
- render(): void;
22
- disconnectedCallback(): void;
23
- }
@@ -1,68 +0,0 @@
1
- import e from "./main.js";
2
- import t from "react";
3
- import n from "debug";
4
- import { createRoot as r } from "react-dom/client";
5
- import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
6
- import { ModelSetEvent as a, SessionChangedEvent as o } from "@pie-element/shared-player-events";
7
- //#region src/delivery/index.ts
8
- var s = n("@pie-elements:extended-text-entry"), c = new DOMParser();
9
- function l(e) {
10
- if (typeof e == "string") try {
11
- return c.parseFromString(e, "text/html").body.textContent;
12
- } catch {
13
- return s("tried to parse as dom and failed", e), e;
14
- }
15
- }
16
- function u(e) {
17
- let t = l(e);
18
- return t !== void 0 && t.length > 0;
19
- }
20
- var d = class extends HTMLElement {
21
- constructor() {
22
- super(), this._model = null, this._session = null, this._root = null;
23
- }
24
- setLangAttribute() {
25
- let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
26
- this.setAttribute("lang", t);
27
- }
28
- set model(e) {
29
- this._model = e, this.dispatchEvent(new a(this.tagName.toLowerCase(), !1, !!this._model)), this.render();
30
- }
31
- set session(e) {
32
- this._session = e, this.render();
33
- }
34
- get session() {
35
- return this._session;
36
- }
37
- valueChange(e) {
38
- this._session.value = e, this.dispatchEvent(new o(this.tagName.toLowerCase(), u(e))), this.render();
39
- }
40
- annotationsChange(e) {
41
- this._session.annotations = e, this.dispatchEvent(new o(this.tagName.toLowerCase(), !0)), this.render();
42
- }
43
- commentChange(e) {
44
- this._session.comment = e, this.dispatchEvent(new o(this.tagName.toLowerCase(), u(e))), this.render();
45
- }
46
- connectedCallback() {
47
- this.setAttribute("aria-label", "Written Response Question"), this.setAttribute("role", "region"), this.render();
48
- }
49
- render() {
50
- if (this._model && this._session) {
51
- let n = t.createElement(e, {
52
- model: this._model,
53
- session: this._session,
54
- onValueChange: this.valueChange.bind(this),
55
- onAnnotationsChange: this.annotationsChange.bind(this),
56
- onCommentChange: this.commentChange.bind(this)
57
- });
58
- this.setLangAttribute(), this._root ||= r(this), this._root.render(n), queueMicrotask(() => {
59
- i(this);
60
- });
61
- }
62
- }
63
- disconnectedCallback() {
64
- this._root && this._root.unmount();
65
- }
66
- };
67
- //#endregion
68
- export { d as default, u as isComplete, l as textContent };
@@ -1,27 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/extended-text-entry/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
- onValueChange: PropTypes.Validator<(...args: any[]) => any>;
14
- onAnnotationsChange: PropTypes.Validator<(...args: any[]) => any>;
15
- onCommentChange: PropTypes.Validator<(...args: any[]) => any>;
16
- model: PropTypes.Requireable<object>;
17
- session: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
18
- value: PropTypes.Requireable<string>;
19
- annotations: PropTypes.Requireable<any[]>;
20
- comment: PropTypes.Requireable<string>;
21
- }>>>;
22
- };
23
- changeSessionValue: import("@pie-element/shared-lodash").CancelableFunction<any>;
24
- changeSessionComment: import("@pie-element/shared-lodash").CancelableFunction<any>;
25
- render(): React.JSX.Element;
26
- }
27
- export default Main;
@@ -1,134 +0,0 @@
1
- import e from "./annotation/annotation-editor.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import { debounce as r } from "@pie-element/shared-lodash";
5
- import i from "debug";
6
- import a from "@mui/material/Typography";
7
- import { styled as o } from "@mui/material/styles";
8
- import s from "@pie-lib/editable-html-tip-tap";
9
- import * as c from "@pie-lib/render-ui";
10
- import { Collapsible as l, Feedback as u, PreviewPrompt as d, UiLayout as f, color as p } from "@pie-lib/render-ui";
11
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
12
- //#region src/delivery/main.tsx
13
- function g(e) {
14
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
15
- }
16
- function _(e, t) {
17
- return !e || g(e) ? e : g(e.default) ? e.default : t && g(e[t]) ? e[t] : t && g(e[t]?.default) ? e[t].default : e;
18
- }
19
- var v = _(f, "UiLayout") || _(w.UiLayout, "UiLayout"), y = _(d, "PreviewPrompt") || _(w.PreviewPrompt, "PreviewPrompt"), b = _(l, "Collapsible") || _(w.Collapsible, "Collapsible"), x = _(u, "Feedback") || _(w.Feedback, "Feedback"), S = c, C = S.default, w = C && typeof C == "object" ? C : S, T = i("@pie-ui:extended-text-entry"), E = o(v)({
20
- backgroundColor: p.background(),
21
- color: p.text()
22
- }), D = o(a)(({ theme: e }) => ({
23
- width: "100%",
24
- color: p.text(),
25
- marginBottom: e.spacing(2),
26
- fontSize: "inherit"
27
- })), O = o("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), k = o(s)(({ theme: e }) => ({
28
- marginBottom: e.spacing(2),
29
- borderRadius: "4px"
30
- })), A = o("h2")({
31
- position: "absolute",
32
- left: "-10000px",
33
- top: "auto",
34
- width: "1px",
35
- height: "1px",
36
- overflow: "hidden"
37
- }), j = class extends t.Component {
38
- static propTypes = {
39
- onValueChange: n.func.isRequired,
40
- onAnnotationsChange: n.func.isRequired,
41
- onCommentChange: n.func.isRequired,
42
- model: n.object,
43
- session: n.shape({
44
- value: n.string,
45
- annotations: n.array,
46
- comment: n.string
47
- }).isRequired
48
- };
49
- changeSessionValue = r(this.props.onValueChange, 1500);
50
- changeSessionComment = r(this.props.onCommentChange, 1500);
51
- render() {
52
- let { model: t, session: n, onAnnotationsChange: r } = this.props, { animationsDisabled: i, annotatorMode: a, customKeys: o, dimensions: s, disabled: c, disabledAnnotator: l, equationEditor: u, extraCSSRules: d, feedback: f, mathInput: p, playersToolbarPosition: g, predefinedAnnotations: _, prompt: v, spanishInput: S, specialInput: C, spellCheckEnabled: w, teacherInstructions: j } = t, { annotations: M, comment: N, value: P } = n, { width: F, height: I } = s || {}, L = "40vh", R = { position: g === "top" ? "top" : "bottom" };
53
- T("[render] disabled? ", c);
54
- let z = /* @__PURE__ */ m(y, {
55
- defaultClassName: "teacher-instructions",
56
- prompt: j
57
- }), B = [];
58
- return S && B.push({ language: "spanish" }), C && B.push({ language: "special" }), /* @__PURE__ */ h(E, {
59
- extraCSSRules: d,
60
- ref: (e) => {
61
- this.containerRef = e;
62
- },
63
- children: [
64
- /* @__PURE__ */ m(A, { children: "Constructed Response Question" }),
65
- j && /* @__PURE__ */ m(O, { children: i ? z : /* @__PURE__ */ m(b, {
66
- labels: {
67
- hidden: "Show Teacher Instructions",
68
- visible: "Hide Teacher Instructions"
69
- },
70
- children: z
71
- }) }),
72
- v && /* @__PURE__ */ m(D, {
73
- component: "span",
74
- children: /* @__PURE__ */ m(y, {
75
- defaultClassName: "prompt",
76
- prompt: t.prompt
77
- })
78
- }),
79
- a ? /* @__PURE__ */ m(e, {
80
- text: P || "",
81
- annotations: M || [],
82
- comment: N || "",
83
- predefinedAnnotations: _ || [],
84
- onChange: r,
85
- onCommentChange: this.changeSessionComment,
86
- width: F,
87
- height: I,
88
- maxHeight: L,
89
- disabled: l,
90
- disabledMath: !p,
91
- customKeys: o,
92
- keypadMode: u
93
- }) : /* @__PURE__ */ m(k, {
94
- className: "response-area-editor",
95
- onChange: this.changeSessionValue,
96
- markup: P || "",
97
- maxWidth: F && F.toString(),
98
- minWidth: "100px",
99
- minHeight: I && I.toString(),
100
- maxHeight: L,
101
- disabled: c,
102
- highlightShape: !0,
103
- toolbarOpts: R,
104
- spellCheck: w,
105
- charactersLimit: 5e4,
106
- autoWidthToolbar: !0,
107
- pluginProps: {
108
- math: {
109
- disabled: !p,
110
- customKeys: this.props.model.customKeys,
111
- keypadMode: this.props.model.equationEditor,
112
- controlledKeypadMode: !1
113
- },
114
- video: { disabled: !0 },
115
- audio: { disabled: !0 },
116
- table: { disabled: !0 },
117
- textAlign: { disabled: !0 },
118
- h3: { disabled: !0 },
119
- separateParagraphs: { disabled: !1 },
120
- ul_list: { disabled: !0 },
121
- ol_list: { disabled: !0 }
122
- },
123
- languageCharactersProps: B
124
- }),
125
- f && /* @__PURE__ */ m(x, {
126
- correctness: "correct",
127
- feedback: f
128
- })
129
- ]
130
- });
131
- }
132
- };
133
- //#endregion
134
- export { j as default };