modern-text 2.0.2 → 2.0.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/README.md +5 -4
- 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/index.cjs +1 -1
- 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 +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{modern-text.EUexrM_5.mjs → modern-text.BZDfPcWk.mjs} +1 -1
- package/dist/shared/{modern-text.DYc0f8rj.d.mts → modern-text.BZegXnct.d.cts} +1 -1
- package/dist/shared/{modern-text.9z5yZjKR.cjs → modern-text.BZmgmU_p.cjs} +1 -1
- package/dist/shared/{modern-text.C6VOXPvn.d.cts → modern-text.D7MgNoyD.d.cts} +1 -1
- package/dist/shared/{modern-text.C6VOXPvn.d.mts → modern-text.D7MgNoyD.d.mts} +1 -1
- package/dist/shared/{modern-text.C6VOXPvn.d.ts → modern-text.D7MgNoyD.d.ts} +1 -1
- package/dist/shared/{modern-text.i19sSLm-.d.ts → modern-text.DjrdQUs8.d.ts} +1 -1
- package/dist/shared/{modern-text.c9v5Qvut.d.cts → modern-text.iF9i8B86.d.mts} +1 -1
- package/dist/web-components/index.cjs +1 -1
- package/dist/web-components/index.d.cts +1 -1
- package/dist/web-components/index.d.mts +1 -1
- package/dist/web-components/index.d.ts +1 -1
- package/dist/web-components/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,12 +83,13 @@ renderText({
|
|
|
83
83
|
|
|
84
84
|
## Layout backends
|
|
85
85
|
|
|
86
|
-
By default `modern-text`
|
|
87
|
-
`fonts`
|
|
88
|
-
|
|
86
|
+
By default `modern-text` uses the pure-JS **`'font'`** backend (`FontMeasurer`),
|
|
87
|
+
which resolves fonts from the `fonts` you pass or from `modern-font`'s global
|
|
88
|
+
registry. Pass `'dom'` to use the browser as ground truth, or a custom
|
|
89
|
+
`TextMeasurer`:
|
|
89
90
|
|
|
90
91
|
```ts
|
|
91
|
-
new Text({ fonts, measurer: 'font' }) // pure-JS, DOM-free (default
|
|
92
|
+
new Text({ fonts, measurer: 'font' }) // pure-JS, DOM-free (default)
|
|
92
93
|
new Text({ fonts, measurer: 'dom' }) // browser ground truth
|
|
93
94
|
new Text({ measurer: myCustomMeasurer }) // any object implementing TextMeasurer
|
|
94
95
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as DeformationPreset } from '../shared/modern-text.
|
|
1
|
+
import { c as DeformationPreset } from '../shared/modern-text.BZegXnct.cjs';
|
|
2
2
|
import 'modern-path2d';
|
|
3
|
-
import '../shared/modern-text.
|
|
3
|
+
import '../shared/modern-text.D7MgNoyD.cjs';
|
|
4
4
|
import 'modern-idoc';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as DeformationPreset } from '../shared/modern-text.
|
|
1
|
+
import { c as DeformationPreset } from '../shared/modern-text.iF9i8B86.mjs';
|
|
2
2
|
import 'modern-path2d';
|
|
3
|
-
import '../shared/modern-text.
|
|
3
|
+
import '../shared/modern-text.D7MgNoyD.mjs';
|
|
4
4
|
import 'modern-idoc';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as DeformationPreset } from '../shared/modern-text.
|
|
1
|
+
import { c as DeformationPreset } from '../shared/modern-text.DjrdQUs8.js';
|
|
2
2
|
import 'modern-path2d';
|
|
3
|
-
import '../shared/modern-text.
|
|
3
|
+
import '../shared/modern-text.D7MgNoyD.js';
|
|
4
4
|
import 'modern-idoc';
|
|
5
5
|
import 'modern-font';
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Text = require('./shared/modern-text.
|
|
3
|
+
const Text = require('./shared/modern-text.BZmgmU_p.cjs');
|
|
4
4
|
const deformation = require('./shared/modern-text.B2xfrqDc.cjs');
|
|
5
5
|
const curves = require('./shared/modern-text.MC5bIC9E.cjs');
|
|
6
6
|
require('modern-font');
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as Plugin, k as TextMeasurer, P as Paragraph, M as MeasureDomResult, a as Character, O as Options, c as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.
|
|
2
|
-
export { C as Canvas2DRenderer, D as DomMeasurer, b as DrawShapePathsOptions, F as Fragment, d as MeasuredCharacter, e as MeasuredCharacterRect, f as MeasuredFragment, g as MeasuredParagraph, h as MeasurerKind, j as TextEvents, t as textDefaultStyle } from './shared/modern-text.
|
|
1
|
+
import { i as Plugin, k as TextMeasurer, P as Paragraph, M as MeasureDomResult, a as Character, O as Options, c as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.D7MgNoyD.cjs';
|
|
2
|
+
export { C as Canvas2DRenderer, D as DomMeasurer, b as DrawShapePathsOptions, F as Fragment, d as MeasuredCharacter, e as MeasuredCharacterRect, f as MeasuredFragment, g as MeasuredParagraph, h as MeasurerKind, j as TextEvents, t as textDefaultStyle } from './shared/modern-text.D7MgNoyD.cjs';
|
|
3
3
|
import { Fonts } from 'modern-font';
|
|
4
4
|
import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
|
|
5
5
|
import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
|
|
6
|
-
import { c as DeformationPreset } from './shared/modern-text.
|
|
7
|
-
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.
|
|
6
|
+
import { c as DeformationPreset } from './shared/modern-text.BZegXnct.cjs';
|
|
7
|
+
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.BZegXnct.cjs';
|
|
8
8
|
|
|
9
9
|
declare function definePlugin(options: Plugin): Plugin;
|
|
10
10
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as Plugin, k as TextMeasurer, P as Paragraph, M as MeasureDomResult, a as Character, O as Options, c as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.
|
|
2
|
-
export { C as Canvas2DRenderer, D as DomMeasurer, b as DrawShapePathsOptions, F as Fragment, d as MeasuredCharacter, e as MeasuredCharacterRect, f as MeasuredFragment, g as MeasuredParagraph, h as MeasurerKind, j as TextEvents, t as textDefaultStyle } from './shared/modern-text.
|
|
1
|
+
import { i as Plugin, k as TextMeasurer, P as Paragraph, M as MeasureDomResult, a as Character, O as Options, c as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.D7MgNoyD.mjs';
|
|
2
|
+
export { C as Canvas2DRenderer, D as DomMeasurer, b as DrawShapePathsOptions, F as Fragment, d as MeasuredCharacter, e as MeasuredCharacterRect, f as MeasuredFragment, g as MeasuredParagraph, h as MeasurerKind, j as TextEvents, t as textDefaultStyle } from './shared/modern-text.D7MgNoyD.mjs';
|
|
3
3
|
import { Fonts } from 'modern-font';
|
|
4
4
|
import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
|
|
5
5
|
import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
|
|
6
|
-
import { c as DeformationPreset } from './shared/modern-text.
|
|
7
|
-
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.
|
|
6
|
+
import { c as DeformationPreset } from './shared/modern-text.iF9i8B86.mjs';
|
|
7
|
+
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.iF9i8B86.mjs';
|
|
8
8
|
|
|
9
9
|
declare function definePlugin(options: Plugin): Plugin;
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as Plugin, k as TextMeasurer, P as Paragraph, M as MeasureDomResult, a as Character, O as Options, c as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.
|
|
2
|
-
export { C as Canvas2DRenderer, D as DomMeasurer, b as DrawShapePathsOptions, F as Fragment, d as MeasuredCharacter, e as MeasuredCharacterRect, f as MeasuredFragment, g as MeasuredParagraph, h as MeasurerKind, j as TextEvents, t as textDefaultStyle } from './shared/modern-text.
|
|
1
|
+
import { i as Plugin, k as TextMeasurer, P as Paragraph, M as MeasureDomResult, a as Character, O as Options, c as MeasureResult, R as RenderOptions, T as Text } from './shared/modern-text.D7MgNoyD.js';
|
|
2
|
+
export { C as Canvas2DRenderer, D as DomMeasurer, b as DrawShapePathsOptions, F as Fragment, d as MeasuredCharacter, e as MeasuredCharacterRect, f as MeasuredFragment, g as MeasuredParagraph, h as MeasurerKind, j as TextEvents, t as textDefaultStyle } from './shared/modern-text.D7MgNoyD.js';
|
|
3
3
|
import { Fonts } from 'modern-font';
|
|
4
4
|
import { FullStyle, NormalizedStyle, NormalizedHighlight, NormalizedEffect } from 'modern-idoc';
|
|
5
5
|
import { BoundingBox, Vector2, Path2DSet, Transform2D } from 'modern-path2d';
|
|
6
|
-
import { c as DeformationPreset } from './shared/modern-text.
|
|
7
|
-
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.
|
|
6
|
+
import { c as DeformationPreset } from './shared/modern-text.DjrdQUs8.js';
|
|
7
|
+
export { B as BendContext, a as BendPreset, C as CurvePreset, D as DeformationCharInfo, b as DeformationCurve, F as FfdContext, d as FfdPreset, O as OffsetPreset, V as VerbatimContext } from './shared/modern-text.DjrdQUs8.js';
|
|
8
8
|
|
|
9
9
|
declare function definePlugin(options: Plugin): Plugin;
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -33,4 +33,4 @@ ${this.paths.map(e=>e.toSvgPathString()).join(``)}
|
|
|
33
33
|
}`)),document.head.appendChild(n)}return this}_parseUrls(e){let t=[...new Set([...e.split(`,`),e])];return[...new Set(t.map(e=>this.familyToUrl.get(e.trim())??this.familyToUrl.get(e)??e))]}get(e){let t;return e&&(t=this._parseUrls(e).reduce((e,t)=>e||this.loaded.get(t),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(e){return e?(Array.isArray(e)?e:[e]).flatMap(e=>e.split(`,`).map(e=>e.trim())):[]}async load(e,t={}){let{cancelOther:n,injectStyleTag:r=!1,injectFontFace:i=!1,...a}=t,o,s;typeof e==`string`?o=e:{src:o,family:s}=e;let c=this._parseFamilies(s);if(this.loaded.has(o))return n&&(this.loading.forEach(e=>e.cancel()),this.loading.clear()),u(this.loaded.get(o));let l=this.loading.get(o);return l||(l=this._createRequest(o,a),this.loading.set(o,l)),n&&this.loading.forEach((e,t)=>{e!==l&&(e.cancel(),this.loading.delete(t))}),l.when.then(e=>{let n;return this.loaded.has(o)?n=u(this.loaded.get(o)):(n=d(e),t.noAdd||this.loaded.set(o,n)),Promise.all(Array.from(n.familySet,async t=>{if(this.familyToUrl.set(t,o),typeof document<`u`&&(i&&await this.injectFontFace(t,e),r&&this.injectStyleTag(t,o),i||r))return await document.fonts.load(`14px "${t}"`)})).then(()=>n)}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return d();throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}function d(e=new ArrayBuffer(0)){let t;function n(){return t||=e.byteLength?ic(e,!1):void 0,t}function r(){let e=n();if(e instanceof Ws||e instanceof nc)return e.sfnt}return{src:o,family:s,buffer:e,familySet:new Set(c),getFont:n,getSFNT:r}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},oc=new Set([`©`,`®`,`÷`]),sc=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),cc={1:`italic`,32:`bold`},lc={1:`italic`,2:`bold`},uc={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},dc=class{content;index;parent;path=new Vr().setMeta(this);lineBox=new W;inlineBox=new W;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){let e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new W(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new W(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}constructor(e,t,n){this.content=e,this.index=t,this.parent=n}_getFontSFNT(e){let t=this.computedStyle.fontFamily,n=e??ac,r=(t?n.get(t):n.fallbackFont)?.getSFNT();return r?.textToGlyphIndexes(this.content).includes(0)&&(r=n.fallbackFont?.getSFNT()),r}updateGlyph(e=this._getFontSFNT()){if(!e)return this;let{hhea:t,os2:n,post:r,head:i}=e,a=i.unitsPerEm,o=t.ascent,s=t.descent,{content:c,computedStyle:l}=this,{fontSize:u}=l,d=a/u,f=e.getAdvanceWidth(c,u),p=(o+Math.abs(s))/d,m=o/d;return this.advanceWidth=f,this.advanceHeight=p,this.underlinePosition=(o-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(o-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=o/d,this.descender=s/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.version>1?n.sxHeight/d:0,this.capHeight=n.version>1?n.sCapHeight/d:0,this.baseline=m,this.centerDiviation=p/2-m,this.fontStyle=cc[n.fsSelection]??lc[i.macStyle],this}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let{isVertical:n,content:r,computedStyle:i,baseline:a,inlineBox:o,ascender:s,descender:c,typoAscender:l,fontStyle:u,advanceWidth:d,advanceHeight:f}=this,{left:p,top:m}=o,h=i.fontStyle===`italic`&&u!==`italic`,g=p,_=m+a,v,y=new Vr().setMeta(this);if(n&&(g+=(f-d)/2,Math.abs(d-f)>.1&&(_-=(s-l)/(s+Math.abs(c))*f),v=void 0),n&&!oc.has(r)&&(r.codePointAt(0)<=256||sc.has(r))){y.addCommands(t.getPathCommands(r,g,m+a-(f-d)/2,i.fontSize));let e={y:m-(f-d)/2+f/2,x:g+d/2};h&&this._italic(y,{x:e.x,y:m-(f-d)/2+a}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(r,g,_,i.fontSize)),h&&this._italic(y,n?{x:g+f/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,i.fontSize)),h&&this._italic(y,n?{x:g+d/2,y:m+l/(s+Math.abs(c))*f}:void 0));let b=i.fontWeight??400;return b in uc&&(b===700||b===`bold`)&&u!==`bold`&&y.bold(uc[b]*i.fontSize*.05),y.style=A({fill:i.color,fillRule:`nonzero`,stroke:i.textStrokeWidth?i.textStrokeColor:void 0,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:void 0}),this.path=y,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){let t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;let{min:n,max:r}=t;return new W(n.x,n.y,r.x-n.x,r.y-n.y)}},fc=class{content;style;fill;outline;index;parent;inlineBox=new W;get computedContent(){let e=this.computedStyle;return e.textTransform===`uppercase`?this.content.toUpperCase():e.textTransform===`lowercase`?this.content.toLowerCase():this.content}constructor(e,t={},n,r,i,a){this.content=e,this.style=t,this.fill=n,this.outline=r,this.index=i,this.parent=a,this.update().initCharacters()}update(){this.computedStyle={...this.parent.computedStyle,...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new dc(n,t++,this));return this.characters=e,this}},pc=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...A(this.parent.computedStyle),...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}};function mc(e){return e}var hc;function gc(){if(hc?.isConnected)return hc;let e=document.createElement(`div`);return e.dataset.modernText=`measurer`,Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,visibility:`hidden`,pointerEvents:`none`}),document.body.appendChild(e),hc=e,e}var _c=class e{static notZeroStyles=new Set([`width`,`height`]);static pxStyles=new Set([`width`,`height`,`fontSize`,`letterSpacing`,`textStrokeWidth`,`textIndent`,`shadowOffsetX`,`shadowOffsetY`,`shadowBlur`,`margin`,`marginLeft`,`marginTop`,`marginRight`,`marginBottom`,`padding`,`paddingLeft`,`paddingTop`,`paddingRight`,`paddingBottom`]);_styleCache=new WeakMap;_mountedDom;_mountedSignature;_toDomStyle(t){let n=this._styleCache.get(t);if(n)return n;let r={},{notZeroStyles:i,pxStyles:a}=e;for(let e in t){let n=t[e];i.has(e)&&n===0||(r[e]=typeof n==`number`&&a.has(e)?`${n}px`:n)}return this._styleCache.set(t,r),r}_resolveRootStyles(e){let t={...e},n=e.writingMode.includes(`horizontal`);switch(e.textAlign){case`start`:case`left`:t.justifyContent=`flex-start`;break;case`center`:t.justifyContent=`center`;break;case`end`:case`right`:t.justifyContent=`flex-end`;break}switch(e.verticalAlign){case`top`:t.alignItems=`flex-start`;break;case`middle`:t.alignItems=`center`;break;case`bottom`:t.alignItems=`flex-end`;break}let r=!!(t.justifyContent||t.alignItems);return{section:{...this._toDomStyle({...t,boxSizing:t.boxSizing??`border-box`,display:t.display??(r?`inline-flex`:void 0),width:t.width??`max-content`,height:t.height??`max-content`}),whiteSpace:`pre-wrap`,wordBreak:`break-all`},ul:{verticalAlign:`inherit`,listStyleType:`inherit`,padding:`0`,margin:`0`,width:r&&n?`100%`:void 0,height:r&&!n?`100%`:void 0}}}_applyRootStyle(e,t,n){let r=this._resolveRootStyles(n);e.removeAttribute(`style`),Object.assign(e.style,r.section),t.removeAttribute(`style`),Object.assign(t.style,r.ul)}_applyLiStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applySpanStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applyFragmentContent(e,t){let n=e.firstChild;n?n.data!==t.content&&(n.data=t.content):e.appendChild(document.createTextNode(t.content))}_hide(e){e.style.visibility=`hidden`}_signature(e){let t=`${e.length}`;for(let n=0;n<e.length;n++)t+=`:${e[n].fragments.length}`;return t}createDom(e,t){let n=document.createElement(`section`),r=document.createElement(`ul`);return this._applyRootStyle(n,r,t),e.forEach(e=>{let t=document.createElement(`li`);this._applyLiStyle(t,e),e.fragments.forEach(e=>{let n=document.createElement(`span`);this._applySpanStyle(n,e),this._applyFragmentContent(n,e),t.appendChild(n)}),r.appendChild(t)}),n.appendChild(r),n}_patchDom(e,t,n,r){let i=e.firstChild;this._applyRootStyle(e,i,n),r&&this._hide(e);let a=i.children;for(let e=0;e<t.length;e++){let n=a[e];this._applyLiStyle(n,t[e]);let r=t[e].fragments,i=n.children;for(let e=0;e<r.length;e++){let t=i[e];this._applySpanStyle(t,r[e]),this._applyFragmentContent(t,r[e])}}}measureDomText(e){let t=e.data??``,n=[];if(!t.length)return n;let r=document.createRange(),i=0;for(;i<t.length;){let a=t.codePointAt(i),o=i+(a>65535?2:1);r.setStart(e,i),r.setEnd(e,o);let s=r.getClientRects?.(),c;s&&s.length?(c=s[s.length-1],s.length>1&&c.width<2&&(c=s[s.length-2])):c=r.getBoundingClientRect(),c&&c.width+c.height!==0&&n.push({content:t.slice(i,o),top:c.top,left:c.left,width:c.width,height:c.height}),i=o}return n}measureDom(e){let t=[],n=[],r=[];return e.querySelectorAll(`li`).forEach((e,i)=>{let a=e.getBoundingClientRect();t.push({paragraphIndex:i,left:a.x,top:a.y,width:a.width,height:a.height}),e.querySelectorAll(`:scope > *`).forEach((e,t)=>{let a=e.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:t,left:a.x,top:a.y,width:a.width,height:a.height});let o=0,s=e=>{this.measureDomText(e).forEach(e=>{r.push({...e,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:t,characterIndex:o++,textWidth:-1,textHeight:-1})})};!e.children.length&&e.firstChild instanceof window.Text?s(e.firstChild):e.querySelectorAll(`:scope > *`).forEach(e=>{e.firstChild instanceof window.Text&&s(e.firstChild)})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){let n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(t=>{let r=e[t.paragraphIndex].lineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height}),r.fragments.forEach(t=>{let r=e[t.paragraphIndex].fragments[t.fragmentIndex].inlineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height});let i=[];return r.characters.forEach(t=>{let{paragraphIndex:r,fragmentIndex:a,characterIndex:o}=t,s=t.left-n.left,c=t.top-n.top;i.push({...t,newParagraphIndex:r,left:s,top:c});let{fontHeight:l,isVertical:u,inlineBox:d,lineBox:f}=e[r].fragments[a].characters[o];d.left=s,d.top=c,d.width=t.width,d.height=t.height,u?(f.left=s+(t.width-l)/2,f.top=c,f.width=l,f.height=t.height):(f.left=s,f.top=c+(t.height-l)/2,f.width=t.width,f.height=l)}),{paragraphs:e,boundingBox:new W(0,0,n.width,n.height)}}measure(e,t,n){return this.measureParagraphDom(e,n??this._mount(e,t))}_mount(e,t){let n=this._signature(e);if(this._mountedDom?.isConnected&&this._mountedSignature===n)return this._patchDom(this._mountedDom,e,t,!0),this._mountedDom;this._unmount();let r=this.createDom(e,t);return this._hide(r),gc().appendChild(r),this._mountedDom=r,this._mountedSignature=n,r}_unmount(){this._mountedDom?.parentNode?.removeChild(this._mountedDom),this._mountedDom=void 0,this._mountedSignature=void 0}dispose(){this._unmount()}};function vc(e,t,n){return e[`${t}${n}`]??e[t]??0}var yc=class{measure(e,t,n,r){let i=r??ac;for(let t of e)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:vc(e,`padding`,`Top`),right:vc(e,`padding`,`Right`),bottom:vc(e,`padding`,`Bottom`),left:vc(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=r?t.width-n.left-n.right:1/0,a=n.top,o=n.left;for(let t of e){let e=t.computedStyle,r=t.style,s=vc(r,`margin`,`Top`),c=vc(r,`margin`,`Bottom`),l=vc(r,`margin`,`Left`),u=vc(r,`margin`,`Right`),d=vc(r,`padding`,`Top`),f=vc(r,`padding`,`Bottom`),p=vc(r,`padding`,`Left`),m=vc(r,`padding`,`Right`),h=n.left+l+p,g=i===1/0?1/0:i-l-u-p-m;a+=s+d;let _=a,v=h,y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,o=0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),o+=this._advance(e);let s=h+r;if(g!==1/0){let e=g-r-o;b===`center`?s+=e/2:(b===`end`||b===`right`)&&(s+=e)}for(let e of n){let t=e.advanceWidth,n=e.advanceHeight,r=e.fontHeight;e.inlineBox.left=s,e.inlineBox.top=a+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,e.lineBox.left=s,e.lineBox.top=e.inlineBox.top+(n-r)/2,e.lineBox.width=t,e.lineBox.height=r,s+=this._advance(e)}s>v&&(v=s),a+=i}v>o&&(o=v);for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));t.lineBox.left=h,t.lineBox.top=_,t.lineBox.width=g===1/0?v-h:g,t.lineBox.height=a-_,a+=f+c}let s=a+n.bottom,c=r?t.width:o+n.right,l=typeof t.height==`number`?t.height:s;if(typeof t.height==`number`){let n=l-s,r=t.verticalAlign,i=r===`middle`?n/2:r===`bottom`?n:0;i&&this._shiftAll(e,i)}return{paragraphs:e,boundingBox:new W(0,0,c,l)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=r?t.height-n.top-n.bottom:1/0,a=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,i)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);a.push({chars:n,thickness:t})}}let o=a.reduce((e,t)=>e+t.thickness,0),s=typeof t.width==`number`,c=s?Math.max(t.width-n.left-n.right,o):o,l=n.left+c,u=n.top;for(let e of a){l-=e.thickness;let t=l,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight,o=n.fontHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,n.lineBox.left=n.inlineBox.left+(a-o)/2,n.lineBox.top=r,n.lineBox.width=o,n.lineBox.height=i,r+=this._advance(n)}r>u&&(u=r)}for(let t of e){for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));this._unionInto(t.lineBox,t.fragments.flatMap(e=>e.characters.map(e=>e.inlineBox)))}return{paragraphs:e,boundingBox:new W(0,0,s?t.width:c+n.left+n.right,r?t.height:u+n.bottom)}}_advance(e){return e.advanceWidth+(e.computedStyle.letterSpacing??0)}_breakLines(e,t){let n=[],r=[],i=0,a=()=>{n.push(r),r=[],i=0};for(let n of e.fragments)for(let e of n.characters){if(e.content===`
|
|
34
34
|
`||e.content===`\r`){a();continue}t!==1/0&&r.length>0&&i+e.advanceWidth>t&&a(),r.push(e),i+=this._advance(e)}return a(),n}_unionInto(e,t){let n=t.filter(e=>e.width!==0||e.height!==0);if(!n.length)return;let r=W.from(...n);e.left=r.left,e.top=r.top,e.width=r.width,e.height=r.height}_shiftAll(e,t){for(let n of e){n.lineBox.top+=t;for(let e of n.fragments){e.inlineBox.top+=t;for(let n of e.characters)n.inlineBox.top+=t,n.lineBox.top+=t}}}dispose(){}};function bc(){let e=new Hr,t=Ur(),n=Wr(t);return{name:`background`,pathSet:e,context:{loader:t,parser:n},load:async e=>{let{backgroundImage:n}=e.computedStyle;n&&t.needsLoad(n)&&await t.load(n)},update:t=>{e.paths.length=0;let{computedStyle:r,lineBox:i,isVertical:a}=t,{backgroundImage:o,backgroundSize:s,backgroundColormap:c}=r;if(O(o))return;let{pathSet:l}=n.parse(o),u=l.getBoundingBox(!0)??new W,d,f,p,m;a?{x:f,y:d,width:m,height:p}=i:{x:d,y:f,width:p,height:m}=i;let h=Jr(c??`none`),g=l.paths.map(e=>{let t=e.clone();return t.style.fill&&t.style.fill in h&&(t.style.fill=h[t.style.fill]),t.style.stroke&&t.style.stroke in h&&(t.style.stroke=h[t.style.stroke]),t}),_,v;if(s===`rigid`){_=t.fontSize*5/u.width,v=_;let e=new U;e.x=u.width-p/_,e.y=u.height-m/v,g.forEach(t=>{t.applyTransform(t=>{let n=t.x>u.left+u.width/2,r=t.y>u.top+u.height/2;n&&(t.x-=e.x),r&&(t.y-=e.y)})})}else _=p/u.width,v=m/u.height;let y=new Bn;y.translate(-u.x,-u.y),y.scale(_,v),a&&(y.translate(-p/2,-m/2),y.rotate(Math.PI/2),y.translate(m/2,p/2)),y.translate(d,f),g.forEach(e=>{e.applyTransform(y)}),e.paths.push(...g)},renderOrder:-2,render:t=>{let{text:n,context:r}=t,{lineBox:i,computedStyle:a}=n;O(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Hr([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function xc(e,t){let{x:n,y:r}=t;if(e instanceof Ir){let{p1:t,cp:i,p2:a}=e,o=n!==void 0&&Math.abs(Math.sign(t.x-n)+Math.sign(i.x-n)+Math.sign(a.x-n))===1,s=r!==void 0&&Math.abs(Math.sign(t.y-r)+Math.sign(i.y-r)+Math.sign(a.y-r))===1,c,l,u,d;if(o&&(c=t.x-2*i.x+a.x,l=2*(-t.x+i.x),u=t.x-n),s&&(c=t.y-2*i.y+a.y,l=2*(-t.y+i.y),u=t.y-r),(o||s)&&(d=l*l-4*c*u,d>0)){let e=Math.sqrt(d),n=[(-l+e)/2/c,(-l-e)/2/c].find(e=>e>0&&e<1);if(n){let e=U.lerp(t,i,n),r=U.lerp(i,a,n),o=U.lerp(e,r,n);return[new Ir(t,e,o),new Ir(o.clone(),r,a)]}}}else if(e instanceof Nr){let{p1:t,cp1:i,cp2:a,p2:o}=e,{min:s,max:c}=e.getMinMax(),l=n!==void 0&&(s.x-n)*(c.x-n)<0,u=r!==void 0&&(s.y-r)*(c.y-r)<0;if(l||u){n=.5*t.x+.5*i.x,r=.5*t.y+.5*i.y;let e=new U(n,r);n=.25*t.x+.5*i.x+.25*a.x,r=.25*t.y+.5*i.y+.25*a.y;let s=new U(n,r);n=.125*t.x+.375*i.x+.375*a.x+.125*o.x,r=.125*t.y+.375*i.y+.375*a.y+.125*o.y;let c=new U(n,r);n=.25*i.x+.5*a.x+.25*o.x,r=.25*i.y+.5*a.y+.25*o.y;let l=new U(n,r);n=.5*a.x+.5*o.x,r=.5*a.y+.5*o.y;let u=new U(n,r);return[new Nr(t,e,s,c),new Nr(c.clone(),l,u,o)]}}else if(e instanceof jr){let{p1:t,p2:i}=e,a=n!==void 0&&(t.x-n)*(i.x-n)<0,o=r!==void 0&&(t.y-r)*(i.y-r)<0;if(a&&(r=t.y+(i.y-t.y)/(i.x-t.x)*(n-t.x)),o&&(n=t.x+(i.x-t.x)/(i.y-t.y)*(r-t.y)),a||o)return[new jr(t,new U(n,r)),new jr(new U(n,r),i)]}return[e]}var Sc=class{get boundingBox(){return this.text.lineBox}get paragraphs(){return this.text.paragraphs}get isHorizontal(){return this.text.computedStyle.writingMode.startsWith(`horizontal`)}get baseWidth(){return this.isHorizontal?this.boundingBox.width:this.boundingBox.height}get baseHeight(){return this.isHorizontal?this.boundingBox.height:this.boundingBox.width}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(e=>e.characters))}constructor({text:e,intensities:t=[],maxFontSize:n=100}){this.text=e,this.intensities=t.map(e=>e/100),this.lineHeight=n}_breakLine(){let e=!this.isHorizontal,{left:t,top:n,bottom:r,right:i}=this.boundingBox,a=.5*(t+i),o=.5*(n+r);this.characters.forEach(t=>{t.glyphBox&&t.path.curves.forEach(t=>{t.curves=t.curves.flatMap(t=>xc(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Ir&&e.isFromLine){let{p1:t,cp:n,p2:r}=e;n.x=2*n.x-.5*(t.x+r.x),n.y=2*n.y-.5*(t.y+r.y)}})})}_lineToQuadraticBezier(){this.characters.forEach(e=>{e.glyphBox&&e.path.curves.forEach(e=>{e.curves=e.curves.map(e=>{if(e instanceof jr&&e.getLength()>5){let{p1:t,p2:n}=e,r=new Ir(t.clone(),new U(.5*(t.x+n.x),.5*(t.y+n.y)),n.clone());return r.isFromLine=!0,r}return e})})})}_transform(e,t,n){let r=this.text.plugins.get(`highlight`),i=n?.(),a=0,o=this.characters.filter(e=>e.glyphBox).length;this.paragraphs.forEach((n,s)=>{n.fragments.forEach((n,c)=>{n.characters.forEach((n,l)=>{if(!n.glyphBox)return;let u=t?.({paragraphIndex:s,fragmentIndex:c,characterIndex:l,character:n},i);if(n.path.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)}),t&&r?.pathSet?.paths){let t=r.pathSet.paths.length/o,n=a*t;for(let i=0;i<t;i++)r?.pathSet?.paths[n+i]?.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)});a++}})})}),this.paragraphs.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{e.glyphBox=e.getGlyphBoundingBox(),e.glyphBox&&(e.inlineBox=e.glyphBox)})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},Cc=class extends Sc{preset;constructor(e,t){super(e),this.preset=t}deform(){Math.hypot(...this.intensities)&&(this._lineToQuadraticBezier(),this._bend(),this._makeTheJointSmooth())}_bend(){let{boundingBox:e,baseWidth:t,baseHeight:n,preset:r}=this,i=this.lineHeight*2/Math.sin(this.intensities[0]*Math.PI*.5),a=r.vertical===void 0||r.vertical===`auto`?!this.isHorizontal:r.vertical,{left:o,top:s,width:c,height:l}=e,u=(a?l:c)/2/i,d={x:o+c/2,y:s+l/2},f,p={x:d.x,y:d.y};a?(f=0,p.x-=n/2/Math.tan(u)+Math.sign(u)*c/2):(f=1.5*Math.PI,p.y+=t/2/Math.tan(u)+Math.sign(u)*l/2);let m=r.transform({lineHeight:i,size:u,center:d,centerDist:p,centerDistAngle:f,width:c,height:l,isHorizontal:this.isHorizontal});this._transform(m)}},wc=class{arcLengthDivisions=200;_cacheArcLengths;_needsUpdate=!1;getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;let t=[0],n=this.getPoint(0),r=0;for(let i=1;i<=e;i++){let a=this.getPoint(i/e);r+=a.distanceTo(n),t.push(r),n=a}return this._cacheArcLengths=t,t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t===void 0?e*n[r-1]:t,a=0,o=r-1,s=0;for(;a<=o;){s=Math.floor(a+(o-a)/2);let e=n[s]-i;if(e<0)a=s+1;else if(e>0)o=s-1;else{o=s;break}}if(s=o,n[s]===i)return s/(r-1);let c=n[s],l=n[s+1]-c,u=(i-c)/l;return(s+u)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}},Tc=class extends wc{curveT=0;getPoint(e,t=new U){return this.getCurve(e).getPoint(this.curveT,t)}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return this.getCurve(e).getTangent(this.curveT,t)}getNormal(e,t=new U){return this.getCurve(e).getNormal(this.curveT,t)}},Ec=class extends wc{start;end;constructor(e,t){super(),this.start=e,this.end=t}getPoint(e,t=new U){return e===1?t.copyFrom(this.end):t.copyFrom(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.end,this.start).normalize()}},Dc=class extends wc{center;radius;start;end;constructor(e,t,n=0,r=Math.PI*2){super(),this.center=e,this.radius=t,this.start=n,this.end=r}getPoint(e,t=new U){return t.copyFrom(this.center).add(this.getNormal(e).scale(this.radius))}getTangent(e,t=new U){let{x:n,y:r}=this.getNormal(e);return t.set(-r,n)}getNormal(e,t=new U){let{start:n,end:r}=this,i=e*(r-n)+n-.5*Math.PI;return t.set(Math.cos(i),Math.sin(i))}},Oc=class extends wc{center;radiusX;radiusY;rotation;startAngle;endAngle;clockwise;constructor(e=new U,t=1,n=1,r=0,i=0,a=Math.PI*2,o=!1){super(),this.center=e,this.radiusX=t,this.radiusY=n,this.rotation=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}getPoint(e,t=new U){let n=Math.PI*2,r=this.endAngle-this.startAngle,i=Math.abs(r)<2**-52;for(;r<0;)r+=n;for(;r>n;)r-=n;r<2**-52&&(r=i?0:n),this.clockwise&&!i&&(r=r===n?-n:r-n);let a=this.startAngle+e*r,o=this.center.x+this.radiusX*Math.cos(a),s=this.center.y+this.radiusY*Math.sin(a);if(this.rotation!==0){let e=Math.cos(this.rotation),t=Math.sin(this.rotation),n=o-this.center.x,r=s-this.center.y;o=n*e-r*t+this.center.x,s=n*t+r*e+this.center.y}return t.set(o,s)}},kc=class extends Tc{center;size;start;end;curves=[];constructor(e,t,n=0,r=1){super(),this.center=e,this.size=t,this.start=n,this.end=r,this.update()}update(){let{x:e,y:t}=this.center,n=new U(e+.5*this.size,t-.5*this.size),r=new U(e-.5*this.size,t-.5*this.size),i=new U(e,t+.5*this.size),a=new Dc(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new Dc(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new Dc(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),c=new U(e,t+this.size),l=new U(e+this.size,t),u=U.lerp(l,c,.75),d=new U(e-this.size,t),f=U.lerp(d,c,.75),p=new Ec(l,u),m=new Ec(f,d);return this.curves=[a,p,s,m,o],this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=9*Math.PI/8+1.5;let n=.5*Math.PI,r;return t<n?(r=0,this.curveT=t/n):t<n+.75?(r=1,this.curveT=(t-n)/.75):t<5*Math.PI/8+.75?(r=2,this.curveT=(t-n-.75)/(Math.PI/8)):t<5*Math.PI/8+1.5?(r=3,this.curveT=(t-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(t-5*Math.PI/8-1.5)/n),this.curves[r]}},Ac=class extends Tc{center;radius;number;start;end;curves=[];points=[];constructor(e,t=0,n=0,r=0,i=1){super(),this.center=e,this.radius=t,this.number=n,this.start=r,this.end=i,this.update()}update(){for(let e=0;e<this.number;e++){let t=e*2*Math.PI/this.number;t-=.5*Math.PI,this.points.push(new U(this.radius*Math.cos(t),this.radius*Math.sin(t)).add(this.center))}for(let e=0;e<this.number;e++)this.curves.push(new Ec(this.points[e],this.points[(e+1)%this.number]));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1);let n=t*this.number,r=Math.floor(n);return this.curveT=n-r,this.curves[r]}},jc=class extends Tc{center;rx;aspectRatio;start;end;curves=[];constructor(e,t,n=1,r=0,i=1){super(),this.center=e,this.rx=t,this.aspectRatio=n,this.start=r,this.end=i,this.update()}update(){let{x:e,y:t}=this.center,n=this.rx,r=this.rx/this.aspectRatio,i=[new U(e-n,t-r),new U(e+n,t-r),new U(e+n,t+r),new U(e-n,t+r)];for(let e=0;e<4;e++)this.curves.push(new Ec(i[e].clone(),i[(e+1)%4].clone()));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=(1+this.aspectRatio)*2;let n;return t<this.aspectRatio?(n=0,this.curveT=t/this.aspectRatio):t<this.aspectRatio+1?(n=1,this.curveT=t-this.aspectRatio):t<2*this.aspectRatio+1?(n=2,this.curveT=(t-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=t-2*this.aspectRatio-1),this.curves[n]}},Mc=class extends Sc{preset;constructor(e,t){super(e),this.preset=t}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this;e.breakLine&&this._breakLine(),e.lineToQuad&&this._lineToQuadraticBezier();let[t,n]=this.intensities,r=this._createFFDControlPoints(e.hBlocks,e.vBlocks);e.build(r,{a:t,b:n,baseWidth:this.baseWidth,baseHeight:this.baseHeight,lineHeight:this.lineHeight,adjust:(e,t,n)=>this._adjustControlPoints(e,{x:t,y:n})}),e.bezier?(this._calculateForBezierFFD(r,e.hBlocks,e.vBlocks),this._makeTheJointSmooth()):this._calculateForLinearFFD(r,e.hBlocks,e.vBlocks)}_calculateForFFD(e,t,n,r){let{left:i,top:a,right:o,width:s,height:c}=this.boundingBox;this._transform(this.isHorizontal?o=>{let l=(o.x-i)/s,u=(o.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,l);for(let n=0;n<r+2;n++){let o=e(r,n,u),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]}:i=>{let l=(o-i.x)/s,u=(i.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,u);for(let n=0;n<r+2;n++){let o=e(r,n,l),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]})}_createFFDControlPoints(e,t){let{left:n,top:r,right:i,width:a,height:o}=this.boundingBox,s=[];if(this.isHorizontal){let i=a/(e+1),c=o/(t+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(n+a*i,r+e*c))}else{let n=a/(t+1),c=o/(e+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(i-e*n,r+a*c))}return s}_adjustControlPoints(e,t){this.isHorizontal?(e.x+=t.x,e.y+=t.y):(e.x-=t.y,e.y+=t.x)}_factorialForFFD(e){let t=1;for(let n=2;n<=e;n++)t*=n;return t}_combineForFFD(e,t){return this._factorialForFFD(e)/this._factorialForFFD(e-t)/this._factorialForFFD(t)}_calculateForBezierFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._combineForFFD(e+1,t)*(1-n)**(e+1-t)*n**t,e,t,n)}_linearBasis(e,t,n){let r=t<n*e?t+1-n*e:n*e-t+1;return Math.max(0,r)}_calculateForLinearFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._linearBasis(e+1,t,n),e,t,n)}},Nc=class extends Sc{preset;constructor(e,t){super(e),this.preset=t}_context(){return{intensities:this.intensities,baseWidth:this.baseWidth,lineHeight:this.lineHeight,isHorizontal:this.isHorizontal,boundingBox:this.boundingBox}}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this,t=this._context();if(e.engine===`offset`)this._transform(e.point,e.perChar?n=>e.perChar(t,n):void 0);else{let n=e.followTangent??!0,{funcPerChar:r,funcPerPoint:i}=this._getPerCharAndPointFunc(n);this._transform(i,r,()=>{let{width:n,height:r,left:i,top:a}=this.boundingBox;return{width:n,height:r,left:i,top:a,curve:e.makeCurve(t),isHorizontal:this.isHorizontal,needExpandAlongNormal:e.expandAlongNormal??!1}})}}_getPerCharAndPointFunc(e=!1){let t,n;return e?(n=this._resetPointPos,t=this._calculateNewCenter):(n=this._resetPointPosWithoutRotate,t=this._calculateNewCenterWithoutRotate),{funcPerPoint:n,funcPerChar:t}}_calculateNewCenter({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s,needExpandAlongNormal:c=!1}=t,{center:l,centerDiviation:u}=e,d=s?(l.x-i)/n:(l.y-a)/r,f=s?new U(0,l.y-a):new U(l.x-i,0);if(c){let e=o.getNormal(d);f.x+=e.x*-u,f.y+=e.y*-u}let p=o.getPointAt(d).add(f),m=o.getTangent(d);return{cos:m.x,sin:m.y,newCenter:p,center:l}}_calculateNewCenterWithoutRotate({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s}=t,{center:c}=e,l=s?(c.x-i)/n:(c.y-a)/r,u=s?new U(0,c.y-a):new U(c.x-i,0);return{newCenter:o.getPointAt(l).add(u),center:c}}_resetPointPos(e,t){let{cos:n=1,sin:r=0,center:i,newCenter:a}=t,o=e.x-i.x,s=e.y-i.y;return[a.x+o*n-s*r,a.y+o*r+s*n]}_resetPointPosWithoutRotate(e,t){let{center:n,newCenter:r}=t;return[e.x-n.x+r.x,e.y-n.y+r.y]}},Pc=new Map;function Fc(e,t){Pc.set(e,t)}function Ic(e){Pc.delete(e)}function Lc(){return[...Pc.keys()]}function Rc(){return mc({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(O(n)||!n)return;let r=Pc.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize},a;switch(r.engine){case`ffd`:a=new Mc(i,r);break;case`bend`:a=new Cc(i,r);break;case`curve`:case`offset`:a=new Nc(i,r);break}a.deform();let o=e.getGlyphBox();e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function zc(e){let{highlight:t,highlightImage:n,highlightReferImage:r,highlightColormap:i,highlightLine:a,highlightSize:o,highlightThickness:s}=e;return{image:t?.image??n??`none`,referImage:t?.referImage??r??`none`,colormap:t?.colormap??i??`none`,line:t?.line??a??`none`,size:t?.size??o??`cover`,thickness:t?.thickness??s??`100%`}}function Bc(){let e=new Hr,t=[],n=Ur(),r=Wr(n);return mc({name:`highlight`,pathSet:e,context:{clipRects:t,loader:n,parser:r},load:async e=>{let t=new Set;e.forEachCharacter(e=>{let{computedStyle:r}=e,{image:i,referImage:a}=zc(r);i&&n.needsLoad(i)&&t.add(i),a&&n.needsLoad(a)&&t.add(a)}),await Promise.all(Array.from(t).map(e=>n.load(e)))},update:n=>{t.length=0,e.paths.length=0;let i=[],a,o;n.forEachCharacter(e=>{let{computedStyle:t}=e,n=zc(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(O(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Xr(o.image,r)&&Xr(o.colormap,s)&&Xr(o.line,c)&&Xr(o.size,l)&&Xr(o.thickness,u))&&a?.length&&(d?a[0].inlineBox.left===n.left:a[0].inlineBox.top===n.top)&&a[0].fontSize===f?a.push(e):(a=[],a.push(e),i.push(a))}o=n}),i=i.filter(e=>e.length);for(let n=0;n<i.length;n++){let a=i[n],o=a[0],s=W.from(...a.map(e=>e.compatibleGlyphBox));if(!s.height||!s.width)continue;let{computedStyle:c,isVertical:l,inlineBox:u,compatibleGlyphBox:d,strikeoutPosition:f,underlinePosition:p}=o,{fontSize:m}=c,{image:h,referImage:g,colormap:_,line:v,size:y,thickness:b}=zc(c),x=qr(b,{fontSize:m,total:s.width})/s.width,S=Jr(_),{pathSet:C,dom:w}=r.parse(h),T=C.getBoundingBox(!0)??new W,E=m/T.width*2,D=new W().copy(s);l&&(D.width=s.height,D.height=s.width,D.left=s.left+s.width);let k=Math.floor(D.width),A=k;y!==`cover`&&(A=qr(y,{fontSize:m,total:s.width})||k,D.width=A);let j=!O(g)&&O(v);if(j)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(O(v))if(T.width/T.height>4){e=`underline`;let t=w.getAttribute(`viewBox`);if(t){let[n,r,i,a]=t.split(` `).map(e=>Number(e)),o=r+a/2;e=T.y<o&&T.y+T.height>o?`line-through`:T.y+T.height<o?`overline`:`underline`}}else e=`outline`;else e=v;switch(e){case`outline`:{let e=D.width*.2,t=D.height*.2;l?(D.x-=t/2,D.y-=e/2,D.x-=D.height):(D.x-=e/2,D.y-=t/2),D.width+=e,D.height+=t;break}case`overline`:D.height=T.height*E,l?D.x=u.left+u.width:D.y=u.top;break;case`line-through`:D.height=T.height*E,l?D.x=u.left+u.width-f+D.height/2:D.y=u.top+f-D.height/2;break;case`underline`:D.height=T.height*E,l?D.x=d.left+d.width-p:D.y=u.top+p;break}}let M=new Bn;if(M.translate(-T.x,-T.y),M.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;j||M.translate(-e,-t),M.rotate(Math.PI/2),j||M.translate(t,e)}M.translate(D.x,D.y);for(let n=0;n<Math.ceil(k/A);n++){let r=M.clone();l?r.translate(0,n*D.width):r.translate(n*D.width,0),C.paths.forEach(n=>{let i=n.clone().applyTransform(r);i.style.strokeWidth&&(i.style.strokeWidth*=E*x),i.style.strokeMiterlimit&&(i.style.strokeMiterlimit*=E),i.style.strokeDashoffset&&(i.style.strokeDashoffset*=E),i.style.strokeDasharray&&(i.style.strokeDasharray=i.style.strokeDasharray.map(e=>e*E)),i.style.fill&&i.style.fill in S&&(i.style.fill=S[i.style.fill]),i.style.stroke&&i.style.stroke in S&&(i.style.stroke=S[i.style.stroke]),e.paths.push(i),k!==A&&(l?t[e.paths.length-1]=new W(s.left-s.width*2,s.top,s.width*4,s.height):t[e.paths.length-1]=new W(s.left,s.top-s.height*2,s.width,s.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{let n=[];return e.paths.forEach((e,r)=>{let i=t[r],a=e.getBoundingBox();if(i){let e=Math.max(a.x,i.x),t=Math.max(a.y,i.y),n=Math.min(a.right,i.right),r=Math.min(a.bottom,i.bottom);a=new W(e,t,n-e,r-t)}n.push(a)}),n.length?W.from(...n):void 0},render:n=>{let{text:r,context:i}=n;e.paths.forEach((e,a)=>{if(n.drawPath(e,{clipRect:t[a]}),r.debug){let t=new Hr([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Vc(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
|
|
35
35
|
<circle cx="${e}" cy="${e}" r="${e}" fill="${t}" />
|
|
36
|
-
</svg>`}function Hc(){let e=new Hr;return mc({name:`listStyle`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n,isVertical:r,fontSize:i}=t,a=i*.45;n.forEach(t=>{let{computedStyle:n}=t,{color:o,listStyleImage:s,listStyleColormap:c,listStyleSize:l,listStyleType:u}=n,d=Jr(c),f=l,p;if(!O(s))p=s;else if(!O(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Vc(e,String(o));break}}if(!p)return;let m=_r(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:qr(f,{total:i,fontSize:i})/i,y=new Bn;if(r){let e=i/h.height*v;y.translate(-h.left,-h.top).rotate(-Math.PI/2).scale(e,e).translate(_.left+(_.width-h.height*e)/2,_.top-a)}else{let e=i/h.height*v;y.translate(-h.left,-h.top).scale(e,e).translate(_.left-h.width*e-a,_.top+(_.height-h.height*e)/2)}e.paths.push(...m.paths.map(e=>{let t=e.clone();return t.applyTransform(y),t.style.fill&&t.style.fill in d&&(t.style.fill=d[t.style.fill]),t.style.stroke&&t.style.stroke in d&&(t.style.stroke=d[t.style.stroke]),t}))})}})}function Uc(){return{name:`outline`}}function Wc(){let e=new Hr;return mc({name:`render`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n}=t;n.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.paths.push(t.path)})})})},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Gr(e,n);t.forEach(e=>{if(!e.glyphBox)return;let t=e.glyphBox.clone(),o=a.apply({x:t.left,y:t.top}),s=a.apply({x:t.right,y:t.top}),c=a.apply({x:t.right,y:t.bottom}),l=a.apply({x:t.left,y:t.bottom}),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);if(t.left=u,t.top=d,t.width=f-u,t.height=p-d,n.shadow?.enabled){let e=(n.shadow.offsetX??0)*r,i=(n.shadow.offsetY??0)*r,a=(n.shadow.blur??0)*r,o=t.left+Math.min(0,e-a),s=t.top+Math.min(0,i-a),c=t.left+t.width+Math.max(0,e+a),l=t.top+t.height+Math.max(0,i+a);t.left=o,t.top=s,t.width=c-o,t.height=l-s}if(n.outline?.enabled){let e=Math.max(.1,n.outline.width??0);t.left-=e,t.top-=e,t.width+=e*2,t.height+=e*2}i.push(t)})}),i.length?W.from(...i):void 0},render:e=>{let{text:t,context:n}=e,{paragraphs:r,glyphBox:i,computedEffects:a}=t;r.length&&(a.length?a.forEach(r=>{if(e.uploadColor(i,r),n.save(),e.transformEffect(r),r.shadow?.enabled){let n={...r,shadow:{...r.shadow,enabled:!1}};e.drawWithShadow(r.shadow,()=>{t.forEachCharacter(t=>{e.drawCharacter(t,n)})})}else t.forEachCharacter(t=>{e.drawCharacter(t,r)});n.restore()}):r.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.drawCharacter(t)})})}),t.debug&&r.forEach(e=>{n.strokeRect(e.lineBox.x,e.lineBox.y,e.lineBox.width,e.lineBox.height)}))}})}function Gc(){let e=new Hr;return mc({name:`textDecoration`,pathSet:e,update:t=>{e.paths.length=0;let n=[],r,i;t.forEachCharacter(e=>{let{computedStyle:t,isVertical:a,inlineBox:o,underlinePosition:s,underlineThickness:c,strikeoutPosition:l,strikeoutSize:u}=e,{color:d,textDecoration:f,writingMode:p}=t;if(O(f))i=void 0;else{let m=!1;if(i?.textDecoration===f&&i?.writingMode===p&&i?.color===d&&(a?r[0].inlineBox.left===o.left:r[0].inlineBox.top===o.top))switch(f){case`underline`:r[0].underlinePosition===s&&r[0].underlineThickness===c&&(m=!0);break;case`line-through`:r[0].strikeoutPosition===l&&r[0].strikeoutSize===u&&(m=!0);break}m?r.push(e):(r=[],r.push(e),n.push(r)),i=t}}),n.forEach(t=>{let{computedStyle:n,isVertical:r,underlinePosition:i,underlineThickness:a,strikeoutPosition:o,strikeoutSize:s}=t[0],{color:c,textDecoration:l}=n,{left:u,top:d,width:f,height:p}=W.from(...t.map(e=>e.inlineBox)),m=r?u+f:d,h=r?-1:1,g=0;switch(l){case`overline`:g=a*2;break;case`underline`:m+=h*i,g=a*2;break;case`line-through`:m+=h*o,g=s*2;break}m-=g;let _;_=r?new Vr([{type:`M`,x:m,y:d},{type:`L`,x:m,y:d+p},{type:`L`,x:m+g,y:d+p},{type:`L`,x:m+g,y:d},{type:`Z`}],{fill:c}):new Vr([{type:`M`,x:u,y:m},{type:`L`,x:u+f,y:m},{type:`L`,x:u+f,y:m+g},{type:`L`,x:u,y:m+g},{type:`Z`}],{fill:c}),e.paths.push(_)})},render:t=>{let{text:n,context:r}=t,{computedEffects:i}=n;i.length?i.forEach(n=>{r.save(),t.transformEffect(n),e.paths.forEach(e=>{t.drawPath(e,t.effectToPathStyle(n))}),r.restore()}):e.paths.forEach(e=>{t.drawPath(e)})}})}function Kc(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function qc(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var Jc,Yc=et(),Xc=class extends ae{needsUpdate=!0;computedStyle={...Yc};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new _c;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;_pluginsByUpdateOrder=[];_pluginsByRenderOrder=[];_renderer;_rendererCtx;get paragraphs(){return this._paragraphs}set paragraphs(e){this._paragraphs=e,this._cachedCharacters=void 0}get fontSize(){return this.computedStyle.fontSize}get defaultFamily(){return this.fonts?.fallbackFont?.familySet.values().next().value??`sans-serif`}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get characters(){if(this._cachedCharacters)return this._cachedCharacters;let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let n=r[t].characters;for(let t=0;t<n.length;t++)e.push(n[t])}}return this._cachedCharacters=e,e}constructor(e={}){super(),this.set(e)}set(e={}){let{content:t,effects:n,style:r,measureDom:i,fonts:a,fill:o,outline:s,deformation:c}=lt(e);if(e.measurer&&typeof e.measurer!=`string`)this.measurer=e.measurer;else{let t=e.measurer??(a?`font`:`dom`);this.measurer=t===`font`?new yc:new _c}this.debug=e.debug??!1,this.content=t,this.effects=n,this.style=r,this.measureDom=i,this.fonts=a,this.fill=o,this.outline=s,this.deformation=c,this.use(bc()).use(Uc()).use(Hc()).use(Gc()).use(Bc()).use(Wc()).use(Rc()),(e.plugins??[]).forEach(e=>{this.use(e)}),this._update()}use(e){return this.plugins.set(e.name,e),this._resortPlugins(),this}_resortPlugins(){this._pluginsByUpdateOrder=[...this.plugins.values()].sort((e,t)=>(e.updateOrder??0)-(t.updateOrder??0)),this._pluginsByRenderOrder=[...this.plugins.values()].sort((e,t)=>(e.renderOrder??0)-(t.renderOrder??0))}forEachCharacter(e){let t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let i=r[t].characters;for(let r=0;r<i.length;r++)e(i[r],{paragraphIndex:n,fragmentIndex:t,characterIndex:r})}}return this}async load(){this._update(),await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))])}async _decodeFonts(){let e=this.fonts??ac,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}t.add(e.fallbackFont),await Promise.all(Array.from(t,async e=>{let t=e?.getFont();t&&typeof t.createSFNTAsync==`function`&&!t._sfnt&&(t._sfnt=await t.createSFNTAsync())}))}_update(){this.computedStyle={...Yc,...this.style},this.computedFill=this.fill?{...this.fill}:void 0,this.computedOutline=this.outline?{...this.outline}:void 0,this.computedEffects=this.effects?.map(e=>e)??[];let e=[];return this.content.forEach((t,n)=>{let{fragments:r,fill:i,outline:a,...o}=t,s=new pc(o,n,this);s.fill=i,s.outline=a,r.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&s.fragments.push(new fc(n,a,r,i,t,s))}),e.push(s)}),this.paragraphs=e,this}createDom(){if(this._update(),!this.measurer.createDom)throw Error(`current measurer does not support createDom()`);return this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(e=this.measureDom){let t={paragraphs:this.paragraphs,inlineBox:this.inlineBox,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();let n=this.measurer.measure(this.paragraphs,this.computedStyle,e,this.fonts);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox;let r=this.characters;for(let e=0;e<r.length;e++)r[e].update(this.fonts);let i=this.getGlyphBox();this.rawGlyphBox=i,this.glyphBox=i;let a=this._pluginsByUpdateOrder;for(let e=0;e<a.length;e++)a[e].update?.(this);let o=this._pluginsByRenderOrder;this.pathSets.length=0;for(let e=0;e<o.length;e++){let t=o[e];t.pathSet?.paths.length&&this.pathSets.push(t.pathSet)}this._updateInlineBox()._updatePathBox()._updateBoundingBox();for(let e in t){let r=this[e];this[e]=t[e],n[e]=r}return this.emit(`measure`,{text:this,result:n}),n}getGlyphBox(){let e=U.MAX,t=U.MIN,n=this.characters;for(let r=0;r<n.length;r++){let i=n[r];if(i.getGlyphMinMax(e,t))continue;let{left:a,top:o,width:s,height:c}=i.inlineBox,l=new U(a,o),u=new U(a+s,o+c);e.clampMin(l,u),t.clampMax(l,u)}return e.x===-(2**53-1)||e.y===-(2**53-1)||t.x===2**53-1||t.y===2**53-1?new W(0,0,0,0):new W(e.x,e.y,t.x-e.x,t.y-e.y)}_updateInlineBox(){let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++)e.push(r[t].inlineBox)}return this.inlineBox=W.from(...e),this}_updatePathBox(){let e=[this.glyphBox];for(let t of this.plugins.values()){let n=t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox();n&&e.push(n)}return this.pathBox=W.from(...e),this}_updateBoundingBox(){return this.boundingBox=W.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(e=this.measureDom){return this.needsUpdate=!1,Object.assign(this,this.measure(e)),this.emit(`update`,{text:this}),this}_getRenderer(e){return(!this._renderer||this._rendererCtx!==e)&&(this._renderer=new Zr(this,e),this._rendererCtx=e),this._renderer}render(e){let{view:t,pixelRatio:n=2}=e,r=t.getContext(`2d`);if(!r)return;this.needsUpdate&&this.update();let i=this._getRenderer(r);i.pixelRatio=n,i.setup();let a=this._pluginsByRenderOrder;for(let e=0;e<a.length;e++){let t=a[e];if(t.render)t.render(i);else if(t.pathSet){let e=t.pathSet.paths;for(let t=0;t<e.length;t++)i.drawPath(e[t])}}this.emit(`render`,{text:this,view:t,pixelRatio:n}),e.onContext?.(r)}dispose(){this.measurer.dispose?.(),this._renderer=void 0,this._rendererCtx=void 0}toString(){return this.content.flatMap(e=>e.fragments.map(e=>e.content)).join(``)}};qc([ie({internal:!0}),Kc(`design:type`,Boolean)],Xc.prototype,`debug`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`content`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`style`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`effects`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`fill`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`outline`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`deformation`,void 0),qc([ie({internal:!0}),Kc(`design:type`,typeof(Jc=typeof HTMLElement<`u`&&HTMLElement)==`function`?Jc:Object)],Xc.prototype,`measureDom`,void 0),qc([ie({internal:!0}),Kc(`design:type`,Object)],Xc.prototype,`fonts`,void 0);function Zc(e,t){let n=new Xc(e);return t?n.load().then(()=>n.measure()):n.measure()}function Qc(e,t){let n=new Xc(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Zr,e.Character=dc,e.CircleCurve=Dc,e.DomMeasurer=_c,e.EllipseCurve=Oc,e.FontMeasurer=yc,e.Fragment=fc,e.HeartCurve=kc,e.Paragraph=pc,e.PolygonCurve=Ac,e.RectangularCurve=jc,e.Text=Xc,e.backgroundPlugin=bc,e.createSvgLoader=Ur,e.createSvgParser=Wr,e.defineDeformation=Fc,e.definePlugin=mc,e.deformationPlugin=Rc,e.getDeformationNames=Lc,e.getEffectTransform2D=Gr,e.getHighlightStyle=zc,e.highlightPlugin=Bc,e.isEqualObject=Yr,e.isEqualValue=Xr,e.listStylePlugin=Hc,e.measureText=Zc,e.outlinePlugin=Uc,e.parseColormap=Jr,e.parseTransformOrigin=Kr,e.parseValueNumber=qr,e.removeDeformation=Ic,e.renderPlugin=Wc,e.renderText=Qc,e.textDecorationPlugin=Gc,e.textDefaultStyle=Yc});
|
|
36
|
+
</svg>`}function Hc(){let e=new Hr;return mc({name:`listStyle`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n,isVertical:r,fontSize:i}=t,a=i*.45;n.forEach(t=>{let{computedStyle:n}=t,{color:o,listStyleImage:s,listStyleColormap:c,listStyleSize:l,listStyleType:u}=n,d=Jr(c),f=l,p;if(!O(s))p=s;else if(!O(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Vc(e,String(o));break}}if(!p)return;let m=_r(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:qr(f,{total:i,fontSize:i})/i,y=new Bn;if(r){let e=i/h.height*v;y.translate(-h.left,-h.top).rotate(-Math.PI/2).scale(e,e).translate(_.left+(_.width-h.height*e)/2,_.top-a)}else{let e=i/h.height*v;y.translate(-h.left,-h.top).scale(e,e).translate(_.left-h.width*e-a,_.top+(_.height-h.height*e)/2)}e.paths.push(...m.paths.map(e=>{let t=e.clone();return t.applyTransform(y),t.style.fill&&t.style.fill in d&&(t.style.fill=d[t.style.fill]),t.style.stroke&&t.style.stroke in d&&(t.style.stroke=d[t.style.stroke]),t}))})}})}function Uc(){return{name:`outline`}}function Wc(){let e=new Hr;return mc({name:`render`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n}=t;n.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.paths.push(t.path)})})})},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Gr(e,n);t.forEach(e=>{if(!e.glyphBox)return;let t=e.glyphBox.clone(),o=a.apply({x:t.left,y:t.top}),s=a.apply({x:t.right,y:t.top}),c=a.apply({x:t.right,y:t.bottom}),l=a.apply({x:t.left,y:t.bottom}),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);if(t.left=u,t.top=d,t.width=f-u,t.height=p-d,n.shadow?.enabled){let e=(n.shadow.offsetX??0)*r,i=(n.shadow.offsetY??0)*r,a=(n.shadow.blur??0)*r,o=t.left+Math.min(0,e-a),s=t.top+Math.min(0,i-a),c=t.left+t.width+Math.max(0,e+a),l=t.top+t.height+Math.max(0,i+a);t.left=o,t.top=s,t.width=c-o,t.height=l-s}if(n.outline?.enabled){let e=Math.max(.1,n.outline.width??0);t.left-=e,t.top-=e,t.width+=e*2,t.height+=e*2}i.push(t)})}),i.length?W.from(...i):void 0},render:e=>{let{text:t,context:n}=e,{paragraphs:r,glyphBox:i,computedEffects:a}=t;r.length&&(a.length?a.forEach(r=>{if(e.uploadColor(i,r),n.save(),e.transformEffect(r),r.shadow?.enabled){let n={...r,shadow:{...r.shadow,enabled:!1}};e.drawWithShadow(r.shadow,()=>{t.forEachCharacter(t=>{e.drawCharacter(t,n)})})}else t.forEachCharacter(t=>{e.drawCharacter(t,r)});n.restore()}):r.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.drawCharacter(t)})})}),t.debug&&r.forEach(e=>{n.strokeRect(e.lineBox.x,e.lineBox.y,e.lineBox.width,e.lineBox.height)}))}})}function Gc(){let e=new Hr;return mc({name:`textDecoration`,pathSet:e,update:t=>{e.paths.length=0;let n=[],r,i;t.forEachCharacter(e=>{let{computedStyle:t,isVertical:a,inlineBox:o,underlinePosition:s,underlineThickness:c,strikeoutPosition:l,strikeoutSize:u}=e,{color:d,textDecoration:f,writingMode:p}=t;if(O(f))i=void 0;else{let m=!1;if(i?.textDecoration===f&&i?.writingMode===p&&i?.color===d&&(a?r[0].inlineBox.left===o.left:r[0].inlineBox.top===o.top))switch(f){case`underline`:r[0].underlinePosition===s&&r[0].underlineThickness===c&&(m=!0);break;case`line-through`:r[0].strikeoutPosition===l&&r[0].strikeoutSize===u&&(m=!0);break}m?r.push(e):(r=[],r.push(e),n.push(r)),i=t}}),n.forEach(t=>{let{computedStyle:n,isVertical:r,underlinePosition:i,underlineThickness:a,strikeoutPosition:o,strikeoutSize:s}=t[0],{color:c,textDecoration:l}=n,{left:u,top:d,width:f,height:p}=W.from(...t.map(e=>e.inlineBox)),m=r?u+f:d,h=r?-1:1,g=0;switch(l){case`overline`:g=a*2;break;case`underline`:m+=h*i,g=a*2;break;case`line-through`:m+=h*o,g=s*2;break}m-=g;let _;_=r?new Vr([{type:`M`,x:m,y:d},{type:`L`,x:m,y:d+p},{type:`L`,x:m+g,y:d+p},{type:`L`,x:m+g,y:d},{type:`Z`}],{fill:c}):new Vr([{type:`M`,x:u,y:m},{type:`L`,x:u+f,y:m},{type:`L`,x:u+f,y:m+g},{type:`L`,x:u,y:m+g},{type:`Z`}],{fill:c}),e.paths.push(_)})},render:t=>{let{text:n,context:r}=t,{computedEffects:i}=n;i.length?i.forEach(n=>{r.save(),t.transformEffect(n),e.paths.forEach(e=>{t.drawPath(e,t.effectToPathStyle(n))}),r.restore()}):e.paths.forEach(e=>{t.drawPath(e)})}})}function Kc(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function qc(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var Jc,Yc=et(),Xc=class extends ae{needsUpdate=!0;computedStyle={...Yc};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new _c;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;_pluginsByUpdateOrder=[];_pluginsByRenderOrder=[];_renderer;_rendererCtx;get paragraphs(){return this._paragraphs}set paragraphs(e){this._paragraphs=e,this._cachedCharacters=void 0}get fontSize(){return this.computedStyle.fontSize}get defaultFamily(){return this.fonts?.fallbackFont?.familySet.values().next().value??`sans-serif`}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get characters(){if(this._cachedCharacters)return this._cachedCharacters;let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let n=r[t].characters;for(let t=0;t<n.length;t++)e.push(n[t])}}return this._cachedCharacters=e,e}constructor(e={}){super(),this.set(e)}set(e={}){let{content:t,effects:n,style:r,measureDom:i,fonts:a,fill:o,outline:s,deformation:c}=lt(e);if(e.measurer&&typeof e.measurer!=`string`)this.measurer=e.measurer;else{let t=e.measurer??`font`;this.measurer=t===`font`?new yc:new _c}this.debug=e.debug??!1,this.content=t,this.effects=n,this.style=r,this.measureDom=i,this.fonts=a,this.fill=o,this.outline=s,this.deformation=c,this.use(bc()).use(Uc()).use(Hc()).use(Gc()).use(Bc()).use(Wc()).use(Rc()),(e.plugins??[]).forEach(e=>{this.use(e)}),this._update()}use(e){return this.plugins.set(e.name,e),this._resortPlugins(),this}_resortPlugins(){this._pluginsByUpdateOrder=[...this.plugins.values()].sort((e,t)=>(e.updateOrder??0)-(t.updateOrder??0)),this._pluginsByRenderOrder=[...this.plugins.values()].sort((e,t)=>(e.renderOrder??0)-(t.renderOrder??0))}forEachCharacter(e){let t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let i=r[t].characters;for(let r=0;r<i.length;r++)e(i[r],{paragraphIndex:n,fragmentIndex:t,characterIndex:r})}}return this}async load(){this._update(),await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))])}async _decodeFonts(){let e=this.fonts??ac,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}t.add(e.fallbackFont),await Promise.all(Array.from(t,async e=>{let t=e?.getFont();t&&typeof t.createSFNTAsync==`function`&&!t._sfnt&&(t._sfnt=await t.createSFNTAsync())}))}_update(){this.computedStyle={...Yc,...this.style},this.computedFill=this.fill?{...this.fill}:void 0,this.computedOutline=this.outline?{...this.outline}:void 0,this.computedEffects=this.effects?.map(e=>e)??[];let e=[];return this.content.forEach((t,n)=>{let{fragments:r,fill:i,outline:a,...o}=t,s=new pc(o,n,this);s.fill=i,s.outline=a,r.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&s.fragments.push(new fc(n,a,r,i,t,s))}),e.push(s)}),this.paragraphs=e,this}createDom(){if(this._update(),!this.measurer.createDom)throw Error(`current measurer does not support createDom()`);return this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(e=this.measureDom){let t={paragraphs:this.paragraphs,inlineBox:this.inlineBox,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();let n=this.measurer.measure(this.paragraphs,this.computedStyle,e,this.fonts);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox;let r=this.characters;for(let e=0;e<r.length;e++)r[e].update(this.fonts);let i=this.getGlyphBox();this.rawGlyphBox=i,this.glyphBox=i;let a=this._pluginsByUpdateOrder;for(let e=0;e<a.length;e++)a[e].update?.(this);let o=this._pluginsByRenderOrder;this.pathSets.length=0;for(let e=0;e<o.length;e++){let t=o[e];t.pathSet?.paths.length&&this.pathSets.push(t.pathSet)}this._updateInlineBox()._updatePathBox()._updateBoundingBox();for(let e in t){let r=this[e];this[e]=t[e],n[e]=r}return this.emit(`measure`,{text:this,result:n}),n}getGlyphBox(){let e=U.MAX,t=U.MIN,n=this.characters;for(let r=0;r<n.length;r++){let i=n[r];if(i.getGlyphMinMax(e,t))continue;let{left:a,top:o,width:s,height:c}=i.inlineBox,l=new U(a,o),u=new U(a+s,o+c);e.clampMin(l,u),t.clampMax(l,u)}return e.x===-(2**53-1)||e.y===-(2**53-1)||t.x===2**53-1||t.y===2**53-1?new W(0,0,0,0):new W(e.x,e.y,t.x-e.x,t.y-e.y)}_updateInlineBox(){let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++)e.push(r[t].inlineBox)}return this.inlineBox=W.from(...e),this}_updatePathBox(){let e=[this.glyphBox];for(let t of this.plugins.values()){let n=t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox();n&&e.push(n)}return this.pathBox=W.from(...e),this}_updateBoundingBox(){return this.boundingBox=W.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(e=this.measureDom){return this.needsUpdate=!1,Object.assign(this,this.measure(e)),this.emit(`update`,{text:this}),this}_getRenderer(e){return(!this._renderer||this._rendererCtx!==e)&&(this._renderer=new Zr(this,e),this._rendererCtx=e),this._renderer}render(e){let{view:t,pixelRatio:n=2}=e,r=t.getContext(`2d`);if(!r)return;this.needsUpdate&&this.update();let i=this._getRenderer(r);i.pixelRatio=n,i.setup();let a=this._pluginsByRenderOrder;for(let e=0;e<a.length;e++){let t=a[e];if(t.render)t.render(i);else if(t.pathSet){let e=t.pathSet.paths;for(let t=0;t<e.length;t++)i.drawPath(e[t])}}this.emit(`render`,{text:this,view:t,pixelRatio:n}),e.onContext?.(r)}dispose(){this.measurer.dispose?.(),this._renderer=void 0,this._rendererCtx=void 0}toString(){return this.content.flatMap(e=>e.fragments.map(e=>e.content)).join(``)}};qc([ie({internal:!0}),Kc(`design:type`,Boolean)],Xc.prototype,`debug`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`content`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`style`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`effects`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`fill`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`outline`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`deformation`,void 0),qc([ie({internal:!0}),Kc(`design:type`,typeof(Jc=typeof HTMLElement<`u`&&HTMLElement)==`function`?Jc:Object)],Xc.prototype,`measureDom`,void 0),qc([ie({internal:!0}),Kc(`design:type`,Object)],Xc.prototype,`fonts`,void 0);function Zc(e,t){let n=new Xc(e);return t?n.load().then(()=>n.measure()):n.measure()}function Qc(e,t){let n=new Xc(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Zr,e.Character=dc,e.CircleCurve=Dc,e.DomMeasurer=_c,e.EllipseCurve=Oc,e.FontMeasurer=yc,e.Fragment=fc,e.HeartCurve=kc,e.Paragraph=pc,e.PolygonCurve=Ac,e.RectangularCurve=jc,e.Text=Xc,e.backgroundPlugin=bc,e.createSvgLoader=Ur,e.createSvgParser=Wr,e.defineDeformation=Fc,e.definePlugin=mc,e.deformationPlugin=Rc,e.getDeformationNames=Lc,e.getEffectTransform2D=Gr,e.getHighlightStyle=zc,e.highlightPlugin=Bc,e.isEqualObject=Yr,e.isEqualValue=Xr,e.listStylePlugin=Hc,e.measureText=Zc,e.outlinePlugin=Uc,e.parseColormap=Jr,e.parseTransformOrigin=Kr,e.parseValueNumber=qr,e.removeDeformation=Ic,e.renderPlugin=Wc,e.renderText=Qc,e.textDecorationPlugin=Gc,e.textDefaultStyle=Yc});
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Text } from './shared/modern-text.
|
|
2
|
-
export { C as Canvas2DRenderer, a as Character, D as DomMeasurer, F as FontMeasurer, b as Fragment, P as Paragraph, c as backgroundPlugin, d as createSvgLoader, e as createSvgParser, g as getEffectTransform2D, f as getHighlightStyle, h as highlightPlugin, i as isEqualObject, j as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColormap, k as parseTransformOrigin, m as parseValueNumber, r as renderPlugin, t as textDecorationPlugin, n as textDefaultStyle } from './shared/modern-text.
|
|
1
|
+
import { T as Text } from './shared/modern-text.BZDfPcWk.mjs';
|
|
2
|
+
export { C as Canvas2DRenderer, a as Character, D as DomMeasurer, F as FontMeasurer, b as Fragment, P as Paragraph, c as backgroundPlugin, d as createSvgLoader, e as createSvgParser, g as getEffectTransform2D, f as getHighlightStyle, h as highlightPlugin, i as isEqualObject, j as isEqualValue, l as listStylePlugin, o as outlinePlugin, p as parseColormap, k as parseTransformOrigin, m as parseValueNumber, r as renderPlugin, t as textDecorationPlugin, n as textDefaultStyle } from './shared/modern-text.BZDfPcWk.mjs';
|
|
3
3
|
export { d as defineDeformation, a as definePlugin, b as deformationPlugin, g as getDeformationNames, r as removeDeformation } from './shared/modern-text.JF1ny7A-.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';
|
|
@@ -2143,7 +2143,7 @@ class Text extends Reactivable {
|
|
|
2143
2143
|
if (options.measurer && typeof options.measurer !== "string") {
|
|
2144
2144
|
this.measurer = options.measurer;
|
|
2145
2145
|
} else {
|
|
2146
|
-
const kind = options.measurer ??
|
|
2146
|
+
const kind = options.measurer ?? "font";
|
|
2147
2147
|
this.measurer = kind === "font" ? new FontMeasurer() : new DomMeasurer();
|
|
2148
2148
|
}
|
|
2149
2149
|
this.debug = options.debug ?? false;
|
|
@@ -2145,7 +2145,7 @@ class Text extends modernIdoc.Reactivable {
|
|
|
2145
2145
|
if (options.measurer && typeof options.measurer !== "string") {
|
|
2146
2146
|
this.measurer = options.measurer;
|
|
2147
2147
|
} else {
|
|
2148
|
-
const kind = options.measurer ??
|
|
2148
|
+
const kind = options.measurer ?? "font";
|
|
2149
2149
|
this.measurer = kind === "font" ? new FontMeasurer() : new DomMeasurer();
|
|
2150
2150
|
}
|
|
2151
2151
|
this.debug = options.debug ?? false;
|
|
@@ -194,7 +194,7 @@ interface Options extends TextObject {
|
|
|
194
194
|
plugins?: Plugin[];
|
|
195
195
|
/**
|
|
196
196
|
* Layout backend: `'font'` (pure-JS) or `'dom'` (browser), or a custom
|
|
197
|
-
* `TextMeasurer`. Defaults to `'font'
|
|
197
|
+
* `TextMeasurer`. Defaults to `'font'`.
|
|
198
198
|
*/
|
|
199
199
|
measurer?: MeasurerKind | TextMeasurer;
|
|
200
200
|
}
|
|
@@ -194,7 +194,7 @@ interface Options extends TextObject {
|
|
|
194
194
|
plugins?: Plugin[];
|
|
195
195
|
/**
|
|
196
196
|
* Layout backend: `'font'` (pure-JS) or `'dom'` (browser), or a custom
|
|
197
|
-
* `TextMeasurer`. Defaults to `'font'
|
|
197
|
+
* `TextMeasurer`. Defaults to `'font'`.
|
|
198
198
|
*/
|
|
199
199
|
measurer?: MeasurerKind | TextMeasurer;
|
|
200
200
|
}
|
|
@@ -194,7 +194,7 @@ interface Options extends TextObject {
|
|
|
194
194
|
plugins?: Plugin[];
|
|
195
195
|
/**
|
|
196
196
|
* Layout backend: `'font'` (pure-JS) or `'dom'` (browser), or a custom
|
|
197
|
-
* `TextMeasurer`. Defaults to `'font'
|
|
197
|
+
* `TextMeasurer`. Defaults to `'font'`.
|
|
198
198
|
*/
|
|
199
199
|
measurer?: MeasurerKind | TextMeasurer;
|
|
200
200
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
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.BZmgmU_p.cjs');
|
|
6
6
|
require('modern-font');
|
|
7
7
|
require('modern-path2d');
|
|
8
8
|
require('../shared/modern-text.B2xfrqDc.cjs');
|
|
@@ -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.BZDfPcWk.mjs';
|
|
4
4
|
import 'modern-font';
|
|
5
5
|
import 'modern-path2d';
|
|
6
6
|
import '../shared/modern-text.JF1ny7A-.mjs';
|