modern-text 1.3.1 → 1.3.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.
- package/README.md +23 -20
- package/dist/index.cjs +216 -139
- package/dist/index.d.cts +23 -4
- package/dist/index.d.mts +23 -4
- package/dist/index.d.ts +23 -4
- package/dist/index.js +5 -5
- package/dist/index.mjs +216 -140
- package/package.json +12 -12
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleDeclaration, TextContent, HighlightDeclaration } from 'modern-idoc';
|
|
2
|
-
import { BoundingBox, Path2DDrawStyle, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
2
|
+
import { BoundingBox, Path2DDrawStyle, Path2D, Vector2, VectorLike, Path2DSet, Matrix3 } from 'modern-path2d';
|
|
3
3
|
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare function parseColor(ctx: CanvasRenderingContext2D, source: string | CanvasGradient | CanvasPattern, box: BoundingBox): string | CanvasGradient | CanvasPattern;
|
|
@@ -95,7 +95,7 @@ declare class Paragraph {
|
|
|
95
95
|
|
|
96
96
|
interface TextPlugin {
|
|
97
97
|
name: string;
|
|
98
|
-
|
|
98
|
+
pathSet?: Path2DSet;
|
|
99
99
|
getBoundingBox?: (text: Text$1) => BoundingBox | undefined;
|
|
100
100
|
update?: (text: Text$1) => void;
|
|
101
101
|
updateOrder?: number;
|
|
@@ -287,6 +287,25 @@ declare function getTransform2D(text: Text$1, style: Partial<StyleDeclaration>):
|
|
|
287
287
|
|
|
288
288
|
declare function textDecoration(): TextPlugin;
|
|
289
289
|
|
|
290
|
+
interface SVGLoader {
|
|
291
|
+
loaded: Map<string, string>;
|
|
292
|
+
needsLoad: (source: string) => boolean;
|
|
293
|
+
load: (svg: string) => Promise<void>;
|
|
294
|
+
}
|
|
295
|
+
declare function createSVGLoader(): SVGLoader;
|
|
296
|
+
|
|
297
|
+
interface SVGParser {
|
|
298
|
+
parsed: Map<string, {
|
|
299
|
+
dom: SVGElement;
|
|
300
|
+
pathSet: Path2DSet;
|
|
301
|
+
}>;
|
|
302
|
+
parse: (svg: string) => {
|
|
303
|
+
dom: SVGElement;
|
|
304
|
+
pathSet: Path2DSet;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
declare function createSVGParser(loader: SVGLoader): SVGParser;
|
|
308
|
+
|
|
290
309
|
interface ValueContext {
|
|
291
310
|
total: number;
|
|
292
311
|
fontSize: number;
|
|
@@ -298,6 +317,6 @@ declare function isEqualObject(obj1: Record<string, any>, obj2: Record<string, a
|
|
|
298
317
|
declare function isEqualValue(val1: any, val2: any): boolean;
|
|
299
318
|
declare function hexToRgb(hex: string): string | null;
|
|
300
319
|
declare function filterEmpty(val: Record<string, any> | undefined): Record<string, any> | undefined;
|
|
301
|
-
declare function needsFetch(source: string): boolean;
|
|
302
320
|
|
|
303
|
-
export { Character,
|
|
321
|
+
export { Character, Fragment, Measurer, Paragraph, Text$1 as Text, background, createSVGLoader, createSVGParser, definePlugin, drawPath, filterEmpty, getHighlightStyle, getTransform2D, hexToRgb, highlight, isEqualObject, isEqualValue, isNone, listStyle, measureText, outline, parseColor, parseColormap, parseValueNumber, render, renderText, setupView, textDecoration, textDefaultStyle, uploadColor, uploadColors };
|
|
322
|
+
export type { DrawShapePathsOptions, LinearGradient, MeasureDomResult, MeasureResult, MeasuredCharacter, MeasuredFragment, MeasuredParagraph, RenderTextOptions, SVGLoader, SVGParser, TextEventMap, TextOptions, TextPlugin, TextRenderOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleDeclaration, TextContent, HighlightDeclaration } from 'modern-idoc';
|
|
2
|
-
import { BoundingBox, Path2DDrawStyle, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
2
|
+
import { BoundingBox, Path2DDrawStyle, Path2D, Vector2, VectorLike, Path2DSet, Matrix3 } from 'modern-path2d';
|
|
3
3
|
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare function parseColor(ctx: CanvasRenderingContext2D, source: string | CanvasGradient | CanvasPattern, box: BoundingBox): string | CanvasGradient | CanvasPattern;
|
|
@@ -95,7 +95,7 @@ declare class Paragraph {
|
|
|
95
95
|
|
|
96
96
|
interface TextPlugin {
|
|
97
97
|
name: string;
|
|
98
|
-
|
|
98
|
+
pathSet?: Path2DSet;
|
|
99
99
|
getBoundingBox?: (text: Text$1) => BoundingBox | undefined;
|
|
100
100
|
update?: (text: Text$1) => void;
|
|
101
101
|
updateOrder?: number;
|
|
@@ -287,6 +287,25 @@ declare function getTransform2D(text: Text$1, style: Partial<StyleDeclaration>):
|
|
|
287
287
|
|
|
288
288
|
declare function textDecoration(): TextPlugin;
|
|
289
289
|
|
|
290
|
+
interface SVGLoader {
|
|
291
|
+
loaded: Map<string, string>;
|
|
292
|
+
needsLoad: (source: string) => boolean;
|
|
293
|
+
load: (svg: string) => Promise<void>;
|
|
294
|
+
}
|
|
295
|
+
declare function createSVGLoader(): SVGLoader;
|
|
296
|
+
|
|
297
|
+
interface SVGParser {
|
|
298
|
+
parsed: Map<string, {
|
|
299
|
+
dom: SVGElement;
|
|
300
|
+
pathSet: Path2DSet;
|
|
301
|
+
}>;
|
|
302
|
+
parse: (svg: string) => {
|
|
303
|
+
dom: SVGElement;
|
|
304
|
+
pathSet: Path2DSet;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
declare function createSVGParser(loader: SVGLoader): SVGParser;
|
|
308
|
+
|
|
290
309
|
interface ValueContext {
|
|
291
310
|
total: number;
|
|
292
311
|
fontSize: number;
|
|
@@ -298,6 +317,6 @@ declare function isEqualObject(obj1: Record<string, any>, obj2: Record<string, a
|
|
|
298
317
|
declare function isEqualValue(val1: any, val2: any): boolean;
|
|
299
318
|
declare function hexToRgb(hex: string): string | null;
|
|
300
319
|
declare function filterEmpty(val: Record<string, any> | undefined): Record<string, any> | undefined;
|
|
301
|
-
declare function needsFetch(source: string): boolean;
|
|
302
320
|
|
|
303
|
-
export { Character,
|
|
321
|
+
export { Character, Fragment, Measurer, Paragraph, Text$1 as Text, background, createSVGLoader, createSVGParser, definePlugin, drawPath, filterEmpty, getHighlightStyle, getTransform2D, hexToRgb, highlight, isEqualObject, isEqualValue, isNone, listStyle, measureText, outline, parseColor, parseColormap, parseValueNumber, render, renderText, setupView, textDecoration, textDefaultStyle, uploadColor, uploadColors };
|
|
322
|
+
export type { DrawShapePathsOptions, LinearGradient, MeasureDomResult, MeasureResult, MeasuredCharacter, MeasuredFragment, MeasuredParagraph, RenderTextOptions, SVGLoader, SVGParser, TextEventMap, TextOptions, TextPlugin, TextRenderOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleDeclaration, TextContent, HighlightDeclaration } from 'modern-idoc';
|
|
2
|
-
import { BoundingBox, Path2DDrawStyle, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
2
|
+
import { BoundingBox, Path2DDrawStyle, Path2D, Vector2, VectorLike, Path2DSet, Matrix3 } from 'modern-path2d';
|
|
3
3
|
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare function parseColor(ctx: CanvasRenderingContext2D, source: string | CanvasGradient | CanvasPattern, box: BoundingBox): string | CanvasGradient | CanvasPattern;
|
|
@@ -95,7 +95,7 @@ declare class Paragraph {
|
|
|
95
95
|
|
|
96
96
|
interface TextPlugin {
|
|
97
97
|
name: string;
|
|
98
|
-
|
|
98
|
+
pathSet?: Path2DSet;
|
|
99
99
|
getBoundingBox?: (text: Text$1) => BoundingBox | undefined;
|
|
100
100
|
update?: (text: Text$1) => void;
|
|
101
101
|
updateOrder?: number;
|
|
@@ -287,6 +287,25 @@ declare function getTransform2D(text: Text$1, style: Partial<StyleDeclaration>):
|
|
|
287
287
|
|
|
288
288
|
declare function textDecoration(): TextPlugin;
|
|
289
289
|
|
|
290
|
+
interface SVGLoader {
|
|
291
|
+
loaded: Map<string, string>;
|
|
292
|
+
needsLoad: (source: string) => boolean;
|
|
293
|
+
load: (svg: string) => Promise<void>;
|
|
294
|
+
}
|
|
295
|
+
declare function createSVGLoader(): SVGLoader;
|
|
296
|
+
|
|
297
|
+
interface SVGParser {
|
|
298
|
+
parsed: Map<string, {
|
|
299
|
+
dom: SVGElement;
|
|
300
|
+
pathSet: Path2DSet;
|
|
301
|
+
}>;
|
|
302
|
+
parse: (svg: string) => {
|
|
303
|
+
dom: SVGElement;
|
|
304
|
+
pathSet: Path2DSet;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
declare function createSVGParser(loader: SVGLoader): SVGParser;
|
|
308
|
+
|
|
290
309
|
interface ValueContext {
|
|
291
310
|
total: number;
|
|
292
311
|
fontSize: number;
|
|
@@ -298,6 +317,6 @@ declare function isEqualObject(obj1: Record<string, any>, obj2: Record<string, a
|
|
|
298
317
|
declare function isEqualValue(val1: any, val2: any): boolean;
|
|
299
318
|
declare function hexToRgb(hex: string): string | null;
|
|
300
319
|
declare function filterEmpty(val: Record<string, any> | undefined): Record<string, any> | undefined;
|
|
301
|
-
declare function needsFetch(source: string): boolean;
|
|
302
320
|
|
|
303
|
-
export { Character,
|
|
321
|
+
export { Character, Fragment, Measurer, Paragraph, Text$1 as Text, background, createSVGLoader, createSVGParser, definePlugin, drawPath, filterEmpty, getHighlightStyle, getTransform2D, hexToRgb, highlight, isEqualObject, isEqualValue, isNone, listStyle, measureText, outline, parseColor, parseColormap, parseValueNumber, render, renderText, setupView, textDecoration, textDefaultStyle, uploadColor, uploadColors };
|
|
322
|
+
export type { DrawShapePathsOptions, LinearGradient, MeasureDomResult, MeasureResult, MeasuredCharacter, MeasuredFragment, MeasuredParagraph, RenderTextOptions, SVGLoader, SVGParser, TextEventMap, TextOptions, TextPlugin, TextRenderOptions };
|