tycho-components 0.40.2 → 0.40.3

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.
@@ -1,4 +1,4 @@
1
- export declare const viewerConfigurations: {
1
+ export declare const conlluViewerConfigurations: {
2
2
  readonly svgID: "canvas";
3
3
  readonly font: "FreeSans, Arial, Helvetica, sans-serif";
4
4
  readonly margin: 4;
@@ -1,4 +1,4 @@
1
- export const viewerConfigurations = {
1
+ export const conlluViewerConfigurations = {
2
2
  svgID: 'canvas',
3
3
  font: 'FreeSans, Arial, Helvetica, sans-serif',
4
4
  margin: 4,
@@ -1,11 +1,11 @@
1
1
  import { Conllu } from '../../configs/types/Conllu';
2
2
  import { ConlluViewerGraph } from './ConlluViewerGraph';
3
- export declare const calculateTextWidth: (text: string, fontSize: number, bold: boolean) => {
3
+ export declare const calculateConlluTextWidth: (text: string, fontSize: number, bold: boolean) => {
4
4
  w: number;
5
5
  h: number;
6
6
  l: number;
7
7
  };
8
- export declare const throwError: (err: Error, idx: number) => never;
8
+ export declare const throwConlluError: (err: Error, idx: number) => never;
9
9
  declare class ConlluViewerConverter {
10
10
  private MIN_NODE_WIDTH;
11
11
  private NODE_SPACING;
@@ -1,5 +1,5 @@
1
1
  import { fontBaseSize, fontBoldAscent, fontBoldDescent, fontBoldSizes, fontRegularAscent, fontRegularDescent, fontRegularSizes, } from './ConlluFontsizes';
2
- export const calculateTextWidth = (text, fontSize, bold) => {
2
+ export const calculateConlluTextWidth = (text, fontSize, bold) => {
3
3
  const { sizes, asc, desc } = bold
4
4
  ? { sizes: fontBoldSizes, asc: fontBoldAscent, desc: fontBoldDescent }
5
5
  : {
@@ -25,7 +25,7 @@ export const calculateTextWidth = (text, fontSize, bold) => {
25
25
  l: Math.round((fontSize * asc) / fontBaseSize),
26
26
  };
27
27
  };
28
- export const throwError = (err, idx) => {
28
+ export const throwConlluError = (err, idx) => {
29
29
  console.error({ err, idx });
30
30
  throw err;
31
31
  };
@@ -58,7 +58,7 @@ class ConlluViewerConverter {
58
58
  return graph;
59
59
  };
60
60
  this.calculateLower = (graph) => {
61
- const { w, h, l: y } = calculateTextWidth('Xg', this.NODE_FONT_SIZE, false);
61
+ const { w, h, l: y, } = calculateConlluTextWidth('Xg', this.NODE_FONT_SIZE, false);
62
62
  graph.lower = y / 2;
63
63
  };
64
64
  this.calculateOffset = (graph) => {
@@ -84,11 +84,11 @@ class ConlluViewerConverter {
84
84
  let width = this.MARGIN;
85
85
  graph.items.forEach((item, i) => {
86
86
  if (item.end !== i + 1) {
87
- throwError(new Error(`Wrong index: ${item.end} != ${i + 1}`), item.lineno);
87
+ throwConlluError(new Error(`Wrong index: ${item.end} != ${i + 1}`), item.lineno);
88
88
  }
89
89
  item.x1 = width;
90
- const { w: w1 } = calculateTextWidth(item.postag + ' i', this.NODE_FONT_SIZE, false);
91
- const { w: w2 } = calculateTextWidth(item.word + ' i', this.NODE_FONT_SIZE, false);
90
+ const { w: w1 } = calculateConlluTextWidth(item.postag + ' i', this.NODE_FONT_SIZE, false);
91
+ const { w: w2 } = calculateConlluTextWidth(item.word + ' i', this.NODE_FONT_SIZE, false);
92
92
  item.x2 = width + 24 + Math.max(this.MIN_NODE_WIDTH, w1, w2);
93
93
  width = item.x2 + this.NODE_SPACING;
94
94
  });
@@ -227,11 +227,11 @@ class ConlluViewerConverter {
227
227
  parts.forEach((part) => {
228
228
  const partsSplits = part.split(':', 2);
229
229
  if (partsSplits.length !== 2) {
230
- throwError(new Error(`Invalid dependency: ${part}`), item.lineno);
230
+ throwConlluError(new Error(`Invalid dependency: ${part}`), item.lineno);
231
231
  }
232
232
  const headpos = graph.positions[partsSplits[0]];
233
233
  if (!headpos) {
234
- throwError(new Error(`Unknown head position ${partsSplits[0]}`), item.lineno);
234
+ throwConlluError(new Error(`Unknown head position ${partsSplits[0]}`), item.lineno);
235
235
  }
236
236
  dependencies.push({
237
237
  end: end,
@@ -1,14 +1,14 @@
1
- export { default as ConlluViewerConverter, calculateTextWidth, throwError, } from './conllu/ConlluViewerConverter';
2
- export { viewerConfigurations } from './conllu/ConlluViewerConstants';
3
- export type { ConlluViewerAnchor, ConlluViewerDependency, ConlluViewerGraph, ConlluViewerItem, ConlluViewerMulti, } from './conllu/ConlluViewerGraph';
4
1
  export { default as DateUtils } from './DateUtils';
5
2
  export { default as EditionTierUtils } from './EditionTierUtils';
6
- export { normalizeCorpusFromApi } from './normalizeCorpusFromApi';
7
3
  export { default as FilterUtils } from './FilterUtils';
8
4
  export { default as FormUtils } from './FormUtils';
9
5
  export { default as ImageUtils } from './ImageUtils';
10
6
  export { default as SecurityUtils } from './SecurityUtils';
11
7
  export { default as SentenceUtils } from './SentenceUtils';
12
- export { default as UsabilityUtils } from './UsabilityUtils';
13
- export { default as ToolsUtils, EDITION_TOOLS, type PlatformTools, } from './ToolsUtils';
8
+ export { EDITION_TOOLS, default as ToolsUtils, type PlatformTools, } from './ToolsUtils';
14
9
  export type { OpenDocumentParams, RedirectPageParams } from './ToolsUtils';
10
+ export { default as UsabilityUtils } from './UsabilityUtils';
11
+ export { conlluViewerConfigurations as viewerConfigurations } from './conllu/ConlluViewerConstants';
12
+ export { default as ConlluViewerConverter, calculateConlluTextWidth as calculateTextWidth, throwConlluError as throwError, } from './conllu/ConlluViewerConverter';
13
+ export type { ConlluViewerAnchor, ConlluViewerDependency, ConlluViewerGraph, ConlluViewerItem, ConlluViewerMulti, } from './conllu/ConlluViewerGraph';
14
+ export { normalizeCorpusFromApi } from './normalizeCorpusFromApi';
@@ -1,12 +1,12 @@
1
- export { default as ConlluViewerConverter, calculateTextWidth, throwError, } from './conllu/ConlluViewerConverter';
2
- export { viewerConfigurations } from './conllu/ConlluViewerConstants';
3
1
  export { default as DateUtils } from './DateUtils';
4
2
  export { default as EditionTierUtils } from './EditionTierUtils';
5
- export { normalizeCorpusFromApi } from './normalizeCorpusFromApi';
6
3
  export { default as FilterUtils } from './FilterUtils';
7
4
  export { default as FormUtils } from './FormUtils';
8
5
  export { default as ImageUtils } from './ImageUtils';
9
6
  export { default as SecurityUtils } from './SecurityUtils';
10
7
  export { default as SentenceUtils } from './SentenceUtils';
8
+ export { EDITION_TOOLS, default as ToolsUtils, } from './ToolsUtils';
11
9
  export { default as UsabilityUtils } from './UsabilityUtils';
12
- export { default as ToolsUtils, EDITION_TOOLS, } from './ToolsUtils';
10
+ export { conlluViewerConfigurations as viewerConfigurations } from './conllu/ConlluViewerConstants';
11
+ export { default as ConlluViewerConverter, calculateConlluTextWidth as calculateTextWidth, throwConlluError as throwError, } from './conllu/ConlluViewerConverter';
12
+ export { normalizeCorpusFromApi } from './normalizeCorpusFromApi';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.40.2",
4
+ "version": "0.40.3",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {