modern-text 0.2.36 → 0.2.38

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/index.d.cts CHANGED
@@ -88,7 +88,7 @@ declare class Fragment {
88
88
  content: string;
89
89
  style: Partial<TextStyle>;
90
90
  parent: Paragraph;
91
- boundingBox: BoundingBox;
91
+ inlineBox: BoundingBox;
92
92
  characters: Character[];
93
93
  computedStyle: TextStyle;
94
94
  get computedContent(): string;
@@ -101,11 +101,9 @@ declare class Character {
101
101
  content: string;
102
102
  index: number;
103
103
  parent: Fragment;
104
- boundingBox: BoundingBox;
105
- textWidth: number;
106
- textHeight: number;
107
- glyphHeight: number;
108
- glyphWidth: number;
104
+ lineBox: BoundingBox;
105
+ inlineBox: BoundingBox;
106
+ glyphBox: BoundingBox;
109
107
  underlinePosition: number;
110
108
  underlineThickness: number;
111
109
  yStrikeoutPosition: number;
@@ -113,11 +111,11 @@ declare class Character {
113
111
  baseline: number;
114
112
  centerDiviation: number;
115
113
  path: Path2D;
116
- glyphBox: BoundingBox;
117
114
  center: Vector2;
118
115
  get computedStyle(): TextStyle;
119
116
  get isVertical(): boolean;
120
117
  get fontSize(): number;
118
+ get fontHeight(): number;
121
119
  constructor(content: string, index: number, parent: Fragment);
122
120
  protected _font(): Sfnt | undefined;
123
121
  updateGlyph(font?: Sfnt | undefined): this;
@@ -136,7 +134,7 @@ declare class Character {
136
134
  declare class Paragraph {
137
135
  style: Partial<TextStyle>;
138
136
  parentStyle: TextStyle;
139
- boundingBox: BoundingBox;
137
+ lineBox: BoundingBox;
140
138
  fragments: Fragment[];
141
139
  computedStyle: TextStyle;
142
140
  constructor(style: Partial<TextStyle>, parentStyle: TextStyle);
@@ -288,19 +286,19 @@ interface Plugin {
288
286
  }
289
287
  declare function definePlugin(options: Plugin): Plugin;
290
288
 
289
+ declare function highlight(): Plugin;
290
+
291
+ declare function listStyle(): Plugin;
292
+
291
293
  type TextEffect = Partial<TextDrawStyle & {
292
294
  offsetX: number;
293
295
  offsetY: number;
294
296
  skewX: number;
295
297
  skewY: number;
296
298
  }>;
297
- declare function effect(): Plugin;
299
+ declare function render(): Plugin;
298
300
  declare function getTransform2D(text: Text, style: TextEffect): Matrix3;
299
301
 
300
- declare function highlight(): Plugin;
301
-
302
- declare function listStyle(): Plugin;
303
-
304
302
  interface DrawShapePathsOptions extends Partial<TextEffect> {
305
303
  ctx: CanvasRenderingContext2D;
306
304
  path: Path2D;
@@ -309,8 +307,6 @@ interface DrawShapePathsOptions extends Partial<TextEffect> {
309
307
  }
310
308
  declare function drawPath(options: DrawShapePathsOptions): void;
311
309
 
312
- declare function fillBackground(ctx: CanvasRenderingContext2D, text: Text): void;
313
-
314
310
  declare function setupView(ctx: CanvasRenderingContext2D, pixelRatio: number, boundingBox: BoundingBox): void;
315
311
 
316
312
  declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text): void;
@@ -318,4 +314,4 @@ declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text): void;
318
314
  declare function isNone(val: string | undefined): boolean;
319
315
  declare function filterEmpty(val: Record<string, any> | undefined): Record<string, any> | undefined;
320
316
 
321
- export { Character, type DrawShapePathsOptions, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type HighlightImage, type HighlightOverflow, type HighlightSize, type HighlightStrokeWidth, type LinearGradient, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type Plugin, type Sizeable, Text, type TextAlign, type TextContent, type TextDecoration, type TextDrawStyle, type TextEffect, type TextHighlightStyle, type TextLayoutStyle, type TextListStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, definePlugin, drawPath, effect, fillBackground, filterEmpty, getTransform2D, highlight, isNone, listStyle, parseColor, setupView, uploadColor, uploadColors };
317
+ export { Character, type DrawShapePathsOptions, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type HighlightImage, type HighlightOverflow, type HighlightSize, type HighlightStrokeWidth, type LinearGradient, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type Plugin, type Sizeable, Text, type TextAlign, type TextContent, type TextDecoration, type TextDrawStyle, type TextEffect, type TextHighlightStyle, type TextLayoutStyle, type TextListStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, definePlugin, drawPath, filterEmpty, getTransform2D, highlight, isNone, listStyle, parseColor, render, setupView, uploadColor, uploadColors };
package/dist/index.d.mts CHANGED
@@ -88,7 +88,7 @@ declare class Fragment {
88
88
  content: string;
89
89
  style: Partial<TextStyle>;
90
90
  parent: Paragraph;
91
- boundingBox: BoundingBox;
91
+ inlineBox: BoundingBox;
92
92
  characters: Character[];
93
93
  computedStyle: TextStyle;
94
94
  get computedContent(): string;
@@ -101,11 +101,9 @@ declare class Character {
101
101
  content: string;
102
102
  index: number;
103
103
  parent: Fragment;
104
- boundingBox: BoundingBox;
105
- textWidth: number;
106
- textHeight: number;
107
- glyphHeight: number;
108
- glyphWidth: number;
104
+ lineBox: BoundingBox;
105
+ inlineBox: BoundingBox;
106
+ glyphBox: BoundingBox;
109
107
  underlinePosition: number;
110
108
  underlineThickness: number;
111
109
  yStrikeoutPosition: number;
@@ -113,11 +111,11 @@ declare class Character {
113
111
  baseline: number;
114
112
  centerDiviation: number;
115
113
  path: Path2D;
116
- glyphBox: BoundingBox;
117
114
  center: Vector2;
118
115
  get computedStyle(): TextStyle;
119
116
  get isVertical(): boolean;
120
117
  get fontSize(): number;
118
+ get fontHeight(): number;
121
119
  constructor(content: string, index: number, parent: Fragment);
122
120
  protected _font(): Sfnt | undefined;
123
121
  updateGlyph(font?: Sfnt | undefined): this;
@@ -136,7 +134,7 @@ declare class Character {
136
134
  declare class Paragraph {
137
135
  style: Partial<TextStyle>;
138
136
  parentStyle: TextStyle;
139
- boundingBox: BoundingBox;
137
+ lineBox: BoundingBox;
140
138
  fragments: Fragment[];
141
139
  computedStyle: TextStyle;
142
140
  constructor(style: Partial<TextStyle>, parentStyle: TextStyle);
@@ -288,19 +286,19 @@ interface Plugin {
288
286
  }
289
287
  declare function definePlugin(options: Plugin): Plugin;
290
288
 
289
+ declare function highlight(): Plugin;
290
+
291
+ declare function listStyle(): Plugin;
292
+
291
293
  type TextEffect = Partial<TextDrawStyle & {
292
294
  offsetX: number;
293
295
  offsetY: number;
294
296
  skewX: number;
295
297
  skewY: number;
296
298
  }>;
297
- declare function effect(): Plugin;
299
+ declare function render(): Plugin;
298
300
  declare function getTransform2D(text: Text, style: TextEffect): Matrix3;
299
301
 
300
- declare function highlight(): Plugin;
301
-
302
- declare function listStyle(): Plugin;
303
-
304
302
  interface DrawShapePathsOptions extends Partial<TextEffect> {
305
303
  ctx: CanvasRenderingContext2D;
306
304
  path: Path2D;
@@ -309,8 +307,6 @@ interface DrawShapePathsOptions extends Partial<TextEffect> {
309
307
  }
310
308
  declare function drawPath(options: DrawShapePathsOptions): void;
311
309
 
312
- declare function fillBackground(ctx: CanvasRenderingContext2D, text: Text): void;
313
-
314
310
  declare function setupView(ctx: CanvasRenderingContext2D, pixelRatio: number, boundingBox: BoundingBox): void;
315
311
 
316
312
  declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text): void;
@@ -318,4 +314,4 @@ declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text): void;
318
314
  declare function isNone(val: string | undefined): boolean;
319
315
  declare function filterEmpty(val: Record<string, any> | undefined): Record<string, any> | undefined;
320
316
 
321
- export { Character, type DrawShapePathsOptions, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type HighlightImage, type HighlightOverflow, type HighlightSize, type HighlightStrokeWidth, type LinearGradient, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type Plugin, type Sizeable, Text, type TextAlign, type TextContent, type TextDecoration, type TextDrawStyle, type TextEffect, type TextHighlightStyle, type TextLayoutStyle, type TextListStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, definePlugin, drawPath, effect, fillBackground, filterEmpty, getTransform2D, highlight, isNone, listStyle, parseColor, setupView, uploadColor, uploadColors };
317
+ export { Character, type DrawShapePathsOptions, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type HighlightImage, type HighlightOverflow, type HighlightSize, type HighlightStrokeWidth, type LinearGradient, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type Plugin, type Sizeable, Text, type TextAlign, type TextContent, type TextDecoration, type TextDrawStyle, type TextEffect, type TextHighlightStyle, type TextLayoutStyle, type TextListStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, definePlugin, drawPath, filterEmpty, getTransform2D, highlight, isNone, listStyle, parseColor, render, setupView, uploadColor, uploadColors };
package/dist/index.d.ts CHANGED
@@ -88,7 +88,7 @@ declare class Fragment {
88
88
  content: string;
89
89
  style: Partial<TextStyle>;
90
90
  parent: Paragraph;
91
- boundingBox: BoundingBox;
91
+ inlineBox: BoundingBox;
92
92
  characters: Character[];
93
93
  computedStyle: TextStyle;
94
94
  get computedContent(): string;
@@ -101,11 +101,9 @@ declare class Character {
101
101
  content: string;
102
102
  index: number;
103
103
  parent: Fragment;
104
- boundingBox: BoundingBox;
105
- textWidth: number;
106
- textHeight: number;
107
- glyphHeight: number;
108
- glyphWidth: number;
104
+ lineBox: BoundingBox;
105
+ inlineBox: BoundingBox;
106
+ glyphBox: BoundingBox;
109
107
  underlinePosition: number;
110
108
  underlineThickness: number;
111
109
  yStrikeoutPosition: number;
@@ -113,11 +111,11 @@ declare class Character {
113
111
  baseline: number;
114
112
  centerDiviation: number;
115
113
  path: Path2D;
116
- glyphBox: BoundingBox;
117
114
  center: Vector2;
118
115
  get computedStyle(): TextStyle;
119
116
  get isVertical(): boolean;
120
117
  get fontSize(): number;
118
+ get fontHeight(): number;
121
119
  constructor(content: string, index: number, parent: Fragment);
122
120
  protected _font(): Sfnt | undefined;
123
121
  updateGlyph(font?: Sfnt | undefined): this;
@@ -136,7 +134,7 @@ declare class Character {
136
134
  declare class Paragraph {
137
135
  style: Partial<TextStyle>;
138
136
  parentStyle: TextStyle;
139
- boundingBox: BoundingBox;
137
+ lineBox: BoundingBox;
140
138
  fragments: Fragment[];
141
139
  computedStyle: TextStyle;
142
140
  constructor(style: Partial<TextStyle>, parentStyle: TextStyle);
@@ -288,19 +286,19 @@ interface Plugin {
288
286
  }
289
287
  declare function definePlugin(options: Plugin): Plugin;
290
288
 
289
+ declare function highlight(): Plugin;
290
+
291
+ declare function listStyle(): Plugin;
292
+
291
293
  type TextEffect = Partial<TextDrawStyle & {
292
294
  offsetX: number;
293
295
  offsetY: number;
294
296
  skewX: number;
295
297
  skewY: number;
296
298
  }>;
297
- declare function effect(): Plugin;
299
+ declare function render(): Plugin;
298
300
  declare function getTransform2D(text: Text, style: TextEffect): Matrix3;
299
301
 
300
- declare function highlight(): Plugin;
301
-
302
- declare function listStyle(): Plugin;
303
-
304
302
  interface DrawShapePathsOptions extends Partial<TextEffect> {
305
303
  ctx: CanvasRenderingContext2D;
306
304
  path: Path2D;
@@ -309,8 +307,6 @@ interface DrawShapePathsOptions extends Partial<TextEffect> {
309
307
  }
310
308
  declare function drawPath(options: DrawShapePathsOptions): void;
311
309
 
312
- declare function fillBackground(ctx: CanvasRenderingContext2D, text: Text): void;
313
-
314
310
  declare function setupView(ctx: CanvasRenderingContext2D, pixelRatio: number, boundingBox: BoundingBox): void;
315
311
 
316
312
  declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text): void;
@@ -318,4 +314,4 @@ declare function uploadColors(ctx: CanvasRenderingContext2D, text: Text): void;
318
314
  declare function isNone(val: string | undefined): boolean;
319
315
  declare function filterEmpty(val: Record<string, any> | undefined): Record<string, any> | undefined;
320
316
 
321
- export { Character, type DrawShapePathsOptions, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type HighlightImage, type HighlightOverflow, type HighlightSize, type HighlightStrokeWidth, type LinearGradient, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type Plugin, type Sizeable, Text, type TextAlign, type TextContent, type TextDecoration, type TextDrawStyle, type TextEffect, type TextHighlightStyle, type TextLayoutStyle, type TextListStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, definePlugin, drawPath, effect, fillBackground, filterEmpty, getTransform2D, highlight, isNone, listStyle, parseColor, setupView, uploadColor, uploadColors };
317
+ export { Character, type DrawShapePathsOptions, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type HighlightImage, type HighlightOverflow, type HighlightSize, type HighlightStrokeWidth, type LinearGradient, type ListStyleImage, type ListStylePosition, type ListStyleSize, type ListStyleType, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type Plugin, type Sizeable, Text, type TextAlign, type TextContent, type TextDecoration, type TextDrawStyle, type TextEffect, type TextHighlightStyle, type TextLayoutStyle, type TextListStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, definePlugin, drawPath, filterEmpty, getTransform2D, highlight, isNone, listStyle, parseColor, render, setupView, uploadColor, uploadColors };