@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,184 +1,165 @@
1
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- 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); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
- 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); }
9
- 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); }
10
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11
- 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); }; }
12
- 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); }
13
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
- 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; } }
15
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
- import React, { Component } from 'react';
17
- import { connect } from 'react-redux';
18
- var SplitPaneView = /*#__PURE__*/function (_Component) {
19
- _inherits(SplitPaneView, _Component);
20
- var _super = _createSuper(SplitPaneView);
21
- function SplitPaneView(props) {
22
- var _this;
23
- _classCallCheck(this, SplitPaneView);
24
- _this = _super.call(this);
25
- // On drag, update the UI continuously
26
- _this.onDrag = function (e) {
27
- if (_this.dragging) {
28
- var whole = window.innerWidth - 2 * _this.dividerWidth;
29
- var left_viewWidth;
30
- var right_viewWidth;
31
- var third_viewWidth;
32
- if (_this.activeDivider === 1) {
33
- left_viewWidth = e.clientX - _this.dividerWidth / 2;
34
- third_viewWidth = whole * _this.splitFractionRight;
35
- right_viewWidth = whole - left_viewWidth - third_viewWidth;
36
- } else {
37
- third_viewWidth = whole - e.clientX - _this.dividerWidth / 2;
38
- left_viewWidth = whole * _this.splitFraction;
39
- right_viewWidth = whole - left_viewWidth - third_viewWidth;
40
- }
41
- // Update as long as we're within limits
42
- if (left_viewWidth >= _this.leftPaneMinWidth && right_viewWidth >= _this.rightPaneMinWidth && third_viewWidth >= _this.thirdPaneMinWidth) {
43
- console.log(whole, left_viewWidth, third_viewWidth);
44
- _this.splitFraction = whole === 0 ? 0.0 : left_viewWidth / whole;
45
- _this.splitFractionRight = whole === 0 ? 0.0 : third_viewWidth / whole;
46
- _this.updateUI();
47
- }
48
- _this.updatePaneSize();
49
- }
50
- };
51
- // Drag start: mark it
52
- _this.onStartDrag = function (position) {
53
- _this.dragging = true;
54
- _this.activeDivider = position === 'first' ? 1 : 2;
55
- };
56
- // Drag end
57
- _this.onEndDrag = function (e) {
58
- _this.dragging = false;
59
- _this.activeDivider = 0;
60
- };
61
- // On window resize
62
- _this.onResize = function (e) {
63
- _this.updatePaneSize();
64
- };
65
- _this.firstFolio = props.document.folios[0];
1
+ import React, { Component } from 'react'
2
+ import { connect } from 'react-redux'
3
+
4
+ class SplitPaneView extends Component {
5
+ constructor(props) {
6
+ super()
7
+ this.firstFolio = props.document.folios[0]
66
8
  // Initialize the splitter
67
- _this.rightPaneMinWidth = props.rightPane.props.documentView.right.transcriptionType === "glossary" ? 450 : 200;
68
- _this.leftPaneMinWidth = props.leftPane.props.documentView.left.transcriptionType === "glossary" ? 450 : 200;
69
- _this.thirdPaneMinWidth = props.thirdPane.props.documentView.third.transcriptionType === "glossary" ? 450 : props.thirdPane.props.documentView.third.transcriptionType === "g" ? 0 : 200;
70
- _this.splitFraction = props.threePanel ? 0.49 : 0.5;
71
- _this.splitFractionRight = props.threePanel ? 0.01 : 0;
72
- _this.dividerWidth = 16;
73
- var _whole = window.innerWidth;
74
- var leftW = _whole / 3;
75
- var split_left = leftW / _whole;
76
- var split_right = (1 - split_left) / 2;
77
- var split_third = 1 - split_left - split_right;
78
- _this.state = {
9
+ this.rightPaneMinWidth = props.rightPane.props.documentView.right.transcriptionType === 'glossary' ? 450 : 200
10
+ this.leftPaneMinWidth = props.leftPane.props.documentView.left.transcriptionType === 'glossary' ? 450 : 200
11
+ this.thirdPaneMinWidth = props.thirdPane.props.documentView.third.transcriptionType === 'glossary' ? 450 : props.thirdPane.props.documentView.third.transcriptionType === 'g' ? 0 : 200
12
+ this.splitFraction = props.threePanel ? 0.49 : 0.5
13
+ this.splitFractionRight = props.threePanel ? 0.01 : 0
14
+ this.dividerWidth = 16
15
+ const whole = window.innerWidth
16
+ const leftW = whole / 3
17
+
18
+ const split_left = (leftW / whole)
19
+ const split_right = (1 - split_left) / 2
20
+ const split_third = 1 - split_left - split_right
21
+ this.state = {
79
22
  style: {
80
- gridTemplateColumns: "".concat(_this.splitFraction, "fr ").concat(_this.dividerWidth, "px ").concat(1 - _this.splitFraction - _this.splitFractionRight, "fr ").concat(_this.dividerWidth, "px ").concat(_this.splitFractionRight, "fr")
81
- }
82
- };
23
+ gridTemplateColumns: `${this.splitFraction}fr ${this.dividerWidth}px ${1 - this.splitFraction - this.splitFractionRight}fr ${this.dividerWidth}px ${this.splitFractionRight}fr`,
24
+ },
25
+ }
83
26
 
84
27
  // event handlers
85
- _this.dragging = false;
86
- _this.activeDivider = 0;
87
- _this.onDrag = _this.onDrag.bind(_assertThisInitialized(_this));
88
- _this.onResize = _this.onResize.bind(_assertThisInitialized(_this));
89
- _this.onEndDrag = _this.onEndDrag.bind(_assertThisInitialized(_this));
90
- _this.updatePaneSize = _this.updatePaneSize.bind(_assertThisInitialized(_this));
91
- _this.updatePaneSize = _this.updatePaneSize.bind(_assertThisInitialized(_this));
92
- return _this;
28
+ this.dragging = false
29
+ this.activeDivider = 0
30
+ this.onDrag = this.onDrag.bind(this)
31
+ this.onResize = this.onResize.bind(this)
32
+ this.onEndDrag = this.onEndDrag.bind(this)
33
+ this.updatePaneSize = this.updatePaneSize.bind(this)
34
+ this.updatePaneSize = this.updatePaneSize.bind(this)
93
35
  }
94
- _createClass(SplitPaneView, [{
95
- key: "updateUI",
96
- value:
97
- // Update the screen with the new split info
98
- function updateUI() {
99
- var left = this.splitFraction;
100
- var third = this.splitFractionRight;
101
- var right = 1.0 - left - third;
102
- this.setState(_objectSpread(_objectSpread({}, this.state), {}, {
103
- style: _objectSpread(_objectSpread({}, this.state.style), {}, {
104
- gridTemplateColumns: "".concat(left, "fr ").concat(this.dividerWidth, "px ").concat(right, "fr ").concat(this.dividerWidth, "px ").concat(third, "fr")
105
- })
106
- }));
107
- }
108
36
 
109
- // Update the sizes of the panes
110
- }, {
111
- key: "updatePaneSize",
112
- value: function updatePaneSize() {
113
- // Record state change
114
- var left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction));
115
- var third_px = Math.floor(Math.abs(window.innerWidth * this.splitFractionRight));
116
- var right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction - this.splitFractionRight));
117
- if (this.props.onWidth && left_px >= this.leftPaneMinWidth && right_px >= this.rightPaneMinWidth && third_px >= this.thirdPaneMinWidth) {
118
- this.props.onWidth(left_px, right_px, third_px);
37
+ // On drag, update the UI continuously
38
+ onDrag = (e) => {
39
+ if (this.dragging) {
40
+ const whole = window.innerWidth - 2 * this.dividerWidth
41
+ let left_viewWidth
42
+ let right_viewWidth
43
+ let third_viewWidth
44
+ if (this.activeDivider === 1) {
45
+ left_viewWidth = e.clientX - this.dividerWidth / 2
46
+ third_viewWidth = whole * this.splitFractionRight
47
+ right_viewWidth = whole - left_viewWidth - third_viewWidth
119
48
  }
120
- }
121
- }, {
122
- key: "componentDidMount",
123
- value: function componentDidMount() {
124
- this.updateUI();
125
- window.addEventListener('pointermove', this.onDrag);
126
- window.addEventListener('pointerup', this.onEndDrag);
127
- window.addEventListener('resize', this.onResize);
128
- console.log(this.props);
129
- // Set the default width on mount
130
- if (this.props.onWidth) {
131
- var left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction));
132
- var right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction));
133
- var third_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction));
134
- this.props.onWidth(left_px, right_px, third_px);
49
+ else {
50
+ third_viewWidth = whole - e.clientX - this.dividerWidth / 2
51
+ left_viewWidth = whole * this.splitFraction
52
+ right_viewWidth = whole - left_viewWidth - third_viewWidth
135
53
  }
54
+ // Update as long as we're within limits
55
+ if (left_viewWidth >= this.leftPaneMinWidth
56
+ && right_viewWidth >= this.rightPaneMinWidth
57
+ && third_viewWidth >= this.thirdPaneMinWidth) {
58
+ this.splitFraction = (whole === 0) ? 0.0 : left_viewWidth / whole
59
+ this.splitFractionRight = (whole === 0) ? 0.0 : third_viewWidth / whole
60
+ this.updateUI()
61
+ }
62
+
63
+ this.updatePaneSize()
136
64
  }
137
- }, {
138
- key: "componentDidUpdate",
139
- value: function componentDidUpdate(prevProps) {
140
- this.rightPaneMinWidth = this.props.rightPane.props.documentView.right.transcriptionType === "glossary" ? 450 : 200;
141
- this.leftPaneMinWidth = this.props.leftPane.props.documentView.left.transcriptionType === "glossary" ? 450 : 200;
142
- this.thirdPaneMinWidth = this.props.thirdPane.props.documentView.third.transcriptionType === "glossary" ? 450 : this.props.thirdPane.props.documentView.third.transcriptionType === "g" ? 0 : 200;
143
- }
144
- }, {
145
- key: "componentWillUnmount",
146
- value: function componentWillUnmount() {
147
- window.removeEventListener('pointermove', this.onDrag);
148
- window.removeEventListener('pointerup', this.onEndDrag);
149
- window.removeEventListener('resize', this.onResize);
150
- }
151
- }, {
152
- key: "renderDivider",
153
- value: function renderDivider(position) {
154
- var _this2 = this;
155
- var drawerIconClass = 'drawer-icon fas fa-caret-left fa-2x';
156
- return /*#__PURE__*/React.createElement("div", {
157
- className: "divider ".concat(position, "_divider"),
158
- onPointerDown: function onPointerDown() {
159
- return _this2.onStartDrag(position);
160
- }
161
- }, /*#__PURE__*/React.createElement("div", {
162
- className: "drawer-button hidden",
163
- onClick: this.onDrawerButton
164
- }, /*#__PURE__*/React.createElement("i", {
165
- className: drawerIconClass
166
- }, " ")));
65
+ }
66
+
67
+ // Drag start: mark it
68
+ onStartDrag = (position) => {
69
+ this.dragging = true
70
+ this.activeDivider = position === 'first' ? 1 : 2
71
+ }
72
+
73
+ // Drag end
74
+ onEndDrag = (e) => {
75
+ this.dragging = false
76
+ this.activeDivider = 0
77
+ }
78
+
79
+ // On window resize
80
+ onResize = (e) => {
81
+ this.updatePaneSize()
82
+ }
83
+
84
+ // Update the screen with the new split info
85
+ updateUI() {
86
+ const left = this.splitFraction
87
+ const third = this.splitFractionRight
88
+ const right = 1.0 - left - third
89
+ this.setState({
90
+ ...this.state,
91
+ style: {
92
+ ...this.state.style,
93
+ gridTemplateColumns: `${left}fr ${this.dividerWidth}px ${right}fr ${this.dividerWidth}px ${third}fr`,
94
+ },
95
+ })
96
+ }
97
+
98
+ // Update the sizes of the panes
99
+ updatePaneSize() {
100
+ // Record state change
101
+ const left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction))
102
+ const third_px = Math.floor(Math.abs(window.innerWidth * this.splitFractionRight))
103
+ const right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction - this.splitFractionRight))
104
+ if (this.props.onWidth && left_px >= this.leftPaneMinWidth && right_px >= this.rightPaneMinWidth && third_px >= this.thirdPaneMinWidth) {
105
+ this.props.onWidth(left_px, right_px, third_px)
167
106
  }
168
- }, {
169
- key: "render",
170
- value: function render() {
171
- return /*#__PURE__*/React.createElement("div", {
172
- className: "split-pane-view three-pane",
173
- style: _objectSpread({}, this.state.style)
174
- }, this.props.leftPane, this.renderDivider('first'), this.props.rightPane, this.props.threePanel && this.renderDivider('second'), this.props.threePanel && this.props.thirdPane);
107
+ }
108
+
109
+ componentDidMount() {
110
+ this.updateUI()
111
+ window.addEventListener('pointermove', this.onDrag)
112
+ window.addEventListener('pointerup', this.onEndDrag)
113
+ window.addEventListener('resize', this.onResize)
114
+ // Set the default width on mount
115
+ if (this.props.onWidth) {
116
+ const left_px = Math.floor(Math.abs(window.innerWidth * this.splitFraction))
117
+ const right_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction))
118
+ const third_px = Math.floor(window.innerWidth * (1.0 - this.splitFraction))
119
+ this.props.onWidth(left_px, right_px, third_px)
175
120
  }
176
- }]);
177
- return SplitPaneView;
178
- }(Component);
121
+ }
122
+
123
+ componentDidUpdate(prevProps) {
124
+ this.rightPaneMinWidth = this.props.rightPane.props.documentView.right.transcriptionType === 'glossary' ? 450 : 200
125
+ this.leftPaneMinWidth = this.props.leftPane.props.documentView.left.transcriptionType === 'glossary' ? 450 : 200
126
+ this.thirdPaneMinWidth = this.props.thirdPane.props.documentView.third.transcriptionType === 'glossary' ? 450 : this.props.thirdPane.props.documentView.third.transcriptionType === 'g' ? 0 : 200
127
+ }
128
+
129
+ componentWillUnmount() {
130
+ window.removeEventListener('pointermove', this.onDrag)
131
+ window.removeEventListener('pointerup', this.onEndDrag)
132
+ window.removeEventListener('resize', this.onResize)
133
+ }
134
+
135
+ renderDivider(position) {
136
+ const drawerIconClass = 'drawer-icon fas fa-caret-left fa-2x'
137
+
138
+ return (
139
+ <div className={`divider ${position}_divider`} onPointerDown={() => this.onStartDrag(position)}>
140
+ <div className="drawer-button hidden" onClick={this.onDrawerButton}>
141
+ <i className={drawerIconClass}> </i>
142
+ </div>
143
+ </div>
144
+ )
145
+ }
146
+
147
+ render() {
148
+ return (
149
+ <div className="split-pane-view three-pane" style={{ ...this.state.style }}>
150
+ { this.props.leftPane }
151
+ { this.renderDivider('first') }
152
+ { this.props.rightPane }
153
+ { this.props.threePanel && this.renderDivider('second') }
154
+ { this.props.threePanel && this.props.thirdPane }
155
+ </div>
156
+ )
157
+ }
158
+ }
159
+
179
160
  function mapStateToProps(state) {
180
161
  return {
181
- document: state.document
182
- };
162
+ document: state.document,
163
+ }
183
164
  }
184
- export default connect(mapStateToProps)(SplitPaneView);
165
+ export default connect(mapStateToProps)(SplitPaneView)