monowind 0.2.7 → 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.
- package/README.md +19 -4
- package/dist/cdn.js +87 -86
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/glyph-box.d.ts +56 -0
- package/dist/glyph-box.d.ts.map +1 -0
- package/dist/glyphs.d.ts +7 -0
- package/dist/glyphs.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1845 -1360
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/metrics.d.ts.map +1 -1
- package/dist/multicol.d.ts.map +1 -1
- package/dist/paint.d.ts +17 -2
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +31 -3
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/pointer.d.ts +12 -0
- package/dist/pointer.d.ts.map +1 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/selection.d.ts +36 -10
- package/dist/selection.d.ts.map +1 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/tree.d.ts.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/width.d.ts +22 -0
- package/dist/width.d.ts.map +1 -0
- package/dist/wrap.d.ts +1 -1
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/styles.css +27 -40
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CellPaint } from "./plain-text.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Which clusters the grid's font draws off their cell count, and how
|
|
4
|
+
* to fit them (specs/wide-characters.md "The grid stays on its cells
|
|
5
|
+
* in any font"): each distinct non-ASCII cluster is measured once per
|
|
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.
|
|
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;
|
|
27
|
+
export declare class GlyphBoxes {
|
|
28
|
+
#private;
|
|
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. */
|
|
32
|
+
configure(font: {
|
|
33
|
+
style: string;
|
|
34
|
+
weight: string;
|
|
35
|
+
size: string;
|
|
36
|
+
family: string;
|
|
37
|
+
}, cell: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
letterSpacing: number;
|
|
41
|
+
}): void;
|
|
42
|
+
/** Forget every measurement: a font finished loading, so the same
|
|
43
|
+
* cluster may draw differently now (the fallback's measurements would
|
|
44
|
+
* otherwise stay cached under the same font name). */
|
|
45
|
+
invalidate(): void;
|
|
46
|
+
/** The box for a cluster painted with `paint`, or null when the font
|
|
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;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=glyph-box.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ;IACvB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd;4EACwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;gCAC4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAaD;8DAC8D;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtF,qBAAa,UAAU;;IASrB,YAAY,UAAU,CAAC,EAAE,UAAU,EAElC;IAED;sEACkE;IAClE,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,GAC7D,IAAI,CAiBN;IAED;;0DAEsD;IACtD,UAAU,IAAI,IAAI,CAGjB;IAED;;;wBAGoB;IACpB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,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.
|
package/dist/glyphs.d.ts.map
CHANGED
|
@@ -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,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"glyphs.d.ts","sourceRoot":"","sources":["../src/glyphs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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AM,GAAG,MAAM,UAAU,GAAG,IAAI,CA+BlE;AAKD,eAAO,MAAM,eAAe,UAiB3B,CAAC;AACF,eAAO,MAAM,gBAAgB,UAiB5B,CAAC;AAsDF;qCACqC;AACrC,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAK9F"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { MonoWindElement, defineMonoWind } from "./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";
|
|
6
6
|
export { renderPlainText } from "./plain-text.ts";
|
|
7
7
|
export { wrapLines } from "./wrap.ts";
|
|
8
|
+
export { clusterAdvances, clusterWidth, graphemes, textCells } from "./width.ts";
|
|
8
9
|
export { multicolLines } from "./multicol.ts";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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,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"}
|