@pie-element/extended-text-entry 15.1.1-next.11 → 15.1.2-next.0
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.
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/defaults.d.ts +166 -0
- package/dist/author/defaults.js +209 -0
- package/dist/author/index.d.ts +52 -0
- package/dist/author/index.js +74 -0
- package/dist/author/main.d.ts +26 -0
- package/dist/author/main.js +166 -0
- package/dist/browser/author/index.js +495 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/browser-kkT1XVKw.js +210 -0
- package/dist/browser/browser-kkT1XVKw.js.map +1 -0
- package/dist/browser/controller/index.js +184 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +98 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-D8VooYkz.js +49034 -0
- package/dist/browser/dist-D8VooYkz.js.map +1 -0
- package/dist/browser/extended-text-entry.css +2 -0
- package/dist/browser/main-C2oHx_V9.js +714 -0
- package/dist/browser/main-C2oHx_V9.js.map +1 -0
- package/dist/browser/print/index.js +53 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/controller/defaults.d.ts +33 -0
- package/dist/controller/defaults.js +104 -0
- package/dist/controller/index.d.ts +59 -0
- package/dist/controller/index.js +72 -0
- package/dist/delivery/annotation/annotation-editor.d.ts +47 -0
- package/dist/delivery/annotation/annotation-editor.js +296 -0
- package/dist/delivery/annotation/annotation-menu.d.ts +25 -0
- package/dist/delivery/annotation/annotation-menu.js +113 -0
- package/dist/delivery/annotation/annotation-utils.d.ts +20 -0
- package/dist/delivery/annotation/annotation-utils.js +65 -0
- package/dist/delivery/annotation/freeform-editor.d.ts +30 -0
- package/dist/delivery/annotation/freeform-editor.js +143 -0
- package/dist/delivery/index.d.ts +23 -0
- package/dist/delivery/index.js +68 -0
- package/dist/delivery/main.d.ts +27 -0
- package/dist/delivery/main.js +134 -0
- package/dist/extended-text-entry.css +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +403 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/print/index.d.ts +15 -0
- package/dist/print/index.js +49 -0
- package/package.json +83 -21
- package/CHANGELOG.json +0 -1282
- package/CHANGELOG.md +0 -2260
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -922
- package/configure/CHANGELOG.md +0 -1949
- package/configure/lib/defaults.js +0 -224
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -125
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -247
- package/configure/lib/main.js.map +0 -1
- package/configure/package.json +0 -23
- package/controller/CHANGELOG.json +0 -362
- package/controller/CHANGELOG.md +0 -1179
- package/controller/lib/defaults.js +0 -91
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -101
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -16
- package/docs/config-schema.json +0 -1782
- package/docs/config-schema.json.md +0 -1333
- package/docs/demo/config.js +0 -7
- package/docs/demo/generate.js +0 -14
- package/docs/demo/index.html +0 -3
- package/docs/demo/session.js +0 -7
- package/docs/pie-schema.json +0 -954
- package/docs/pie-schema.json.md +0 -717
- package/lib/annotation/annotation-editor.js +0 -636
- package/lib/annotation/annotation-editor.js.map +0 -1
- package/lib/annotation/annotation-menu.js +0 -147
- package/lib/annotation/annotation-menu.js.map +0 -1
- package/lib/annotation/annotation-utils.js +0 -205
- package/lib/annotation/annotation-utils.js.map +0 -1
- package/lib/annotation/freeform-editor.js +0 -241
- package/lib/annotation/freeform-editor.js.map +0 -1
- package/lib/index.js +0 -108
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -205
- package/lib/main.js.map +0 -1
- package/lib/print.js +0 -86
- package/lib/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -139
- package/module/demo.js +0 -38
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -76
- package/module/print.html +0 -18
- package/module/print.js +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,QAAQ,EAAE,UAAU;MACpBC,KAAK,EAAE,MAAM;MACbC,GAAG,EAAE,MAAM;MACXC,MAAM,EAAE,mBAAmB;MAC3BC,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,aAAa,EAAE,MAAM;MACrBC,WAAW,EAAE,KAAK;MAClBC,gBAAgB,EAAEd,KAAK,CAACe,OAAO,CAACC,IAAI,CAAC,GAAG;IAC1C,CAAC;IACD,IAAIf,cAAc,KAAK,UAAU,IAAI;MACnC,WAAW,EAAE;QACXa,gBAAgB,EAAE;MACpB;IACF,CAAC,CAAC;IACF,IAAIb,cAAc,KAAK,UAAU,IAAI;MACnC,WAAW,EAAE;QACXa,gBAAgB,EAAE;MACpB;IACF,CAAC;EACH;AACF,CAAC,CAAC,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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,108 +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
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.default = RootExtendedTextEntry;
|
|
108
|
-
//# 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 }\n }\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAEA,MAAMM,GAAG,GAAG,IAAAC,cAAK,EAAC,mCAAmC,CAAC;AAEtD,MAAMC,SAAS,GAAG,OAAOC,MAAM,KAAKC,SAAS,GAAG,IAAIC,SAAS,CAAC,CAAC,GAAG;EAAEC,eAAe,EAAGC,CAAC,IAAKA;AAAE,CAAC;AAExF,SAASC,WAAWA,CAACC,KAAK,EAAE;EACjC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOL,SAAS;EAClB;EAEA,IAAI;IACF,MAAMM,QAAQ,GAAGR,SAAS,CAACI,eAAe,CAACG,KAAK,EAAE,WAAW,CAAC;IAC9D,MAAMD,WAAW,GAAGE,QAAQ,CAACC,IAAI,CAACH,WAAW;IAE7C,OAAOA,WAAW;EACpB,CAAC,CAAC,OAAOI,GAAG,EAAE;IACZZ,GAAG,CAAC,kCAAkC,EAAES,KAAK,CAAC;IAC9C,OAAOA,KAAK;EACd;AACF;AAEO,SAASI,UAAUA,CAACJ,KAAK,EAAE;EAChC,MAAMK,EAAE,GAAGN,WAAW,CAACC,KAAK,CAAC;EAC7B,MAAMM,GAAG,GAAGD,EAAE,KAAKV,SAAS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C,IAAI;MAC/C,CAAC,CAAC;MAEF,IAAI,CAAC1B,gBAAgB,CAAC,CAAC;MAEvB,IAAI,CAAC,IAAI,CAACD,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAA8B,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAAC9B,KAAK,CAACY,MAAM,CAACU,IAAI,CAAC;MACvBS,cAAc,CAAC,MAAM;QACnB,IAAAC,yBAAU,EAAC,IAAI,CAAC;MAClB,CAAC,CAAC;IACJ;EACF;EAEAC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACjC,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACkC,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAAzC,qBAAA","ignoreList":[]}
|
package/lib/main.js
DELETED
|
@@ -1,205 +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
|
-
}));
|
|
31
|
-
const TeacherInstructions = (0, _styles.styled)('div')(({
|
|
32
|
-
theme
|
|
33
|
-
}) => ({
|
|
34
|
-
marginBottom: theme.spacing(2)
|
|
35
|
-
}));
|
|
36
|
-
const Editor = (0, _styles.styled)(_editableHtmlTipTap.default)(({
|
|
37
|
-
theme
|
|
38
|
-
}) => ({
|
|
39
|
-
marginBottom: theme.spacing(2),
|
|
40
|
-
borderRadius: '4px'
|
|
41
|
-
}));
|
|
42
|
-
const SrOnly = (0, _styles.styled)('h2')({
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
left: '-10000px',
|
|
45
|
-
top: 'auto',
|
|
46
|
-
width: '1px',
|
|
47
|
-
height: '1px',
|
|
48
|
-
overflow: 'hidden'
|
|
49
|
-
});
|
|
50
|
-
class Main extends _react.default.Component {
|
|
51
|
-
constructor(...args) {
|
|
52
|
-
super(...args);
|
|
53
|
-
(0, _defineProperty2.default)(this, "changeSessionValue", (0, _lodashEs.debounce)(this.props.onValueChange, 1500));
|
|
54
|
-
(0, _defineProperty2.default)(this, "changeSessionComment", (0, _lodashEs.debounce)(this.props.onCommentChange, 1500));
|
|
55
|
-
}
|
|
56
|
-
render() {
|
|
57
|
-
const {
|
|
58
|
-
model,
|
|
59
|
-
session,
|
|
60
|
-
onAnnotationsChange
|
|
61
|
-
} = this.props;
|
|
62
|
-
const {
|
|
63
|
-
animationsDisabled,
|
|
64
|
-
annotatorMode,
|
|
65
|
-
customKeys,
|
|
66
|
-
dimensions,
|
|
67
|
-
disabled,
|
|
68
|
-
disabledAnnotator,
|
|
69
|
-
equationEditor,
|
|
70
|
-
extraCSSRules,
|
|
71
|
-
feedback,
|
|
72
|
-
mathInput,
|
|
73
|
-
playersToolbarPosition,
|
|
74
|
-
predefinedAnnotations,
|
|
75
|
-
prompt,
|
|
76
|
-
spanishInput,
|
|
77
|
-
specialInput,
|
|
78
|
-
spellCheckEnabled,
|
|
79
|
-
teacherInstructions
|
|
80
|
-
} = model;
|
|
81
|
-
const {
|
|
82
|
-
annotations,
|
|
83
|
-
comment,
|
|
84
|
-
value
|
|
85
|
-
} = session;
|
|
86
|
-
const {
|
|
87
|
-
width,
|
|
88
|
-
height
|
|
89
|
-
} = dimensions || {};
|
|
90
|
-
const maxHeight = '40vh';
|
|
91
|
-
const toolbarOpts = {
|
|
92
|
-
position: playersToolbarPosition === 'top' ? 'top' : 'bottom'
|
|
93
|
-
};
|
|
94
|
-
log('[render] disabled? ', disabled);
|
|
95
|
-
const teacherInstructionsDiv = /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
|
|
96
|
-
defaultClassName: "teacher-instructions",
|
|
97
|
-
prompt: teacherInstructions
|
|
98
|
-
});
|
|
99
|
-
const languageCharactersProps = [];
|
|
100
|
-
if (spanishInput) {
|
|
101
|
-
languageCharactersProps.push({
|
|
102
|
-
language: 'spanish'
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (specialInput) {
|
|
106
|
-
languageCharactersProps.push({
|
|
107
|
-
language: 'special'
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return /*#__PURE__*/_react.default.createElement(MainContainer, {
|
|
111
|
-
extraCSSRules: extraCSSRules,
|
|
112
|
-
ref: ref => {
|
|
113
|
-
this.containerRef = ref;
|
|
114
|
-
}
|
|
115
|
-
}, /*#__PURE__*/_react.default.createElement(SrOnly, null, "Constructed Response Question"), teacherInstructions && /*#__PURE__*/_react.default.createElement(TeacherInstructions, null, !animationsDisabled ? /*#__PURE__*/_react.default.createElement(_renderUi.Collapsible, {
|
|
116
|
-
labels: {
|
|
117
|
-
hidden: 'Show Teacher Instructions',
|
|
118
|
-
visible: 'Hide Teacher Instructions'
|
|
119
|
-
}
|
|
120
|
-
}, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && /*#__PURE__*/_react.default.createElement(StyledPrompt, {
|
|
121
|
-
component: 'span'
|
|
122
|
-
}, /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
|
|
123
|
-
defaultClassName: "prompt",
|
|
124
|
-
prompt: model.prompt
|
|
125
|
-
})), annotatorMode ? /*#__PURE__*/_react.default.createElement(_annotationEditor.default, {
|
|
126
|
-
text: value || '',
|
|
127
|
-
annotations: annotations || [],
|
|
128
|
-
comment: comment || '',
|
|
129
|
-
predefinedAnnotations: predefinedAnnotations || [],
|
|
130
|
-
onChange: onAnnotationsChange,
|
|
131
|
-
onCommentChange: this.changeSessionComment,
|
|
132
|
-
width: width,
|
|
133
|
-
height: height,
|
|
134
|
-
maxHeight: maxHeight,
|
|
135
|
-
disabled: disabledAnnotator,
|
|
136
|
-
disabledMath: !mathInput,
|
|
137
|
-
customKeys: customKeys,
|
|
138
|
-
keypadMode: equationEditor
|
|
139
|
-
}) : /*#__PURE__*/_react.default.createElement(Editor, {
|
|
140
|
-
className: "response-area-editor",
|
|
141
|
-
onChange: this.changeSessionValue,
|
|
142
|
-
markup: value || '',
|
|
143
|
-
maxWidth: width && width.toString(),
|
|
144
|
-
minWidth: '100px',
|
|
145
|
-
minHeight: height && height.toString(),
|
|
146
|
-
maxHeight: maxHeight,
|
|
147
|
-
disabled: disabled,
|
|
148
|
-
highlightShape: true,
|
|
149
|
-
toolbarOpts: toolbarOpts,
|
|
150
|
-
spellCheck: spellCheckEnabled,
|
|
151
|
-
charactersLimit: 50000,
|
|
152
|
-
autoWidthToolbar: true,
|
|
153
|
-
pluginProps: {
|
|
154
|
-
math: {
|
|
155
|
-
disabled: !mathInput,
|
|
156
|
-
customKeys: this.props.model.customKeys,
|
|
157
|
-
keypadMode: this.props.model.equationEditor,
|
|
158
|
-
controlledKeypadMode: false
|
|
159
|
-
},
|
|
160
|
-
video: {
|
|
161
|
-
disabled: true
|
|
162
|
-
},
|
|
163
|
-
audio: {
|
|
164
|
-
disabled: true
|
|
165
|
-
},
|
|
166
|
-
table: {
|
|
167
|
-
disabled: true
|
|
168
|
-
},
|
|
169
|
-
textAlign: {
|
|
170
|
-
disabled: true
|
|
171
|
-
},
|
|
172
|
-
h3: {
|
|
173
|
-
disabled: true
|
|
174
|
-
},
|
|
175
|
-
separateParagraphs: {
|
|
176
|
-
disabled: false
|
|
177
|
-
},
|
|
178
|
-
ul_list: {
|
|
179
|
-
disabled: true
|
|
180
|
-
},
|
|
181
|
-
ol_list: {
|
|
182
|
-
disabled: true
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
languageCharactersProps: languageCharactersProps
|
|
186
|
-
}), feedback && /*#__PURE__*/_react.default.createElement(_renderUi.Feedback, {
|
|
187
|
-
correctness: "correct",
|
|
188
|
-
feedback: feedback
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
exports.Main = Main;
|
|
193
|
-
(0, _defineProperty2.default)(Main, "propTypes", {
|
|
194
|
-
onValueChange: _propTypes.default.func.isRequired,
|
|
195
|
-
onAnnotationsChange: _propTypes.default.func.isRequired,
|
|
196
|
-
onCommentChange: _propTypes.default.func.isRequired,
|
|
197
|
-
model: _propTypes.default.object,
|
|
198
|
-
session: _propTypes.default.shape({
|
|
199
|
-
value: _propTypes.default.string,
|
|
200
|
-
annotations: _propTypes.default.array,
|
|
201
|
-
comment: _propTypes.default.string
|
|
202
|
-
}).isRequired
|
|
203
|
-
});
|
|
204
|
-
var _default = exports.default = Main;
|
|
205
|
-
//# 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","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}));\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,s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