@flighthq/text-markup 0.5.1-next.799.62ef0c7 → 0.5.1-next.820.97b3830

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/text-markup`. The `@
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/text-markup@0.5.1-next.799.62ef0c7](https://github.com/flighthq/flight/tree/62ef0c74f09f24177aac3695b2487b2d743d4fe6/packages/text-markup)
17
- - [License](https://github.com/flighthq/flight/blob/62ef0c74f09f24177aac3695b2487b2d743d4fe6/LICENSE.md)
16
+ - [Source for @flighthq/text-markup@0.5.1-next.820.97b3830](https://github.com/flighthq/flight/tree/97b3830e843209d92da169e02a52c0574efe5c09/packages/text-markup)
17
+ - [License](https://github.com/flighthq/flight/blob/97b3830e843209d92da169e02a52c0574efe5c09/LICENSE.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/text-markup",
3
- "version": "0.5.1-next.799.62ef0c7",
3
+ "version": "0.5.1-next.820.97b3830",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,10 +38,10 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/color": "0.5.1-next.799.62ef0c7",
42
- "@flighthq/entity": "0.5.1-next.799.62ef0c7",
43
- "@flighthq/textlayout": "0.5.1-next.799.62ef0c7",
44
- "@flighthq/types": "0.5.1-next.799.62ef0c7"
41
+ "@flighthq/color": "0.5.1-next.820.97b3830",
42
+ "@flighthq/entity": "0.5.1-next.820.97b3830",
43
+ "@flighthq/textlayout": "0.5.1-next.820.97b3830",
44
+ "@flighthq/types": "0.5.1-next.820.97b3830"
45
45
  },
46
46
  "devDependencies": {
47
47
  "typescript": "^5.3.0"
@@ -1,3 +1,4 @@
1
+ import { createTextFormatRange } from '@flighthq/textlayout/contract';
1
2
  import type { RichTextContent, TextFormat } from '@flighthq/types/contract';
2
3
  import { EntityRuntimeKey } from '@flighthq/types/contract';
3
4
  import { describe, expect, it } from 'vitest';
@@ -30,7 +31,7 @@ describe('formatTextMarkup', () => {
30
31
  it('emits style booleans as their tags', () => {
31
32
  const content: RichTextContent = {
32
33
  [EntityRuntimeKey]: undefined,
33
- formatRanges: [{ end: 4, format: { bold: true, italic: true, strikethrough: true, underline: true }, start: 0 }],
34
+ formatRanges: [createTextFormatRange({ bold: true, italic: true, strikethrough: true, underline: true }, 0, 4)],
34
35
  text: 'text',
35
36
  };
36
37
  expect(formatTextMarkup(content)).toBe('<b><i><u><s>text</s></u></i></b>');
@@ -39,7 +40,7 @@ describe('formatTextMarkup', () => {
39
40
  it('emits font color as a #rrggbb attribute', () => {
40
41
  const content: RichTextContent = {
41
42
  [EntityRuntimeKey]: undefined,
42
- formatRanges: [{ end: 3, format: { color: 0xff0000ff, font: 'Verdana', size: 18 }, start: 0 }],
43
+ formatRanges: [createTextFormatRange({ color: 0xff0000ff, font: 'Verdana', size: 18 }, 0, 3)],
43
44
  text: 'red',
44
45
  };
45
46
  expect(formatTextMarkup(content)).toBe('<font color="#ff0000" size="18" face="Verdana">red</font>');
@@ -48,7 +49,7 @@ describe('formatTextMarkup', () => {
48
49
  it('emits anchors with href and target', () => {
49
50
  const content: RichTextContent = {
50
51
  [EntityRuntimeKey]: undefined,
51
- formatRanges: [{ end: 4, format: { target: '_blank', url: 'https://a.test' }, start: 0 }],
52
+ formatRanges: [createTextFormatRange({ target: '_blank', url: 'https://a.test' }, 0, 4)],
52
53
  text: 'link',
53
54
  };
54
55
  expect(formatTextMarkup(content)).toBe('<a href="https://a.test" target="_blank">link</a>');
@@ -57,7 +58,7 @@ describe('formatTextMarkup', () => {
57
58
  it('emits textformat block metrics', () => {
58
59
  const content: RichTextContent = {
59
60
  [EntityRuntimeKey]: undefined,
60
- formatRanges: [{ end: 1, format: { blockIndent: 4, leading: 2, leftMargin: 10, tabStops: [10, 20] }, start: 0 }],
61
+ formatRanges: [createTextFormatRange({ blockIndent: 4, leading: 2, leftMargin: 10, tabStops: [10, 20] }, 0, 1)],
61
62
  text: 'x',
62
63
  };
63
64
  expect(formatTextMarkup(content)).toBe(
@@ -68,7 +69,7 @@ describe('formatTextMarkup', () => {
68
69
  it('emits bullets with a list marker type', () => {
69
70
  const content: RichTextContent = {
70
71
  [EntityRuntimeKey]: undefined,
71
- formatRanges: [{ end: 4, format: { bullet: true, listMarker: 'square' }, start: 0 }],
72
+ formatRanges: [createTextFormatRange({ bullet: true, listMarker: 'square' }, 0, 4)],
72
73
  text: 'item',
73
74
  };
74
75
  expect(formatTextMarkup(content)).toBe('<li type="square">item</li>');
@@ -250,7 +251,7 @@ describe('textMarkupRoundTrip', () => {
250
251
  const once = parseTextMarkup(source);
251
252
  const twice = parseTextMarkup(formatTextMarkup(once));
252
253
  expect(twice.text).toBe(once.text);
253
- expect(twice.formatRanges).toEqual(once.formatRanges);
254
+ expect(twice.formatRanges).toMatchObject(once.formatRanges);
254
255
  }
255
256
  });
256
257
  });