@flighthq/textlayout 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
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/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/textlayout`. The `@f
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/textlayout@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/textlayout@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/textlayout)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/textlayout",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/textshaper": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/textshaper": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
computeRichTextContent,
|
|
7
7
|
createRichTextContent,
|
|
8
8
|
getRichTextContent,
|
|
9
|
+
initializeRichTextContent,
|
|
9
10
|
} from './richTextContent';
|
|
10
11
|
import { createTextFormatRange } from './textFormatRange';
|
|
11
12
|
|
|
@@ -136,3 +137,8 @@ describe('getRichTextContent', () => {
|
|
|
136
137
|
expect(getRichTextContent(runtime)).toBe(content);
|
|
137
138
|
});
|
|
138
139
|
});
|
|
140
|
+
describe('initializeRichTextContent', () => {
|
|
141
|
+
it('is the construction initializer of createRichTextContent', () => {
|
|
142
|
+
expect(typeof initializeRichTextContent).toBe('function');
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTextFormatRange } from './textFormatRange';
|
|
1
|
+
import { createTextFormatRange, initializeTextFormatRange } from './textFormatRange';
|
|
2
2
|
|
|
3
3
|
describe('createTextFormatRange', () => {
|
|
4
4
|
it('creates a range with the given fields', () => {
|
|
@@ -7,3 +7,8 @@ describe('createTextFormatRange', () => {
|
|
|
7
7
|
expect(range).toMatchObject({ end: 10, format: fmt, start: 0 });
|
|
8
8
|
});
|
|
9
9
|
});
|
|
10
|
+
describe('initializeTextFormatRange', () => {
|
|
11
|
+
it('is the construction initializer of createTextFormatRange', () => {
|
|
12
|
+
expect(typeof initializeTextFormatRange).toBe('function');
|
|
13
|
+
});
|
|
14
|
+
});
|
package/src/textLayout.test.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { TextLayoutParams, TextLayoutResult } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import { createTextFormatRange } from './textFormatRange';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
TEXT_LAYOUT_GUTTER,
|
|
6
|
+
computeTextLayout,
|
|
7
|
+
createTextLayoutResult,
|
|
8
|
+
initializeTextLayoutResult,
|
|
9
|
+
isTextLayoutTruncated,
|
|
10
|
+
} from './textLayout';
|
|
5
11
|
|
|
6
12
|
// Fixed-width measure: every character is 10px regardless of font settings.
|
|
7
13
|
const fixedMeasure = (text: string) => text.length * 10;
|
|
@@ -754,6 +760,12 @@ describe('createTextLayoutResult', () => {
|
|
|
754
760
|
});
|
|
755
761
|
});
|
|
756
762
|
|
|
763
|
+
describe('initializeTextLayoutResult', () => {
|
|
764
|
+
it('is the construction initializer of createTextLayoutResult', () => {
|
|
765
|
+
expect(typeof initializeTextLayoutResult).toBe('function');
|
|
766
|
+
});
|
|
767
|
+
});
|
|
768
|
+
|
|
757
769
|
describe('isTextLayoutTruncated', () => {
|
|
758
770
|
it('returns false when maxLines is -1', () => {
|
|
759
771
|
const params = singleRangeParams('hello');
|
|
@@ -761,7 +773,6 @@ describe('isTextLayoutTruncated', () => {
|
|
|
761
773
|
expect(isTextLayoutTruncated(result, params)).toBe(false);
|
|
762
774
|
});
|
|
763
775
|
});
|
|
764
|
-
|
|
765
776
|
describe('TEXT_LAYOUT_GUTTER', () => {
|
|
766
777
|
it('is a positive number', () => {
|
|
767
778
|
expect(TEXT_LAYOUT_GUTTER).toBeGreaterThan(0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTextLayoutGroup } from './textLayoutGroup';
|
|
1
|
+
import { createTextLayoutGroup, initializeTextLayoutGroup } from './textLayoutGroup';
|
|
2
2
|
|
|
3
3
|
describe('createTextLayoutGroup', () => {
|
|
4
4
|
it('initializes with zero metrics', () => {
|
|
@@ -28,3 +28,8 @@ describe('createTextLayoutGroup', () => {
|
|
|
28
28
|
expect(createTextLayoutGroup(fmt, 0, 1)).not.toBe(createTextLayoutGroup(fmt, 0, 1));
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
|
+
describe('initializeTextLayoutGroup', () => {
|
|
32
|
+
it('is the construction initializer of createTextLayoutGroup', () => {
|
|
33
|
+
expect(typeof initializeTextLayoutGroup).toBe('function');
|
|
34
|
+
});
|
|
35
|
+
});
|
package/src/textMetrics.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextLayoutResult } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
|
-
import { createTextMetrics, getTextMetrics } from './textMetrics';
|
|
3
|
+
import { createTextMetrics, getTextMetrics, initializeTextMetrics } from './textMetrics';
|
|
4
4
|
|
|
5
5
|
describe('createTextMetrics', () => {
|
|
6
6
|
it('creates a zeroed metrics object', () => {
|
|
@@ -17,3 +17,8 @@ describe('getTextMetrics', () => {
|
|
|
17
17
|
expect(out.numLines).toBe(2);
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
|
+
describe('initializeTextMetrics', () => {
|
|
21
|
+
it('is the construction initializer of createTextMetrics', () => {
|
|
22
|
+
expect(typeof initializeTextMetrics).toBe('function');
|
|
23
|
+
});
|
|
24
|
+
});
|