@weasel-js/text 1.14.1 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FODNMBHI.js → chunk-ZNSU5C43.js} +536 -400
- package/dist/chunk-ZNSU5C43.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +58 -29
- package/dist/index.js.map +1 -1
- package/dist/{test-seams-DHGfE_6p.d.ts → test-seams-Ck0mfD3U.d.ts} +34 -1
- package/dist/test-seams.d.ts +1 -1
- package/dist/test-seams.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-FODNMBHI.js.map +0 -1
|
@@ -389,6 +389,12 @@ interface TextPaint {
|
|
|
389
389
|
* mean-of-the-axes factor `resolveStrokeWidth` takes.
|
|
390
390
|
*/
|
|
391
391
|
declare function resolveTextStyle(style?: TextStyle, paint?: TextPaint, scale?: number): ResolvedTextStyle;
|
|
392
|
+
/**
|
|
393
|
+
* {@link resolveTextStyle}, written into `out` and returned. A field `out`
|
|
394
|
+
* holds that this resolution leaves out — `script`, `lang`, `stroke` — is set
|
|
395
|
+
* to `undefined`, so one object can take resolution after resolution.
|
|
396
|
+
*/
|
|
397
|
+
declare function resolveTextStyleInto(out: ResolvedTextStyle, style?: TextStyle, paint?: TextPaint, scale?: number): ResolvedTextStyle;
|
|
392
398
|
/** Build a CSS `font` shorthand suitable for `ctx.font`. */
|
|
393
399
|
declare function fontString(s: ResolvedTextStyle): string;
|
|
394
400
|
|
|
@@ -513,6 +519,14 @@ declare function resolveRunFace(run: StyledRun, style: Pick<ResolvedTextStyle, '
|
|
|
513
519
|
* `{ px }` size or spacing; the inherited ones arrived already resolved on
|
|
514
520
|
* `style`. */
|
|
515
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[];
|
|
516
530
|
|
|
517
531
|
/**
|
|
518
532
|
* The bidi contract, declared here and implemented elsewhere.
|
|
@@ -961,6 +975,18 @@ declare function cachedLayoutRuns(runs: readonly ResolvedRun[], opts: LayoutRuns
|
|
|
961
975
|
* Passing `runs` again afterwards is only a cache miss.
|
|
962
976
|
*/
|
|
963
977
|
declare function dropRuns(runs: readonly ResolvedRun[]): void;
|
|
978
|
+
/**
|
|
979
|
+
* Forget what the caches hold for `runs`, which its caller is about to refill
|
|
980
|
+
* in place, leaving the array filed: unlike {@link dropRuns}, the next call
|
|
981
|
+
* with it costs no `WeakMap` set. A readout rewriting its text every frame
|
|
982
|
+
* refills one runs array this way, so the command it hands the renderer
|
|
983
|
+
* stays the same object.
|
|
984
|
+
*
|
|
985
|
+
* Call it before the first write to `runs` or any run in it: the structural
|
|
986
|
+
* list compares later runs with these, and a painting may still have to build
|
|
987
|
+
* its key from them.
|
|
988
|
+
*/
|
|
989
|
+
declare function clearRuns(runs: readonly ResolvedRun[]): void;
|
|
964
990
|
/** Test helper. Do not call from product code. */
|
|
965
991
|
declare function _resetLayoutCacheForTests(): void;
|
|
966
992
|
|
|
@@ -976,13 +1002,20 @@ declare function _resetLayoutCacheForTests(): void;
|
|
|
976
1002
|
* none. Pass `null`, or call the function returned, to take it out again.
|
|
977
1003
|
*/
|
|
978
1004
|
declare function registerBidi(engine: BidiResolver | null): () => void;
|
|
1005
|
+
/** The engine {@link registerBidi} was last given, or null. */
|
|
1006
|
+
declare function registeredBidi(): BidiResolver | null;
|
|
979
1007
|
/**
|
|
980
1008
|
* The direction `text`'s first paragraph reads in: `direction` when it states
|
|
981
1009
|
* one, otherwise its first strong character's. Finding that takes an engine,
|
|
982
1010
|
* so with none registered the answer is `'ltr'`.
|
|
983
1011
|
*/
|
|
984
1012
|
declare function paragraphDirection(text: string, direction?: TextDirection | 'auto', engine?: BidiResolver | null): TextDirection;
|
|
1013
|
+
/**
|
|
1014
|
+
* Warn, once per process, when `codePoints` hold right-to-left letters and
|
|
1015
|
+
* there is no engine to reorder them. `who` names the caller laying them out.
|
|
1016
|
+
*/
|
|
1017
|
+
declare function warnRtlWithoutEngine(codePoints: ArrayLike<number>, who?: string): void;
|
|
985
1018
|
/** Test helper. Do not call from product code. */
|
|
986
1019
|
declare function _resetBidiWarningForTests(): void;
|
|
987
1020
|
|
|
988
|
-
export {
|
|
1021
|
+
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-Ck0mfD3U.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.0",
|
|
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.0",
|
|
24
|
+
"@weasel-js/paint": "1.15.0",
|
|
25
|
+
"@weasel-js/registry": "1.15.0"
|
|
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.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@weasel-js/font": "1.
|
|
57
|
+
"@weasel-js/font": "1.15.0"
|
|
58
58
|
}
|
|
59
59
|
}
|