ropegeo-common 1.25.0 → 1.25.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.
- package/dist/models/betaSections/betaSection.d.ts +1 -1
- package/dist/models/betaSections/betaSection.d.ts.map +1 -1
- package/dist/models/betaSections/betaSectionExcerpt.d.ts +4 -4
- package/dist/models/betaSections/betaSectionExcerpt.d.ts.map +1 -1
- package/dist/models/betaSections/betaSectionExcerpt.js +12 -4
- package/dist/models/betaSections/boldRelevantPhrase.d.ts +3 -2
- package/dist/models/betaSections/boldRelevantPhrase.d.ts.map +1 -1
- package/dist/models/betaSections/boldRelevantPhrase.js +3 -2
- package/dist/models/minimap/legend/concrete/imageContext.d.ts +6 -3
- package/dist/models/minimap/legend/concrete/imageContext.d.ts.map +1 -1
- package/dist/models/minimap/legend/concrete/imageContext.js +12 -4
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ export declare abstract class BetaSection {
|
|
|
28
28
|
* Builds a {@link BetaSectionExcerpt} for a verbatim excerpt from this section's text.
|
|
29
29
|
* When the excerpt cannot be located, `start` and `end` are left undefined.
|
|
30
30
|
*/
|
|
31
|
-
toExcerpt(excerptText: string, relevanceStrength: RelevanceStrength, relevantPhrase
|
|
31
|
+
toExcerpt(excerptText: string, relevanceStrength: RelevanceStrength, relevantPhrase?: string): BetaSectionExcerpt;
|
|
32
32
|
/**
|
|
33
33
|
* Renders an excerpt with nearby section context when its offsets still
|
|
34
34
|
* match this section, otherwise falls back to the excerpt alone.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"betaSection.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/betaSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,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Z,IAAI;IAeP,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,SAAS,GAC7B,IAAI;IAcP,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAgB3C,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAC7B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,SAAS,GAC7B,gBAAgB,EAAE;IAYrB,SAAS,CAAC,MAAM,CAAC,oBAAoB,CACjC,MAAM,EAAE,gBAAgB,EAAE,EAC1B,SAAS,EAAE,OAAO,GACnB,IAAI;CAeV"}
|
|
@@ -6,11 +6,11 @@ export declare class BetaSectionExcerpt {
|
|
|
6
6
|
readonly relevanceStrength: RelevanceStrength;
|
|
7
7
|
/**
|
|
8
8
|
* Verbatim substring of the text block’s title and/or body that connects
|
|
9
|
-
* this excerpt to the map feature.
|
|
10
|
-
*
|
|
9
|
+
* this excerpt to the map feature. When omitted, excerpt HTML is not
|
|
10
|
+
* phrase-highlighted.
|
|
11
11
|
*/
|
|
12
|
-
readonly relevantPhrase
|
|
13
|
-
constructor(text: string | undefined, start: number | undefined, end: number | undefined, relevanceStrength: RelevanceStrength, relevantPhrase
|
|
12
|
+
readonly relevantPhrase?: string;
|
|
13
|
+
constructor(text: string | undefined, start: number | undefined, end: number | undefined, relevanceStrength: RelevanceStrength, relevantPhrase?: string);
|
|
14
14
|
toPlain(): Record<string, unknown>;
|
|
15
15
|
/** Returns displayable excerpt HTML when the owning beta section is unavailable. */
|
|
16
16
|
toHtml(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"betaSectionExcerpt.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/betaSectionExcerpt.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"betaSectionExcerpt.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/betaSectionExcerpt.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,kBAAkB;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;gBAG7B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,CAAC,EAAE,MAAM;IAgB3B,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAmBlC,oFAAoF;IACpF,MAAM,IAAI,MAAM;IAKhB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB;IAiDtD,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAOnC,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAK1C"}
|
|
@@ -7,7 +7,9 @@ const relevanceStrength_1 = require("../relevanceStrength");
|
|
|
7
7
|
class BetaSectionExcerpt {
|
|
8
8
|
constructor(text, start, end, relevanceStrength, relevantPhrase) {
|
|
9
9
|
(0, relevanceStrength_1.assertRelevanceStrength)(relevanceStrength, 'BetaSectionExcerpt.relevanceStrength');
|
|
10
|
-
|
|
10
|
+
if (relevantPhrase !== undefined) {
|
|
11
|
+
BetaSectionExcerpt.assertNonEmptyString(relevantPhrase, 'BetaSectionExcerpt.relevantPhrase');
|
|
12
|
+
}
|
|
11
13
|
this.text = text;
|
|
12
14
|
this.start = start;
|
|
13
15
|
this.end = end;
|
|
@@ -17,7 +19,6 @@ class BetaSectionExcerpt {
|
|
|
17
19
|
toPlain() {
|
|
18
20
|
const out = {
|
|
19
21
|
relevanceStrength: this.relevanceStrength,
|
|
20
|
-
relevantPhrase: this.relevantPhrase,
|
|
21
22
|
};
|
|
22
23
|
if (this.text !== undefined) {
|
|
23
24
|
out.text = this.text;
|
|
@@ -28,11 +29,15 @@ class BetaSectionExcerpt {
|
|
|
28
29
|
if (this.end !== undefined) {
|
|
29
30
|
out.end = this.end;
|
|
30
31
|
}
|
|
32
|
+
if (this.relevantPhrase !== undefined) {
|
|
33
|
+
out.relevantPhrase = this.relevantPhrase;
|
|
34
|
+
}
|
|
31
35
|
return out;
|
|
32
36
|
}
|
|
33
37
|
/** Returns displayable excerpt HTML when the owning beta section is unavailable. */
|
|
34
38
|
toHtml() {
|
|
35
|
-
|
|
39
|
+
const normalized = (0, normalizeExcerptHtml_1.normalizeExcerptListHtml)(this.text ?? '');
|
|
40
|
+
return (0, boldRelevantPhrase_1.boldRelevantPhraseInHtml)(normalized, this.relevantPhrase);
|
|
36
41
|
}
|
|
37
42
|
static fromResult(result) {
|
|
38
43
|
if (result == null || typeof result !== 'object' || Array.isArray(result)) {
|
|
@@ -40,7 +45,10 @@ class BetaSectionExcerpt {
|
|
|
40
45
|
}
|
|
41
46
|
const r = result;
|
|
42
47
|
const relevanceStrength = (0, relevanceStrength_1.assertRelevanceStrength)(r.relevanceStrength, 'BetaSectionExcerpt.relevanceStrength');
|
|
43
|
-
|
|
48
|
+
let relevantPhrase;
|
|
49
|
+
if (r.relevantPhrase !== undefined && r.relevantPhrase !== null) {
|
|
50
|
+
relevantPhrase = BetaSectionExcerpt.assertNonEmptyString(r.relevantPhrase, 'BetaSectionExcerpt.relevantPhrase');
|
|
51
|
+
}
|
|
44
52
|
let text;
|
|
45
53
|
if (r.text !== undefined) {
|
|
46
54
|
if (typeof r.text !== 'string') {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Wraps the first contiguous text-run occurrence of `phrase` in `<b>…</b>`
|
|
3
3
|
* without splitting HTML tags. If the phrase already sits fully inside a
|
|
4
4
|
* `<b>`/`<strong>` element, or spans multiple text runs (tags in between),
|
|
5
|
-
* returns `html` unchanged.
|
|
5
|
+
* returns `html` unchanged. When `phrase` is undefined/null/empty, returns
|
|
6
|
+
* `html` unchanged (no highlighting).
|
|
6
7
|
*/
|
|
7
|
-
export declare function boldRelevantPhraseInHtml(html: string, phrase: string): string;
|
|
8
|
+
export declare function boldRelevantPhraseInHtml(html: string, phrase: string | undefined | null): string;
|
|
8
9
|
//# sourceMappingURL=boldRelevantPhrase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boldRelevantPhrase.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/boldRelevantPhrase.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"boldRelevantPhrase.d.ts","sourceRoot":"","sources":["../../../src/models/betaSections/boldRelevantPhrase.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAClC,MAAM,CAuBR"}
|
|
@@ -5,10 +5,11 @@ exports.boldRelevantPhraseInHtml = boldRelevantPhraseInHtml;
|
|
|
5
5
|
* Wraps the first contiguous text-run occurrence of `phrase` in `<b>…</b>`
|
|
6
6
|
* without splitting HTML tags. If the phrase already sits fully inside a
|
|
7
7
|
* `<b>`/`<strong>` element, or spans multiple text runs (tags in between),
|
|
8
|
-
* returns `html` unchanged.
|
|
8
|
+
* returns `html` unchanged. When `phrase` is undefined/null/empty, returns
|
|
9
|
+
* `html` unchanged (no highlighting).
|
|
9
10
|
*/
|
|
10
11
|
function boldRelevantPhraseInHtml(html, phrase) {
|
|
11
|
-
if (html.length === 0 || phrase.length === 0)
|
|
12
|
+
if (html.length === 0 || phrase == null || phrase.length === 0)
|
|
12
13
|
return html;
|
|
13
14
|
const tokens = tokenizeHtml(html);
|
|
14
15
|
for (let i = 0; i < tokens.length; i++) {
|
|
@@ -2,9 +2,12 @@ import { type RelevanceStrength } from '../../../relevanceStrength';
|
|
|
2
2
|
export declare class ImageContext {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
readonly relevanceStrength: RelevanceStrength;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Verbatim substring of the image caption. When omitted, caption
|
|
7
|
+
* highlighting is skipped.
|
|
8
|
+
*/
|
|
9
|
+
readonly relevantPhrase?: string;
|
|
10
|
+
constructor(id: string, relevanceStrength: RelevanceStrength, relevantPhrase?: string);
|
|
8
11
|
toPlain(): Record<string, unknown>;
|
|
9
12
|
static fromResult(result: unknown): ImageContext;
|
|
10
13
|
private static assertNonEmptyString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/imageContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,YAAY;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C
|
|
1
|
+
{"version":3,"file":"imageContext.d.ts","sourceRoot":"","sources":["../../../../../src/models/minimap/legend/concrete/imageContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,iBAAiB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,YAAY;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;gBAErB,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,CAAC,EAAE,MAAM;IAWrF,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAWlC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY;IAoBhD,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAMtC"}
|
|
@@ -6,17 +6,22 @@ class ImageContext {
|
|
|
6
6
|
constructor(id, relevanceStrength, relevantPhrase) {
|
|
7
7
|
ImageContext.assertNonEmptyString(id, 'ImageContext.id');
|
|
8
8
|
(0, relevanceStrength_1.assertRelevanceStrength)(relevanceStrength, 'ImageContext.relevanceStrength');
|
|
9
|
-
|
|
9
|
+
if (relevantPhrase !== undefined) {
|
|
10
|
+
ImageContext.assertNonEmptyString(relevantPhrase, 'ImageContext.relevantPhrase');
|
|
11
|
+
}
|
|
10
12
|
this.id = id;
|
|
11
13
|
this.relevanceStrength = relevanceStrength;
|
|
12
14
|
this.relevantPhrase = relevantPhrase;
|
|
13
15
|
}
|
|
14
16
|
toPlain() {
|
|
15
|
-
|
|
17
|
+
const out = {
|
|
16
18
|
id: this.id,
|
|
17
19
|
relevanceStrength: this.relevanceStrength,
|
|
18
|
-
relevantPhrase: this.relevantPhrase,
|
|
19
20
|
};
|
|
21
|
+
if (this.relevantPhrase !== undefined) {
|
|
22
|
+
out.relevantPhrase = this.relevantPhrase;
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
20
25
|
}
|
|
21
26
|
static fromResult(result) {
|
|
22
27
|
if (result == null || typeof result !== 'object' || Array.isArray(result)) {
|
|
@@ -25,7 +30,10 @@ class ImageContext {
|
|
|
25
30
|
const r = result;
|
|
26
31
|
const id = ImageContext.assertNonEmptyString(r.id, 'ImageContext.id');
|
|
27
32
|
const relevanceStrength = (0, relevanceStrength_1.assertRelevanceStrength)(r.relevanceStrength, 'ImageContext.relevanceStrength');
|
|
28
|
-
|
|
33
|
+
let relevantPhrase;
|
|
34
|
+
if (r.relevantPhrase !== undefined && r.relevantPhrase !== null) {
|
|
35
|
+
relevantPhrase = ImageContext.assertNonEmptyString(r.relevantPhrase, 'ImageContext.relevantPhrase');
|
|
36
|
+
}
|
|
29
37
|
return new ImageContext(id, relevanceStrength, relevantPhrase);
|
|
30
38
|
}
|
|
31
39
|
static assertNonEmptyString(value, context) {
|