modern-text 1.9.1 → 1.10.0
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.cjs +4 -8
- package/dist/index.d.cts +19 -44
- package/dist/index.d.mts +19 -44
- package/dist/index.d.ts +19 -44
- package/dist/index.js +8 -8
- package/dist/index.mjs +2 -2
- package/dist/shared/{modern-text.B2pcGP3X.mjs → modern-text.BD1kUWDw.mjs} +229 -204
- package/dist/shared/{modern-text.BmTeQ51D.cjs → modern-text.BUyl2x8m.cjs} +229 -208
- package/dist/shared/{modern-text.WbWB6f3d.d.ts → modern-text.D_VtaVfs.d.cts} +52 -33
- package/dist/shared/{modern-text.WbWB6f3d.d.cts → modern-text.D_VtaVfs.d.mts} +52 -33
- package/dist/shared/{modern-text.WbWB6f3d.d.mts → modern-text.D_VtaVfs.d.ts} +52 -33
- package/dist/web-components/index.cjs +1 -1
- package/dist/web-components/index.d.cts +2 -2
- package/dist/web-components/index.d.mts +2 -2
- package/dist/web-components/index.d.ts +2 -2
- package/dist/web-components/index.mjs +1 -1
- package/package.json +7 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fonts, SFNT } from 'modern-font';
|
|
2
1
|
import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, TextObject, ReactivableEvents, Reactivable, NormalizedText } from 'modern-idoc';
|
|
3
|
-
import { BoundingBox, Path2D, Vector2, VectorLike, Path2DSet } from 'modern-path2d';
|
|
2
|
+
import { BoundingBox, Path2D, Vector2, VectorLike, Path2DSet, Path2DDrawStyle } from 'modern-path2d';
|
|
3
|
+
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare class Fragment {
|
|
6
6
|
content: string;
|
|
@@ -64,39 +64,23 @@ declare class Character {
|
|
|
64
64
|
max: Vector2;
|
|
65
65
|
} | undefined;
|
|
66
66
|
getGlyphBoundingBox(withStyle?: boolean): BoundingBox | undefined;
|
|
67
|
-
drawTo(ctx: CanvasRenderingContext2D, config?: NormalizedStyle): void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
declare class Paragraph {
|
|
71
|
-
style: NormalizedStyle;
|
|
72
|
-
index: number;
|
|
73
|
-
parent: Text$1;
|
|
74
|
-
lineBox: BoundingBox;
|
|
75
|
-
fragments: Fragment[];
|
|
76
|
-
fill?: NormalizedFill;
|
|
77
|
-
outline?: NormalizedOutline;
|
|
78
|
-
computedStyle: FullStyle;
|
|
79
|
-
get computedFill(): NormalizedFill | undefined;
|
|
80
|
-
get computedOutline(): NormalizedOutline | undefined;
|
|
81
|
-
constructor(style: NormalizedStyle, index: number, parent: Text$1);
|
|
82
|
-
updateComputedStyle(): this;
|
|
83
67
|
}
|
|
84
68
|
|
|
85
|
-
interface
|
|
69
|
+
interface Plugin {
|
|
86
70
|
name: string;
|
|
87
71
|
pathSet?: Path2DSet;
|
|
88
72
|
getBoundingBox?: (text: Text$1) => BoundingBox | undefined;
|
|
89
73
|
update?: (text: Text$1) => void;
|
|
90
74
|
updateOrder?: number;
|
|
91
|
-
render?: (
|
|
75
|
+
render?: (renderer: Canvas2DRenderer) => void;
|
|
92
76
|
renderOrder?: number;
|
|
93
77
|
load?: (text: Text$1) => Promise<void>;
|
|
94
78
|
}
|
|
95
|
-
interface
|
|
79
|
+
interface Options extends TextObject {
|
|
96
80
|
debug?: boolean;
|
|
97
81
|
measureDom?: HTMLElement;
|
|
98
82
|
fonts?: Fonts;
|
|
99
|
-
plugins?:
|
|
83
|
+
plugins?: Plugin[];
|
|
100
84
|
}
|
|
101
85
|
|
|
102
86
|
interface MeasuredParagraph {
|
|
@@ -162,7 +146,7 @@ declare class Measurer {
|
|
|
162
146
|
measure(paragraphs: Paragraph[], rootStyle: FullStyle, dom?: HTMLElement): MeasureDomResult;
|
|
163
147
|
}
|
|
164
148
|
|
|
165
|
-
interface
|
|
149
|
+
interface RenderOptions {
|
|
166
150
|
view: HTMLCanvasElement;
|
|
167
151
|
pixelRatio?: number;
|
|
168
152
|
onContext?: (context: CanvasRenderingContext2D) => void;
|
|
@@ -207,6 +191,7 @@ declare class Text$1 extends Reactivable {
|
|
|
207
191
|
fonts?: Fonts;
|
|
208
192
|
needsUpdate: boolean;
|
|
209
193
|
computedStyle: FullStyle;
|
|
194
|
+
computedEffects: NormalizedStyle[];
|
|
210
195
|
paragraphs: Paragraph[];
|
|
211
196
|
lineBox: BoundingBox;
|
|
212
197
|
rawGlyphBox: BoundingBox;
|
|
@@ -214,31 +199,65 @@ declare class Text$1 extends Reactivable {
|
|
|
214
199
|
pathBox: BoundingBox;
|
|
215
200
|
boundingBox: BoundingBox;
|
|
216
201
|
measurer: Measurer;
|
|
217
|
-
plugins: Map<string,
|
|
202
|
+
plugins: Map<string, Plugin>;
|
|
218
203
|
pathSets: Path2DSet[];
|
|
219
204
|
get fontSize(): number;
|
|
220
205
|
get isVertical(): boolean;
|
|
221
206
|
get characters(): Character[];
|
|
222
|
-
constructor(options?:
|
|
223
|
-
set(options?:
|
|
224
|
-
use(plugin:
|
|
207
|
+
constructor(options?: Options);
|
|
208
|
+
set(options?: Options): void;
|
|
209
|
+
use(plugin: Plugin): this;
|
|
225
210
|
forEachCharacter(handle: (character: Character, ctx: {
|
|
226
211
|
paragraphIndex: number;
|
|
227
212
|
fragmentIndex: number;
|
|
228
213
|
characterIndex: number;
|
|
229
214
|
}) => void): this;
|
|
230
215
|
load(): Promise<void>;
|
|
231
|
-
|
|
216
|
+
protected _update(): this;
|
|
232
217
|
createDom(): HTMLElement;
|
|
233
218
|
measure(dom?: HTMLElement | undefined): MeasureResult;
|
|
234
219
|
getGlyphBox(): BoundingBox;
|
|
235
|
-
|
|
236
|
-
|
|
220
|
+
protected _updatePathBox(): this;
|
|
221
|
+
protected _updateBoundingBox(): this;
|
|
237
222
|
requestUpdate(): this;
|
|
238
223
|
update(dom?: HTMLElement | undefined): this;
|
|
239
|
-
render(options:
|
|
224
|
+
render(options: RenderOptions): void;
|
|
240
225
|
toString(): string;
|
|
241
226
|
}
|
|
242
227
|
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
declare class Paragraph {
|
|
229
|
+
style: NormalizedStyle;
|
|
230
|
+
index: number;
|
|
231
|
+
parent: Text$1;
|
|
232
|
+
lineBox: BoundingBox;
|
|
233
|
+
fragments: Fragment[];
|
|
234
|
+
fill?: NormalizedFill;
|
|
235
|
+
outline?: NormalizedOutline;
|
|
236
|
+
computedStyle: FullStyle;
|
|
237
|
+
get computedFill(): NormalizedFill | undefined;
|
|
238
|
+
get computedOutline(): NormalizedOutline | undefined;
|
|
239
|
+
constructor(style: NormalizedStyle, index: number, parent: Text$1);
|
|
240
|
+
updateComputedStyle(): this;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface DrawShapePathsOptions extends NormalizedStyle, Omit<Partial<Path2DDrawStyle>, 'fill' | 'outline'> {
|
|
244
|
+
fontSize?: number;
|
|
245
|
+
clipRect?: BoundingBox;
|
|
246
|
+
}
|
|
247
|
+
declare class Canvas2DRenderer {
|
|
248
|
+
text: Text$1;
|
|
249
|
+
context: CanvasRenderingContext2D;
|
|
250
|
+
pixelRatio: number;
|
|
251
|
+
constructor(text: Text$1, context: CanvasRenderingContext2D);
|
|
252
|
+
protected _setupView: () => void;
|
|
253
|
+
protected _setupColors: () => void;
|
|
254
|
+
setup: () => this;
|
|
255
|
+
protected _parseColor: (source: string | CanvasGradient | CanvasPattern, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
|
|
256
|
+
protected _uploadedStyles: string[];
|
|
257
|
+
uploadColor: (style: NormalizedStyle, box: BoundingBox) => void;
|
|
258
|
+
drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
|
|
259
|
+
drawCharacter: (character: Character, userStyle?: NormalizedStyle) => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { Canvas2DRenderer as C, Fragment as F, Text$1 as T, Character as a, Paragraph as b, Measurer as g, textDefaultStyle as t };
|
|
263
|
+
export type { DrawShapePathsOptions as D, MeasureResult as M, Options as O, Plugin as P, RenderOptions as R, MeasuredParagraph as c, MeasuredFragment as d, MeasuredCharacter as e, MeasureDomResult as f, TextEvents as h };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fonts, SFNT } from 'modern-font';
|
|
2
1
|
import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, TextObject, ReactivableEvents, Reactivable, NormalizedText } from 'modern-idoc';
|
|
3
|
-
import { BoundingBox, Path2D, Vector2, VectorLike, Path2DSet } from 'modern-path2d';
|
|
2
|
+
import { BoundingBox, Path2D, Vector2, VectorLike, Path2DSet, Path2DDrawStyle } from 'modern-path2d';
|
|
3
|
+
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare class Fragment {
|
|
6
6
|
content: string;
|
|
@@ -64,39 +64,23 @@ declare class Character {
|
|
|
64
64
|
max: Vector2;
|
|
65
65
|
} | undefined;
|
|
66
66
|
getGlyphBoundingBox(withStyle?: boolean): BoundingBox | undefined;
|
|
67
|
-
drawTo(ctx: CanvasRenderingContext2D, config?: NormalizedStyle): void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
declare class Paragraph {
|
|
71
|
-
style: NormalizedStyle;
|
|
72
|
-
index: number;
|
|
73
|
-
parent: Text$1;
|
|
74
|
-
lineBox: BoundingBox;
|
|
75
|
-
fragments: Fragment[];
|
|
76
|
-
fill?: NormalizedFill;
|
|
77
|
-
outline?: NormalizedOutline;
|
|
78
|
-
computedStyle: FullStyle;
|
|
79
|
-
get computedFill(): NormalizedFill | undefined;
|
|
80
|
-
get computedOutline(): NormalizedOutline | undefined;
|
|
81
|
-
constructor(style: NormalizedStyle, index: number, parent: Text$1);
|
|
82
|
-
updateComputedStyle(): this;
|
|
83
67
|
}
|
|
84
68
|
|
|
85
|
-
interface
|
|
69
|
+
interface Plugin {
|
|
86
70
|
name: string;
|
|
87
71
|
pathSet?: Path2DSet;
|
|
88
72
|
getBoundingBox?: (text: Text$1) => BoundingBox | undefined;
|
|
89
73
|
update?: (text: Text$1) => void;
|
|
90
74
|
updateOrder?: number;
|
|
91
|
-
render?: (
|
|
75
|
+
render?: (renderer: Canvas2DRenderer) => void;
|
|
92
76
|
renderOrder?: number;
|
|
93
77
|
load?: (text: Text$1) => Promise<void>;
|
|
94
78
|
}
|
|
95
|
-
interface
|
|
79
|
+
interface Options extends TextObject {
|
|
96
80
|
debug?: boolean;
|
|
97
81
|
measureDom?: HTMLElement;
|
|
98
82
|
fonts?: Fonts;
|
|
99
|
-
plugins?:
|
|
83
|
+
plugins?: Plugin[];
|
|
100
84
|
}
|
|
101
85
|
|
|
102
86
|
interface MeasuredParagraph {
|
|
@@ -162,7 +146,7 @@ declare class Measurer {
|
|
|
162
146
|
measure(paragraphs: Paragraph[], rootStyle: FullStyle, dom?: HTMLElement): MeasureDomResult;
|
|
163
147
|
}
|
|
164
148
|
|
|
165
|
-
interface
|
|
149
|
+
interface RenderOptions {
|
|
166
150
|
view: HTMLCanvasElement;
|
|
167
151
|
pixelRatio?: number;
|
|
168
152
|
onContext?: (context: CanvasRenderingContext2D) => void;
|
|
@@ -207,6 +191,7 @@ declare class Text$1 extends Reactivable {
|
|
|
207
191
|
fonts?: Fonts;
|
|
208
192
|
needsUpdate: boolean;
|
|
209
193
|
computedStyle: FullStyle;
|
|
194
|
+
computedEffects: NormalizedStyle[];
|
|
210
195
|
paragraphs: Paragraph[];
|
|
211
196
|
lineBox: BoundingBox;
|
|
212
197
|
rawGlyphBox: BoundingBox;
|
|
@@ -214,31 +199,65 @@ declare class Text$1 extends Reactivable {
|
|
|
214
199
|
pathBox: BoundingBox;
|
|
215
200
|
boundingBox: BoundingBox;
|
|
216
201
|
measurer: Measurer;
|
|
217
|
-
plugins: Map<string,
|
|
202
|
+
plugins: Map<string, Plugin>;
|
|
218
203
|
pathSets: Path2DSet[];
|
|
219
204
|
get fontSize(): number;
|
|
220
205
|
get isVertical(): boolean;
|
|
221
206
|
get characters(): Character[];
|
|
222
|
-
constructor(options?:
|
|
223
|
-
set(options?:
|
|
224
|
-
use(plugin:
|
|
207
|
+
constructor(options?: Options);
|
|
208
|
+
set(options?: Options): void;
|
|
209
|
+
use(plugin: Plugin): this;
|
|
225
210
|
forEachCharacter(handle: (character: Character, ctx: {
|
|
226
211
|
paragraphIndex: number;
|
|
227
212
|
fragmentIndex: number;
|
|
228
213
|
characterIndex: number;
|
|
229
214
|
}) => void): this;
|
|
230
215
|
load(): Promise<void>;
|
|
231
|
-
|
|
216
|
+
protected _update(): this;
|
|
232
217
|
createDom(): HTMLElement;
|
|
233
218
|
measure(dom?: HTMLElement | undefined): MeasureResult;
|
|
234
219
|
getGlyphBox(): BoundingBox;
|
|
235
|
-
|
|
236
|
-
|
|
220
|
+
protected _updatePathBox(): this;
|
|
221
|
+
protected _updateBoundingBox(): this;
|
|
237
222
|
requestUpdate(): this;
|
|
238
223
|
update(dom?: HTMLElement | undefined): this;
|
|
239
|
-
render(options:
|
|
224
|
+
render(options: RenderOptions): void;
|
|
240
225
|
toString(): string;
|
|
241
226
|
}
|
|
242
227
|
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
declare class Paragraph {
|
|
229
|
+
style: NormalizedStyle;
|
|
230
|
+
index: number;
|
|
231
|
+
parent: Text$1;
|
|
232
|
+
lineBox: BoundingBox;
|
|
233
|
+
fragments: Fragment[];
|
|
234
|
+
fill?: NormalizedFill;
|
|
235
|
+
outline?: NormalizedOutline;
|
|
236
|
+
computedStyle: FullStyle;
|
|
237
|
+
get computedFill(): NormalizedFill | undefined;
|
|
238
|
+
get computedOutline(): NormalizedOutline | undefined;
|
|
239
|
+
constructor(style: NormalizedStyle, index: number, parent: Text$1);
|
|
240
|
+
updateComputedStyle(): this;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface DrawShapePathsOptions extends NormalizedStyle, Omit<Partial<Path2DDrawStyle>, 'fill' | 'outline'> {
|
|
244
|
+
fontSize?: number;
|
|
245
|
+
clipRect?: BoundingBox;
|
|
246
|
+
}
|
|
247
|
+
declare class Canvas2DRenderer {
|
|
248
|
+
text: Text$1;
|
|
249
|
+
context: CanvasRenderingContext2D;
|
|
250
|
+
pixelRatio: number;
|
|
251
|
+
constructor(text: Text$1, context: CanvasRenderingContext2D);
|
|
252
|
+
protected _setupView: () => void;
|
|
253
|
+
protected _setupColors: () => void;
|
|
254
|
+
setup: () => this;
|
|
255
|
+
protected _parseColor: (source: string | CanvasGradient | CanvasPattern, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
|
|
256
|
+
protected _uploadedStyles: string[];
|
|
257
|
+
uploadColor: (style: NormalizedStyle, box: BoundingBox) => void;
|
|
258
|
+
drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
|
|
259
|
+
drawCharacter: (character: Character, userStyle?: NormalizedStyle) => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { Canvas2DRenderer as C, Fragment as F, Text$1 as T, Character as a, Paragraph as b, Measurer as g, textDefaultStyle as t };
|
|
263
|
+
export type { DrawShapePathsOptions as D, MeasureResult as M, Options as O, Plugin as P, RenderOptions as R, MeasuredParagraph as c, MeasuredFragment as d, MeasuredCharacter as e, MeasureDomResult as f, TextEvents as h };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fonts, SFNT } from 'modern-font';
|
|
2
1
|
import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle, TextObject, ReactivableEvents, Reactivable, NormalizedText } from 'modern-idoc';
|
|
3
|
-
import { BoundingBox, Path2D, Vector2, VectorLike, Path2DSet } from 'modern-path2d';
|
|
2
|
+
import { BoundingBox, Path2D, Vector2, VectorLike, Path2DSet, Path2DDrawStyle } from 'modern-path2d';
|
|
3
|
+
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare class Fragment {
|
|
6
6
|
content: string;
|
|
@@ -64,39 +64,23 @@ declare class Character {
|
|
|
64
64
|
max: Vector2;
|
|
65
65
|
} | undefined;
|
|
66
66
|
getGlyphBoundingBox(withStyle?: boolean): BoundingBox | undefined;
|
|
67
|
-
drawTo(ctx: CanvasRenderingContext2D, config?: NormalizedStyle): void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
declare class Paragraph {
|
|
71
|
-
style: NormalizedStyle;
|
|
72
|
-
index: number;
|
|
73
|
-
parent: Text$1;
|
|
74
|
-
lineBox: BoundingBox;
|
|
75
|
-
fragments: Fragment[];
|
|
76
|
-
fill?: NormalizedFill;
|
|
77
|
-
outline?: NormalizedOutline;
|
|
78
|
-
computedStyle: FullStyle;
|
|
79
|
-
get computedFill(): NormalizedFill | undefined;
|
|
80
|
-
get computedOutline(): NormalizedOutline | undefined;
|
|
81
|
-
constructor(style: NormalizedStyle, index: number, parent: Text$1);
|
|
82
|
-
updateComputedStyle(): this;
|
|
83
67
|
}
|
|
84
68
|
|
|
85
|
-
interface
|
|
69
|
+
interface Plugin {
|
|
86
70
|
name: string;
|
|
87
71
|
pathSet?: Path2DSet;
|
|
88
72
|
getBoundingBox?: (text: Text$1) => BoundingBox | undefined;
|
|
89
73
|
update?: (text: Text$1) => void;
|
|
90
74
|
updateOrder?: number;
|
|
91
|
-
render?: (
|
|
75
|
+
render?: (renderer: Canvas2DRenderer) => void;
|
|
92
76
|
renderOrder?: number;
|
|
93
77
|
load?: (text: Text$1) => Promise<void>;
|
|
94
78
|
}
|
|
95
|
-
interface
|
|
79
|
+
interface Options extends TextObject {
|
|
96
80
|
debug?: boolean;
|
|
97
81
|
measureDom?: HTMLElement;
|
|
98
82
|
fonts?: Fonts;
|
|
99
|
-
plugins?:
|
|
83
|
+
plugins?: Plugin[];
|
|
100
84
|
}
|
|
101
85
|
|
|
102
86
|
interface MeasuredParagraph {
|
|
@@ -162,7 +146,7 @@ declare class Measurer {
|
|
|
162
146
|
measure(paragraphs: Paragraph[], rootStyle: FullStyle, dom?: HTMLElement): MeasureDomResult;
|
|
163
147
|
}
|
|
164
148
|
|
|
165
|
-
interface
|
|
149
|
+
interface RenderOptions {
|
|
166
150
|
view: HTMLCanvasElement;
|
|
167
151
|
pixelRatio?: number;
|
|
168
152
|
onContext?: (context: CanvasRenderingContext2D) => void;
|
|
@@ -207,6 +191,7 @@ declare class Text$1 extends Reactivable {
|
|
|
207
191
|
fonts?: Fonts;
|
|
208
192
|
needsUpdate: boolean;
|
|
209
193
|
computedStyle: FullStyle;
|
|
194
|
+
computedEffects: NormalizedStyle[];
|
|
210
195
|
paragraphs: Paragraph[];
|
|
211
196
|
lineBox: BoundingBox;
|
|
212
197
|
rawGlyphBox: BoundingBox;
|
|
@@ -214,31 +199,65 @@ declare class Text$1 extends Reactivable {
|
|
|
214
199
|
pathBox: BoundingBox;
|
|
215
200
|
boundingBox: BoundingBox;
|
|
216
201
|
measurer: Measurer;
|
|
217
|
-
plugins: Map<string,
|
|
202
|
+
plugins: Map<string, Plugin>;
|
|
218
203
|
pathSets: Path2DSet[];
|
|
219
204
|
get fontSize(): number;
|
|
220
205
|
get isVertical(): boolean;
|
|
221
206
|
get characters(): Character[];
|
|
222
|
-
constructor(options?:
|
|
223
|
-
set(options?:
|
|
224
|
-
use(plugin:
|
|
207
|
+
constructor(options?: Options);
|
|
208
|
+
set(options?: Options): void;
|
|
209
|
+
use(plugin: Plugin): this;
|
|
225
210
|
forEachCharacter(handle: (character: Character, ctx: {
|
|
226
211
|
paragraphIndex: number;
|
|
227
212
|
fragmentIndex: number;
|
|
228
213
|
characterIndex: number;
|
|
229
214
|
}) => void): this;
|
|
230
215
|
load(): Promise<void>;
|
|
231
|
-
|
|
216
|
+
protected _update(): this;
|
|
232
217
|
createDom(): HTMLElement;
|
|
233
218
|
measure(dom?: HTMLElement | undefined): MeasureResult;
|
|
234
219
|
getGlyphBox(): BoundingBox;
|
|
235
|
-
|
|
236
|
-
|
|
220
|
+
protected _updatePathBox(): this;
|
|
221
|
+
protected _updateBoundingBox(): this;
|
|
237
222
|
requestUpdate(): this;
|
|
238
223
|
update(dom?: HTMLElement | undefined): this;
|
|
239
|
-
render(options:
|
|
224
|
+
render(options: RenderOptions): void;
|
|
240
225
|
toString(): string;
|
|
241
226
|
}
|
|
242
227
|
|
|
243
|
-
|
|
244
|
-
|
|
228
|
+
declare class Paragraph {
|
|
229
|
+
style: NormalizedStyle;
|
|
230
|
+
index: number;
|
|
231
|
+
parent: Text$1;
|
|
232
|
+
lineBox: BoundingBox;
|
|
233
|
+
fragments: Fragment[];
|
|
234
|
+
fill?: NormalizedFill;
|
|
235
|
+
outline?: NormalizedOutline;
|
|
236
|
+
computedStyle: FullStyle;
|
|
237
|
+
get computedFill(): NormalizedFill | undefined;
|
|
238
|
+
get computedOutline(): NormalizedOutline | undefined;
|
|
239
|
+
constructor(style: NormalizedStyle, index: number, parent: Text$1);
|
|
240
|
+
updateComputedStyle(): this;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface DrawShapePathsOptions extends NormalizedStyle, Omit<Partial<Path2DDrawStyle>, 'fill' | 'outline'> {
|
|
244
|
+
fontSize?: number;
|
|
245
|
+
clipRect?: BoundingBox;
|
|
246
|
+
}
|
|
247
|
+
declare class Canvas2DRenderer {
|
|
248
|
+
text: Text$1;
|
|
249
|
+
context: CanvasRenderingContext2D;
|
|
250
|
+
pixelRatio: number;
|
|
251
|
+
constructor(text: Text$1, context: CanvasRenderingContext2D);
|
|
252
|
+
protected _setupView: () => void;
|
|
253
|
+
protected _setupColors: () => void;
|
|
254
|
+
setup: () => this;
|
|
255
|
+
protected _parseColor: (source: string | CanvasGradient | CanvasPattern, box: BoundingBox) => string | CanvasGradient | CanvasPattern;
|
|
256
|
+
protected _uploadedStyles: string[];
|
|
257
|
+
uploadColor: (style: NormalizedStyle, box: BoundingBox) => void;
|
|
258
|
+
drawPath: (path: Path2D, options?: DrawShapePathsOptions) => void;
|
|
259
|
+
drawCharacter: (character: Character, userStyle?: NormalizedStyle) => void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { Canvas2DRenderer as C, Fragment as F, Text$1 as T, Character as a, Paragraph as b, Measurer as g, textDefaultStyle as t };
|
|
263
|
+
export type { DrawShapePathsOptions as D, MeasureResult as M, Options as O, Plugin as P, RenderOptions as R, MeasuredParagraph as c, MeasuredFragment as d, MeasuredCharacter as e, MeasureDomResult as f, TextEvents as h };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
|
|
2
|
-
import { T as Text } from '../shared/modern-text.
|
|
3
|
-
import 'modern-font';
|
|
2
|
+
import { T as Text } from '../shared/modern-text.D_VtaVfs.cjs';
|
|
4
3
|
import 'modern-path2d';
|
|
4
|
+
import 'modern-font';
|
|
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.
|
|
3
|
-
import 'modern-font';
|
|
2
|
+
import { T as Text } from '../shared/modern-text.D_VtaVfs.mjs';
|
|
4
3
|
import 'modern-path2d';
|
|
4
|
+
import 'modern-font';
|
|
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.
|
|
3
|
-
import 'modern-font';
|
|
2
|
+
import { T as Text } from '../shared/modern-text.D_VtaVfs.js';
|
|
4
3
|
import 'modern-path2d';
|
|
4
|
+
import 'modern-font';
|
|
5
5
|
|
|
6
6
|
interface IndexCharacter {
|
|
7
7
|
paragraphIndex: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { diffChars } from 'diff';
|
|
2
2
|
import { isCRLF, textContentToString, normalizeCRLF, normalizeTextContent, property } from 'modern-idoc';
|
|
3
|
-
import { T as Text } from '../shared/modern-text.
|
|
3
|
+
import { T as Text } from '../shared/modern-text.BD1kUWDw.mjs';
|
|
4
4
|
import 'modern-path2d';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.10.0",
|
|
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",
|
|
@@ -51,32 +51,23 @@
|
|
|
51
51
|
"release": "bumpp package.json --commit \"release: v%s\" --push --all --tag",
|
|
52
52
|
"start": "esno src/index.ts",
|
|
53
53
|
"test": "vitest",
|
|
54
|
-
"typecheck": "tsc --noEmit"
|
|
55
|
-
"prepare": "simple-git-hooks"
|
|
54
|
+
"typecheck": "tsc --noEmit"
|
|
56
55
|
},
|
|
57
56
|
"dependencies": {
|
|
58
57
|
"diff": "^8.0.2",
|
|
59
58
|
"modern-font": "^0.4.4",
|
|
60
|
-
"modern-idoc": "^0.10.
|
|
59
|
+
"modern-idoc": "^0.10.5",
|
|
61
60
|
"modern-path2d": "^1.4.10"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
|
-
"@antfu/eslint-config": "^6.
|
|
65
|
-
"@types/node": "^24.
|
|
63
|
+
"@antfu/eslint-config": "^6.1.0",
|
|
64
|
+
"@types/node": "^24.9.2",
|
|
66
65
|
"bumpp": "^10.3.1",
|
|
67
66
|
"conventional-changelog-cli": "^5.0.0",
|
|
68
67
|
"eslint": "^9.38.0",
|
|
69
|
-
"lint-staged": "^16.2.4",
|
|
70
|
-
"simple-git-hooks": "^2.13.1",
|
|
71
68
|
"typescript": "^5.9.3",
|
|
72
69
|
"unbuild": "^3.6.1",
|
|
73
|
-
"vite": "^7.1.
|
|
74
|
-
"vitest": "^
|
|
75
|
-
},
|
|
76
|
-
"simple-git-hooks": {
|
|
77
|
-
"pre-commit": "pnpm lint-staged"
|
|
78
|
-
},
|
|
79
|
-
"lint-staged": {
|
|
80
|
-
"*": ""
|
|
70
|
+
"vite": "^7.1.12",
|
|
71
|
+
"vitest": "^4.0.4"
|
|
81
72
|
}
|
|
82
73
|
}
|