modern-text 2.1.1 → 2.1.2

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,5 +1,5 @@
1
- import { Vector2Like, BoundingBox, Vector2 } from 'modern-path2d';
2
- import { a as Character } from './modern-text.DG27jpKj.js';
1
+ import { Vector2, Vector2Like, BoundingBox } from 'modern-path2d';
2
+ import { C as Character } from './modern-text.DENkEKJN.js';
3
3
 
4
4
  /** 逐字沿形状排布所需的曲线最小接口(实现了这三个方法即可当作变形曲线) */
5
5
  interface DeformationCurve {
@@ -97,4 +97,4 @@ interface OffsetPreset extends PresetBase {
97
97
  }
98
98
  type DeformationPreset = FfdPreset | BendPreset | CurvePreset | OffsetPreset;
99
99
 
100
- export type { BendContext as B, CurvePreset as C, DeformationCharInfo as D, FfdContext as F, OffsetPreset as O, VerbatimContext as V, BendPreset as a, DeformationCurve as b, DeformationPreset as c, FfdPreset as d };
100
+ export type { BendContext as B, CurvePreset as C, DeformationPreset as D, FfdContext as F, OffsetPreset as O, VerbatimContext as V, BendPreset as a, DeformationCharInfo as b, DeformationCurve as c, FfdPreset as d };
@@ -1,5 +1,5 @@
1
- import { Vector2Like, BoundingBox, Vector2 } from 'modern-path2d';
2
- import { a as Character } from './modern-text.DG27jpKj.mjs';
1
+ import { Vector2, Vector2Like, BoundingBox } from 'modern-path2d';
2
+ import { C as Character } from './modern-text.DENkEKJN.cjs';
3
3
 
4
4
  /** 逐字沿形状排布所需的曲线最小接口(实现了这三个方法即可当作变形曲线) */
5
5
  interface DeformationCurve {
@@ -97,4 +97,4 @@ interface OffsetPreset extends PresetBase {
97
97
  }
98
98
  type DeformationPreset = FfdPreset | BendPreset | CurvePreset | OffsetPreset;
99
99
 
100
- export type { BendContext as B, CurvePreset as C, DeformationCharInfo as D, FfdContext as F, OffsetPreset as O, VerbatimContext as V, BendPreset as a, DeformationCurve as b, DeformationPreset as c, FfdPreset as d };
100
+ export type { BendContext as B, CurvePreset as C, DeformationPreset as D, FfdContext as F, OffsetPreset as O, VerbatimContext as V, BendPreset as a, DeformationCharInfo as b, DeformationCurve as c, FfdPreset as d };
@@ -1,5 +1,5 @@
1
- import { Vector2Like, BoundingBox, Vector2 } from 'modern-path2d';
2
- import { a as Character } from './modern-text.DG27jpKj.cjs';
1
+ import { Vector2, Vector2Like, BoundingBox } from 'modern-path2d';
2
+ import { C as Character } from './modern-text.DENkEKJN.mjs';
3
3
 
4
4
  /** 逐字沿形状排布所需的曲线最小接口(实现了这三个方法即可当作变形曲线) */
5
5
  interface DeformationCurve {
@@ -97,4 +97,4 @@ interface OffsetPreset extends PresetBase {
97
97
  }
98
98
  type DeformationPreset = FfdPreset | BendPreset | CurvePreset | OffsetPreset;
99
99
 
100
- export type { BendContext as B, CurvePreset as C, DeformationCharInfo as D, FfdContext as F, OffsetPreset as O, VerbatimContext as V, BendPreset as a, DeformationCurve as b, DeformationPreset as c, FfdPreset as d };
100
+ export type { BendContext as B, CurvePreset as C, DeformationPreset as D, FfdContext as F, OffsetPreset as O, VerbatimContext as V, BendPreset as a, DeformationCharInfo as b, DeformationCurve as c, FfdPreset as d };
@@ -1,6 +1,6 @@
1
- import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, TextObject, ReactivableEvents, Reactivable, NormalizedText, NormalizedEffect, LinearGradientWithType, RadialGradientWithType, NormalizedShadow } from 'modern-idoc';
2
- import { BoundingBox, Path2D, Vector2, Vector2Like, Path2DSet, Path2DStyle } from 'modern-path2d';
1
+ import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, LinearGradientWithType, RadialGradientWithType, NormalizedEffect, NormalizedShadow, TextObject, ReactivableEvents, Reactivable, NormalizedText } from 'modern-idoc';
3
2
  import { SFNT, Fonts } from 'modern-font';
3
+ import { BoundingBox, Path2D, Vector2, Vector2Like, Path2DStyle, Path2DSet } from 'modern-path2d';
4
4
 
5
5
  declare class Fragment {
6
6
  readonly content: string;
@@ -114,6 +114,40 @@ declare class Character {
114
114
  getGlyphBoundingBox(withStyle?: boolean): BoundingBox | undefined;
115
115
  }
116
116
 
117
+ interface DrawShapePathsOptions extends Partial<Path2DStyle> {
118
+ clipRect?: BoundingBox;
119
+ }
120
+ declare class Canvas2DRenderer {
121
+ text: Text;
122
+ context: CanvasRenderingContext2D;
123
+ pixelRatio: number;
124
+ region?: {
125
+ x: number;
126
+ y: number;
127
+ width: number;
128
+ height: number;
129
+ };
130
+ constructor(text: Text, context: CanvasRenderingContext2D);
131
+ protected _setupView: () => void;
132
+ protected _setupColors: () => void;
133
+ setup: () => this;
134
+ protected _parseColor: (source: string | CanvasGradient | CanvasPattern | LinearGradientWithType | RadialGradientWithType, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
135
+ protected _uploadedStyles: string[];
136
+ uploadColor: (box: BoundingBox, ctx: {
137
+ style?: NormalizedStyle;
138
+ fill?: NormalizedFill;
139
+ outline?: NormalizedOutline;
140
+ }) => void;
141
+ protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
142
+ drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
143
+ effectToPathStyle(effect: NormalizedEffect): Partial<Path2DStyle>;
144
+ transformEffect(effect: NormalizedEffect): void;
145
+ protected _shadowCanvas?: HTMLCanvasElement;
146
+ protected _shadowCtx?: CanvasRenderingContext2D | null;
147
+ drawWithShadow: (shadow: NormalizedShadow, drawFn: () => void) => void;
148
+ drawCharacter: (character: Character, effect?: NormalizedEffect) => void;
149
+ }
150
+
117
151
  /**
118
152
  * A measurer's output: the paragraphs with their four-level boxes filled in place,
119
153
  * plus the overall bounding box. (Formerly `MeasureDomResult`; layout is now
@@ -311,39 +345,5 @@ declare class Paragraph {
311
345
  update(): this;
312
346
  }
313
347
 
314
- interface DrawShapePathsOptions extends Partial<Path2DStyle> {
315
- clipRect?: BoundingBox;
316
- }
317
- declare class Canvas2DRenderer {
318
- text: Text;
319
- context: CanvasRenderingContext2D;
320
- pixelRatio: number;
321
- region?: {
322
- x: number;
323
- y: number;
324
- width: number;
325
- height: number;
326
- };
327
- constructor(text: Text, context: CanvasRenderingContext2D);
328
- protected _setupView: () => void;
329
- protected _setupColors: () => void;
330
- setup: () => this;
331
- protected _parseColor: (source: string | CanvasGradient | CanvasPattern | LinearGradientWithType | RadialGradientWithType, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
332
- protected _uploadedStyles: string[];
333
- uploadColor: (box: BoundingBox, ctx: {
334
- style?: NormalizedStyle;
335
- fill?: NormalizedFill;
336
- outline?: NormalizedOutline;
337
- }) => void;
338
- protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
339
- drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
340
- effectToPathStyle(effect: NormalizedEffect): Partial<Path2DStyle>;
341
- transformEffect(effect: NormalizedEffect): void;
342
- protected _shadowCanvas?: HTMLCanvasElement;
343
- protected _shadowCtx?: CanvasRenderingContext2D | null;
344
- drawWithShadow: (shadow: NormalizedShadow, drawFn: () => void) => void;
345
- drawCharacter: (character: Character, effect?: NormalizedEffect) => void;
346
- }
347
-
348
- export { Canvas2DRenderer as C, Fragment as F, Paragraph as P, Text as T, Character as a, textDefaultStyle as t };
349
- export type { DrawShapePathsOptions as D, MeasureResult as M, Options as O, RenderOptions as R, MeasurerResult as b, Plugin as c, TextEvents as d, TextMeasurer as e };
348
+ export { Character as C, Fragment as F, Paragraph as a, Text as c, Canvas2DRenderer as d, textDefaultStyle as t };
349
+ export type { DrawShapePathsOptions as D, MeasurerResult as M, Options as O, Plugin as P, RenderOptions as R, TextMeasurer as T, MeasureResult as b, TextEvents as e };
@@ -1,6 +1,6 @@
1
- import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, TextObject, ReactivableEvents, Reactivable, NormalizedText, NormalizedEffect, LinearGradientWithType, RadialGradientWithType, NormalizedShadow } from 'modern-idoc';
2
- import { BoundingBox, Path2D, Vector2, Vector2Like, Path2DSet, Path2DStyle } from 'modern-path2d';
1
+ import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, LinearGradientWithType, RadialGradientWithType, NormalizedEffect, NormalizedShadow, TextObject, ReactivableEvents, Reactivable, NormalizedText } from 'modern-idoc';
3
2
  import { SFNT, Fonts } from 'modern-font';
3
+ import { BoundingBox, Path2D, Vector2, Vector2Like, Path2DStyle, Path2DSet } from 'modern-path2d';
4
4
 
5
5
  declare class Fragment {
6
6
  readonly content: string;
@@ -114,6 +114,40 @@ declare class Character {
114
114
  getGlyphBoundingBox(withStyle?: boolean): BoundingBox | undefined;
115
115
  }
116
116
 
117
+ interface DrawShapePathsOptions extends Partial<Path2DStyle> {
118
+ clipRect?: BoundingBox;
119
+ }
120
+ declare class Canvas2DRenderer {
121
+ text: Text;
122
+ context: CanvasRenderingContext2D;
123
+ pixelRatio: number;
124
+ region?: {
125
+ x: number;
126
+ y: number;
127
+ width: number;
128
+ height: number;
129
+ };
130
+ constructor(text: Text, context: CanvasRenderingContext2D);
131
+ protected _setupView: () => void;
132
+ protected _setupColors: () => void;
133
+ setup: () => this;
134
+ protected _parseColor: (source: string | CanvasGradient | CanvasPattern | LinearGradientWithType | RadialGradientWithType, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
135
+ protected _uploadedStyles: string[];
136
+ uploadColor: (box: BoundingBox, ctx: {
137
+ style?: NormalizedStyle;
138
+ fill?: NormalizedFill;
139
+ outline?: NormalizedOutline;
140
+ }) => void;
141
+ protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
142
+ drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
143
+ effectToPathStyle(effect: NormalizedEffect): Partial<Path2DStyle>;
144
+ transformEffect(effect: NormalizedEffect): void;
145
+ protected _shadowCanvas?: HTMLCanvasElement;
146
+ protected _shadowCtx?: CanvasRenderingContext2D | null;
147
+ drawWithShadow: (shadow: NormalizedShadow, drawFn: () => void) => void;
148
+ drawCharacter: (character: Character, effect?: NormalizedEffect) => void;
149
+ }
150
+
117
151
  /**
118
152
  * A measurer's output: the paragraphs with their four-level boxes filled in place,
119
153
  * plus the overall bounding box. (Formerly `MeasureDomResult`; layout is now
@@ -311,39 +345,5 @@ declare class Paragraph {
311
345
  update(): this;
312
346
  }
313
347
 
314
- interface DrawShapePathsOptions extends Partial<Path2DStyle> {
315
- clipRect?: BoundingBox;
316
- }
317
- declare class Canvas2DRenderer {
318
- text: Text;
319
- context: CanvasRenderingContext2D;
320
- pixelRatio: number;
321
- region?: {
322
- x: number;
323
- y: number;
324
- width: number;
325
- height: number;
326
- };
327
- constructor(text: Text, context: CanvasRenderingContext2D);
328
- protected _setupView: () => void;
329
- protected _setupColors: () => void;
330
- setup: () => this;
331
- protected _parseColor: (source: string | CanvasGradient | CanvasPattern | LinearGradientWithType | RadialGradientWithType, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
332
- protected _uploadedStyles: string[];
333
- uploadColor: (box: BoundingBox, ctx: {
334
- style?: NormalizedStyle;
335
- fill?: NormalizedFill;
336
- outline?: NormalizedOutline;
337
- }) => void;
338
- protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
339
- drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
340
- effectToPathStyle(effect: NormalizedEffect): Partial<Path2DStyle>;
341
- transformEffect(effect: NormalizedEffect): void;
342
- protected _shadowCanvas?: HTMLCanvasElement;
343
- protected _shadowCtx?: CanvasRenderingContext2D | null;
344
- drawWithShadow: (shadow: NormalizedShadow, drawFn: () => void) => void;
345
- drawCharacter: (character: Character, effect?: NormalizedEffect) => void;
346
- }
347
-
348
- export { Canvas2DRenderer as C, Fragment as F, Paragraph as P, Text as T, Character as a, textDefaultStyle as t };
349
- export type { DrawShapePathsOptions as D, MeasureResult as M, Options as O, RenderOptions as R, MeasurerResult as b, Plugin as c, TextEvents as d, TextMeasurer as e };
348
+ export { Character as C, Fragment as F, Paragraph as a, Text as c, Canvas2DRenderer as d, textDefaultStyle as t };
349
+ export type { DrawShapePathsOptions as D, MeasurerResult as M, Options as O, Plugin as P, RenderOptions as R, TextMeasurer as T, MeasureResult as b, TextEvents as e };
@@ -1,6 +1,6 @@
1
- import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, TextObject, ReactivableEvents, Reactivable, NormalizedText, NormalizedEffect, LinearGradientWithType, RadialGradientWithType, NormalizedShadow } from 'modern-idoc';
2
- import { BoundingBox, Path2D, Vector2, Vector2Like, Path2DSet, Path2DStyle } from 'modern-path2d';
1
+ import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, LinearGradientWithType, RadialGradientWithType, NormalizedEffect, NormalizedShadow, TextObject, ReactivableEvents, Reactivable, NormalizedText } from 'modern-idoc';
3
2
  import { SFNT, Fonts } from 'modern-font';
3
+ import { BoundingBox, Path2D, Vector2, Vector2Like, Path2DStyle, Path2DSet } from 'modern-path2d';
4
4
 
5
5
  declare class Fragment {
6
6
  readonly content: string;
@@ -114,6 +114,40 @@ declare class Character {
114
114
  getGlyphBoundingBox(withStyle?: boolean): BoundingBox | undefined;
115
115
  }
116
116
 
117
+ interface DrawShapePathsOptions extends Partial<Path2DStyle> {
118
+ clipRect?: BoundingBox;
119
+ }
120
+ declare class Canvas2DRenderer {
121
+ text: Text;
122
+ context: CanvasRenderingContext2D;
123
+ pixelRatio: number;
124
+ region?: {
125
+ x: number;
126
+ y: number;
127
+ width: number;
128
+ height: number;
129
+ };
130
+ constructor(text: Text, context: CanvasRenderingContext2D);
131
+ protected _setupView: () => void;
132
+ protected _setupColors: () => void;
133
+ setup: () => this;
134
+ protected _parseColor: (source: string | CanvasGradient | CanvasPattern | LinearGradientWithType | RadialGradientWithType, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
135
+ protected _uploadedStyles: string[];
136
+ uploadColor: (box: BoundingBox, ctx: {
137
+ style?: NormalizedStyle;
138
+ fill?: NormalizedFill;
139
+ outline?: NormalizedOutline;
140
+ }) => void;
141
+ protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
142
+ drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
143
+ effectToPathStyle(effect: NormalizedEffect): Partial<Path2DStyle>;
144
+ transformEffect(effect: NormalizedEffect): void;
145
+ protected _shadowCanvas?: HTMLCanvasElement;
146
+ protected _shadowCtx?: CanvasRenderingContext2D | null;
147
+ drawWithShadow: (shadow: NormalizedShadow, drawFn: () => void) => void;
148
+ drawCharacter: (character: Character, effect?: NormalizedEffect) => void;
149
+ }
150
+
117
151
  /**
118
152
  * A measurer's output: the paragraphs with their four-level boxes filled in place,
119
153
  * plus the overall bounding box. (Formerly `MeasureDomResult`; layout is now
@@ -311,39 +345,5 @@ declare class Paragraph {
311
345
  update(): this;
312
346
  }
313
347
 
314
- interface DrawShapePathsOptions extends Partial<Path2DStyle> {
315
- clipRect?: BoundingBox;
316
- }
317
- declare class Canvas2DRenderer {
318
- text: Text;
319
- context: CanvasRenderingContext2D;
320
- pixelRatio: number;
321
- region?: {
322
- x: number;
323
- y: number;
324
- width: number;
325
- height: number;
326
- };
327
- constructor(text: Text, context: CanvasRenderingContext2D);
328
- protected _setupView: () => void;
329
- protected _setupColors: () => void;
330
- setup: () => this;
331
- protected _parseColor: (source: string | CanvasGradient | CanvasPattern | LinearGradientWithType | RadialGradientWithType, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
332
- protected _uploadedStyles: string[];
333
- uploadColor: (box: BoundingBox, ctx: {
334
- style?: NormalizedStyle;
335
- fill?: NormalizedFill;
336
- outline?: NormalizedOutline;
337
- }) => void;
338
- protected _mergePathStyle(path: Path2D, style: Partial<Path2DStyle>): Partial<Path2DStyle>;
339
- drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
340
- effectToPathStyle(effect: NormalizedEffect): Partial<Path2DStyle>;
341
- transformEffect(effect: NormalizedEffect): void;
342
- protected _shadowCanvas?: HTMLCanvasElement;
343
- protected _shadowCtx?: CanvasRenderingContext2D | null;
344
- drawWithShadow: (shadow: NormalizedShadow, drawFn: () => void) => void;
345
- drawCharacter: (character: Character, effect?: NormalizedEffect) => void;
346
- }
347
-
348
- export { Canvas2DRenderer as C, Fragment as F, Paragraph as P, Text as T, Character as a, textDefaultStyle as t };
349
- export type { DrawShapePathsOptions as D, MeasureResult as M, Options as O, RenderOptions as R, MeasurerResult as b, Plugin as c, TextEvents as d, TextMeasurer as e };
348
+ export { Character as C, Fragment as F, Paragraph as a, Text as c, Canvas2DRenderer as d, textDefaultStyle as t };
349
+ export type { DrawShapePathsOptions as D, MeasurerResult as M, Options as O, Plugin as P, RenderOptions as R, TextMeasurer as T, MeasureResult as b, TextEvents as e };
@@ -1,7 +1,7 @@
1
1
  import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
2
- import { T as Text } from '../shared/modern-text.DG27jpKj.cjs';
3
- import 'modern-path2d';
2
+ import { c as Text } from '../shared/modern-text.DENkEKJN.cjs';
4
3
  import 'modern-font';
4
+ import 'modern-path2d';
5
5
 
6
6
  interface IndexCharacter {
7
7
  paragraphIndex: number;
@@ -1,7 +1,7 @@
1
1
  import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
2
- import { T as Text } from '../shared/modern-text.DG27jpKj.mjs';
3
- import 'modern-path2d';
2
+ import { c as Text } from '../shared/modern-text.DENkEKJN.mjs';
4
3
  import 'modern-font';
4
+ import 'modern-path2d';
5
5
 
6
6
  interface IndexCharacter {
7
7
  paragraphIndex: number;
@@ -1,7 +1,7 @@
1
1
  import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
2
- import { T as Text } from '../shared/modern-text.DG27jpKj.js';
3
- import 'modern-path2d';
2
+ import { c as Text } from '../shared/modern-text.DENkEKJN.js';
4
3
  import 'modern-font';
4
+ import 'modern-path2d';
5
5
 
6
6
  interface IndexCharacter {
7
7
  paragraphIndex: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "2.1.1",
4
+ "version": "2.1.2",
5
5
  "packageManager": "pnpm@10.18.1",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",
@@ -60,19 +60,19 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "diff": "^9.0.0",
63
- "modern-font": "^0.6.0",
64
- "modern-idoc": "^0.12.1",
65
- "modern-path2d": "^1.7.0"
63
+ "modern-font": "^0.6.2",
64
+ "modern-idoc": "^0.12.3",
65
+ "modern-path2d": "^1.8.6"
66
66
  },
67
67
  "devDependencies": {
68
- "@antfu/eslint-config": "^9.0.0",
69
- "@types/node": "^25.9.1",
68
+ "@antfu/eslint-config": "^9.1.0",
69
+ "@types/node": "^26.0.1",
70
70
  "bumpp": "^11.1.0",
71
71
  "conventional-changelog-cli": "^5.0.0",
72
- "eslint": "^10.4.0",
72
+ "eslint": "^10.6.0",
73
73
  "typescript": "^6.0.3",
74
74
  "unbuild": "^3.6.1",
75
- "vite": "^8.0.14",
76
- "vitest": "^4.1.7"
75
+ "vite": "^8.1.2",
76
+ "vitest": "^4.1.9"
77
77
  }
78
78
  }