@weasel-js/text 1.14.2 → 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.
@@ -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.
@@ -967,6 +975,18 @@ declare function cachedLayoutRuns(runs: readonly ResolvedRun[], opts: LayoutRuns
967
975
  * Passing `runs` again afterwards is only a cache miss.
968
976
  */
969
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;
970
990
  /** Test helper. Do not call from product code. */
971
991
  declare function _resetLayoutCacheForTests(): void;
972
992
 
@@ -982,13 +1002,20 @@ declare function _resetLayoutCacheForTests(): void;
982
1002
  * none. Pass `null`, or call the function returned, to take it out again.
983
1003
  */
984
1004
  declare function registerBidi(engine: BidiResolver | null): () => void;
1005
+ /** The engine {@link registerBidi} was last given, or null. */
1006
+ declare function registeredBidi(): BidiResolver | null;
985
1007
  /**
986
1008
  * The direction `text`'s first paragraph reads in: `direction` when it states
987
1009
  * one, otherwise its first strong character's. Finding that takes an engine,
988
1010
  * so with none registered the answer is `'ltr'`.
989
1011
  */
990
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;
991
1018
  /** Test helper. Do not call from product code. */
992
1019
  declare function _resetBidiWarningForTests(): void;
993
1020
 
994
- export { scriptMetrics as $, dropRuns as A, type BidiAnalysis as B, type CacheUse as C, DEFAULT_TEXT_FILL as D, fontString as E, type FontVariantCaps as F, halfLeadingFor as G, isBoldWeight as H, isSmallCapsLetter as I, layoutRuns as J, markdownToRuns as K, type LaidOutRuns as L, MARKDOWN_RUN_GRAMMAR as M, numericWeight as N, paragraphDirection as O, type PlacedGlyph as P, registerBidi as Q, type ResolvedTextStyle as R, type StyledRun as S, type TextStyle as T, resolveAlign as U, resolveRunFace as V, resolveRuns as W, resolveTextStyle as X, resolveTextStyleInto as Y, runsToMarkdown as Z, runsToPlainText as _, type ResolvedRun as a, scriptMetricsFor as a0, smallCapsScale as a1, smallCapsScaleFor as a2, smallCapsText as a3, toRuns as a4, transformRunTexts as a5, _resetBidiWarningForTests as a6, _resetLayoutCacheForTests as a7, 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 };
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 };
@@ -1,3 +1,3 @@
1
- export { a6 as _resetBidiWarningForTests, a7 as _resetLayoutCacheForTests } from './test-seams-D6uEFbAw.js';
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';
@@ -1,3 +1,3 @@
1
- export { _resetBidiWarningForTests, _resetLayoutCacheForTests } from './chunk-5BJN6MC6.js';
1
+ export { _resetBidiWarningForTests, _resetLayoutCacheForTests } from './chunk-ZNSU5C43.js';
2
2
  //# sourceMappingURL=test-seams.js.map
3
3
  //# sourceMappingURL=test-seams.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/text",
3
- "version": "1.14.2",
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.14.2",
24
- "@weasel-js/paint": "1.14.2",
25
- "@weasel-js/registry": "1.14.2"
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.14.2"
54
+ "@weasel-js/bidi": "1.15.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@weasel-js/font": "1.14.2"
57
+ "@weasel-js/font": "1.15.0"
58
58
  }
59
59
  }