modern-text 2.1.1 → 2.1.3
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/deformations/index.cjs +1 -1
- package/dist/deformations/index.d.cts +2 -2
- package/dist/deformations/index.d.mts +2 -2
- package/dist/deformations/index.d.ts +2 -2
- package/dist/deformations/index.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -7
- package/dist/index.mjs +3 -3
- package/dist/shared/{modern-text.CGZmjNV0.d.ts → modern-text.1LMQ6ZWb.d.ts} +3 -3
- package/dist/shared/{modern-text._10DVHum.cjs → modern-text.B1qEGvHu.cjs} +1 -6
- package/dist/shared/{modern-text.BdF52nXP.mjs → modern-text.C6Cwc-zm.mjs} +1 -1
- package/dist/shared/{modern-text.DNXfZmiT.d.mts → modern-text.CjkLMv3V.d.cts} +3 -3
- package/dist/shared/{modern-text.DzBaDwbG.d.cts → modern-text.Cv-GZog_.d.mts} +3 -3
- package/dist/shared/{modern-text.CdKp2H-o.mjs → modern-text.Cvc61q2w.mjs} +1 -6
- package/dist/shared/{modern-text.BAnUZM0U.cjs → modern-text.D8v3zJdm.cjs} +1 -1
- package/dist/shared/{modern-text.DG27jpKj.d.cts → modern-text.DENkEKJN.d.cts} +38 -38
- package/dist/shared/{modern-text.DG27jpKj.d.mts → modern-text.DENkEKJN.d.mts} +38 -38
- package/dist/shared/{modern-text.DG27jpKj.d.ts → modern-text.DENkEKJN.d.ts} +38 -38
- package/dist/web-components/index.cjs +2 -2
- 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 +2 -2
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as Text } from './shared/modern-text.
|
|
2
|
-
export { C as Canvas2DRenderer, a as Character, F as Fragment, M as Measurer, P as Paragraph, b as backgroundPlugin, c as createSvgLoader, d as createSvgParser, g as getEffectTransform2D, e as getHighlightStyle, h as highlightPlugin, i as isEqualObject, f as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColormap, j as parseTransformOrigin, k as parseValueNumber, r as renderPlugin, t as textDecorationPlugin, m as textDefaultStyle } from './shared/modern-text.
|
|
3
|
-
export { d as defineDeformation, a as definePlugin, b as deformationPlugin, g as getDeformationNames, r as removeDeformation } from './shared/modern-text.
|
|
1
|
+
import { T as Text } from './shared/modern-text.C6Cwc-zm.mjs';
|
|
2
|
+
export { C as Canvas2DRenderer, a as Character, F as Fragment, M as Measurer, P as Paragraph, b as backgroundPlugin, c as createSvgLoader, d as createSvgParser, g as getEffectTransform2D, e as getHighlightStyle, h as highlightPlugin, i as isEqualObject, f as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColormap, j as parseTransformOrigin, k as parseValueNumber, r as renderPlugin, t as textDecorationPlugin, m as textDefaultStyle } from './shared/modern-text.C6Cwc-zm.mjs';
|
|
3
|
+
export { d as defineDeformation, a as definePlugin, b as deformationPlugin, g as getDeformationNames, r as removeDeformation } from './shared/modern-text.Cvc61q2w.mjs';
|
|
4
4
|
export { C as CircleCurve, E as EllipseCurve, H as HeartCurve, P as PolygonCurve, R as RectangularCurve } from './shared/modern-text.fT17R5HY.mjs';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
import 'modern-idoc';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Vector2Like, BoundingBox
|
|
2
|
-
import {
|
|
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,
|
|
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 };
|
|
@@ -206,9 +206,6 @@ class Deformer {
|
|
|
206
206
|
paragraph.fragments.forEach((fragment) => {
|
|
207
207
|
fragment.characters.forEach((character) => {
|
|
208
208
|
character.glyphBox = character.getGlyphBoundingBox();
|
|
209
|
-
if (character.glyphBox) {
|
|
210
|
-
character.inlineBox = character.glyphBox;
|
|
211
|
-
}
|
|
212
209
|
});
|
|
213
210
|
});
|
|
214
211
|
});
|
|
@@ -549,6 +546,7 @@ function deformationPlugin() {
|
|
|
549
546
|
deformer = new VerbatimDeformer(options, preset);
|
|
550
547
|
break;
|
|
551
548
|
}
|
|
549
|
+
text.forEachCharacter((character) => character.update(text.fonts));
|
|
552
550
|
deformer.deform();
|
|
553
551
|
let box = text.getGlyphBox();
|
|
554
552
|
const dx = box.left;
|
|
@@ -563,9 +561,6 @@ function deformationPlugin() {
|
|
|
563
561
|
point.set(point.x - dx, point.y - dy);
|
|
564
562
|
});
|
|
565
563
|
character.glyphBox = character.getGlyphBoundingBox();
|
|
566
|
-
if (character.glyphBox) {
|
|
567
|
-
character.inlineBox = character.glyphBox;
|
|
568
|
-
}
|
|
569
564
|
}
|
|
570
565
|
highlight?.pathSet?.paths?.forEach((path) => {
|
|
571
566
|
path.getControlPointRefs().forEach((point) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fonts } from 'modern-font';
|
|
2
2
|
import { isNone, isGradient, normalizeGradient, clearUndef, Reactivable, normalizeText, getDefaultStyle, property } from 'modern-idoc';
|
|
3
3
|
import { svgToDom, svgToPath2DSet, Path2DSet, Transform2D, setCanvasContext, Path2D, BoundingBox, Vector2 } from 'modern-path2d';
|
|
4
|
-
import { a as definePlugin, b as deformationPlugin } from './modern-text.
|
|
4
|
+
import { a as definePlugin, b as deformationPlugin } from './modern-text.Cvc61q2w.mjs';
|
|
5
5
|
|
|
6
6
|
function createSvgLoader() {
|
|
7
7
|
const loaded = /* @__PURE__ */ new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Vector2Like, BoundingBox
|
|
2
|
-
import {
|
|
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,
|
|
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
|
|
2
|
-
import {
|
|
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,
|
|
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 };
|
|
@@ -204,9 +204,6 @@ class Deformer {
|
|
|
204
204
|
paragraph.fragments.forEach((fragment) => {
|
|
205
205
|
fragment.characters.forEach((character) => {
|
|
206
206
|
character.glyphBox = character.getGlyphBoundingBox();
|
|
207
|
-
if (character.glyphBox) {
|
|
208
|
-
character.inlineBox = character.glyphBox;
|
|
209
|
-
}
|
|
210
207
|
});
|
|
211
208
|
});
|
|
212
209
|
});
|
|
@@ -547,6 +544,7 @@ function deformationPlugin() {
|
|
|
547
544
|
deformer = new VerbatimDeformer(options, preset);
|
|
548
545
|
break;
|
|
549
546
|
}
|
|
547
|
+
text.forEachCharacter((character) => character.update(text.fonts));
|
|
550
548
|
deformer.deform();
|
|
551
549
|
let box = text.getGlyphBox();
|
|
552
550
|
const dx = box.left;
|
|
@@ -561,9 +559,6 @@ function deformationPlugin() {
|
|
|
561
559
|
point.set(point.x - dx, point.y - dy);
|
|
562
560
|
});
|
|
563
561
|
character.glyphBox = character.getGlyphBoundingBox();
|
|
564
|
-
if (character.glyphBox) {
|
|
565
|
-
character.inlineBox = character.glyphBox;
|
|
566
|
-
}
|
|
567
562
|
}
|
|
568
563
|
highlight?.pathSet?.paths?.forEach((path) => {
|
|
569
564
|
path.getControlPointRefs().forEach((point) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const modernFont = require('modern-font');
|
|
4
4
|
const modernIdoc = require('modern-idoc');
|
|
5
5
|
const modernPath2d = require('modern-path2d');
|
|
6
|
-
const deformation = require('./modern-text.
|
|
6
|
+
const deformation = require('./modern-text.B1qEGvHu.cjs');
|
|
7
7
|
|
|
8
8
|
function createSvgLoader() {
|
|
9
9
|
const loaded = /* @__PURE__ */ new Map();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NormalizedStyle, NormalizedFill, NormalizedOutline, FullStyle,
|
|
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
|
-
|
|
315
|
-
|
|
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,
|
|
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
|
-
|
|
315
|
-
|
|
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,
|
|
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
|
-
|
|
315
|
-
|
|
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 };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const diff = require('diff');
|
|
4
4
|
const modernIdoc = require('modern-idoc');
|
|
5
|
-
const Text = require('../shared/modern-text.
|
|
5
|
+
const Text = require('../shared/modern-text.D8v3zJdm.cjs');
|
|
6
6
|
require('modern-font');
|
|
7
7
|
require('modern-path2d');
|
|
8
|
-
require('../shared/modern-text.
|
|
8
|
+
require('../shared/modern-text.B1qEGvHu.cjs');
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropertyAccessor, NormalizedTextContent } from 'modern-idoc';
|
|
2
|
-
import {
|
|
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 {
|
|
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 {
|
|
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;
|
|
@@ -1,9 +1,9 @@
|
|
|
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.C6Cwc-zm.mjs';
|
|
4
4
|
import 'modern-font';
|
|
5
5
|
import 'modern-path2d';
|
|
6
|
-
import '../shared/modern-text.
|
|
6
|
+
import '../shared/modern-text.Cvc61q2w.mjs';
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.3",
|
|
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.
|
|
64
|
-
"modern-idoc": "^0.12.
|
|
65
|
-
"modern-path2d": "^1.7
|
|
63
|
+
"modern-font": "^0.6.2",
|
|
64
|
+
"modern-idoc": "^0.12.3",
|
|
65
|
+
"modern-path2d": "^1.8.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@antfu/eslint-config": "^9.
|
|
69
|
-
"@types/node": "^
|
|
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.
|
|
72
|
+
"eslint": "^10.6.0",
|
|
73
73
|
"typescript": "^6.0.3",
|
|
74
74
|
"unbuild": "^3.6.1",
|
|
75
|
-
"vite": "^8.
|
|
76
|
-
"vitest": "^4.1.
|
|
75
|
+
"vite": "^8.1.2",
|
|
76
|
+
"vitest": "^4.1.9"
|
|
77
77
|
}
|
|
78
78
|
}
|