monowind 0.2.8 → 0.2.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AA2KA,QAAA,MAAM,eAAe,EAEhB,OAAO,WAAW,CAAC;AAExB,qBAAa,eAAgB,SAAQ,eAAe;;IAClD,MAAM,CAAC,kBAAkB,WAAuB;IAyHhD,cAsBC;IAED,iBAAiB,IAAI,IAAI,CAmGxB;IAED,oBAAoB,IAAI,IAAI,CAyC3B;IAmgCD,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CA+B1F;IAED;;;;0DAIsD;IACtD,WAAW,IAAI,MAAM,CAIpB;CA+PF;AAED;+DAC+D;AAC/D,wBAAgB,cAAc,IAAI,IAAI,CAIrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF;AA+CD;;;;;;;;;yDASyD;AACzD,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR"}
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AA6LA,QAAA,MAAM,eAAe,EAEhB,OAAO,WAAW,CAAC;AAExB,qBAAa,eAAgB,SAAQ,eAAe;;IAClD,MAAM,CAAC,kBAAkB,WAAuB;IA6HhD,cAsBC;IAkBD,iBAAiB,IAAI,IAAI,CAmGxB;IAED,oBAAoB,IAAI,IAAI,CAyC3B;IA+iCD,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CA+B1F;IAED;;;;0DAIsD;IACtD,WAAW,IAAI,MAAM,CAIpB;CAyQF;AAED;+DAC+D;AAC/D,wBAAgB,cAAc,IAAI,IAAI,CAIrC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,eAAe,CAAC;KAC9B;CACF;AAyDD;;;;;;;;;yDASyD;AACzD,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR"}
@@ -3,14 +3,32 @@ import type { CellPaint } from "./plain-text.ts";
3
3
  * Which clusters the grid's font draws off their cell count, and how
4
4
  * to fit them (specs/wide-characters.md "The grid stays on its cells
5
5
  * in any font"): each distinct non-ASCII cluster is measured once per
6
- * font family, size, weight, and style with canvas `measureText`.
7
- * A mismatch is painted in a box of exactly its cells, the glyph
8
- * scaled to fill the box, capped so its ink stays inside the row and
9
- * the box. Without a canvas (headless tests) nothing is boxed.
6
+ * font (family, size, weight, style) with canvas `measureText`, and a
7
+ * mismatch is painted in a box of exactly its cells, the glyph scaled
8
+ * to fill it within the row. Block Elements and Box Drawing fit their
9
+ * row instead, one transform per range from its reference glyph, and
10
+ * a shade's lattice is locked to whole device pixels and carried
11
+ * across rows (`shift`). Without a canvas (headless tests) nothing is
12
+ * boxed.
10
13
  */
14
+ export interface GlyphBox {
15
+ /** The box's `font-size` as a factor of the grid's. */
16
+ scale: number;
17
+ /** The box's own `line-height` in px, which places a tiling glyph's
18
+ * top a pixel and a half above the row (set for tiling ranges only). */
19
+ lineHeight?: number;
20
+ /** The vertical period of a shade's lattice at that scale, in px
21
+ * (set for shades only). */
22
+ period?: number;
23
+ }
24
+ /** Where the baseline of `glyph` lands, in px from the top of a box a
25
+ * row tall with that `font-size` factor and `line-height`. */
26
+ export type BaselineOf = (glyph: string, scale: number, lineHeight: number) => number;
11
27
  export declare class GlyphBoxes {
12
28
  #private;
13
- /** The grid's font and cell; a change forgets every measurement. */
29
+ constructor(baselineOf?: BaselineOf);
30
+ /** The grid's font and cell; a change (the device pixel ratio's too —
31
+ * a zoom moves the shades' lattice) forgets every measurement. */
14
32
  configure(font: {
15
33
  style: string;
16
34
  weight: string;
@@ -26,10 +44,13 @@ export declare class GlyphBoxes {
26
44
  * otherwise stay cached under the same font name). */
27
45
  invalidate(): void;
28
46
  /** The box for a cluster painted with `paint`, or null when the font
29
- * draws it at `cells` cells within 0.01 cell. Nothing is cached while
30
- * fonts are still loading. */
31
- box(cluster: string, cells: number, paint?: CellPaint): {
32
- scale: number;
33
- } | null;
47
+ * draws it at `cells` cells within 0.01 cell (a block: at its width
48
+ * and at least the row's height). Nothing is cached while fonts are
49
+ * still loading. */
50
+ box(cluster: string, cells: number, paint?: CellPaint): GlyphBox | null;
51
+ /** How far down a shade's lattice sits in `row` so that it carries
52
+ * on from the row above: what remains of the period after the rows
53
+ * above it. */
54
+ shift(box: GlyphBox, row: number): number;
34
55
  }
35
56
  //# sourceMappingURL=glyph-box.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glyph-box.d.ts","sourceRoot":"","sources":["../src/glyph-box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;GAQG;AACH,qBAAa,UAAU;;IAMrB,oEAAoE;IACpE,SAAS,CACP,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EACrE,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAC7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,GAAG,IAAI,CActE;IA4BD;;mBAEe;IACf,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKxC;CA8HF"}
package/dist/glyphs.d.ts CHANGED
@@ -32,6 +32,13 @@ export interface GlyphTable {
32
32
  /** Scrollbar gutter ink (specs/scrolling.md); defaults `░` / `█`. */
33
33
  scrollTrack?: string;
34
34
  scrollThumb?: string;
35
+ /** QR modules (specs/qr-code.md): a full cell, its upper half, its
36
+ * lower half — `█ ▀ ▄` by default. A set naming `qrFull` without
37
+ * both halves has no half blocks: its modules are full cells, two
38
+ * per module at the usual cell. */
39
+ qrFull?: string;
40
+ qrUpper?: string;
41
+ qrLower?: string;
35
42
  }
36
43
  export type BorderGlyphSet = Partial<Record<BorderStyle, GlyphTable>>;
37
44
  /** Register (or last-wins replace, with a warning) a glyph set.
@@ -1 +1 @@
1
- {"version":3,"file":"glyphs.d.ts","sourceRoot":"","sources":["../src/glyphs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AAEH;;2BAE2B;AAC3B,MAAM,WAAW,UAAU;IACzB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,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./element.ts";
2
- export { registerBorderGlyphs } from "./glyphs.ts";
2
+ export { glyphSetFor, registerBorderGlyphs } from "./glyphs.ts";
3
3
  export type { BorderGlyphSet, GlyphTable } from "./glyphs.ts";
4
4
  export { invalidateLeaves, registerLeafRenderer } from "./leaf.ts";
5
5
  export type { LeafContent, LeafPaint, LeafRegistration, LeafRun } from "./leaf.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB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