@pie-element/extended-text-entry 15.2.2-beta.4 → 15.2.2-beta.6

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 (36) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/configure/CHANGELOG.md +8 -0
  3. package/configure/package.json +3 -3
  4. package/controller/CHANGELOG.md +8 -0
  5. package/controller/package.json +1 -1
  6. package/package.json +4 -4
  7. package/configure/lib/__tests__/main.test.js +0 -123
  8. package/configure/lib/defaults.js +0 -224
  9. package/configure/lib/defaults.js.map +0 -1
  10. package/configure/lib/index.js +0 -129
  11. package/configure/lib/index.js.map +0 -1
  12. package/configure/lib/main.js +0 -247
  13. package/configure/lib/main.js.map +0 -1
  14. package/controller/lib/__tests__/index.test.js +0 -350
  15. package/controller/lib/defaults.js +0 -91
  16. package/controller/lib/defaults.js.map +0 -1
  17. package/controller/lib/index.js +0 -101
  18. package/controller/lib/index.js.map +0 -1
  19. package/docs/demo/pie.manifest.json +0 -11
  20. package/lib/__tests__/index.test.js +0 -37
  21. package/lib/annotation/__tests__/annotation-editor.test.js +0 -326
  22. package/lib/annotation/__tests__/freeform-editor.test.js +0 -136
  23. package/lib/annotation/annotation-editor.js +0 -636
  24. package/lib/annotation/annotation-editor.js.map +0 -1
  25. package/lib/annotation/annotation-menu.js +0 -147
  26. package/lib/annotation/annotation-menu.js.map +0 -1
  27. package/lib/annotation/annotation-utils.js +0 -205
  28. package/lib/annotation/annotation-utils.js.map +0 -1
  29. package/lib/annotation/freeform-editor.js +0 -241
  30. package/lib/annotation/freeform-editor.js.map +0 -1
  31. package/lib/index.js +0 -109
  32. package/lib/index.js.map +0 -1
  33. package/lib/main.js +0 -206
  34. package/lib/main.js.map +0 -1
  35. package/lib/print.js +0 -86
  36. package/lib/print.js.map +0 -1
@@ -1,241 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
- var _material = require("@mui/material");
12
- var _styles = require("@mui/material/styles");
13
- const StyledPopover = (0, _styles.styled)(_material.Popover)(({
14
- theme,
15
- annotationType
16
- }) => ({
17
- '& .MuiPaper-root': {
18
- overflowX: 'unset',
19
- overflowY: 'unset',
20
- marginLeft: '16px',
21
- '&::before': {
22
- position: 'absolute',
23
- right: '100%',
24
- top: '13px',
25
- border: 'solid transparent',
26
- content: '""',
27
- height: 0,
28
- width: 0,
29
- pointerEvents: 'none',
30
- borderWidth: '7px',
31
- borderRightColor: theme.palette.grey[100]
32
- },
33
- ...(annotationType === 'negative' && {
34
- '&::before': {
35
- borderRightColor: 'rgb(255, 204, 238) !important'
36
- }
37
- }),
38
- ...(annotationType === 'positive' && {
39
- '&::before': {
40
- borderRightColor: 'rgb(153, 255, 153) !important'
41
- }
42
- })
43
- }
44
- }));
45
- const Wrapper = (0, _styles.styled)('div')(({
46
- theme,
47
- annotationType
48
- }) => ({
49
- width: '200px',
50
- overflow: 'hidden',
51
- borderRadius: '4px',
52
- backgroundColor: '#ffffff',
53
- border: `4px solid ${theme.palette.grey[100]}`,
54
- ...(annotationType === 'negative' && {
55
- borderColor: 'rgb(255, 204, 238) !important'
56
- }),
57
- ...(annotationType === 'positive' && {
58
- borderColor: 'rgb(153, 255, 153) !important'
59
- })
60
- }));
61
- const Holder = (0, _styles.styled)('div')(({
62
- theme
63
- }) => ({
64
- display: 'flex',
65
- flexWrap: 'wrap',
66
- borderTop: `2px solid ${theme.palette.grey[100]}`
67
- }));
68
- const Button = (0, _styles.styled)('div')(({
69
- theme,
70
- variant,
71
- annotationType
72
- }) => ({
73
- flexGrow: 1,
74
- width: '28%',
75
- textAlign: 'center',
76
- padding: '4px',
77
- cursor: 'pointer',
78
- '&:not(:nth-child(3n))': {
79
- borderRight: `1px solid ${theme.palette.grey[100]}`
80
- },
81
- '&:hover': {
82
- backgroundColor: theme.palette.grey[100]
83
- },
84
- ...(variant === 'positive' && {
85
- backgroundColor: 'rgb(153, 255, 153) !important',
86
- '&:hover': {
87
- filter: 'brightness(85%)'
88
- }
89
- }),
90
- ...(variant === 'negative' && {
91
- backgroundColor: 'rgb(255, 204, 238) !important',
92
- '&:hover': {
93
- filter: 'brightness(85%)'
94
- }
95
- }),
96
- ...(variant === 'typeChange' && annotationType === 'negative' && {
97
- '&:hover': {
98
- backgroundColor: 'rgb(153, 255, 153) !important'
99
- }
100
- }),
101
- ...(variant === 'typeChange' && annotationType === 'positive' && {
102
- '&:hover': {
103
- backgroundColor: 'rgb(255, 204, 238) !important'
104
- }
105
- })
106
- }));
107
- class FreeformEditor extends _react.default.Component {
108
- constructor(props) {
109
- super(props);
110
- (0, _defineProperty2.default)(this, "onValueChange", event => this.setState({
111
- value: event.target.value
112
- }));
113
- (0, _defineProperty2.default)(this, "handleSave", () => {
114
- const {
115
- value: oldValue,
116
- onSave,
117
- onClose,
118
- onDelete
119
- } = this.props;
120
- const {
121
- value
122
- } = this.state;
123
- if (value === '') {
124
- onDelete();
125
- }
126
- if (oldValue !== value) {
127
- onSave(oldValue, value);
128
- }
129
- this.setState({
130
- value: ''
131
- });
132
- onClose();
133
- });
134
- (0, _defineProperty2.default)(this, "handleTypeChange", () => {
135
- const {
136
- onTypeChange,
137
- onDelete
138
- } = this.props;
139
- const {
140
- value
141
- } = this.state;
142
- if (value === '') {
143
- onDelete();
144
- } else {
145
- onTypeChange(value);
146
- }
147
- this.setState({
148
- value: ''
149
- });
150
- });
151
- this.state = {
152
- value: props.value
153
- };
154
- }
155
- UNSAFE_componentWillReceiveProps(nextProps) {
156
- const {
157
- value
158
- } = nextProps;
159
- const {
160
- value: propsValue
161
- } = this.props;
162
- if (value !== propsValue) {
163
- this.setState({
164
- value
165
- });
166
- }
167
- }
168
- render() {
169
- const {
170
- anchorEl,
171
- offset,
172
- onDelete,
173
- open,
174
- type
175
- } = this.props;
176
- const {
177
- value
178
- } = this.state;
179
- return /*#__PURE__*/_react.default.createElement(StyledPopover, {
180
- anchorEl: anchorEl,
181
- elevation: 2,
182
- open: open,
183
- onClose: this.handleSave,
184
- annotationType: type,
185
- style: {
186
- marginTop: `${offset}px`,
187
- transition: 'margin-top 2s ease-out'
188
- },
189
- transitionDuration: {
190
- enter: 225,
191
- exit: 195
192
- },
193
- anchorOrigin: {
194
- vertical: 'top',
195
- horizontal: 'right'
196
- },
197
- transformOrigin: {
198
- vertical: 'top',
199
- horizontal: 'left'
200
- }
201
- }, /*#__PURE__*/_react.default.createElement(Wrapper, {
202
- annotationType: type
203
- }, /*#__PURE__*/_react.default.createElement(_material.TextField, {
204
- id: "annotation-editor",
205
- style: {
206
- padding: '2px 5px',
207
- width: '95%'
208
- },
209
- autoFocus: true,
210
- multiline: true,
211
- rows: 1,
212
- maxRows: 4,
213
- value: value,
214
- onChange: this.onValueChange,
215
- InputProps: {
216
- disableUnderline: true
217
- }
218
- }), /*#__PURE__*/_react.default.createElement(Holder, null, /*#__PURE__*/_react.default.createElement(Button, {
219
- onClick: onDelete
220
- }, "Delete"), /*#__PURE__*/_react.default.createElement(Button, {
221
- variant: "typeChange",
222
- annotationType: type,
223
- onClick: this.handleTypeChange
224
- }, type === 'negative' ? 'Green' : 'Pink'), /*#__PURE__*/_react.default.createElement(Button, {
225
- onClick: this.handleSave
226
- }, "Save"))));
227
- }
228
- }
229
- (0, _defineProperty2.default)(FreeformEditor, "propTypes", {
230
- anchorEl: _propTypes.default.object,
231
- open: _propTypes.default.bool,
232
- offset: _propTypes.default.number,
233
- value: _propTypes.default.string,
234
- type: _propTypes.default.string,
235
- onClose: _propTypes.default.func,
236
- onDelete: _propTypes.default.func,
237
- onSave: _propTypes.default.func,
238
- onTypeChange: _propTypes.default.func
239
- });
240
- var _default = exports.default = FreeformEditor;
241
- //# sourceMappingURL=freeform-editor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"freeform-editor.js","names":["_react","_interopRequireDefault","require","_propTypes","_material","_styles","StyledPopover","styled","Popover","theme","annotationType","overflowX","overflowY","marginLeft","position","right","top","border","content","height","width","pointerEvents","borderWidth","borderRightColor","palette","grey","Wrapper","overflow","borderRadius","backgroundColor","borderColor","Holder","display","flexWrap","borderTop","Button","variant","flexGrow","textAlign","padding","cursor","borderRight","filter","FreeformEditor","React","Component","constructor","props","_defineProperty2","default","event","setState","value","target","oldValue","onSave","onClose","onDelete","state","onTypeChange","UNSAFE_componentWillReceiveProps","nextProps","propsValue","render","anchorEl","offset","open","type","createElement","elevation","handleSave","style","marginTop","transition","transitionDuration","enter","exit","anchorOrigin","vertical","horizontal","transformOrigin","TextField","id","autoFocus","multiline","rows","maxRows","onChange","onValueChange","InputProps","disableUnderline","onClick","handleTypeChange","PropTypes","object","bool","number","string","func","_default","exports"],"sources":["../../src/annotation/freeform-editor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Popover, TextField } from '@mui/material';\nimport { styled } from '@mui/material/styles';\n\nconst StyledPopover = styled(Popover)(({ theme, annotationType }) => ({\n '& .MuiPaper-root': {\n overflowX: 'unset',\n overflowY: 'unset',\n marginLeft: '16px',\n '&::before': {\n position: 'absolute',\n right: '100%',\n top: '13px',\n border: 'solid transparent',\n content: '\"\"',\n height: 0,\n width: 0,\n pointerEvents: 'none',\n borderWidth: '7px',\n borderRightColor: theme.palette.grey[100],\n },\n ...(annotationType === 'negative' && {\n '&::before': {\n borderRightColor: 'rgb(255, 204, 238) !important',\n },\n }),\n ...(annotationType === 'positive' && {\n '&::before': {\n borderRightColor: 'rgb(153, 255, 153) !important',\n },\n }),\n },\n}));\n\nconst Wrapper = styled('div')(({ theme, annotationType }) => ({\n width: '200px',\n overflow: 'hidden',\n borderRadius: '4px',\n backgroundColor: '#ffffff',\n border: `4px solid ${theme.palette.grey[100]}`,\n ...(annotationType === 'negative' && {\n borderColor: 'rgb(255, 204, 238) !important',\n }),\n ...(annotationType === 'positive' && {\n borderColor: 'rgb(153, 255, 153) !important',\n }),\n}));\n\nconst Holder = styled('div')(({ theme }) => ({\n display: 'flex',\n flexWrap: 'wrap',\n borderTop: `2px solid ${theme.palette.grey[100]}`,\n}));\n\nconst Button = styled('div')(({ theme, variant, annotationType }) => ({\n flexGrow: 1,\n width: '28%',\n textAlign: 'center',\n padding: '4px',\n cursor: 'pointer',\n '&:not(:nth-child(3n))': {\n borderRight: `1px solid ${theme.palette.grey[100]}`,\n },\n '&:hover': {\n backgroundColor: theme.palette.grey[100],\n },\n ...(variant === 'positive' && {\n backgroundColor: 'rgb(153, 255, 153) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'negative' && {\n backgroundColor: 'rgb(255, 204, 238) !important',\n '&:hover': {\n filter: 'brightness(85%)',\n },\n }),\n ...(variant === 'typeChange' && annotationType === 'negative' && {\n '&:hover': {\n backgroundColor: 'rgb(153, 255, 153) !important',\n },\n }),\n ...(variant === 'typeChange' && annotationType === 'positive' && {\n '&:hover': {\n backgroundColor: 'rgb(255, 204, 238) !important',\n },\n }),\n}));\n\nclass FreeformEditor extends React.Component {\n static propTypes = {\n anchorEl: PropTypes.object,\n open: PropTypes.bool,\n offset: PropTypes.number,\n value: PropTypes.string,\n type: PropTypes.string,\n onClose: PropTypes.func,\n onDelete: PropTypes.func,\n onSave: PropTypes.func,\n onTypeChange: PropTypes.func,\n };\n\n constructor(props) {\n super(props);\n this.state = { value: props.value };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { value } = nextProps;\n const { value: propsValue } = this.props;\n\n if (value !== propsValue) {\n this.setState({ value });\n }\n }\n\n onValueChange = (event) => this.setState({ value: event.target.value });\n\n handleSave = () => {\n const { value: oldValue, onSave, onClose, onDelete } = this.props;\n const { value } = this.state;\n\n if (value === '') {\n onDelete();\n }\n\n if (oldValue !== value) {\n onSave(oldValue, value);\n }\n\n this.setState({ value: '' });\n onClose();\n };\n\n handleTypeChange = () => {\n const { onTypeChange, onDelete } = this.props;\n const { value } = this.state;\n\n if (value === '') {\n onDelete();\n } else {\n onTypeChange(value);\n }\n\n this.setState({ value: '' });\n };\n\n render() {\n const { anchorEl, offset, onDelete, open, type } = this.props;\n const { value } = this.state;\n\n return (\n <StyledPopover\n anchorEl={anchorEl}\n elevation={2}\n open={open}\n onClose={this.handleSave}\n annotationType={type}\n style={{ marginTop: `${offset}px`, transition: 'margin-top 2s ease-out' }}\n transitionDuration={{ enter: 225, exit: 195 }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n >\n <Wrapper annotationType={type}>\n <TextField\n id=\"annotation-editor\"\n style={{\n padding: '2px 5px',\n width: '95%',\n }}\n autoFocus\n multiline\n rows={1}\n maxRows={4}\n value={value}\n onChange={this.onValueChange}\n InputProps={{ disableUnderline: true }}\n />\n <Holder>\n <Button onClick={onDelete}>\n Delete\n </Button>\n <Button variant=\"typeChange\" annotationType={type} onClick={this.handleTypeChange}>\n {type === 'negative' ? 'Green' : 'Pink'}\n </Button>\n <Button onClick={this.handleSave}>\n Save\n </Button>\n </Holder>\n </Wrapper>\n </StyledPopover>\n );\n }\n}\n\nexport default FreeformEditor;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,aAAa,GAAG,IAAAC,cAAM,EAACC,iBAAO,CAAC,CAAC,CAAC;EAAEC,KAAK;EAAEC;AAAe,CAAC,MAAM;EACpE,kBAAkB,EAAE;IAClBC,SAAS,EAAE,OAAO;IAClBC,SAAS,EAAE,OAAO;IAClBC,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE;MACXC,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AM;MAACwD,OAAO,EAAElC;IAAS,GAAC,QAEnB,CAAC,eACTzD,MAAA,CAAAiD,OAAA,CAAAmB,aAAA,CAACjC,MAAM;MAACC,OAAO,EAAC,YAAY;MAAC1B,cAAc,EAAEyD,IAAK;MAACwB,OAAO,EAAE,IAAI,CAACC;IAAiB,GAC/EzB,IAAI,KAAK,UAAU,GAAG,OAAO,GAAG,MAC3B,CAAC,eACTnE,MAAA,CAAAiD,OAAA,CAAAmB,aAAA,CAACjC,MAAM;MAACwD,OAAO,EAAE,IAAI,CAACrB;IAAW,GAAC,MAE1B,CACF,CACD,CACI,CAAC;EAEpB;AACF;AAAC,IAAAtB,gBAAA,CAAAC,OAAA,EA9GKN,cAAc,eACC;EACjBqB,QAAQ,EAAE6B,kBAAS,CAACC,MAAM;EAC1B5B,IAAI,EAAE2B,kBAAS,CAACE,IAAI;EACpB9B,MAAM,EAAE4B,kBAAS,CAACG,MAAM;EACxB5C,KAAK,EAAEyC,kBAAS,CAACI,MAAM;EACvB9B,IAAI,EAAE0B,kBAAS,CAACI,MAAM;EACtBzC,OAAO,EAAEqC,kBAAS,CAACK,IAAI;EACvBzC,QAAQ,EAAEoC,kBAAS,CAACK,IAAI;EACxB3C,MAAM,EAAEsC,kBAAS,CAACK,IAAI;EACtBvC,YAAY,EAAEkC,kBAAS,CAACK;AAC1B,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAqGYN,cAAc","ignoreList":[]}
package/lib/index.js DELETED
@@ -1,109 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- exports.isComplete = isComplete;
9
- exports.textContent = textContent;
10
- var _main = _interopRequireDefault(require("./main"));
11
- var _react = _interopRequireDefault(require("react"));
12
- var _client = require("react-dom/client");
13
- var _debug = _interopRequireDefault(require("debug"));
14
- var _mathRendering = require("@pie-lib/math-rendering");
15
- var _piePlayerEvents = require("@pie-framework/pie-player-events");
16
- const log = (0, _debug.default)('@pie-elements:extended-text-entry');
17
- const domParser = typeof window !== undefined ? new DOMParser() : {
18
- parseFromString: v => v
19
- };
20
- function textContent(value) {
21
- if (typeof value !== 'string') {
22
- return undefined;
23
- }
24
- try {
25
- const document = domParser.parseFromString(value, 'text/html');
26
- const textContent = document.body.textContent;
27
- return textContent;
28
- } catch (err) {
29
- log('tried to parse as dom and failed', value);
30
- return value;
31
- }
32
- }
33
- function isComplete(value) {
34
- const tc = textContent(value);
35
- const out = tc !== undefined && tc.length > 0;
36
- return out;
37
- }
38
- class RootExtendedTextEntry extends HTMLElement {
39
- constructor() {
40
- super();
41
- this._model = null;
42
- this._session = null;
43
- this._root = null;
44
- }
45
- setLangAttribute() {
46
- const language = this._model && typeof this._model.language ? this._model.language : '';
47
- const lang = language ? language.slice(0, 2) : 'en';
48
- this.setAttribute('lang', lang);
49
- }
50
- set model(m) {
51
- this._model = m;
52
- this.dispatchEvent(new _piePlayerEvents.ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model));
53
- this.render();
54
- }
55
- set session(s) {
56
- this._session = s;
57
- this.render();
58
- }
59
- get session() {
60
- return this._session;
61
- }
62
- valueChange(value) {
63
- this._session.value = value;
64
- this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value)));
65
- this.render();
66
- }
67
- annotationsChange(annotations) {
68
- this._session.annotations = annotations;
69
- this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), true));
70
- this.render();
71
- }
72
- commentChange(comment) {
73
- this._session.comment = comment;
74
- this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), isComplete(comment)));
75
- this.render();
76
- }
77
- connectedCallback() {
78
- this.setAttribute('aria-label', 'Written Response Question');
79
- this.setAttribute('role', 'region');
80
- this.render();
81
- }
82
- render() {
83
- if (this._model && this._session) {
84
- let elem = /*#__PURE__*/_react.default.createElement(_main.default, {
85
- model: this._model,
86
- session: this._session,
87
- onValueChange: this.valueChange.bind(this),
88
- onAnnotationsChange: this.annotationsChange.bind(this),
89
- onCommentChange: this.commentChange.bind(this)
90
- });
91
- this.setLangAttribute();
92
- if (!this._root) {
93
- this._root = (0, _client.createRoot)(this);
94
- }
95
- this._root.render(elem);
96
- queueMicrotask(() => {
97
- (0, _mathRendering.renderMath)(this);
98
- });
99
- }
100
- }
101
- disconnectedCallback() {
102
- if (this._root) {
103
- this._root.unmount();
104
- this._root = null;
105
- }
106
- }
107
- }
108
- exports.default = RootExtendedTextEntry;
109
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_main","_interopRequireDefault","require","_react","_client","_debug","_mathRendering","_piePlayerEvents","log","debug","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","HTMLElement","constructor","_model","_session","_root","setLangAttribute","language","lang","slice","setAttribute","model","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","session","s","valueChange","SessionChangedEvent","annotationsChange","annotations","commentChange","comment","connectedCallback","elem","React","createElement","Main","onValueChange","bind","onAnnotationsChange","onCommentChange","createRoot","queueMicrotask","renderMath","disconnectedCallback","unmount","exports","default"],"sources":["../src/index.js"],"sourcesContent":["import Main from './main';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\n\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\n\nconst log = debug('@pie-elements:extended-text-entry');\n\nconst domParser = typeof window !== undefined ? new DOMParser() : { parseFromString: (v) => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n this._root = null;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model));\n\n this.render();\n }\n\n set session(s) {\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n valueChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value)));\n\n this.render();\n }\n\n annotationsChange(annotations) {\n this._session.annotations = annotations;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n\n this.render();\n }\n\n commentChange(comment) {\n this._session.comment = comment;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(comment)));\n\n this.render();\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Written Response Question');\n this.setAttribute('role', 'region');\n\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onValueChange: this.valueChange.bind(this),\n onAnnotationsChange: this.annotationsChange.bind(this),\n onCommentChange: this.commentChange.bind(this),\n });\n\n this.setLangAttribute();\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAC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I,CAACA,KAAK,CAACkC,OAAO,CAAC,CAAC;MACpB,IAAI,CAAClC,KAAK,GAAG,IAAI;IACnB;EACF;AACF;AAACmC,OAAA,CAAAC,OAAA,GAAAzC,qBAAA","ignoreList":[]}
package/lib/main.js DELETED
@@ -1,206 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Main = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
- var _lodashEs = require("lodash-es");
12
- var _debug = _interopRequireDefault(require("debug"));
13
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
14
- var _styles = require("@mui/material/styles");
15
- var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
16
- var _renderUi = require("@pie-lib/render-ui");
17
- var _annotationEditor = _interopRequireDefault(require("./annotation/annotation-editor"));
18
- const log = (0, _debug.default)('@pie-ui:extended-text-entry');
19
- const MainContainer = (0, _styles.styled)(_renderUi.UiLayout)({
20
- backgroundColor: _renderUi.color.background(),
21
- color: _renderUi.color.text()
22
- });
23
- const StyledPrompt = (0, _styles.styled)(_Typography.default)(({
24
- theme
25
- }) => ({
26
- width: '100%',
27
- color: _renderUi.color.text(),
28
- marginBottom: theme.spacing(2),
29
- fontSize: 'inherit',
30
- display: 'block'
31
- }));
32
- const TeacherInstructions = (0, _styles.styled)('div')(({
33
- theme
34
- }) => ({
35
- marginBottom: theme.spacing(2)
36
- }));
37
- const Editor = (0, _styles.styled)(_editableHtmlTipTap.default)(({
38
- theme
39
- }) => ({
40
- marginBottom: theme.spacing(2),
41
- borderRadius: '4px'
42
- }));
43
- const SrOnly = (0, _styles.styled)('h2')({
44
- position: 'absolute',
45
- left: '-10000px',
46
- top: 'auto',
47
- width: '1px',
48
- height: '1px',
49
- overflow: 'hidden'
50
- });
51
- class Main extends _react.default.Component {
52
- constructor(...args) {
53
- super(...args);
54
- (0, _defineProperty2.default)(this, "changeSessionValue", (0, _lodashEs.debounce)(this.props.onValueChange, 1500));
55
- (0, _defineProperty2.default)(this, "changeSessionComment", (0, _lodashEs.debounce)(this.props.onCommentChange, 1500));
56
- }
57
- render() {
58
- const {
59
- model,
60
- session,
61
- onAnnotationsChange
62
- } = this.props;
63
- const {
64
- animationsDisabled,
65
- annotatorMode,
66
- customKeys,
67
- dimensions,
68
- disabled,
69
- disabledAnnotator,
70
- equationEditor,
71
- extraCSSRules,
72
- feedback,
73
- mathInput,
74
- playersToolbarPosition,
75
- predefinedAnnotations,
76
- prompt,
77
- spanishInput,
78
- specialInput,
79
- spellCheckEnabled,
80
- teacherInstructions
81
- } = model;
82
- const {
83
- annotations,
84
- comment,
85
- value
86
- } = session;
87
- const {
88
- width,
89
- height
90
- } = dimensions || {};
91
- const maxHeight = '40vh';
92
- const toolbarOpts = {
93
- position: playersToolbarPosition === 'top' ? 'top' : 'bottom'
94
- };
95
- log('[render] disabled? ', disabled);
96
- const teacherInstructionsDiv = /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
97
- defaultClassName: "teacher-instructions",
98
- prompt: teacherInstructions
99
- });
100
- const languageCharactersProps = [];
101
- if (spanishInput) {
102
- languageCharactersProps.push({
103
- language: 'spanish'
104
- });
105
- }
106
- if (specialInput) {
107
- languageCharactersProps.push({
108
- language: 'special'
109
- });
110
- }
111
- return /*#__PURE__*/_react.default.createElement(MainContainer, {
112
- extraCSSRules: extraCSSRules,
113
- ref: ref => {
114
- this.containerRef = ref;
115
- }
116
- }, /*#__PURE__*/_react.default.createElement(SrOnly, null, "Constructed Response Question"), teacherInstructions && /*#__PURE__*/_react.default.createElement(TeacherInstructions, null, !animationsDisabled ? /*#__PURE__*/_react.default.createElement(_renderUi.Collapsible, {
117
- labels: {
118
- hidden: 'Show Teacher Instructions',
119
- visible: 'Hide Teacher Instructions'
120
- }
121
- }, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && /*#__PURE__*/_react.default.createElement(StyledPrompt, {
122
- component: 'span'
123
- }, /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
124
- defaultClassName: "prompt",
125
- prompt: model.prompt
126
- })), annotatorMode ? /*#__PURE__*/_react.default.createElement(_annotationEditor.default, {
127
- text: value || '',
128
- annotations: annotations || [],
129
- comment: comment || '',
130
- predefinedAnnotations: predefinedAnnotations || [],
131
- onChange: onAnnotationsChange,
132
- onCommentChange: this.changeSessionComment,
133
- width: width,
134
- height: height,
135
- maxHeight: maxHeight,
136
- disabled: disabledAnnotator,
137
- disabledMath: !mathInput,
138
- customKeys: customKeys,
139
- keypadMode: equationEditor
140
- }) : /*#__PURE__*/_react.default.createElement(Editor, {
141
- className: "response-area-editor",
142
- onChange: this.changeSessionValue,
143
- markup: value || '',
144
- maxWidth: width && width.toString(),
145
- minWidth: '100px',
146
- minHeight: height && height.toString(),
147
- maxHeight: maxHeight,
148
- disabled: disabled,
149
- highlightShape: true,
150
- toolbarOpts: toolbarOpts,
151
- spellCheck: spellCheckEnabled,
152
- charactersLimit: 50000,
153
- autoWidthToolbar: true,
154
- pluginProps: {
155
- math: {
156
- disabled: !mathInput,
157
- customKeys: this.props.model.customKeys,
158
- keypadMode: this.props.model.equationEditor,
159
- controlledKeypadMode: false
160
- },
161
- video: {
162
- disabled: true
163
- },
164
- audio: {
165
- disabled: true
166
- },
167
- table: {
168
- disabled: true
169
- },
170
- textAlign: {
171
- disabled: true
172
- },
173
- h3: {
174
- disabled: true
175
- },
176
- separateParagraphs: {
177
- disabled: false
178
- },
179
- ul_list: {
180
- disabled: true
181
- },
182
- ol_list: {
183
- disabled: true
184
- }
185
- },
186
- languageCharactersProps: languageCharactersProps
187
- }), feedback && /*#__PURE__*/_react.default.createElement(_renderUi.Feedback, {
188
- correctness: "correct",
189
- feedback: feedback
190
- }));
191
- }
192
- }
193
- exports.Main = Main;
194
- (0, _defineProperty2.default)(Main, "propTypes", {
195
- onValueChange: _propTypes.default.func.isRequired,
196
- onAnnotationsChange: _propTypes.default.func.isRequired,
197
- onCommentChange: _propTypes.default.func.isRequired,
198
- model: _propTypes.default.object,
199
- session: _propTypes.default.shape({
200
- value: _propTypes.default.string,
201
- annotations: _propTypes.default.array,
202
- comment: _propTypes.default.string
203
- }).isRequired
204
- });
205
- var _default = exports.default = Main;
206
- //# sourceMappingURL=main.js.map
package/lib/main.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_lodashEs","_debug","_Typography","_styles","_editableHtmlTipTap","_renderUi","_annotationEditor","log","debug","MainContainer","styled","UiLayout","backgroundColor","color","background","text","StyledPrompt","Typography","theme","width","marginBottom","spacing","fontSize","display","TeacherInstructions","Editor","EditableHtml","borderRadius","SrOnly","position","left","top","height","overflow","Main","React","Component","constructor","args","_defineProperty2","default","debounce","props","onValueChange","onCommentChange","render","model","session","onAnnotationsChange","animationsDisabled","annotatorMode","customKeys","dimensions","disabled","disabledAnnotator","equationEditor","extraCSSRules","feedback","mathInput","playersToolbarPosition","predefinedAnnotations","prompt","spanishInput","specialInput","spellCheckEnabled","teacherInstructions","annotations","comment","value","maxHeight","toolbarOpts","teacherInstructionsDiv","createElement","PreviewPrompt","defaultClassName","languageCharactersProps","push","language","ref","containerRef","Collapsible","labels","hidden","visible","component","onChange","changeSessionComment","disabledMath","keypadMode","className","changeSessionValue","markup","maxWidth","toString","minWidth","minHeight","highlightShape","spellCheck","charactersLimit","autoWidthToolbar","pluginProps","math","controlledKeypadMode","video","audio","table","textAlign","h3","separateParagraphs","ul_list","ol_list","Feedback","correctness","exports","PropTypes","func","isRequired","object","shape","string","array","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { debounce } from 'lodash-es';\nimport debug from 'debug';\n\nimport Typography from '@mui/material/Typography';\nimport { styled } from '@mui/material/styles';\n\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { color, Feedback, Collapsible, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\n\nimport AnnotationEditor from './annotation/annotation-editor';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst MainContainer = styled(UiLayout)({\n backgroundColor: color.background(),\n color: color.text(),\n});\n\nconst StyledPrompt = styled(Typography)(({ theme }) => ({\n width: '100%',\n color: color.text(),\n marginBottom: theme.spacing(2),\n fontSize: 'inherit',\n display: 'block',\n}));\n\nconst TeacherInstructions = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst Editor = styled(EditableHtml)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n borderRadius: '4px',\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n onValueChange: PropTypes.func.isRequired,\n onAnnotationsChange: PropTypes.func.isRequired,\n onCommentChange: PropTypes.func.isRequired,\n model: PropTypes.object,\n session: PropTypes.shape({\n value: PropTypes.string,\n annotations: PropTypes.array,\n comment: PropTypes.string,\n }).isRequired,\n };\n\n changeSessionValue = debounce(this.props.onValueChange, 1500);\n\n changeSessionComment = debounce(this.props.onCommentChange, 1500);\n\n render() {\n const { model, session, onAnnotationsChange } = this.props;\n const {\n animationsDisabled,\n annotatorMode,\n customKeys,\n dimensions,\n disabled,\n disabledAnnotator,\n equationEditor,\n extraCSSRules,\n feedback,\n mathInput,\n playersToolbarPosition,\n predefinedAnnotations,\n prompt,\n spanishInput,\n specialInput,\n spellCheckEnabled,\n teacherInstructions,\n } = model;\n const { annotations, comment, value } = session;\n const { width, height } = dimensions || {};\n const maxHeight = '40vh';\n const toolbarOpts = { position: playersToolbarPosition === 'top' ? 'top' : 'bottom' };\n\n log('[render] disabled? ', disabled);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const languageCharactersProps = [];\n\n if (spanishInput) {\n languageCharactersProps.push({ language: 'spanish' });\n }\n\n if (specialInput) {\n languageCharactersProps.push({ language: 'special' });\n }\n\n return (\n <MainContainer\n extraCSSRules={extraCSSRules}\n ref={(ref) => {\n this.containerRef = ref;\n }}\n >\n <SrOnly>Constructed Response Question</SrOnly>\n\n {teacherInstructions && (\n <TeacherInstructions>\n {!animationsDisabled ? (\n <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </TeacherInstructions>\n )}\n\n {prompt && (\n <StyledPrompt component={'span'}>\n <PreviewPrompt defaultClassName=\"prompt\" prompt={model.prompt} />\n </StyledPrompt>\n )}\n\n {annotatorMode ? (\n <AnnotationEditor\n text={value || ''}\n annotations={annotations || []}\n comment={comment || ''}\n predefinedAnnotations={predefinedAnnotations || []}\n onChange={onAnnotationsChange}\n onCommentChange={this.changeSessionComment}\n width={width}\n height={height}\n maxHeight={maxHeight}\n disabled={disabledAnnotator}\n disabledMath={!mathInput}\n customKeys={customKeys}\n keypadMode={equationEditor}\n />\n ) : (\n <Editor\n className=\"response-area-editor\"\n onChange={this.changeSessionValue}\n markup={value || ''}\n maxWidth={width && width.toString()}\n minWidth={'100px'}\n minHeight={height && height.toString()}\n maxHeight={maxHeight}\n disabled={disabled}\n highlightShape={true}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n charactersLimit={50000}\n autoWidthToolbar\n pluginProps={{\n math: {\n disabled: !mathInput,\n customKeys: this.props.model.customKeys,\n keypadMode: this.props.model.equationEditor,\n controlledKeypadMode: false,\n },\n video: {\n disabled: true,\n },\n audio: {\n disabled: true,\n },\n table: {\n disabled: true,\n },\n textAlign: {\n disabled: true,\n },\n h3: {\n disabled: true,\n },\n separateParagraphs: { disabled: false },\n ul_list: { disabled: true },\n ol_list: { disabled: true },\n }}\n languageCharactersProps={languageCharactersProps}\n />\n )}\n\n {feedback && <Feedback correctness=\"correct\" feedback={feedback} />}\n </MainContainer>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAEA,IAAAM,mBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,MAAMS,GAAG,GAAG,IAAAC,cAAK,EAAC,6BAA6B,CAAC;AAEhD,MAAMC,aAAa,GAAG,IAAAC,cAAM,EAACC,kBAAQ,CAAC,CAAC;EACrCC,eAAe,EAAEC,eAAK,CAACC,UAAU,CAAC,CAAC;EACnCD,KAAK,EAAEA,eAAK,CAACE,IAAI,CAAC;AACpB,CAAC,CAAC;AAEF,MAAMC,YAAY,GAAG,IAAAN,cAAM,EAACO,mBAAU,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACtDC,KAAK,EAAE,MAAM;EACbN,KAAK,EAAEA,eAAK,CAACE,IAAI,CAAC,CAAC;EACnBK,YAAY,EAAEF,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC;EAC9BC,QAAQ,EAAE,SAAS;EACnBC,OAAO,EAAE;AACX,CAAC,CAAC,CAAC;AAEH,MAAMC,mBAAmB,GAAG,IAAAd,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEQ;AAAM,CAAC,MAAM;EACxDE,YAAY,EAAEF,KAAK,CAACG,OAAO,CAAC,CAAC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