@weasel-js/text 1.14.2 → 1.15.1
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/{chunk-5BJN6MC6.js → chunk-WUFANHTE.js} +111 -43
- package/dist/chunk-WUFANHTE.js.map +1 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.js +48 -18
- package/dist/index.js.map +1 -1
- package/dist/{test-seams-D6uEFbAw.d.ts → test-seams-B2R_EedN.d.ts} +31 -2
- package/dist/test-seams.d.ts +1 -1
- package/dist/test-seams.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-5BJN6MC6.js.map +0 -1
|
@@ -519,6 +519,14 @@ declare function resolveRunFace(run: StyledRun, style: Pick<ResolvedTextStyle, '
|
|
|
519
519
|
* `{ px }` size or spacing; the inherited ones arrived already resolved on
|
|
520
520
|
* `style`. */
|
|
521
521
|
declare function resolveRuns(runs: readonly StyledRun[], style: ResolvedTextStyle, viewScale?: number): ResolvedRun[];
|
|
522
|
+
/**
|
|
523
|
+
* {@link resolveRuns} into `out`, which is refilled in place and returned: a
|
|
524
|
+
* run already at an index is rewritten when it has the same optional fields as
|
|
525
|
+
* its replacement. For a caller that owns `out` and hands nothing it held
|
|
526
|
+
* to anyone who keeps it; one whose runs the text caches have seen calls
|
|
527
|
+
* `clearRuns` on them first.
|
|
528
|
+
*/
|
|
529
|
+
declare function resolveRunsInto(out: ResolvedRun[], runs: readonly StyledRun[], style: ResolvedTextStyle, viewScale?: number): ResolvedRun[];
|
|
522
530
|
|
|
523
531
|
/**
|
|
524
532
|
* The bidi contract, declared here and implemented elsewhere.
|
|
@@ -613,11 +621,13 @@ interface ShapedCluster {
|
|
|
613
621
|
d: string | null;
|
|
614
622
|
/** Names `d` among the glyphs of one face, for caching what is built from it. */
|
|
615
623
|
key: string;
|
|
616
|
-
/** Each glyph
|
|
624
|
+
/** Each glyph, where it is drawn, and how far the shaper moved the pen past it, in ems
|
|
625
|
+
* from the pen, y down. A mark the shaper set over its base has no advance. */
|
|
617
626
|
glyphs: readonly {
|
|
618
627
|
gid: number;
|
|
619
628
|
x: number;
|
|
620
629
|
y: number;
|
|
630
|
+
advance: number;
|
|
621
631
|
}[];
|
|
622
632
|
/** Whether it was shaped right to left. */
|
|
623
633
|
rtl: boolean;
|
|
@@ -967,6 +977,18 @@ declare function cachedLayoutRuns(runs: readonly ResolvedRun[], opts: LayoutRuns
|
|
|
967
977
|
* Passing `runs` again afterwards is only a cache miss.
|
|
968
978
|
*/
|
|
969
979
|
declare function dropRuns(runs: readonly ResolvedRun[]): void;
|
|
980
|
+
/**
|
|
981
|
+
* Forget what the caches hold for `runs`, which its caller is about to refill
|
|
982
|
+
* in place, leaving the array filed: unlike {@link dropRuns}, the next call
|
|
983
|
+
* with it costs no `WeakMap` set. A readout rewriting its text every frame
|
|
984
|
+
* refills one runs array this way, so the command it hands the renderer
|
|
985
|
+
* stays the same object.
|
|
986
|
+
*
|
|
987
|
+
* Call it before the first write to `runs` or any run in it: the structural
|
|
988
|
+
* list compares later runs with these, and a painting may still have to build
|
|
989
|
+
* its key from them.
|
|
990
|
+
*/
|
|
991
|
+
declare function clearRuns(runs: readonly ResolvedRun[]): void;
|
|
970
992
|
/** Test helper. Do not call from product code. */
|
|
971
993
|
declare function _resetLayoutCacheForTests(): void;
|
|
972
994
|
|
|
@@ -982,13 +1004,20 @@ declare function _resetLayoutCacheForTests(): void;
|
|
|
982
1004
|
* none. Pass `null`, or call the function returned, to take it out again.
|
|
983
1005
|
*/
|
|
984
1006
|
declare function registerBidi(engine: BidiResolver | null): () => void;
|
|
1007
|
+
/** The engine {@link registerBidi} was last given, or null. */
|
|
1008
|
+
declare function registeredBidi(): BidiResolver | null;
|
|
985
1009
|
/**
|
|
986
1010
|
* The direction `text`'s first paragraph reads in: `direction` when it states
|
|
987
1011
|
* one, otherwise its first strong character's. Finding that takes an engine,
|
|
988
1012
|
* so with none registered the answer is `'ltr'`.
|
|
989
1013
|
*/
|
|
990
1014
|
declare function paragraphDirection(text: string, direction?: TextDirection | 'auto', engine?: BidiResolver | null): TextDirection;
|
|
1015
|
+
/**
|
|
1016
|
+
* Warn, once per process, when `codePoints` hold right-to-left letters and
|
|
1017
|
+
* there is no engine to reorder them. `who` names the caller laying them out.
|
|
1018
|
+
*/
|
|
1019
|
+
declare function warnRtlWithoutEngine(codePoints: ArrayLike<number>, who?: string): void;
|
|
991
1020
|
/** Test helper. Do not call from product code. */
|
|
992
1021
|
declare function _resetBidiWarningForTests(): void;
|
|
993
1022
|
|
|
994
|
-
export {
|
|
1023
|
+
export { resolveTextStyleInto as $, clearRuns as A, type BidiAnalysis as B, type CacheUse as C, DEFAULT_TEXT_FILL as D, dropRuns as E, type FontVariantCaps as F, fontString as G, halfLeadingFor as H, isBoldWeight as I, isSmallCapsLetter as J, layoutRuns as K, type LaidOutRuns as L, MARKDOWN_RUN_GRAMMAR as M, markdownToRuns as N, numericWeight as O, type PlacedGlyph as P, paragraphDirection as Q, type ResolvedTextStyle as R, type StyledRun as S, type TextStyle as T, registerBidi as U, registeredBidi as V, resolveAlign as W, resolveRunFace as X, resolveRuns as Y, resolveRunsInto as Z, resolveTextStyle as _, type ResolvedRun as a, runsToMarkdown as a0, runsToPlainText as a1, scriptMetrics as a2, scriptMetricsFor as a3, smallCapsScale as a4, smallCapsScaleFor as a5, smallCapsText as a6, toRuns as a7, transformRunTexts as a8, warnRtlWithoutEngine as a9, _resetBidiWarningForTests as aa, _resetLayoutCacheForTests as ab, type LayoutRunsOpts as b, type TextShaper as c, type TextPaint as d, type BidiReordering as e, type BidiResolver as f, DEFAULT_TEXT_STYLE as g, LAYOUT_CACHE_STRUCTURAL_LIMIT as h, LAYOUT_CACHE_VARIANT_LIMIT as i, type LaidOutCell as j, type LaidOutLineBox as k, type RunFlag as l, type RunGrammar as m, type RunMarker as n, type RunSourceMap as o, SCRIPT_METRICS as p, SMALL_CAPS_SCALE as q, type ScriptPreset as r, type ShapedCluster as s, type ShapedGlyph as t, type SmallCapsText as u, type TextAlign as v, type TextDirection as w, type TextTransform as x, type TransformedRunText as y, cachedLayoutRuns as z };
|
package/dist/test-seams.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { aa as _resetBidiWarningForTests, ab as _resetLayoutCacheForTests } from './test-seams-B2R_EedN.js';
|
|
2
2
|
import '@weasel-js/paint';
|
|
3
3
|
import '@weasel-js/font';
|
package/dist/test-seams.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/text",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "Typography for weasel: styled runs, style resolution, kerned glyph layout, wrap and measurement. No scene graph, no React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@weasel-js/geom": "1.
|
|
24
|
-
"@weasel-js/paint": "1.
|
|
25
|
-
"@weasel-js/registry": "1.
|
|
23
|
+
"@weasel-js/geom": "1.15.1",
|
|
24
|
+
"@weasel-js/paint": "1.15.1",
|
|
25
|
+
"@weasel-js/registry": "1.15.1"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"test": "vitest run",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"provenance": true
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@weasel-js/bidi": "1.
|
|
54
|
+
"@weasel-js/bidi": "1.15.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@weasel-js/font": "1.
|
|
57
|
+
"@weasel-js/font": "1.15.1"
|
|
58
58
|
}
|
|
59
59
|
}
|