@manuscripts/body-editor 1.4.23 → 1.4.24

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.
@@ -33,7 +33,6 @@ const context_menu_1 = require("../../lib/context-menu");
33
33
  const track_changes_utils_1 = require("../../lib/track-changes-utils");
34
34
  const node_type_icons_1 = require("../../node-type-icons");
35
35
  const section_title_1 = require("../../views/section_title");
36
- const RequirementsAlert_1 = require("../requirements/RequirementsAlert");
37
36
  const Outline_1 = require("./Outline");
38
37
  const isExcluded = (nodeType) => {
39
38
  const { nodes } = nodeType.schema;
@@ -128,7 +127,7 @@ class Tree extends React.Component {
128
127
  render() {
129
128
  const { depth = 0, tree, canDrop, connectDragSource, connectDragPreview, connectDropTarget, isDragging, isOverCurrent, item, view, } = this.props;
130
129
  const { open, dragPosition } = this.state;
131
- const { node, requirementsNode, items, isSelected } = tree;
130
+ const { node, items, isSelected } = tree;
132
131
  const isDeletedItem = (0, track_changes_utils_1.isDeleted)(node);
133
132
  const isRejectedItem = (0, track_changes_utils_1.isRejectedInsert)(node);
134
133
  const mightDrop = item && isOverCurrent && canDrop;
@@ -147,8 +146,7 @@ class Tree extends React.Component {
147
146
  alignItems: 'center',
148
147
  } },
149
148
  React.createElement(Outline_1.OutlineItemIcon, null, (0, node_type_icons_1.nodeTypeIcon)(node.type)))),
150
- React.createElement(Outline_1.OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)),
151
- React.createElement(RequirementsAlert_1.RequirementsAlert, { node: requirementsNode || node }))))))),
149
+ React.createElement(Outline_1.OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)))))))),
152
150
  items.length ? (React.createElement("div", { style: {
153
151
  display: open || (0, section_title_1.isSpecialSection)(node) ? '' : 'none',
154
152
  } }, items.map((subtree) => (React.createElement(DraggableTree, Object.assign({}, this.props, { key: subtree.node.attrs.id, tree: subtree, view: view, depth: (0, section_title_1.isSpecialSection)(node) ? depth : depth + 1 })))))) : null,
package/dist/cjs/index.js CHANGED
@@ -32,7 +32,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.ManuscriptsEditor = exports.useEditor = exports.isHighlightComment = exports.isThereSelector = exports.commentScroll = exports.toolbar = exports.PopperManager = exports.getMenus = exports.RequirementsProvider = exports.RequirementsContext = exports.Statistics = exports.Checks = exports.ManuscriptToolbar = exports.OutlineManuscript = exports.OutlineItemIcon = exports.ManuscriptOutline = exports.DialogNames = exports.DialogController = void 0;
35
+ exports.ManuscriptsEditor = exports.useEditor = exports.isHighlightComment = exports.isThereSelector = exports.commentScroll = exports.toolbar = exports.PopperManager = exports.getMenus = exports.ManuscriptToolbar = exports.OutlineManuscript = exports.OutlineItemIcon = exports.ManuscriptOutline = exports.DialogNames = exports.DialogController = void 0;
36
36
  __exportStar(require("./citation-sources"), exports);
37
37
  __exportStar(require("./commands"), exports);
38
38
  __exportStar(require("./components/application-menu"), exports);
@@ -47,13 +47,6 @@ var OutlineManuscript_1 = require("./components/outline/OutlineManuscript");
47
47
  Object.defineProperty(exports, "OutlineManuscript", { enumerable: true, get: function () { return OutlineManuscript_1.OutlineManuscript; } });
48
48
  var ManuscriptToolbar_1 = require("./components/toolbar/ManuscriptToolbar");
49
49
  Object.defineProperty(exports, "ManuscriptToolbar", { enumerable: true, get: function () { return ManuscriptToolbar_1.ManuscriptToolbar; } });
50
- var Checks_1 = require("./components/requirements/Checks");
51
- Object.defineProperty(exports, "Checks", { enumerable: true, get: function () { return Checks_1.Checks; } });
52
- var Statistics_1 = require("./components/requirements/Statistics");
53
- Object.defineProperty(exports, "Statistics", { enumerable: true, get: function () { return Statistics_1.Statistics; } });
54
- var RequirementsProvider_1 = require("./components/requirements/RequirementsProvider");
55
- Object.defineProperty(exports, "RequirementsContext", { enumerable: true, get: function () { return RequirementsProvider_1.RequirementsContext; } });
56
- Object.defineProperty(exports, "RequirementsProvider", { enumerable: true, get: function () { return RequirementsProvider_1.RequirementsProvider; } });
57
50
  var menus_1 = require("./menus");
58
51
  Object.defineProperty(exports, "getMenus", { enumerable: true, get: function () { return __importDefault(menus_1).default; } });
59
52
  var popper_1 = require("./lib/popper");
@@ -7,7 +7,6 @@ import { ContextMenu } from '../../lib/context-menu';
7
7
  import { isDeleted, isRejectedInsert } from '../../lib/track-changes-utils';
8
8
  import { nodeTypeIcon } from '../../node-type-icons';
9
9
  import { isSpecialSection } from '../../views/section_title';
10
- import { RequirementsAlert } from '../requirements/RequirementsAlert';
11
10
  import { Outline, OutlineDropPreview, OutlineItem, OutlineItemArrow, OutlineItemIcon, OutlineItemLink, OutlineItemLinkText, OutlineItemNoArrow, OutlineItemPlaceholder, StyledTriangleCollapsed, StyledTriangleExpanded, } from './Outline';
12
11
  const isExcluded = (nodeType) => {
13
12
  const { nodes } = nodeType.schema;
@@ -101,7 +100,7 @@ class Tree extends React.Component {
101
100
  render() {
102
101
  const { depth = 0, tree, canDrop, connectDragSource, connectDragPreview, connectDropTarget, isDragging, isOverCurrent, item, view, } = this.props;
103
102
  const { open, dragPosition } = this.state;
104
- const { node, requirementsNode, items, isSelected } = tree;
103
+ const { node, items, isSelected } = tree;
105
104
  const isDeletedItem = isDeleted(node);
106
105
  const isRejectedItem = isRejectedInsert(node);
107
106
  const mightDrop = item && isOverCurrent && canDrop;
@@ -120,8 +119,7 @@ class Tree extends React.Component {
120
119
  alignItems: 'center',
121
120
  } },
122
121
  React.createElement(OutlineItemIcon, null, nodeTypeIcon(node.type)))),
123
- React.createElement(OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)),
124
- React.createElement(RequirementsAlert, { node: requirementsNode || node }))))))),
122
+ React.createElement(OutlineItemLinkText, { className: `outline-text-${node.type.name} ${isDeletedItem && 'deleted'}` }, this.itemText(node)))))))),
125
123
  items.length ? (React.createElement("div", { style: {
126
124
  display: open || isSpecialSection(node) ? '' : 'none',
127
125
  } }, items.map((subtree) => (React.createElement(DraggableTree, Object.assign({}, this.props, { key: subtree.node.attrs.id, tree: subtree, view: view, depth: isSpecialSection(node) ? depth : depth + 1 })))))) : null,
package/dist/es/index.js CHANGED
@@ -21,9 +21,6 @@ export { ManuscriptOutline } from './components/outline/ManuscriptOutline';
21
21
  export { OutlineItemIcon } from './components/outline/Outline';
22
22
  export { OutlineManuscript } from './components/outline/OutlineManuscript';
23
23
  export { ManuscriptToolbar, } from './components/toolbar/ManuscriptToolbar';
24
- export { Checks } from './components/requirements/Checks';
25
- export { Statistics } from './components/requirements/Statistics';
26
- export { RequirementsContext, RequirementsProvider, } from './components/requirements/RequirementsProvider';
27
24
  export { default as getMenus } from './menus';
28
25
  export { PopperManager } from './lib/popper';
29
26
  export { toolbar } from './toolbar';
@@ -21,9 +21,6 @@ export { ManuscriptOutline } from './components/outline/ManuscriptOutline';
21
21
  export { OutlineItemIcon } from './components/outline/Outline';
22
22
  export { OutlineManuscript } from './components/outline/OutlineManuscript';
23
23
  export { ManuscriptToolbar, ToolbarButtonConfig, } from './components/toolbar/ManuscriptToolbar';
24
- export { Checks } from './components/requirements/Checks';
25
- export { Statistics } from './components/requirements/Statistics';
26
- export { RequirementsAlerts, RequirementsContext, RequirementsProvider, } from './components/requirements/RequirementsProvider';
27
24
  export { default as getMenus } from './menus';
28
25
  export { ChangeReceiver } from './types';
29
26
  export { PopperManager } from './lib/popper';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/body-editor",
3
3
  "description": "Prosemirror components for editing and viewing manuscripts",
4
- "version": "1.4.23",
4
+ "version": "1.4.24",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -38,7 +38,6 @@
38
38
  "astrocite-eutils": "^0.16.4",
39
39
  "axios": "^1.2.2",
40
40
  "codemirror": "^5.58.1",
41
- "comlink": "^4.3.0",
42
41
  "dompurify": "^2.4.1",
43
42
  "formik": "^2.2.9",
44
43
  "grapheme-splitter": "^1.0.4",
@@ -1,72 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 Atypon Systems LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.Checks = void 0;
22
- const AttentionOrange_1 = __importDefault(require("@manuscripts/assets/react/AttentionOrange"));
23
- const SuccessGreen_1 = __importDefault(require("@manuscripts/assets/react/SuccessGreen"));
24
- const transform_1 = require("@manuscripts/transform");
25
- const react_1 = __importDefault(require("react"));
26
- const styled_components_1 = __importDefault(require("styled-components"));
27
- const node_type_icons_1 = require("../../node-type-icons");
28
- const Outline_1 = require("../outline/Outline");
29
- const IconContainer = styled_components_1.default.div `
30
- display: inline-flex;
31
- align-items: center;
32
- width: ${(props) => props.theme.grid.unit * 5}px;
33
- margin-right: ${(props) => props.theme.grid.unit}px;
34
- `;
35
- const CheckContainer = styled_components_1.default.div `
36
- display: flex;
37
- align-items: center;
38
- margin: ${(props) => props.theme.grid.unit * 2}px 0;
39
- padding-left: ${(props) => props.theme.grid.unit * 4}px;
40
-
41
- &:not(:last-child) {
42
- margin-bottom: 8px;
43
- }
44
- `;
45
- const Check = ({ message, passed }) => (react_1.default.createElement(CheckContainer, null,
46
- react_1.default.createElement(IconContainer, null, passed ? (react_1.default.createElement(SuccessGreen_1.default, { width: 16, height: 16 })) : (react_1.default.createElement(AttentionOrange_1.default, { width: 16, height: 16 }))),
47
- message));
48
- const Header = styled_components_1.default.div `
49
- display: flex;
50
- align-items: center;
51
- white-space: nowrap;
52
- overflow: hidden;
53
- text-overflow: ellipsis;
54
- margin-bottom: 4px;
55
- `;
56
- const nodeText = (node) => {
57
- const text = (0, transform_1.nodeTitle)(node);
58
- return text ? text.trim() : (0, transform_1.nodeTitlePlaceholder)(node.type);
59
- };
60
- const Checks = ({ node, alerts }) => {
61
- const icon = (0, node_type_icons_1.nodeTypeIcon)(node.type);
62
- const text = nodeText(node);
63
- return (react_1.default.createElement(Container, null,
64
- icon && (react_1.default.createElement(Header, null,
65
- react_1.default.createElement(Outline_1.OutlineItemIcon, null, icon),
66
- text)),
67
- Object.values(alerts).map((alert, index) => (react_1.default.createElement(Check, { message: alert.message, passed: alert.passed, key: index })))));
68
- };
69
- exports.Checks = Checks;
70
- const Container = styled_components_1.default.div `
71
- margin-bottom: 16px;
72
- `;
@@ -1,83 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 Atypon Systems LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
41
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
- return new (P || (P = Promise))(function (resolve, reject) {
43
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
44
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
46
- step((generator = generator.apply(thisArg, _arguments || [])).next());
47
- });
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.RequirementsAlert = void 0;
54
- const AttentionOrange_1 = __importDefault(require("@manuscripts/assets/react/AttentionOrange"));
55
- const style_guide_1 = require("@manuscripts/style-guide");
56
- const transform_1 = require("@manuscripts/transform");
57
- const react_1 = __importStar(require("react"));
58
- const RequirementsProvider_1 = require("./RequirementsProvider");
59
- const RequirementsAlert = ({ node, }) => {
60
- const [items, setItems] = (0, react_1.useState)();
61
- const validateRequirements = (0, react_1.useContext)(RequirementsProvider_1.RequirementsContext);
62
- (0, react_1.useEffect)(() => {
63
- const timer = setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
64
- if ((0, transform_1.isNodeType)(node, 'manuscript') ||
65
- (0, transform_1.isNodeType)(node, 'section')) {
66
- const requirements = yield validateRequirements(node);
67
- const items = Object.values(requirements)
68
- .filter((requirement) => !requirement.passed)
69
- .map((requirement) => requirement.message);
70
- setItems(items);
71
- }
72
- }), 250);
73
- return () => {
74
- clearTimeout(timer);
75
- };
76
- }, [validateRequirements, node]);
77
- if (items && items.length) {
78
- return (react_1.default.createElement(style_guide_1.Tip, { placement: 'right', title: items.join('. ') },
79
- react_1.default.createElement(AttentionOrange_1.default, { height: '1em' })));
80
- }
81
- return null;
82
- };
83
- exports.RequirementsAlert = RequirementsAlert;
@@ -1,143 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 Atypon Systems LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
41
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
- return new (P || (P = Promise))(function (resolve, reject) {
43
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
44
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
46
- step((generator = generator.apply(thisArg, _arguments || [])).next());
47
- });
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.RequirementsProvider = exports.RequirementsContext = void 0;
51
- const transform_1 = require("@manuscripts/transform");
52
- const Comlink = __importStar(require("comlink"));
53
- const react_1 = __importStar(require("react"));
54
- const statistics_1 = require("../../lib/statistics");
55
- const StatisticsWorker = Comlink.wrap(new Worker('../../lib/statistics.worker', { type: 'module' }));
56
- exports.RequirementsContext = (0, react_1.createContext)(() => __awaiter(void 0, void 0, void 0, function* () {
57
- throw new Error('RequirementsProvider is not mounted');
58
- }));
59
- const RequirementsProvider = ({ modelMap, children }) => {
60
- const getActiveRequirementCount = (id) => {
61
- if (!id) {
62
- return undefined;
63
- }
64
- const requirement = modelMap.get(id);
65
- if (!requirement) {
66
- return undefined;
67
- }
68
- if (requirement.ignored) {
69
- return undefined;
70
- }
71
- return requirement.count;
72
- };
73
- const buildRequirementsAlerts = (node, statistics) => __awaiter(void 0, void 0, void 0, function* () {
74
- const output = {};
75
- const { id } = node.attrs;
76
- if (!id) {
77
- return output;
78
- }
79
- const model = modelMap.get(id);
80
- if (!model) {
81
- return output;
82
- }
83
- const requirements = {
84
- words: {
85
- minimum: getActiveRequirementCount(model.minWordCountRequirement),
86
- maximum: getActiveRequirementCount(model.maxWordCountRequirement),
87
- },
88
- characters: {
89
- minimum: getActiveRequirementCount(model.minCharacterCountRequirement),
90
- maximum: getActiveRequirementCount(model.maxCharacterCountRequirement),
91
- },
92
- };
93
- const hasWordsRequirement = requirements.words.maximum || requirements.words.minimum;
94
- const hasCharactersRequirement = requirements.characters.maximum || requirements.characters.minimum;
95
- const hasAnyRequirement = hasWordsRequirement || hasCharactersRequirement;
96
- if (hasAnyRequirement) {
97
- const nodeTypeName = transform_1.nodeNames.get(node.type);
98
- const nodeName = nodeTypeName
99
- ? nodeTypeName.toLowerCase()
100
- : node.type.name;
101
- const text = statistics ? statistics.text : (0, statistics_1.buildText)(node);
102
- if (hasWordsRequirement) {
103
- const count = statistics
104
- ? statistics.words
105
- : yield StatisticsWorker.countWords(text);
106
- const { maximum, minimum } = requirements.words;
107
- if (maximum !== undefined) {
108
- output.words_maximum = {
109
- message: `The ${nodeName} should have a maximum of ${maximum.toLocaleString()} words`,
110
- passed: count <= maximum,
111
- };
112
- }
113
- if (minimum !== undefined) {
114
- output.words_minimum = {
115
- message: `The ${nodeName} should have a minimum of ${minimum.toLocaleString()} words`,
116
- passed: count >= minimum,
117
- };
118
- }
119
- }
120
- if (hasCharactersRequirement) {
121
- const count = statistics
122
- ? statistics.characters
123
- : yield StatisticsWorker.countCharacters(text);
124
- const { maximum, minimum } = requirements.characters;
125
- if (maximum !== undefined) {
126
- output.characters_maximum = {
127
- message: `The ${nodeName} should have a maximum of ${maximum.toLocaleString()} characters`,
128
- passed: count <= maximum,
129
- };
130
- }
131
- if (minimum !== undefined) {
132
- output.characters_minimum = {
133
- message: `The ${nodeName} should have a minimum of ${minimum.toLocaleString()} characters`,
134
- passed: count >= minimum,
135
- };
136
- }
137
- }
138
- }
139
- return output;
140
- });
141
- return (react_1.default.createElement(exports.RequirementsContext.Provider, { value: buildRequirementsAlerts }, children));
142
- };
143
- exports.RequirementsProvider = RequirementsProvider;
@@ -1,121 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 Atypon Systems LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
41
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
- return new (P || (P = Promise))(function (resolve, reject) {
43
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
44
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
46
- step((generator = generator.apply(thisArg, _arguments || [])).next());
47
- });
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.Statistics = void 0;
54
- require("@manuscripts/style-guide/styles/tip.css");
55
- const AttentionOrange_1 = __importDefault(require("@manuscripts/assets/react/AttentionOrange"));
56
- const style_guide_1 = require("@manuscripts/style-guide");
57
- const Comlink = __importStar(require("comlink"));
58
- const react_1 = __importStar(require("react"));
59
- const styled_components_1 = __importDefault(require("styled-components"));
60
- const statistics_1 = require("../../lib/statistics");
61
- const RequirementsProvider_1 = require("./RequirementsProvider");
62
- const StatisticsWorker = Comlink.wrap(new Worker('../../lib/statistics.worker', { type: 'module' }));
63
- const AlertContainer = styled_components_1.default.div `
64
- display: inline-flex;
65
- align-items: center;
66
- width: ${(props) => props.theme.grid.unit * 5}px;
67
- cursor: pointer;
68
- `;
69
- const StatisticContainer = styled_components_1.default.div `
70
- display: flex;
71
- align-items: center;
72
- margin: ${(props) => props.theme.grid.unit * 2}px 0;
73
- `;
74
- const Statistic = ({ value, singular, plural, alert }) => (react_1.default.createElement(StatisticContainer, null,
75
- react_1.default.createElement(AlertContainer, null, alert && (react_1.default.createElement(style_guide_1.Tip, { placement: 'left', title: alert },
76
- react_1.default.createElement(AttentionOrange_1.default, { width: 12, height: 12 })))),
77
- value.toLocaleString(),
78
- " ",
79
- value === 1 ? singular : plural));
80
- const chooseAlertMessage = (requirements, types) => {
81
- for (const type of types) {
82
- const result = requirements[type];
83
- if (result && !result.passed) {
84
- return result.message;
85
- }
86
- }
87
- };
88
- const Statistics = ({ node }) => {
89
- const [statistics, setStatistics] = (0, react_1.useState)();
90
- const [alerts, setAlerts] = (0, react_1.useState)();
91
- const validateRequirements = (0, react_1.useContext)(RequirementsProvider_1.RequirementsContext);
92
- (0, react_1.useEffect)(() => {
93
- const timer = setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
94
- const text = (0, statistics_1.buildText)(node);
95
- const statistics = {
96
- text,
97
- characters: yield StatisticsWorker.countCharacters(text),
98
- words: yield StatisticsWorker.countWords(text),
99
- };
100
- setStatistics(statistics);
101
- const alerts = yield validateRequirements(node, statistics);
102
- setAlerts(alerts);
103
- }), 250);
104
- return () => {
105
- clearTimeout(timer);
106
- };
107
- }, [validateRequirements, node]);
108
- if (!statistics || !alerts) {
109
- return null;
110
- }
111
- return (react_1.default.createElement(Container, null,
112
- react_1.default.createElement(Statistic, { value: statistics.words, alert: chooseAlertMessage(alerts, ['words_maximum', 'words_minimum']), singular: 'word', plural: 'words' }),
113
- react_1.default.createElement(Statistic, { value: statistics.characters, alert: chooseAlertMessage(alerts, [
114
- 'characters_maximum',
115
- 'characters_minimum',
116
- ]), singular: 'character', plural: 'characters' })));
117
- };
118
- exports.Statistics = Statistics;
119
- const Container = styled_components_1.default.div `
120
- margin: 8px 0;
121
- `;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /*!
3
- * © 2019 Atypon Systems LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- const Comlink = __importStar(require("comlink"));
42
- const statistics_1 = require("./statistics");
43
- Comlink.expose({ countWords: statistics_1.countWords, countCharacters: statistics_1.countCharacters });
@@ -1,65 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import AttentionOrange from '@manuscripts/assets/react/AttentionOrange';
17
- import SuccessGreen from '@manuscripts/assets/react/SuccessGreen';
18
- import { nodeTitle, nodeTitlePlaceholder, } from '@manuscripts/transform';
19
- import React from 'react';
20
- import styled from 'styled-components';
21
- import { nodeTypeIcon } from '../../node-type-icons';
22
- import { OutlineItemIcon } from '../outline/Outline';
23
- const IconContainer = styled.div `
24
- display: inline-flex;
25
- align-items: center;
26
- width: ${(props) => props.theme.grid.unit * 5}px;
27
- margin-right: ${(props) => props.theme.grid.unit}px;
28
- `;
29
- const CheckContainer = styled.div `
30
- display: flex;
31
- align-items: center;
32
- margin: ${(props) => props.theme.grid.unit * 2}px 0;
33
- padding-left: ${(props) => props.theme.grid.unit * 4}px;
34
-
35
- &:not(:last-child) {
36
- margin-bottom: 8px;
37
- }
38
- `;
39
- const Check = ({ message, passed }) => (React.createElement(CheckContainer, null,
40
- React.createElement(IconContainer, null, passed ? (React.createElement(SuccessGreen, { width: 16, height: 16 })) : (React.createElement(AttentionOrange, { width: 16, height: 16 }))),
41
- message));
42
- const Header = styled.div `
43
- display: flex;
44
- align-items: center;
45
- white-space: nowrap;
46
- overflow: hidden;
47
- text-overflow: ellipsis;
48
- margin-bottom: 4px;
49
- `;
50
- const nodeText = (node) => {
51
- const text = nodeTitle(node);
52
- return text ? text.trim() : nodeTitlePlaceholder(node.type);
53
- };
54
- export const Checks = ({ node, alerts }) => {
55
- const icon = nodeTypeIcon(node.type);
56
- const text = nodeText(node);
57
- return (React.createElement(Container, null,
58
- icon && (React.createElement(Header, null,
59
- React.createElement(OutlineItemIcon, null, icon),
60
- text)),
61
- Object.values(alerts).map((alert, index) => (React.createElement(Check, { message: alert.message, passed: alert.passed, key: index })))));
62
- };
63
- const Container = styled.div `
64
- margin-bottom: 16px;
65
- `;
@@ -1,53 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- import AttentionOrange from '@manuscripts/assets/react/AttentionOrange';
26
- import { Tip } from '@manuscripts/style-guide';
27
- import { isNodeType, } from '@manuscripts/transform';
28
- import React, { useContext, useEffect, useState } from 'react';
29
- import { RequirementsContext } from './RequirementsProvider';
30
- export const RequirementsAlert = ({ node, }) => {
31
- const [items, setItems] = useState();
32
- const validateRequirements = useContext(RequirementsContext);
33
- useEffect(() => {
34
- const timer = setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
35
- if (isNodeType(node, 'manuscript') ||
36
- isNodeType(node, 'section')) {
37
- const requirements = yield validateRequirements(node);
38
- const items = Object.values(requirements)
39
- .filter((requirement) => !requirement.passed)
40
- .map((requirement) => requirement.message);
41
- setItems(items);
42
- }
43
- }), 250);
44
- return () => {
45
- clearTimeout(timer);
46
- };
47
- }, [validateRequirements, node]);
48
- if (items && items.length) {
49
- return (React.createElement(Tip, { placement: 'right', title: items.join('. ') },
50
- React.createElement(AttentionOrange, { height: '1em' })));
51
- }
52
- return null;
53
- };
@@ -1,116 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- import { nodeNames } from '@manuscripts/transform';
26
- import * as Comlink from 'comlink';
27
- import React, { createContext } from 'react';
28
- import { buildText } from '../../lib/statistics';
29
- const StatisticsWorker = Comlink.wrap(new Worker('../../lib/statistics.worker', { type: 'module' }));
30
- export const RequirementsContext = createContext(() => __awaiter(void 0, void 0, void 0, function* () {
31
- throw new Error('RequirementsProvider is not mounted');
32
- }));
33
- export const RequirementsProvider = ({ modelMap, children }) => {
34
- const getActiveRequirementCount = (id) => {
35
- if (!id) {
36
- return undefined;
37
- }
38
- const requirement = modelMap.get(id);
39
- if (!requirement) {
40
- return undefined;
41
- }
42
- if (requirement.ignored) {
43
- return undefined;
44
- }
45
- return requirement.count;
46
- };
47
- const buildRequirementsAlerts = (node, statistics) => __awaiter(void 0, void 0, void 0, function* () {
48
- const output = {};
49
- const { id } = node.attrs;
50
- if (!id) {
51
- return output;
52
- }
53
- const model = modelMap.get(id);
54
- if (!model) {
55
- return output;
56
- }
57
- const requirements = {
58
- words: {
59
- minimum: getActiveRequirementCount(model.minWordCountRequirement),
60
- maximum: getActiveRequirementCount(model.maxWordCountRequirement),
61
- },
62
- characters: {
63
- minimum: getActiveRequirementCount(model.minCharacterCountRequirement),
64
- maximum: getActiveRequirementCount(model.maxCharacterCountRequirement),
65
- },
66
- };
67
- const hasWordsRequirement = requirements.words.maximum || requirements.words.minimum;
68
- const hasCharactersRequirement = requirements.characters.maximum || requirements.characters.minimum;
69
- const hasAnyRequirement = hasWordsRequirement || hasCharactersRequirement;
70
- if (hasAnyRequirement) {
71
- const nodeTypeName = nodeNames.get(node.type);
72
- const nodeName = nodeTypeName
73
- ? nodeTypeName.toLowerCase()
74
- : node.type.name;
75
- const text = statistics ? statistics.text : buildText(node);
76
- if (hasWordsRequirement) {
77
- const count = statistics
78
- ? statistics.words
79
- : yield StatisticsWorker.countWords(text);
80
- const { maximum, minimum } = requirements.words;
81
- if (maximum !== undefined) {
82
- output.words_maximum = {
83
- message: `The ${nodeName} should have a maximum of ${maximum.toLocaleString()} words`,
84
- passed: count <= maximum,
85
- };
86
- }
87
- if (minimum !== undefined) {
88
- output.words_minimum = {
89
- message: `The ${nodeName} should have a minimum of ${minimum.toLocaleString()} words`,
90
- passed: count >= minimum,
91
- };
92
- }
93
- }
94
- if (hasCharactersRequirement) {
95
- const count = statistics
96
- ? statistics.characters
97
- : yield StatisticsWorker.countCharacters(text);
98
- const { maximum, minimum } = requirements.characters;
99
- if (maximum !== undefined) {
100
- output.characters_maximum = {
101
- message: `The ${nodeName} should have a maximum of ${maximum.toLocaleString()} characters`,
102
- passed: count <= maximum,
103
- };
104
- }
105
- if (minimum !== undefined) {
106
- output.characters_minimum = {
107
- message: `The ${nodeName} should have a minimum of ${minimum.toLocaleString()} characters`,
108
- passed: count >= minimum,
109
- };
110
- }
111
- }
112
- }
113
- return output;
114
- });
115
- return (React.createElement(RequirementsContext.Provider, { value: buildRequirementsAlerts }, children));
116
- };
@@ -1,91 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- import '@manuscripts/style-guide/styles/tip.css';
26
- import AttentionOrange from '@manuscripts/assets/react/AttentionOrange';
27
- import { Tip } from '@manuscripts/style-guide';
28
- import * as Comlink from 'comlink';
29
- import React, { useContext, useEffect, useState } from 'react';
30
- import styled from 'styled-components';
31
- import { buildText } from '../../lib/statistics';
32
- import { RequirementsContext } from './RequirementsProvider';
33
- const StatisticsWorker = Comlink.wrap(new Worker('../../lib/statistics.worker', { type: 'module' }));
34
- const AlertContainer = styled.div `
35
- display: inline-flex;
36
- align-items: center;
37
- width: ${(props) => props.theme.grid.unit * 5}px;
38
- cursor: pointer;
39
- `;
40
- const StatisticContainer = styled.div `
41
- display: flex;
42
- align-items: center;
43
- margin: ${(props) => props.theme.grid.unit * 2}px 0;
44
- `;
45
- const Statistic = ({ value, singular, plural, alert }) => (React.createElement(StatisticContainer, null,
46
- React.createElement(AlertContainer, null, alert && (React.createElement(Tip, { placement: 'left', title: alert },
47
- React.createElement(AttentionOrange, { width: 12, height: 12 })))),
48
- value.toLocaleString(),
49
- " ",
50
- value === 1 ? singular : plural));
51
- const chooseAlertMessage = (requirements, types) => {
52
- for (const type of types) {
53
- const result = requirements[type];
54
- if (result && !result.passed) {
55
- return result.message;
56
- }
57
- }
58
- };
59
- export const Statistics = ({ node }) => {
60
- const [statistics, setStatistics] = useState();
61
- const [alerts, setAlerts] = useState();
62
- const validateRequirements = useContext(RequirementsContext);
63
- useEffect(() => {
64
- const timer = setTimeout(() => __awaiter(void 0, void 0, void 0, function* () {
65
- const text = buildText(node);
66
- const statistics = {
67
- text,
68
- characters: yield StatisticsWorker.countCharacters(text),
69
- words: yield StatisticsWorker.countWords(text),
70
- };
71
- setStatistics(statistics);
72
- const alerts = yield validateRequirements(node, statistics);
73
- setAlerts(alerts);
74
- }), 250);
75
- return () => {
76
- clearTimeout(timer);
77
- };
78
- }, [validateRequirements, node]);
79
- if (!statistics || !alerts) {
80
- return null;
81
- }
82
- return (React.createElement(Container, null,
83
- React.createElement(Statistic, { value: statistics.words, alert: chooseAlertMessage(alerts, ['words_maximum', 'words_minimum']), singular: 'word', plural: 'words' }),
84
- React.createElement(Statistic, { value: statistics.characters, alert: chooseAlertMessage(alerts, [
85
- 'characters_maximum',
86
- 'characters_minimum',
87
- ]), singular: 'character', plural: 'characters' })));
88
- };
89
- const Container = styled.div `
90
- margin: 8px 0;
91
- `;
@@ -1,18 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import * as Comlink from 'comlink';
17
- import { countCharacters, countWords } from './statistics';
18
- Comlink.expose({ countWords, countCharacters });
@@ -1,22 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { ManuscriptNode } from '@manuscripts/transform';
17
- import React from 'react';
18
- import { RequirementsAlerts } from './RequirementsProvider';
19
- export declare const Checks: React.FC<{
20
- node: ManuscriptNode;
21
- alerts: RequirementsAlerts;
22
- }>;
@@ -1,20 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { ManuscriptNode } from '@manuscripts/transform';
17
- import React from 'react';
18
- export declare const RequirementsAlert: React.FC<{
19
- node: ManuscriptNode;
20
- }>;
@@ -1,34 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Model } from '@manuscripts/json-schema';
17
- import { ManuscriptNode } from '@manuscripts/transform';
18
- import React from 'react';
19
- import { NodeStatistics } from '../../lib/statistics';
20
- export interface RequirementResult {
21
- message: string;
22
- passed?: boolean;
23
- }
24
- export interface RequirementsAlerts {
25
- words_maximum?: RequirementResult;
26
- words_minimum?: RequirementResult;
27
- characters_maximum?: RequirementResult;
28
- characters_minimum?: RequirementResult;
29
- }
30
- export type RequirementsValue = (node: ManuscriptNode, statistics?: NodeStatistics) => Promise<RequirementsAlerts>;
31
- export declare const RequirementsContext: React.Context<RequirementsValue>;
32
- export declare const RequirementsProvider: React.FC<{
33
- modelMap: Map<string, Model>;
34
- }>;
@@ -1,21 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import '@manuscripts/style-guide/styles/tip.css';
17
- import { ManuscriptNode } from '@manuscripts/transform';
18
- import React from 'react';
19
- export declare const Statistics: React.FC<{
20
- node: ManuscriptNode;
21
- }>;
@@ -1,16 +0,0 @@
1
- /*!
2
- * © 2019 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export {};