restty 0.1.24 → 0.1.26

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.
Files changed (163) hide show
  1. package/README.md +70 -1
  2. package/dist/{chunk-68qdtczc.js → chunk-y290zh3e.js} +11469 -7848
  3. package/dist/fonts/index.d.ts +4 -1
  4. package/dist/fonts/manager/classification.d.ts +13 -0
  5. package/dist/fonts/manager/entries.d.ts +13 -0
  6. package/dist/fonts/manager/picker.d.ts +6 -0
  7. package/dist/fonts/manager/sources.d.ts +16 -0
  8. package/dist/fonts/types.d.ts +20 -10
  9. package/dist/grid/grid.d.ts +5 -3
  10. package/dist/ime/ime.d.ts +13 -0
  11. package/dist/index.d.ts +3 -3
  12. package/dist/input/keymap/before-input.d.ts +4 -0
  13. package/dist/input/keymap/constants.d.ts +13 -0
  14. package/dist/input/keymap/control.d.ts +2 -0
  15. package/dist/input/keymap/default-mapping.d.ts +1 -0
  16. package/dist/input/keymap/kitty.d.ts +1 -0
  17. package/dist/input/keymap/normalization.d.ts +4 -0
  18. package/dist/input/keymap/pty-map.d.ts +4 -0
  19. package/dist/input/keymap.d.ts +2 -11
  20. package/dist/input/output/csi.d.ts +33 -0
  21. package/dist/input/{output.d.ts → output/index.d.ts} +3 -9
  22. package/dist/input/output/osc.d.ts +15 -0
  23. package/dist/input/output/prompt.d.ts +11 -0
  24. package/dist/internal.d.ts +4 -4
  25. package/dist/internal.js +13 -150
  26. package/dist/renderer/index.d.ts +7 -2
  27. package/dist/renderer/shaders/glyph-gl.d.ts +4 -0
  28. package/dist/renderer/{shaders.d.ts → shaders/glyph-wgsl.d.ts} +0 -10
  29. package/dist/renderer/shaders/rect.d.ts +6 -0
  30. package/dist/renderer/shapes/block-elements.d.ts +3 -0
  31. package/dist/renderer/shapes/box-drawing/dashed-lines.d.ts +3 -0
  32. package/dist/renderer/shapes/box-drawing/diagonal.d.ts +2 -0
  33. package/dist/renderer/shapes/box-drawing/draw-box-drawing.d.ts +6 -0
  34. package/dist/renderer/shapes/box-drawing/fallback.d.ts +2 -0
  35. package/dist/renderer/shapes/box-drawing/mapped.d.ts +2 -0
  36. package/dist/renderer/shapes/box-drawing/rounded-corner.d.ts +2 -0
  37. package/dist/renderer/shapes/braille.d.ts +3 -0
  38. package/dist/renderer/shapes/classify.d.ts +18 -0
  39. package/dist/renderer/shapes/geometry.d.ts +9 -0
  40. package/dist/renderer/shapes/glyph-box.d.ts +7 -0
  41. package/dist/renderer/shapes/powerline.d.ts +3 -0
  42. package/dist/renderer/shapes/types.d.ts +38 -0
  43. package/dist/renderer/shapes.d.ts +8 -81
  44. package/dist/renderer/webgpu/buffers.d.ts +7 -0
  45. package/dist/renderer/webgpu/setup.d.ts +10 -0
  46. package/dist/renderer/webgpu/state.d.ts +15 -0
  47. package/dist/renderer/webgpu/webgl.d.ts +3 -0
  48. package/dist/restty.js +1 -1
  49. package/dist/{app → runtime}/atlas-builder.d.ts +53 -18
  50. package/dist/runtime/codepoint-utils.d.ts +12 -0
  51. package/dist/runtime/create-app-io-utils.d.ts +9 -0
  52. package/dist/runtime/create-app-symbols.d.ts +11 -0
  53. package/dist/runtime/create-app-types.d.ts +72 -0
  54. package/dist/runtime/create-runtime/atlas-debug-utils.d.ts +5 -0
  55. package/dist/runtime/create-runtime/blend-utils.d.ts +11 -0
  56. package/dist/runtime/create-runtime/color-glyph-atlas.d.ts +11 -0
  57. package/dist/runtime/create-runtime/debug-tools/create-dump-glyph-render.d.ts +2 -0
  58. package/dist/runtime/create-runtime/debug-tools/diagnose-codepoint.d.ts +2 -0
  59. package/dist/runtime/create-runtime/debug-tools/dump-atlas-for-codepoint.d.ts +2 -0
  60. package/dist/runtime/create-runtime/debug-tools/read-texture-to-image-data.d.ts +1 -0
  61. package/dist/runtime/create-runtime/debug-tools/setup-debug-expose.d.ts +2 -0
  62. package/dist/runtime/create-runtime/debug-tools/types.d.ts +63 -0
  63. package/dist/runtime/create-runtime/debug-tools.d.ts +6 -0
  64. package/dist/runtime/create-runtime/font-runtime-grid-helpers.d.ts +39 -0
  65. package/dist/runtime/create-runtime/font-runtime-helpers.d.ts +20 -0
  66. package/dist/runtime/create-runtime/font-runtime-helpers.types.d.ts +108 -0
  67. package/dist/runtime/create-runtime/font-runtime-text-helpers.d.ts +21 -0
  68. package/dist/runtime/create-runtime/font-runtime-webgpu-atlas.d.ts +26 -0
  69. package/dist/runtime/create-runtime/format-utils.d.ts +2 -0
  70. package/dist/runtime/create-runtime/input-hooks.d.ts +12 -0
  71. package/dist/runtime/create-runtime/interaction-runtime/bind-ime-events.d.ts +12 -0
  72. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-aux-handlers.d.ts +28 -0
  73. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-events.d.ts +41 -0
  74. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-up-handler.d.ts +28 -0
  75. package/dist/runtime/create-runtime/interaction-runtime/kitty-image-cache.d.ts +18 -0
  76. package/dist/runtime/create-runtime/interaction-runtime/kitty-overlay-runtime.d.ts +15 -0
  77. package/dist/runtime/create-runtime/interaction-runtime/scrollbar-runtime.d.ts +30 -0
  78. package/dist/runtime/create-runtime/interaction-runtime/types.d.ts +110 -0
  79. package/dist/runtime/create-runtime/interaction-runtime.d.ts +3 -0
  80. package/dist/runtime/create-runtime/kitty-overlay-utils.d.ts +26 -0
  81. package/dist/runtime/create-runtime/lifecycle-theme-size-canvas.d.ts +13 -0
  82. package/dist/runtime/create-runtime/lifecycle-theme-size-theme.d.ts +6 -0
  83. package/dist/runtime/create-runtime/lifecycle-theme-size.d.ts +16 -0
  84. package/dist/runtime/create-runtime/lifecycle-theme-size.types.d.ts +85 -0
  85. package/dist/runtime/create-runtime/pty-input-runtime.d.ts +45 -0
  86. package/dist/runtime/create-runtime/render-tick-webgl-context.d.ts +4 -0
  87. package/dist/runtime/create-runtime/render-tick-webgl-glyph-pipeline.d.ts +2 -0
  88. package/dist/runtime/create-runtime/render-tick-webgl-overlays.d.ts +2 -0
  89. package/dist/runtime/create-runtime/render-tick-webgl-scene.d.ts +2 -0
  90. package/dist/runtime/create-runtime/render-tick-webgl.d.ts +3 -0
  91. package/dist/runtime/create-runtime/render-tick-webgl.types.d.ts +162 -0
  92. package/dist/runtime/create-runtime/render-tick-webgpu-cell-pass.d.ts +25 -0
  93. package/dist/runtime/create-runtime/render-tick-webgpu-draw-pass.d.ts +2 -0
  94. package/dist/runtime/create-runtime/render-tick-webgpu-emit-glyphs.d.ts +2 -0
  95. package/dist/runtime/create-runtime/render-tick-webgpu-overlays-atlas.d.ts +2 -0
  96. package/dist/runtime/create-runtime/render-tick-webgpu.d.ts +3 -0
  97. package/dist/runtime/create-runtime/render-tick-webgpu.types.d.ts +386 -0
  98. package/dist/runtime/create-runtime/render-ticks.d.ts +9 -0
  99. package/dist/runtime/create-runtime/runtime-app-api.d.ts +103 -0
  100. package/dist/runtime/create-runtime/runtime-logger.d.ts +17 -0
  101. package/dist/runtime/create-runtime/runtime-reporting.d.ts +40 -0
  102. package/dist/runtime/create-runtime/shader-stage-runtime.d.ts +29 -0
  103. package/dist/runtime/create-runtime.d.ts +7 -0
  104. package/dist/runtime/font-atlas-utils/bitmap-utils.d.ts +5 -0
  105. package/dist/runtime/font-atlas-utils/glyph-atlas-builder.d.ts +29 -0
  106. package/dist/runtime/font-atlas-utils/nerd-metrics-utils.d.ts +25 -0
  107. package/dist/runtime/font-atlas-utils/packing-utils.d.ts +13 -0
  108. package/dist/runtime/overlay-scrollbar.d.ts +24 -0
  109. package/dist/runtime/pty-output-buffer.d.ts +12 -0
  110. package/dist/runtime/render-color-utils.d.ts +6 -0
  111. package/dist/runtime/render-stage-runtime.d.ts +18 -0
  112. package/dist/runtime/render-stage-shaders.d.ts +6 -0
  113. package/dist/runtime/shader-stages.d.ts +9 -0
  114. package/dist/runtime/text-decoration.d.ts +4 -0
  115. package/dist/{app → runtime}/types.d.ts +36 -0
  116. package/dist/selection/clipboard.d.ts +4 -0
  117. package/dist/selection/{selection.d.ts → core.d.ts} +0 -11
  118. package/dist/selection/index.d.ts +3 -1
  119. package/dist/selection/text.d.ts +8 -0
  120. package/dist/surface/app-factory.d.ts +3 -0
  121. package/dist/{app → surface}/pane-app-manager.d.ts +2 -2
  122. package/dist/surface/panes/default-context-menu-items.d.ts +8 -0
  123. package/dist/surface/panes/layout.d.ts +9 -0
  124. package/dist/surface/panes/manager.d.ts +2 -0
  125. package/dist/surface/panes/pane-interactions.d.ts +11 -0
  126. package/dist/surface/panes/window-events.d.ts +10 -0
  127. package/dist/{app → surface}/panes-types.d.ts +1 -1
  128. package/dist/surface/restty/active-pane-api.d.ts +23 -0
  129. package/dist/surface/restty/manager-options.d.ts +24 -0
  130. package/dist/surface/restty/pane-ops.d.ts +42 -0
  131. package/dist/surface/restty/plugin-dispatcher.d.ts +39 -0
  132. package/dist/surface/restty/plugin-ops.d.ts +24 -0
  133. package/dist/surface/restty/shader-ops.d.ts +27 -0
  134. package/dist/surface/restty-pane-handle.d.ts +70 -0
  135. package/dist/surface/restty-plugin-runtime.d.ts +57 -0
  136. package/dist/surface/restty-plugin-types.d.ts +164 -0
  137. package/dist/surface/restty-plugin-utils.d.ts +22 -0
  138. package/dist/surface/restty.d.ts +93 -0
  139. package/dist/utils/base64.d.ts +12 -0
  140. package/dist/wasm/index.d.ts +2 -1
  141. package/dist/wasm/runtime/abi.d.ts +7 -0
  142. package/dist/wasm/runtime/kitty.d.ts +2 -0
  143. package/dist/wasm/runtime/render-state.d.ts +2 -0
  144. package/dist/wasm/runtime/restty-wasm.d.ts +42 -0
  145. package/dist/wasm/{runtime.d.ts → runtime/types.d.ts} +48 -41
  146. package/dist/wasm/runtime/view-cache.d.ts +4 -0
  147. package/dist/xterm/app-options.d.ts +2 -0
  148. package/dist/xterm/dimensions.d.ts +1 -0
  149. package/dist/xterm/listeners.d.ts +5 -0
  150. package/dist/xterm.d.ts +1 -6
  151. package/dist/xterm.js +61 -63
  152. package/package.json +1 -1
  153. package/dist/app/index.d.ts +0 -9
  154. package/dist/app/panes.d.ts +0 -15
  155. package/dist/app/restty.d.ts +0 -340
  156. package/dist/fonts/manager.d.ts +0 -45
  157. package/dist/renderer/webgpu.d.ts +0 -33
  158. package/dist/restty-input.d.ts +0 -1
  159. /package/dist/{app → runtime}/clipboard-paste.d.ts +0 -0
  160. /package/dist/{app → runtime}/font-sources.d.ts +0 -0
  161. /package/dist/{app → runtime}/session.d.ts +0 -0
  162. /package/dist/{app → surface}/panes-context-menu.d.ts +0 -0
  163. /package/dist/{app → surface}/panes-styles.d.ts +0 -0
@@ -0,0 +1,3 @@
1
+ import type { Color, RectData } from "../types";
2
+ export declare function drawDashedHorizontal(count: number, thickness: number, desiredGap: number, x: number, y: number, cellWInt: number, cellHInt: number, color: Color, out: RectData): void;
3
+ export declare function drawDashedVertical(count: number, thickness: number, desiredGap: number, x: number, y: number, cellWInt: number, cellHInt: number, color: Color, out: RectData): void;
@@ -0,0 +1,2 @@
1
+ import type { Color, RectData } from "../types";
2
+ export declare function drawDiagonal(dir: "ul_lr" | "ur_ll", x: number, y: number, cellW: number, cellH: number, light: number, color: Color, out: RectData): void;
@@ -0,0 +1,6 @@
1
+ import type { Color, RectData } from "../types";
2
+ /**
3
+ * Rasterize a Unicode Box Drawing character (U+2500-U+257F) into rect instances.
4
+ * Handles straight segments, dashed lines, rounded corners, and diagonal lines.
5
+ */
6
+ export declare function drawBoxDrawing(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData, boxThicknessPx?: number): boolean;
@@ -0,0 +1,2 @@
1
+ import type { Color, RectData } from "../types";
2
+ export declare function drawFallbackBoxDrawing(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData, light: number, heavy: number): boolean;
@@ -0,0 +1,2 @@
1
+ import { type Color, type RectData } from "../types";
2
+ export declare function drawMappedBoxDrawing(spec: readonly [number, number, number, number], x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData, lightStroke: number, heavyStroke: number): boolean;
@@ -0,0 +1,2 @@
1
+ import type { Color, RectData } from "../types";
2
+ export declare function drawRoundedCorner(cornerCp: 0x256d | 0x256e | 0x256f | 0x2570, x: number, y: number, cellW: number, cellH: number, light: number, color: Color, out: RectData): void;
@@ -0,0 +1,3 @@
1
+ import type { Color, RectData } from "./types";
2
+ /** Rasterize a Unicode Braille Pattern (U+2800-U+28FF) into rect dot instances. */
3
+ export declare function drawBraille(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData): boolean;
@@ -0,0 +1,18 @@
1
+ /** Test whether a codepoint falls in a Unicode Private Use Area. */
2
+ export declare function isPrivateUse(cp: number): boolean;
3
+ /** Test whether a codepoint is a space-like character (NUL, SP, or EN SPACE). */
4
+ export declare function isSpaceCp(cp: number): boolean;
5
+ /** Test whether a codepoint is in the Box Drawing block (U+2500-U+257F). */
6
+ export declare function isBoxDrawing(cp: number): boolean;
7
+ /** Test whether a codepoint is in the Block Elements block (U+2580-U+259F). */
8
+ export declare function isBlockElement(cp: number): boolean;
9
+ /** Test whether a codepoint is in the Legacy Computing Symbols blocks. */
10
+ export declare function isLegacyComputing(cp: number): boolean;
11
+ /** Test whether a codepoint is a Powerline symbol (U+E0B0-U+E0D7). */
12
+ export declare function isPowerline(cp: number): boolean;
13
+ /** Test whether a codepoint is in the Braille Patterns block (U+2800-U+28FF). */
14
+ export declare function isBraille(cp: number): boolean;
15
+ /** Test whether a codepoint is any GPU-drawable graphics element (box, block, legacy, powerline). */
16
+ export declare function isGraphicsElement(cp: number): boolean;
17
+ /** Test whether a codepoint is a symbol that may need special rendering (PUA or graphics). */
18
+ export declare function isSymbolCp(cp: number): boolean;
@@ -0,0 +1,9 @@
1
+ import type { Color, RectData } from "./types";
2
+ /** Return a new color with its alpha channel multiplied by the given factor. */
3
+ export declare function applyAlpha(color: Color, alpha: number): Color;
4
+ /** Append a rect instance (position, size, color) to the output array. */
5
+ export declare function pushRect(out: RectData, x: number, y: number, w: number, h: number, color: Color): void;
6
+ /** Append a rect snapped to pixel boundaries (floor origin, ceil extent). */
7
+ export declare function pushRectSnapped(out: RectData, x: number, y: number, w: number, h: number, color: Color): void;
8
+ /** Append a rect with rounded position and at-least-1px dimensions for box drawing. */
9
+ export declare function pushRectBox(out: RectData, x: number, y: number, w: number, h: number, color: Color): void;
@@ -0,0 +1,7 @@
1
+ import type { NerdConstraint } from "../../fonts/nerd-constraints";
2
+ import type { GlyphBox, NerdMetrics } from "./types";
3
+ /**
4
+ * Apply a Nerd Font constraint to a glyph bounding box, adjusting size and
5
+ * alignment to fit within the cell according to the constraint rules.
6
+ */
7
+ export declare function constrainGlyphBox(glyph: GlyphBox, constraint: NerdConstraint, metrics: NerdMetrics, constraintWidth: number): GlyphBox;
@@ -0,0 +1,3 @@
1
+ import type { Color, RectData } from "./types";
2
+ /** Rasterize a Powerline glyph (U+E0B0-U+E0D7) into rect scanline instances. */
3
+ export declare function drawPowerline(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData): boolean;
@@ -0,0 +1,38 @@
1
+ /** RGBA color tuple with components in 0-1 range. */
2
+ export type Color = [number, number, number, number];
3
+ /** Flat array of rect instance data (x, y, w, h, r, g, b, a per rect). */
4
+ export type RectData = number[];
5
+ /**
6
+ * Font metrics used for Nerd Font glyph constraint calculations.
7
+ */
8
+ export type NerdMetrics = {
9
+ /** Cell width in pixels. */
10
+ cellWidth: number;
11
+ /** Cell height in pixels. */
12
+ cellHeight: number;
13
+ /** Font face bounding-box width. */
14
+ faceWidth: number;
15
+ /** Font face bounding-box height. */
16
+ faceHeight: number;
17
+ /** Vertical offset of the font face within the cell. */
18
+ faceY: number;
19
+ /** Target icon height for multi-cell-width glyphs. */
20
+ iconHeight: number;
21
+ /** Target icon height for single-cell-width glyphs. */
22
+ iconHeightSingle: number;
23
+ };
24
+ /** Positioned bounding box for a rendered glyph. */
25
+ export type GlyphBox = {
26
+ x: number;
27
+ y: number;
28
+ width: number;
29
+ height: number;
30
+ };
31
+ /** Box-drawing line style: no line. */
32
+ export declare const BOX_STYLE_NONE = 0;
33
+ /** Box-drawing line style: thin/light stroke. */
34
+ export declare const BOX_STYLE_LIGHT = 1;
35
+ /** Box-drawing line style: thick/heavy stroke. */
36
+ export declare const BOX_STYLE_HEAVY = 2;
37
+ /** Box-drawing line style: double parallel strokes. */
38
+ export declare const BOX_STYLE_DOUBLE = 3;
@@ -1,81 +1,8 @@
1
- import type { NerdConstraint } from "../fonts/nerd-constraints";
2
- /** RGBA color tuple with components in 0-1 range. */
3
- export type Color = [number, number, number, number];
4
- /** Flat array of rect instance data (x, y, w, h, r, g, b, a per rect). */
5
- export type RectData = number[];
6
- /**
7
- * Font metrics used for Nerd Font glyph constraint calculations.
8
- */
9
- export type NerdMetrics = {
10
- /** Cell width in pixels. */
11
- cellWidth: number;
12
- /** Cell height in pixels. */
13
- cellHeight: number;
14
- /** Font face bounding-box width. */
15
- faceWidth: number;
16
- /** Font face bounding-box height. */
17
- faceHeight: number;
18
- /** Vertical offset of the font face within the cell. */
19
- faceY: number;
20
- /** Target icon height for multi-cell-width glyphs. */
21
- iconHeight: number;
22
- /** Target icon height for single-cell-width glyphs. */
23
- iconHeightSingle: number;
24
- };
25
- /** Positioned bounding box for a rendered glyph. */
26
- export type GlyphBox = {
27
- x: number;
28
- y: number;
29
- width: number;
30
- height: number;
31
- };
32
- /** Box-drawing line style: no line. */
33
- export declare const BOX_STYLE_NONE = 0;
34
- /** Box-drawing line style: thin/light stroke. */
35
- export declare const BOX_STYLE_LIGHT = 1;
36
- /** Box-drawing line style: thick/heavy stroke. */
37
- export declare const BOX_STYLE_HEAVY = 2;
38
- /** Box-drawing line style: double parallel strokes. */
39
- export declare const BOX_STYLE_DOUBLE = 3;
40
- /** Test whether a codepoint falls in a Unicode Private Use Area. */
41
- export declare function isPrivateUse(cp: number): boolean;
42
- /** Test whether a codepoint is a space-like character (NUL, SP, or EN SPACE). */
43
- export declare function isSpaceCp(cp: number): boolean;
44
- /** Test whether a codepoint is in the Box Drawing block (U+2500-U+257F). */
45
- export declare function isBoxDrawing(cp: number): boolean;
46
- /** Test whether a codepoint is in the Block Elements block (U+2580-U+259F). */
47
- export declare function isBlockElement(cp: number): boolean;
48
- /** Test whether a codepoint is in the Legacy Computing Symbols blocks. */
49
- export declare function isLegacyComputing(cp: number): boolean;
50
- /** Test whether a codepoint is a Powerline symbol (U+E0B0-U+E0D7). */
51
- export declare function isPowerline(cp: number): boolean;
52
- /** Test whether a codepoint is in the Braille Patterns block (U+2800-U+28FF). */
53
- export declare function isBraille(cp: number): boolean;
54
- /** Test whether a codepoint is any GPU-drawable graphics element (box, block, legacy, powerline). */
55
- export declare function isGraphicsElement(cp: number): boolean;
56
- /** Test whether a codepoint is a symbol that may need special rendering (PUA or graphics). */
57
- export declare function isSymbolCp(cp: number): boolean;
58
- /** Return a new color with its alpha channel multiplied by the given factor. */
59
- export declare function applyAlpha(color: Color, alpha: number): Color;
60
- /** Append a rect instance (position, size, color) to the output array. */
61
- export declare function pushRect(out: RectData, x: number, y: number, w: number, h: number, color: Color): void;
62
- /** Append a rect snapped to pixel boundaries (floor origin, ceil extent). */
63
- export declare function pushRectSnapped(out: RectData, x: number, y: number, w: number, h: number, color: Color): void;
64
- /** Append a rect with rounded position and at-least-1px dimensions for box drawing. */
65
- export declare function pushRectBox(out: RectData, x: number, y: number, w: number, h: number, color: Color): void;
66
- /** Rasterize a Unicode Block Element (U+2580-U+259F) into rect instances. */
67
- export declare function drawBlockElement(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData): boolean;
68
- /**
69
- * Rasterize a Unicode Box Drawing character (U+2500-U+257F) into rect instances.
70
- * Handles straight segments, dashed lines, rounded corners, and diagonal lines.
71
- */
72
- export declare function drawBoxDrawing(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData, boxThicknessPx?: number): boolean;
73
- /** Rasterize a Unicode Braille Pattern (U+2800-U+28FF) into rect dot instances. */
74
- export declare function drawBraille(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData): boolean;
75
- /** Rasterize a Powerline glyph (U+E0B0-U+E0D7) into rect scanline instances. */
76
- export declare function drawPowerline(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData): boolean;
77
- /**
78
- * Apply a Nerd Font constraint to a glyph bounding box, adjusting size and
79
- * alignment to fit within the cell according to the constraint rules.
80
- */
81
- export declare function constrainGlyphBox(glyph: GlyphBox, constraint: NerdConstraint, metrics: NerdMetrics, constraintWidth: number): GlyphBox;
1
+ export * from "./shapes/types";
2
+ export * from "./shapes/classify";
3
+ export * from "./shapes/geometry";
4
+ export * from "./shapes/block-elements";
5
+ export * from "./shapes/box-drawing/draw-box-drawing";
6
+ export * from "./shapes/braille";
7
+ export * from "./shapes/powerline";
8
+ export * from "./shapes/glyph-box";
@@ -0,0 +1,7 @@
1
+ import type { WebGLState, WebGPUState } from "../types";
2
+ /** Grow a WebGPU instance buffer if the required byte length exceeds current capacity. */
3
+ export declare function ensureInstanceBuffer(state: WebGPUState, kind: "rect" | "glyph", byteLength: number): void;
4
+ /** Re-configure the WebGPU canvas context with the current device and format. */
5
+ export declare function configureContext(state: WebGPUState): void;
6
+ /** Grow a WebGL instance buffer if the required byte length exceeds current capacity. */
7
+ export declare function ensureGLInstanceBuffer(state: WebGLState, kind: "rect" | "glyph", byteLength: number): void;
@@ -0,0 +1,10 @@
1
+ import type { WebGPUCoreState, WebGPUState } from "../types";
2
+ /** Initialize shared WebGPU core state (device, pipelines, vertex buffer) from a canvas. */
3
+ export declare function initWebGPUCore(canvas: HTMLCanvasElement): Promise<WebGPUCoreState | null>;
4
+ /**
5
+ * Initialize a full WebGPU renderer state for a canvas, including context,
6
+ * uniform buffer, and bind groups. Accepts an optional pre-initialized core.
7
+ */
8
+ export declare function initWebGPU(canvas: HTMLCanvasElement, options?: {
9
+ core?: WebGPUCoreState | null;
10
+ }): Promise<WebGPUState | null>;
@@ -0,0 +1,15 @@
1
+ /** Create the initial resize tracking state with default values. */
2
+ export declare function createResizeState(): {
3
+ active: boolean;
4
+ lastAt: number;
5
+ cols: number;
6
+ rows: number;
7
+ dpr: number;
8
+ };
9
+ /** Create the initial scrollbar position state with default values. */
10
+ export declare function createScrollbarState(): {
11
+ lastInputAt: number;
12
+ lastTotal: number;
13
+ lastOffset: number;
14
+ lastLen: number;
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { WebGLState } from "../types";
2
+ /** Initialize a WebGL2 fallback renderer state from a canvas. */
3
+ export declare function initWebGL(canvas: HTMLCanvasElement): WebGLState | null;
package/dist/restty.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  isBuiltinThemeName,
9
9
  listBuiltinThemeNames,
10
10
  parseGhosttyTheme
11
- } from "./chunk-68qdtczc.js";
11
+ } from "./chunk-y290zh3e.js";
12
12
  export {
13
13
  parseGhosttyTheme,
14
14
  listBuiltinThemeNames,
@@ -1,3 +1,5 @@
1
+ import type { Font, FontAtlas, FontEntry, FontSizeMode } from "../fonts";
2
+ import type { AtlasOptions, GlyphRasterizeOptions, Matrix2D, Matrix3x3, RasterizedGlyph } from "text-shaper";
1
3
  /**
2
4
  * Metadata for constrained glyph rendering.
3
5
  * - cp: Unicode code point
@@ -38,32 +40,65 @@ export type AtlasConstraintContext = {
38
40
  iconHeight: number;
39
41
  iconHeightSingle: number;
40
42
  };
41
- fontEntry: any;
43
+ fontEntry: FontEntry;
44
+ };
45
+ type RasterizeGlyphTransformOptions = GlyphRasterizeOptions & {
46
+ offsetX26?: number;
47
+ offsetY26?: number;
48
+ };
49
+ type RasterizeGlyphFn = (font: Font, glyphId: number, fontSize: number, options?: GlyphRasterizeOptions) => RasterizedGlyph | null;
50
+ type RasterizeGlyphWithTransformFn = (font: Font, glyphId: number, fontSize: number, matrix: Matrix2D | Matrix3x3, options?: RasterizeGlyphTransformOptions) => RasterizedGlyph | null;
51
+ type BuildGlyphAtlasWithConstraintsOptions = {
52
+ font: Font;
53
+ glyphIds: number[];
54
+ fontSize: number;
55
+ sizeMode: FontSizeMode;
56
+ padding: number;
57
+ maxWidth: number;
58
+ maxHeight: number;
59
+ pixelMode: number;
60
+ hinting: boolean;
61
+ rasterizeGlyph?: RasterizeGlyphFn;
62
+ rasterizeGlyphWithTransform?: RasterizeGlyphWithTransformFn;
63
+ glyphMeta?: Map<number, GlyphConstraintMeta>;
64
+ constraintContext?: AtlasConstraintContext;
65
+ };
66
+ type BuildGlyphAtlasWithConstraintsResult = {
67
+ atlas: FontAtlas | null;
68
+ constrainedGlyphWidths?: Map<number, number> | null;
69
+ };
70
+ type BuildColorEmojiAtlasWithCanvasOptions = {
71
+ font: Font;
72
+ fontEntry: FontEntry;
73
+ glyphIds: number[];
74
+ fontSize: number;
75
+ sizeMode: FontSizeMode;
76
+ padding: number;
77
+ maxWidth: number;
78
+ maxHeight: number;
79
+ pixelMode: number;
42
80
  };
43
81
  type BuildAtlasDeps = {
44
82
  fontScaleOverrides: Array<{
45
83
  match: RegExp;
46
84
  scale: number;
47
85
  }>;
48
- sizeMode: string;
49
- isSymbolFont: (entry: any) => boolean;
50
- fontScaleOverride: (entry: any, overrides: Array<{
86
+ sizeMode: FontSizeMode;
87
+ isSymbolFont: (entry: FontEntry | null | undefined) => boolean;
88
+ fontScaleOverride: (entry: FontEntry | null | undefined, overrides: Array<{
51
89
  match: RegExp;
52
90
  scale: number;
53
91
  }>) => number;
54
- resolveGlyphPixelMode: (entry: any) => number;
55
- atlasBitmapToRGBA: (atlas: any) => Uint8Array | null;
56
- padAtlasRGBA: (rgba: Uint8Array, atlas: any, padding: number) => Uint8Array;
57
- buildAtlas: (font: any, glyphIds: number[], options: any) => any;
58
- buildGlyphAtlasWithConstraints: (options: any) => {
59
- atlas: any;
60
- constrainedGlyphWidths?: any;
61
- } | null;
62
- buildColorEmojiAtlasWithCanvas: (options: any) => {
63
- atlas: any;
92
+ resolveGlyphPixelMode: (entry: FontEntry) => number;
93
+ atlasBitmapToRGBA: (atlas: FontAtlas) => Uint8Array | null;
94
+ padAtlasRGBA: (rgba: Uint8Array, atlas: FontAtlas, padding: number) => Uint8Array;
95
+ buildAtlas: (font: Font, glyphIds: number[], options: AtlasOptions) => FontAtlas;
96
+ buildGlyphAtlasWithConstraints: (options: BuildGlyphAtlasWithConstraintsOptions) => BuildGlyphAtlasWithConstraintsResult | null;
97
+ buildColorEmojiAtlasWithCanvas: (options: BuildColorEmojiAtlasWithCanvasOptions) => {
98
+ atlas: FontAtlas;
64
99
  } | null;
65
- rasterizeGlyph?: any;
66
- rasterizeGlyphWithTransform?: any;
100
+ rasterizeGlyph?: RasterizeGlyphFn;
101
+ rasterizeGlyphWithTransform?: RasterizeGlyphWithTransformFn;
67
102
  nerdConstraintSignature: (glyphMeta: Map<number, GlyphConstraintMeta> | undefined, constraintContext: AtlasConstraintContext | null | undefined) => string;
68
103
  constants: {
69
104
  atlasPadding: number;
@@ -90,7 +125,7 @@ type BuildAtlasDeps = {
90
125
  * - deps: external dependencies for atlas building
91
126
  */
92
127
  export type BuildFontAtlasParams = {
93
- entry: any;
128
+ entry: FontEntry;
94
129
  neededGlyphIds: Set<number>;
95
130
  glyphMeta?: Map<number, GlyphConstraintMeta>;
96
131
  fontSizePx: number;
@@ -109,7 +144,7 @@ export type BuildFontAtlasParams = {
109
144
  */
110
145
  export type BuildFontAtlasResult = {
111
146
  rebuilt: boolean;
112
- atlas: any | null;
147
+ atlas: FontAtlas | null;
113
148
  rgba: Uint8Array | null;
114
149
  colorGlyphs?: Set<number>;
115
150
  preferNearest: boolean;
@@ -0,0 +1,12 @@
1
+ import type { FontEntry } from "../fonts";
2
+ export declare function isLikelyEmojiCodepoint(cp: number): boolean;
3
+ export declare function isVariationSelectorCodepoint(cp: number): boolean;
4
+ export declare function isCombiningMarkCodepoint(cp: number): boolean;
5
+ export declare function isEmojiModifierCodepoint(cp: number): boolean;
6
+ export declare function isCoverageIgnorableCodepoint(cp: number): boolean;
7
+ export declare function shouldMergeTrailingClusterCodepoint(cp: number): boolean;
8
+ export declare function resolvePresentationPreference(text: string, chars: string[]): "emoji" | "text" | "auto";
9
+ export declare function stylePreferenceFromFlags(bold: boolean, italic: boolean): "regular" | "bold" | "italic" | "bold_italic";
10
+ export declare function isAppleSymbolsFont(entry: FontEntry | undefined | null): boolean;
11
+ export declare function fontEntryHasBoldStyle(entry: FontEntry | undefined | null): boolean;
12
+ export declare function fontEntryHasItalicStyle(entry: FontEntry | undefined | null): boolean;
@@ -0,0 +1,9 @@
1
+ export declare function openLink(uri: string): void;
2
+ export declare function sourceLabelFromUrl(url: string, index: number): string;
3
+ export declare function sourceBufferFromView(view: ArrayBufferView): ArrayBuffer;
4
+ export declare function normalizeNewlines(text: string): string;
5
+ export declare function fitTextTailToWidth(text: string, maxWidthPx: number, measureWidthPx: (value: string) => number): {
6
+ text: string;
7
+ offset: number;
8
+ widthPx: number;
9
+ };
@@ -0,0 +1,11 @@
1
+ import { type NerdConstraint } from "../fonts";
2
+ import type { ResttyTouchSelectionMode } from "./types";
3
+ export declare const DEFAULT_SYMBOL_CONSTRAINT: NerdConstraint;
4
+ export declare const DEFAULT_APPLE_SYMBOLS_CONSTRAINT: NerdConstraint;
5
+ export declare const DEFAULT_EMOJI_CONSTRAINT: NerdConstraint;
6
+ export declare function normalizeTouchSelectionMode(value: ResttyTouchSelectionMode | undefined): ResttyTouchSelectionMode;
7
+ export declare function clampFiniteNumber(value: number | undefined, fallback: number, min: number, max: number, round?: boolean): number;
8
+ export declare function isRenderSymbolLike(cp: number): boolean;
9
+ export declare function resolveSymbolConstraint(cp: number): NerdConstraint | null;
10
+ export declare function isRendererSymbolFallbackRange(cp: number): boolean;
11
+ export declare function rendererSymbolFallbackRanges(): ReadonlyArray<readonly [number, number]>;
@@ -0,0 +1,72 @@
1
+ import type { ResttyShaderStage } from "./types";
2
+ export type LocalFontsPermissionDescriptor = PermissionDescriptor & {
3
+ name: "local-fonts";
4
+ };
5
+ export type LocalFontFaceData = {
6
+ family?: string;
7
+ fullName?: string;
8
+ postscriptName?: string;
9
+ blob: () => Promise<Blob>;
10
+ };
11
+ export type NavigatorWithLocalFontAccess = Navigator & {
12
+ queryLocalFonts?: () => Promise<LocalFontFaceData[]>;
13
+ permissions?: {
14
+ query?: (permissionDesc: LocalFontsPermissionDescriptor) => Promise<PermissionStatus>;
15
+ };
16
+ };
17
+ export type GlobalWithLocalFontAccess = typeof globalThis & {
18
+ queryLocalFonts?: () => Promise<LocalFontFaceData[]>;
19
+ navigator?: NavigatorWithLocalFontAccess;
20
+ };
21
+ export type ResttyDebugWindow = Window & typeof globalThis & {
22
+ diagnoseCodepoint?: (cp: number) => void;
23
+ dumpGlyphMetrics?: (cp: number) => {
24
+ fontIndex: number;
25
+ glyphId: number;
26
+ } | null;
27
+ dumpAtlasRegion?: (fontIndex: number, x: number, y: number, width: number, height: number) => Promise<ImageData | null>;
28
+ dumpGlyphRender?: (cp: number, constraintWidth?: number) => Promise<unknown>;
29
+ };
30
+ export type CompiledWebGPUShaderStage = {
31
+ stage: ResttyShaderStage;
32
+ pipeline: GPURenderPipeline;
33
+ uniformBuffer: GPUBuffer;
34
+ uniformData: Float32Array;
35
+ params: Float32Array;
36
+ sampler: GPUSampler;
37
+ bindGroupScene: GPUBindGroup | null;
38
+ bindGroupPing: GPUBindGroup | null;
39
+ bindGroupPong: GPUBindGroup | null;
40
+ };
41
+ export type WebGPUStageTargets = {
42
+ width: number;
43
+ height: number;
44
+ sceneTexture: GPUTexture;
45
+ sceneView: GPUTextureView;
46
+ pingTexture: GPUTexture;
47
+ pingView: GPUTextureView;
48
+ pongTexture: GPUTexture;
49
+ pongView: GPUTextureView;
50
+ };
51
+ export type CompiledWebGLShaderStage = {
52
+ stage: ResttyShaderStage;
53
+ program: WebGLProgram;
54
+ sourceLoc: WebGLUniformLocation;
55
+ resolutionLoc: WebGLUniformLocation;
56
+ timeLoc: WebGLUniformLocation;
57
+ params0Loc: WebGLUniformLocation;
58
+ params1Loc: WebGLUniformLocation;
59
+ params: Float32Array;
60
+ };
61
+ export type WebGLStageTargets = {
62
+ width: number;
63
+ height: number;
64
+ quadVao: WebGLVertexArrayObject;
65
+ quadBuffer: WebGLBuffer;
66
+ sceneTexture: WebGLTexture;
67
+ sceneFramebuffer: WebGLFramebuffer;
68
+ pingTexture: WebGLTexture;
69
+ pongTexture: WebGLTexture;
70
+ pingFramebuffer: WebGLFramebuffer;
71
+ pongFramebuffer: WebGLFramebuffer;
72
+ };
@@ -0,0 +1,5 @@
1
+ import type { FontAtlas, FontEntry } from "../../fonts";
2
+ export declare function atlasRegionToImageData(atlas: FontAtlas, x: number, y: number, width: number, height: number, pixelModeGray: number, pixelModeRgba: number): ImageData;
3
+ export declare function padAtlasRGBA(rgba: Uint8Array, atlas: FontAtlas, padding: number): Uint8Array;
4
+ export declare function resolveGlyphPixelMode(entry: FontEntry, pixelModeGray: number, pixelModeRgba: number, isColorEmojiFont: (entry: FontEntry) => boolean): number;
5
+ export declare function atlasBitmapToRGBA(atlas: FontAtlas, pixelModeRgba: number, atlasToRGBA: (atlas: FontAtlas) => Uint8Array): Uint8Array | null;
@@ -0,0 +1,11 @@
1
+ import type { Color } from "../../renderer";
2
+ export type AlphaBlendingMode = "native" | "linear" | "linear-corrected";
3
+ export declare function srgbChannelToLinear(channel: number): number;
4
+ export declare function srgbToLinearColor(color: Color): Color;
5
+ export declare function resolveBlendFlags(alphaBlending: AlphaBlendingMode, backendType: "webgpu" | "webgl2", state?: {
6
+ srgbSwapchain?: boolean;
7
+ }): {
8
+ useLinearBlending: boolean;
9
+ useLinearCorrection: boolean;
10
+ };
11
+ export declare function floatsToRgb(color: number[]): [number, number, number];
@@ -0,0 +1,11 @@
1
+ import type { FontAtlas } from "../../fonts";
2
+ import type { BuildColorEmojiAtlasWithCanvas } from "./font-runtime-helpers.types";
3
+ type CreateColorGlyphAtlasHelpersOptions = {
4
+ pixelModeRgba: number;
5
+ atlasToRGBA: (atlas: FontAtlas) => Uint8Array;
6
+ };
7
+ export declare function createColorGlyphAtlasHelpers(options: CreateColorGlyphAtlasHelpersOptions): {
8
+ atlasBitmapToRGBA: (atlas: FontAtlas) => Uint8Array | null;
9
+ buildColorEmojiAtlasWithCanvas: BuildColorEmojiAtlasWithCanvas;
10
+ };
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { CreateRuntimeDebugToolsOptions } from "./types";
2
+ export declare function createDumpGlyphRender(options: CreateRuntimeDebugToolsOptions): (cp: number, constraintWidth?: number) => Promise<ImageData>;
@@ -0,0 +1,2 @@
1
+ import type { CreateRuntimeDebugToolsOptions } from "./types";
2
+ export declare function createDiagnoseCodepoint(options: CreateRuntimeDebugToolsOptions): (cp: number) => void;
@@ -0,0 +1,2 @@
1
+ import type { CreateRuntimeDebugToolsOptions } from "./types";
2
+ export declare function createDumpAtlasForCodepoint(options: CreateRuntimeDebugToolsOptions): (cp: number) => void;
@@ -0,0 +1 @@
1
+ export declare function readTextureToImageData(device: GPUDevice, texture: GPUTexture, width: number, height: number, origin?: GPUOrigin3D): Promise<ImageData>;
@@ -0,0 +1,2 @@
1
+ import type { CreateRuntimeDebugToolsOptions } from "./types";
2
+ export declare function createSetupDebugExpose(options: CreateRuntimeDebugToolsOptions, diagnoseCodepoint: (cp: number) => void): () => void;
@@ -0,0 +1,63 @@
1
+ import type { fontAdvanceUnits as fontAdvanceUnitsFn, fontMaxCellSpan as fontMaxCellSpanFn, fontScaleOverride as fontScaleOverrideFn, FontEntry, FontManagerState, NerdConstraint, isColorEmojiFont as isColorEmojiFontFn, isNerdSymbolCodepoint as isNerdSymbolCodepointFn, isSymbolFont as isSymbolFontFn } from "../../../fonts";
2
+ import type { clamp as clampFn, fontHeightUnits as fontHeightUnitsFn } from "../../../grid";
3
+ import type { WebGLState, WebGPUState } from "../../../renderer";
4
+ import type { GlyphConstraintMeta, AtlasConstraintContext } from "../../atlas-builder";
5
+ import type { NerdMetrics } from "../render-tick-webgpu.types";
6
+ export type GridState = {
7
+ cols: number;
8
+ rows: number;
9
+ cellW: number;
10
+ cellH: number;
11
+ fontSizePx: number;
12
+ yPad: number;
13
+ };
14
+ export type FontConfig = {
15
+ sizePx: number;
16
+ };
17
+ export type ShapeClusterResult = {
18
+ glyphs: Array<{
19
+ glyphId: number;
20
+ xAdvance: number;
21
+ xOffset: number;
22
+ yOffset: number;
23
+ }>;
24
+ advance: number;
25
+ };
26
+ export type BuildNerdMetricsFn = (cellW: number, cellH: number, lineHeight: number, font: FontEntry["font"] | null | undefined, primaryScale: number, nerdIconScale: number) => NerdMetrics;
27
+ export type EnsureAtlasForFontFn = (device: GPUDevice, state: WebGPUState, entry: FontEntry, neededGlyphIds: Set<number>, fontSizePx: number, fontIndex: number, atlasScale: number, glyphMeta?: Map<number, GlyphConstraintMeta>, constraintContext?: AtlasConstraintContext | null) => boolean;
28
+ export type CreateRuntimeDebugToolsOptions = {
29
+ debugExpose: boolean;
30
+ getWindow: () => (Window & typeof globalThis) | undefined;
31
+ getActiveState: () => WebGPUState | WebGLState | null;
32
+ getCanvas: () => HTMLCanvasElement;
33
+ atlasCanvas: HTMLCanvasElement | null;
34
+ atlasInfoEl: HTMLElement | null;
35
+ fontState: FontManagerState;
36
+ gridState: GridState;
37
+ fontConfig: FontConfig;
38
+ pickFontIndexForText: (text: string, expectedSpan?: number) => number;
39
+ ensureAtlasForFont: EnsureAtlasForFontFn;
40
+ formatCodepoint: (cp: number) => string;
41
+ isSymbolFont: typeof isSymbolFontFn;
42
+ isNerdSymbolCodepoint: typeof isNerdSymbolCodepointFn;
43
+ isSymbolCp: (cp: number) => boolean;
44
+ fontHasGlyph: (font: FontEntry["font"], ch: string) => boolean;
45
+ shapeClusterWithFont: (entry: FontEntry, text: string) => ShapeClusterResult;
46
+ getNerdConstraint: (cp: number) => NerdConstraint | null;
47
+ fontHeightUnits: typeof fontHeightUnitsFn;
48
+ fontScaleOverride: typeof fontScaleOverrideFn;
49
+ fontScaleOverrides: Array<{
50
+ match: RegExp;
51
+ scale: number;
52
+ }>;
53
+ fontAdvanceUnits: typeof fontAdvanceUnitsFn;
54
+ fontMaxCellSpan: typeof fontMaxCellSpanFn;
55
+ clamp: typeof clampFn;
56
+ buildNerdMetrics: BuildNerdMetricsFn;
57
+ nerdIconScale: number;
58
+ isColorEmojiFont: typeof isColorEmojiFontFn;
59
+ atlasPadding: number;
60
+ symbolAtlasPadding: number;
61
+ pixelModeGray: number;
62
+ pixelModeRgba: number;
63
+ };
@@ -0,0 +1,6 @@
1
+ import type { CreateRuntimeDebugToolsOptions } from "./debug-tools/types";
2
+ export type { CreateRuntimeDebugToolsOptions } from "./debug-tools/types";
3
+ export declare function createRuntimeDebugTools(options: CreateRuntimeDebugToolsOptions): {
4
+ dumpAtlasForCodepoint: (cp: number) => void;
5
+ setupDebugExpose: () => void;
6
+ };