@cu-mkp/editioncrafter 1.0.2 → 1.0.4-beta.1

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 (57) hide show
  1. package/README.md +7 -7
  2. package/dist/editioncrafter.js +65802 -0
  3. package/dist/editioncrafter.umd.cjs +553 -0
  4. package/dist/es/src/action/DiplomaticActions.js +9 -11
  5. package/dist/es/src/action/DocumentActions.js +164 -154
  6. package/dist/es/src/action/GlossaryActions.js +9 -11
  7. package/dist/es/src/action/initialState/diplomaticInitialState.js +2 -2
  8. package/dist/es/src/action/initialState/documentInitialState.js +9 -12
  9. package/dist/es/src/action/initialState/glossaryInitialState.js +3 -3
  10. package/dist/es/src/action/rootReducer.js +31 -29
  11. package/dist/es/src/component/AlphabetLinks.js +44 -66
  12. package/dist/es/src/component/CustomizedTooltops.js +101 -110
  13. package/dist/es/src/component/DiploMatic.js +64 -91
  14. package/dist/es/src/component/DocumentView.js +442 -366
  15. package/dist/es/src/component/EditorComment.js +51 -75
  16. package/dist/es/src/component/ErrorBoundary.js +37 -61
  17. package/dist/es/src/component/FigureImage.js +56 -67
  18. package/dist/es/src/component/GlossaryView.js +157 -149
  19. package/dist/es/src/component/HelpPopper.js +96 -78
  20. package/dist/es/src/component/ImageGridView.js +184 -249
  21. package/dist/es/src/component/ImageView.js +155 -165
  22. package/dist/es/src/component/ImageZoomControl.js +19 -38
  23. package/dist/es/src/component/JumpToFolio.js +56 -60
  24. package/dist/es/src/component/Navigation.js +374 -328
  25. package/dist/es/src/component/Pagination.js +73 -70
  26. package/dist/es/src/component/Parser.js +11 -32
  27. package/dist/es/src/component/RingSpinner.js +31 -32
  28. package/dist/es/src/component/RouteListener.js +30 -21
  29. package/dist/es/src/component/SeaDragonComponent.js +33 -56
  30. package/dist/es/src/component/SinglePaneView.js +15 -33
  31. package/dist/es/src/component/SplitPaneView.js +151 -170
  32. package/dist/es/src/component/TranscriptionView.js +190 -179
  33. package/dist/es/src/component/Watermark.js +21 -30
  34. package/dist/es/src/component/XMLView.js +60 -82
  35. package/dist/es/src/hooks/useIsWidthUp.js +9 -7
  36. package/dist/es/src/icons/ByIcon.js +16 -16
  37. package/dist/es/src/icons/CcIcon.js +16 -16
  38. package/dist/es/src/icons/NcIcon.js +16 -16
  39. package/dist/es/src/icons/SaIcon.js +16 -16
  40. package/dist/es/src/icons/SideMenuIconLeft.js +30 -38
  41. package/dist/es/src/icons/SideMenuIconRight.js +32 -38
  42. package/dist/es/src/index.js +21 -20
  43. package/dist/es/src/lib/copyObject.js +3 -2
  44. package/dist/es/src/lib/registerServiceWorker.js +77 -54
  45. package/dist/es/src/model/DocumentHelper.js +7 -6
  46. package/dist/es/src/model/Folio.js +64 -86
  47. package/dist/es/src/model/ReduxStore.js +32 -78
  48. package/dist/es/src/model/folioLayout.js +275 -280
  49. package/dist/es/src/saga/RouteListenerSaga.js +89 -193
  50. package/dist/es/src/saga/rootSaga.js +9 -16
  51. package/dist/es/src/scss/_imageView.scss +1 -1
  52. package/dist/es/src/scss/_navigation.scss +1 -1
  53. package/dist/es/src/scss/editioncrafter.scss +1 -1
  54. package/dist/style.css +1 -0
  55. package/package.json +36 -51
  56. package/dist/editioncrafter.min.js +0 -2
  57. package/dist/editioncrafter.min.js.LICENSE.txt +0 -144
@@ -1,75 +1,51 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useState } from 'react';
8
- import Typography from '@material-ui/core/Typography';
9
- import Popper from '@material-ui/core/Popper';
10
- import Fade from '@material-ui/core/Fade';
11
- import Paper from '@material-ui/core/Paper';
12
- import Parser from 'html-react-parser';
13
- var EditorComment = function EditorComment(props) {
14
- var _useState = useState(null),
15
- _useState2 = _slicedToArray(_useState, 2),
16
- anchorRef = _useState2[0],
17
- setAnchorRef = _useState2[1];
18
- var _useState3 = useState(false),
19
- _useState4 = _slicedToArray(_useState3, 2),
20
- open = _useState4[0],
21
- setOpen = _useState4[1];
22
- var onOpen = function onOpen(event) {
23
- setAnchorRef(event.currentTarget);
24
- setOpen(true);
25
- };
26
- var onClose = function onClose(event) {
27
- setOpen(false);
28
- };
29
- var renderPopper = function renderPopper() {
30
- var interpreted = Parser(props.text);
31
- var content = interpreted || "ERROR: Could not find comment for id: ".concat(props.commentID, ".");
32
- var style = {
33
- maxWidth: 200,
34
- padding: '25px 15px 15px 15px'
35
- };
36
- var closeXStyle = {
37
- "float": 'right',
38
- padding: 5,
39
- fontStyle: 'bold'
40
- };
41
- return /*#__PURE__*/React.createElement(Popper, {
42
- id: props.commentID,
43
- open: open,
44
- anchorEl: anchorRef
45
- }, /*#__PURE__*/React.createElement(Fade, {
46
- "in": open
47
- }, /*#__PURE__*/React.createElement(Paper, {
48
- className: "editor-comment-content"
49
- }, /*#__PURE__*/React.createElement("div", {
50
- onClick: onClose,
51
- style: closeXStyle
52
- }, /*#__PURE__*/React.createElement("span", {
53
- className: "fa fa-window-close"
54
- })), /*#__PURE__*/React.createElement(Typography, {
55
- style: style
56
- }, content))));
57
- };
58
- var style = {
59
- display: 'inline'
60
- };
61
- var asteriskStyle = {
62
- fontStyle: 'bold',
63
- fontSize: '18pt',
64
- color: 'red'
65
- };
66
- return /*#__PURE__*/React.createElement("div", {
67
- style: style
68
- }, /*#__PURE__*/React.createElement("span", {
69
- onClick: function onClick(e) {
70
- return onOpen(e);
71
- },
72
- style: asteriskStyle
73
- }, "*"), renderPopper());
74
- };
75
- export default EditorComment;
1
+ import Fade from '@material-ui/core/Fade'
2
+ import Paper from '@material-ui/core/Paper'
3
+ import Popper from '@material-ui/core/Popper'
4
+ import Typography from '@material-ui/core/Typography'
5
+ import Parser from 'html-react-parser'
6
+ import React, { useState } from 'react'
7
+
8
+ function EditorComment(props) {
9
+ const [anchorRef, setAnchorRef] = useState(null)
10
+ const [open, setOpen] = useState(false)
11
+
12
+ const onOpen = (event) => {
13
+ setAnchorRef(event.currentTarget)
14
+ setOpen(true)
15
+ }
16
+
17
+ const onClose = (event) => {
18
+ setOpen(false)
19
+ }
20
+
21
+ const renderPopper = () => {
22
+ const interpreted = Parser(props.text)
23
+ const content = interpreted || `ERROR: Could not find comment for id: ${props.commentID}.`
24
+ const style = { maxWidth: 200, padding: '25px 15px 15px 15px' }
25
+ const closeXStyle = { float: 'right', padding: 5, fontStyle: 'bold' }
26
+
27
+ return (
28
+ <Popper id={props.commentID} open={open} anchorEl={anchorRef}>
29
+ <Fade in={open}>
30
+ <Paper className="editor-comment-content">
31
+ <div onClick={onClose} style={closeXStyle}>
32
+ <span className="fa fa-window-close" />
33
+ </div>
34
+ <Typography style={style}>{content}</Typography>
35
+ </Paper>
36
+ </Fade>
37
+ </Popper>
38
+ )
39
+ }
40
+
41
+ const style = { display: 'inline' }
42
+ const asteriskStyle = { fontStyle: 'bold', fontSize: '18pt', color: 'red' }
43
+ return (
44
+ <div style={style}>
45
+ <span onClick={e => onOpen(e)} style={asteriskStyle}>*</span>
46
+ {renderPopper()}
47
+ </div>
48
+ )
49
+ }
50
+
51
+ export default EditorComment
@@ -1,63 +1,39 @@
1
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
7
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
10
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
13
- import React, { Component } from 'react';
14
- var CommentErrorBoundary = /*#__PURE__*/function (_Component) {
15
- _inherits(CommentErrorBoundary, _Component);
16
- var _super = _createSuper(CommentErrorBoundary);
17
- function CommentErrorBoundary(props) {
18
- var _this;
19
- _classCallCheck(this, CommentErrorBoundary);
20
- _this = _super.call(this, props);
21
- _this.state = {
22
- error: null,
23
- errorInfo: null
24
- };
25
- return _this;
1
+ import React, { Component } from 'react'
2
+
3
+ export default class CommentErrorBoundary extends Component {
4
+ constructor(props) {
5
+ super(props)
6
+ this.state = { error: null, errorInfo: null }
26
7
  }
27
- _createClass(CommentErrorBoundary, [{
28
- key: "componentDidCatch",
29
- value: function componentDidCatch(error, errorInfo) {
30
- this.setState({
31
- error: error,
32
- errorInfo: errorInfo
33
- });
34
- }
35
- }, {
36
- key: "render",
37
- value: function render() {
38
- if (this.state.errorInfo) {
39
- return /*#__PURE__*/React.createElement("div", {
40
- style: {
41
- height: '350px',
42
- overflowY: 'scroll'
43
- }
44
- }, /*#__PURE__*/React.createElement("h2", null, "Something went wrong."), /*#__PURE__*/React.createElement("details", {
45
- style: {
46
- whiteSpace: 'pre-wrap'
47
- }
48
- }, "There has been an error rendering a comment", /*#__PURE__*/React.createElement("br", null), this.state.error && this.state.error.toString(), /*#__PURE__*/React.createElement("br", null), this.state.errorInfo.componentStack));
49
- }
50
- return this.props.children;
51
- }
52
- }], [{
53
- key: "getDerivedStateFromError",
54
- value: function getDerivedStateFromError(error) {
55
- // Update state so the next render will show the fallback UI.
56
- return {
57
- error: true
58
- };
8
+
9
+ static getDerivedStateFromError(error) {
10
+ // Update state so the next render will show the fallback UI.
11
+ return { error: true }
12
+ }
13
+
14
+ componentDidCatch(error, errorInfo) {
15
+ this.setState({
16
+ error,
17
+ errorInfo,
18
+ })
19
+ }
20
+
21
+ render() {
22
+ if (this.state.errorInfo) {
23
+ return (
24
+ <div style={{ height: '350px', overflowY: 'scroll' }}>
25
+ <h2>Something went wrong.</h2>
26
+ <details style={{ whiteSpace: 'pre-wrap' }}>
27
+ There has been an error rendering a comment
28
+ <br />
29
+
30
+ {this.state.error && this.state.error.toString()}
31
+ <br />
32
+ {this.state.errorInfo.componentStack}
33
+ </details>
34
+ </div>
35
+ )
59
36
  }
60
- }]);
61
- return CommentErrorBoundary;
62
- }(Component);
63
- export { CommentErrorBoundary as default };
37
+ return this.props.children
38
+ }
39
+ }
@@ -1,21 +1,14 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React from 'react';
8
- import Dialog from '@material-ui/core/Dialog';
9
- import IconButton from '@material-ui/core/IconButton';
10
- import CloseIcon from '@material-ui/icons/Cancel';
11
- var FigureDialog = function FigureDialog(_ref) {
12
- var img = _ref.img,
13
- onClose = _ref.onClose,
14
- open = _ref.open;
15
- var handleClose = function handleClose() {
16
- onClose();
17
- };
18
- var closeButtonBackground = {
1
+ import Dialog from '@material-ui/core/Dialog'
2
+ import IconButton from '@material-ui/core/IconButton'
3
+ import CloseIcon from '@material-ui/icons/Cancel'
4
+ import React from 'react'
5
+
6
+ function FigureDialog({ img, onClose, open }) {
7
+ const handleClose = () => {
8
+ onClose()
9
+ }
10
+
11
+ const closeButtonBackground = {
19
12
  position: 'absolute',
20
13
  right: 0,
21
14
  width: 50,
@@ -23,52 +16,48 @@ var FigureDialog = function FigureDialog(_ref) {
23
16
  display: 'flex',
24
17
  justifyContent: 'center',
25
18
  backgroundColor: 'rgb(0,0,0,0.2)',
26
- borderRadius: '0 0 0 50%'
27
- };
28
- return /*#__PURE__*/React.createElement(Dialog, {
29
- onClose: handleClose,
30
- open: open,
31
- PaperProps: {
32
- style: {
33
- maxWidth: '90%',
34
- maxHeight: '80%'
35
- }
36
- }
37
- }, /*#__PURE__*/React.createElement("div", {
38
- className: "figure-dialog-img-container",
39
- style: {
40
- overflowY: 'scroll'
41
- }
42
- }, img), /*#__PURE__*/React.createElement("div", {
43
- style: closeButtonBackground
44
- }, /*#__PURE__*/React.createElement(IconButton, {
45
- style: {
46
- color: 'white',
47
- position: 'absolute'
48
- },
49
- onClick: handleClose
50
- }, /*#__PURE__*/React.createElement(CloseIcon, null))));
51
- };
52
- var FigureImage = function FigureImage(_ref2) {
53
- var img = _ref2.img;
54
- var _React$useState = React.useState(false),
55
- _React$useState2 = _slicedToArray(_React$useState, 2),
56
- open = _React$useState2[0],
57
- setOpen = _React$useState2[1];
58
- var handleClickOpen = function handleClickOpen() {
59
- setOpen(true);
60
- };
61
- var handleClose = function handleClose(value) {
62
- setOpen(false);
63
- };
64
- return /*#__PURE__*/React.createElement("div", {
65
- className: "figure-image-container"
66
- }, /*#__PURE__*/React.createElement("div", {
67
- onClick: handleClickOpen
68
- }, img), /*#__PURE__*/React.createElement(FigureDialog, {
69
- open: open,
70
- onClose: handleClose,
71
- img: img
72
- }));
73
- };
74
- export default FigureImage;
19
+ borderRadius: '0 0 0 50%',
20
+ }
21
+
22
+ return (
23
+ <Dialog
24
+ onClose={handleClose}
25
+ open={open}
26
+ PaperProps={{ style: { maxWidth: '90%', maxHeight: '80%' } }}
27
+ >
28
+ <div className="figure-dialog-img-container" style={{ overflowY: 'scroll' }}>
29
+ {img}
30
+ </div>
31
+ <div style={closeButtonBackground}>
32
+ <IconButton style={{ color: 'white', position: 'absolute' }} onClick={handleClose}>
33
+ <CloseIcon />
34
+ </IconButton>
35
+ </div>
36
+ </Dialog>
37
+ )
38
+ }
39
+
40
+ FigureDialog.propTypes = {
41
+ }
42
+
43
+ function FigureImage({ img }) {
44
+ const [open, setOpen] = React.useState(false)
45
+
46
+ const handleClickOpen = () => {
47
+ setOpen(true)
48
+ }
49
+ const handleClose = (value) => {
50
+ setOpen(false)
51
+ }
52
+
53
+ return (
54
+ <div className="figure-image-container">
55
+ <div onClick={handleClickOpen}>
56
+ {img}
57
+ </div>
58
+ <FigureDialog open={open} onClose={handleClose} img={img} />
59
+ </div>
60
+ )
61
+ }
62
+
63
+ export default FigureImage