restty 0.1.23 → 0.1.25

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 (164) hide show
  1. package/dist/{chunk-mkkhfg0z.js → chunk-pab3ge3d.js} +11446 -7806
  2. package/dist/fonts/index.d.ts +4 -1
  3. package/dist/fonts/manager/classification.d.ts +13 -0
  4. package/dist/fonts/manager/entries.d.ts +13 -0
  5. package/dist/fonts/manager/picker.d.ts +6 -0
  6. package/dist/fonts/manager/sources.d.ts +16 -0
  7. package/dist/fonts/types.d.ts +20 -10
  8. package/dist/grid/grid.d.ts +5 -3
  9. package/dist/ime/ime.d.ts +13 -0
  10. package/dist/index.d.ts +3 -3
  11. package/dist/input/index.d.ts +1 -1
  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} +6 -9
  22. package/dist/input/output/osc.d.ts +15 -0
  23. package/dist/input/output/prompt.d.ts +11 -0
  24. package/dist/input/types.d.ts +13 -0
  25. package/dist/internal.d.ts +4 -4
  26. package/dist/internal.js +13 -150
  27. package/dist/renderer/index.d.ts +7 -2
  28. package/dist/renderer/shaders/glyph-gl.d.ts +4 -0
  29. package/dist/renderer/{shaders.d.ts → shaders/glyph-wgsl.d.ts} +0 -10
  30. package/dist/renderer/shaders/rect.d.ts +6 -0
  31. package/dist/renderer/shapes/block-elements.d.ts +3 -0
  32. package/dist/renderer/shapes/box-drawing/dashed-lines.d.ts +3 -0
  33. package/dist/renderer/shapes/box-drawing/diagonal.d.ts +2 -0
  34. package/dist/renderer/shapes/box-drawing/draw-box-drawing.d.ts +6 -0
  35. package/dist/renderer/shapes/box-drawing/fallback.d.ts +2 -0
  36. package/dist/renderer/shapes/box-drawing/mapped.d.ts +2 -0
  37. package/dist/renderer/shapes/box-drawing/rounded-corner.d.ts +2 -0
  38. package/dist/renderer/shapes/braille.d.ts +3 -0
  39. package/dist/renderer/shapes/classify.d.ts +18 -0
  40. package/dist/renderer/shapes/geometry.d.ts +9 -0
  41. package/dist/renderer/shapes/glyph-box.d.ts +7 -0
  42. package/dist/renderer/shapes/powerline.d.ts +3 -0
  43. package/dist/renderer/shapes/types.d.ts +38 -0
  44. package/dist/renderer/shapes.d.ts +8 -81
  45. package/dist/renderer/webgpu/buffers.d.ts +7 -0
  46. package/dist/renderer/webgpu/setup.d.ts +10 -0
  47. package/dist/renderer/webgpu/state.d.ts +15 -0
  48. package/dist/renderer/webgpu/webgl.d.ts +3 -0
  49. package/dist/restty.js +1 -1
  50. package/dist/{app → runtime}/atlas-builder.d.ts +53 -18
  51. package/dist/runtime/codepoint-utils.d.ts +12 -0
  52. package/dist/runtime/create-app-io-utils.d.ts +9 -0
  53. package/dist/runtime/create-app-symbols.d.ts +11 -0
  54. package/dist/runtime/create-app-types.d.ts +72 -0
  55. package/dist/runtime/create-runtime/atlas-debug-utils.d.ts +5 -0
  56. package/dist/runtime/create-runtime/blend-utils.d.ts +11 -0
  57. package/dist/runtime/create-runtime/color-glyph-atlas.d.ts +11 -0
  58. package/dist/runtime/create-runtime/debug-tools/create-dump-glyph-render.d.ts +2 -0
  59. package/dist/runtime/create-runtime/debug-tools/diagnose-codepoint.d.ts +2 -0
  60. package/dist/runtime/create-runtime/debug-tools/dump-atlas-for-codepoint.d.ts +2 -0
  61. package/dist/runtime/create-runtime/debug-tools/read-texture-to-image-data.d.ts +1 -0
  62. package/dist/runtime/create-runtime/debug-tools/setup-debug-expose.d.ts +2 -0
  63. package/dist/runtime/create-runtime/debug-tools/types.d.ts +63 -0
  64. package/dist/runtime/create-runtime/debug-tools.d.ts +6 -0
  65. package/dist/runtime/create-runtime/font-runtime-grid-helpers.d.ts +39 -0
  66. package/dist/runtime/create-runtime/font-runtime-helpers.d.ts +20 -0
  67. package/dist/runtime/create-runtime/font-runtime-helpers.types.d.ts +108 -0
  68. package/dist/runtime/create-runtime/font-runtime-text-helpers.d.ts +21 -0
  69. package/dist/runtime/create-runtime/font-runtime-webgpu-atlas.d.ts +26 -0
  70. package/dist/runtime/create-runtime/format-utils.d.ts +2 -0
  71. package/dist/runtime/create-runtime/input-hooks.d.ts +12 -0
  72. package/dist/runtime/create-runtime/interaction-runtime/bind-ime-events.d.ts +12 -0
  73. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-aux-handlers.d.ts +28 -0
  74. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-events.d.ts +41 -0
  75. package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-up-handler.d.ts +28 -0
  76. package/dist/runtime/create-runtime/interaction-runtime/kitty-image-cache.d.ts +18 -0
  77. package/dist/runtime/create-runtime/interaction-runtime/kitty-overlay-runtime.d.ts +15 -0
  78. package/dist/runtime/create-runtime/interaction-runtime/scrollbar-runtime.d.ts +30 -0
  79. package/dist/runtime/create-runtime/interaction-runtime/types.d.ts +110 -0
  80. package/dist/runtime/create-runtime/interaction-runtime.d.ts +3 -0
  81. package/dist/runtime/create-runtime/kitty-overlay-utils.d.ts +26 -0
  82. package/dist/runtime/create-runtime/lifecycle-theme-size-canvas.d.ts +13 -0
  83. package/dist/runtime/create-runtime/lifecycle-theme-size-theme.d.ts +6 -0
  84. package/dist/runtime/create-runtime/lifecycle-theme-size.d.ts +16 -0
  85. package/dist/runtime/create-runtime/lifecycle-theme-size.types.d.ts +85 -0
  86. package/dist/runtime/create-runtime/pty-input-runtime.d.ts +45 -0
  87. package/dist/runtime/create-runtime/render-tick-webgl-context.d.ts +4 -0
  88. package/dist/runtime/create-runtime/render-tick-webgl-glyph-pipeline.d.ts +2 -0
  89. package/dist/runtime/create-runtime/render-tick-webgl-overlays.d.ts +2 -0
  90. package/dist/runtime/create-runtime/render-tick-webgl-scene.d.ts +2 -0
  91. package/dist/runtime/create-runtime/render-tick-webgl.d.ts +3 -0
  92. package/dist/runtime/create-runtime/render-tick-webgl.types.d.ts +162 -0
  93. package/dist/runtime/create-runtime/render-tick-webgpu-cell-pass.d.ts +25 -0
  94. package/dist/runtime/create-runtime/render-tick-webgpu-draw-pass.d.ts +2 -0
  95. package/dist/runtime/create-runtime/render-tick-webgpu-emit-glyphs.d.ts +2 -0
  96. package/dist/runtime/create-runtime/render-tick-webgpu-overlays-atlas.d.ts +2 -0
  97. package/dist/runtime/create-runtime/render-tick-webgpu.d.ts +3 -0
  98. package/dist/runtime/create-runtime/render-tick-webgpu.types.d.ts +386 -0
  99. package/dist/runtime/create-runtime/render-ticks.d.ts +9 -0
  100. package/dist/runtime/create-runtime/runtime-app-api.d.ts +103 -0
  101. package/dist/runtime/create-runtime/runtime-logger.d.ts +17 -0
  102. package/dist/runtime/create-runtime/runtime-reporting.d.ts +40 -0
  103. package/dist/runtime/create-runtime/shader-stage-runtime.d.ts +29 -0
  104. package/dist/runtime/create-runtime.d.ts +7 -0
  105. package/dist/runtime/font-atlas-utils/bitmap-utils.d.ts +5 -0
  106. package/dist/runtime/font-atlas-utils/glyph-atlas-builder.d.ts +29 -0
  107. package/dist/runtime/font-atlas-utils/nerd-metrics-utils.d.ts +25 -0
  108. package/dist/runtime/font-atlas-utils/packing-utils.d.ts +13 -0
  109. package/dist/runtime/overlay-scrollbar.d.ts +24 -0
  110. package/dist/runtime/pty-output-buffer.d.ts +12 -0
  111. package/dist/runtime/render-color-utils.d.ts +6 -0
  112. package/dist/runtime/render-stage-runtime.d.ts +18 -0
  113. package/dist/runtime/render-stage-shaders.d.ts +6 -0
  114. package/dist/runtime/shader-stages.d.ts +9 -0
  115. package/dist/runtime/text-decoration.d.ts +4 -0
  116. package/dist/{app → runtime}/types.d.ts +39 -1
  117. package/dist/selection/clipboard.d.ts +4 -0
  118. package/dist/selection/{selection.d.ts → core.d.ts} +0 -11
  119. package/dist/selection/index.d.ts +3 -1
  120. package/dist/selection/text.d.ts +8 -0
  121. package/dist/surface/app-factory.d.ts +3 -0
  122. package/dist/{app → surface}/pane-app-manager.d.ts +2 -2
  123. package/dist/surface/panes/default-context-menu-items.d.ts +8 -0
  124. package/dist/surface/panes/layout.d.ts +9 -0
  125. package/dist/surface/panes/manager.d.ts +2 -0
  126. package/dist/surface/panes/pane-interactions.d.ts +11 -0
  127. package/dist/surface/panes/window-events.d.ts +10 -0
  128. package/dist/{app → surface}/panes-types.d.ts +1 -1
  129. package/dist/surface/restty/active-pane-api.d.ts +23 -0
  130. package/dist/surface/restty/manager-options.d.ts +24 -0
  131. package/dist/surface/restty/pane-ops.d.ts +42 -0
  132. package/dist/surface/restty/plugin-dispatcher.d.ts +39 -0
  133. package/dist/surface/restty/plugin-ops.d.ts +24 -0
  134. package/dist/surface/restty/shader-ops.d.ts +27 -0
  135. package/dist/surface/restty-pane-handle.d.ts +70 -0
  136. package/dist/surface/restty-plugin-runtime.d.ts +57 -0
  137. package/dist/surface/restty-plugin-types.d.ts +164 -0
  138. package/dist/surface/restty-plugin-utils.d.ts +22 -0
  139. package/dist/surface/restty.d.ts +93 -0
  140. package/dist/utils/base64.d.ts +12 -0
  141. package/dist/wasm/index.d.ts +2 -1
  142. package/dist/wasm/runtime/abi.d.ts +7 -0
  143. package/dist/wasm/runtime/kitty.d.ts +2 -0
  144. package/dist/wasm/runtime/render-state.d.ts +2 -0
  145. package/dist/wasm/runtime/restty-wasm.d.ts +42 -0
  146. package/dist/wasm/{runtime.d.ts → runtime/types.d.ts} +48 -41
  147. package/dist/wasm/runtime/view-cache.d.ts +4 -0
  148. package/dist/xterm/app-options.d.ts +2 -0
  149. package/dist/xterm/dimensions.d.ts +1 -0
  150. package/dist/xterm/listeners.d.ts +5 -0
  151. package/dist/xterm.d.ts +1 -6
  152. package/dist/xterm.js +61 -63
  153. package/package.json +1 -1
  154. package/dist/app/index.d.ts +0 -9
  155. package/dist/app/panes.d.ts +0 -15
  156. package/dist/app/restty.d.ts +0 -336
  157. package/dist/fonts/manager.d.ts +0 -45
  158. package/dist/renderer/webgpu.d.ts +0 -33
  159. package/dist/restty-input.d.ts +0 -1
  160. /package/dist/{app → runtime}/clipboard-paste.d.ts +0 -0
  161. /package/dist/{app → runtime}/font-sources.d.ts +0 -0
  162. /package/dist/{app → runtime}/session.d.ts +0 -0
  163. /package/dist/{app → surface}/panes-context-menu.d.ts +0 -0
  164. /package/dist/{app → surface}/panes-styles.d.ts +0 -0
@@ -1,13 +1,3 @@
1
- /** WebGPU WGSL shader for rendering solid-color rectangles. */
2
- export declare const RECT_SHADER = "\nstruct Uniforms {\n res: vec2f,\n _pad: vec2f,\n blend: vec2f,\n _pad2: vec2f,\n};\n\n@group(0) @binding(0) var<uniform> uniforms: Uniforms;\n\nstruct VSIn {\n @location(0) quad: vec2f,\n @location(1) pos: vec2f,\n @location(2) size: vec2f,\n @location(3) color: vec4f,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) color: vec4f,\n};\n\n// sRGB to linear conversion for proper blending\nfn srgbToLinear(c: f32) -> f32 {\n if (c <= 0.04045) {\n return c / 12.92;\n }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\nfn srgbToLinear3(c: vec3f) -> vec3f {\n return vec3f(srgbToLinear(c.x), srgbToLinear(c.y), srgbToLinear(c.z));\n}\n\n@vertex\nfn vsMain(input: VSIn) -> VSOut {\n let pixel = input.pos + input.quad * input.size;\n let clip = vec2f(\n (pixel.x / uniforms.res.x) * 2.0 - 1.0,\n 1.0 - (pixel.y / uniforms.res.y) * 2.0\n );\n\n var out: VSOut;\n out.position = vec4f(clip.x, clip.y, 0.0, 1.0);\n out.color = input.color;\n return out;\n}\n\n@fragment\nfn fsMain(input: VSOut) -> @location(0) vec4f {\n let useLinear = uniforms.blend.x > 0.5;\n var color = input.color;\n if (useLinear) {\n color = vec4f(srgbToLinear3(color.rgb), color.a);\n }\n color = vec4f(color.rgb * color.a, color.a);\n return color;\n}\n";
3
- /** WebGL2 vertex shader for rendering solid-color rectangles. */
4
- export declare const RECT_SHADER_GL_VERT = "#version 300 es\nprecision highp float;\n\nuniform vec2 u_resolution;\n\nlayout(location = 0) in vec2 a_quad;\nlayout(location = 1) in vec2 a_pos;\nlayout(location = 2) in vec2 a_size;\nlayout(location = 3) in vec4 a_color;\n\nout vec4 v_color;\n\nvoid main() {\n vec2 pixel = a_pos + a_quad * a_size;\n vec2 clip = vec2(\n (pixel.x / u_resolution.x) * 2.0 - 1.0,\n 1.0 - (pixel.y / u_resolution.y) * 2.0\n );\n gl_Position = vec4(clip, 0.0, 1.0);\n v_color = a_color;\n}\n";
5
- /** WebGL2 fragment shader for rendering solid-color rectangles with alpha blending. */
6
- export declare const RECT_SHADER_GL_FRAG = "#version 300 es\nprecision highp float;\n\nuniform vec2 u_blend;\n\nin vec4 v_color;\nout vec4 fragColor;\n\n// sRGB to linear conversion for proper blending\nfloat srgbToLinear(float c) {\n if (c <= 0.04045) {\n return c / 12.92;\n }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\nvec3 srgbToLinear(vec3 c) {\n return vec3(srgbToLinear(c.r), srgbToLinear(c.g), srgbToLinear(c.b));\n}\n\nvoid main() {\n bool useLinear = u_blend.x > 0.5;\n vec4 color = v_color;\n if (useLinear) {\n color.rgb = srgbToLinear(color.rgb);\n }\n color.rgb *= color.a;\n fragColor = color;\n}\n";
7
- /** WebGL2 vertex shader for rendering textured glyph quads. */
8
- export declare const GLYPH_SHADER_GL_VERT = "#version 300 es\nprecision highp float;\n\nuniform vec2 u_resolution;\n\nlayout(location = 0) in vec2 a_quad;\nlayout(location = 1) in vec2 a_pos;\nlayout(location = 2) in vec2 a_size;\nlayout(location = 3) in vec2 a_uv0;\nlayout(location = 4) in vec2 a_uv1;\nlayout(location = 5) in vec4 a_color;\nlayout(location = 6) in vec4 a_bg;\nlayout(location = 7) in float a_slant;\nlayout(location = 8) in float a_mode;\n\nout vec2 v_uv;\nout vec4 v_color;\nout vec4 v_bg;\nout float v_mode;\n\nvoid main() {\n vec2 pixel = a_pos + vec2(a_quad.x * a_size.x + a_slant * (1.0 - a_quad.y), a_quad.y * a_size.y);\n vec2 clip = vec2(\n (pixel.x / u_resolution.x) * 2.0 - 1.0,\n 1.0 - (pixel.y / u_resolution.y) * 2.0\n );\n v_uv = a_uv0 + (a_uv1 - a_uv0) * a_quad;\n gl_Position = vec4(clip, 0.0, 1.0);\n v_color = a_color;\n v_bg = a_bg;\n v_mode = a_mode;\n}\n";
9
- /** WebGL2 fragment shader for sampling glyph atlas textures with linear filtering. */
10
- export declare const GLYPH_SHADER_GL_FRAG = "#version 300 es\nprecision highp float;\n\nuniform sampler2D u_atlas;\nuniform vec2 u_blend;\n\nin vec2 v_uv;\nin vec4 v_color;\nin vec4 v_bg;\nin float v_mode;\nout vec4 fragColor;\n\n// sRGB to linear conversion for proper blending\nfloat srgbToLinear(float c) {\n if (c <= 0.04045) {\n return c / 12.92;\n }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\n// Linear to sRGB conversion\nfloat linearToSrgb(float c) {\n if (c <= 0.0031308) {\n return c * 12.92;\n }\n return 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\n\nvec3 srgbToLinear(vec3 c) {\n return vec3(srgbToLinear(c.r), srgbToLinear(c.g), srgbToLinear(c.b));\n}\n\nvec3 linearToSrgb(vec3 c) {\n return vec3(linearToSrgb(c.r), linearToSrgb(c.g), linearToSrgb(c.b));\n}\n\nfloat luminance(vec3 color) {\n return dot(color, vec3(0.2126, 0.7152, 0.0722));\n}\n\nvoid main() {\n vec4 atlasSample = texture(u_atlas, v_uv);\n bool useLinear = u_blend.x > 0.5;\n bool useCorrection = u_blend.y > 0.5;\n\n if (v_mode > 0.5) {\n vec4 color = atlasSample;\n if (useLinear) {\n color.rgb = srgbToLinear(color.rgb);\n }\n color.rgb *= color.a;\n fragColor = color;\n return;\n }\n\n vec4 fg = v_color;\n vec4 bg = v_bg;\n if (useLinear) {\n fg.rgb = srgbToLinear(fg.rgb);\n bg.rgb = srgbToLinear(bg.rgb);\n }\n fg.rgb *= fg.a;\n bg.rgb *= bg.a;\n\n float alpha = atlasSample.a;\n if (useCorrection && useLinear) {\n float fg_l = luminance(fg.rgb);\n float bg_l = luminance(bg.rgb);\n if (abs(fg_l - bg_l) > 0.001) {\n float blend_l = srgbToLinear(linearToSrgb(fg_l) * alpha + linearToSrgb(bg_l) * (1.0 - alpha));\n alpha = clamp((blend_l - bg_l) / (fg_l - bg_l), 0.0, 1.0);\n }\n }\n\n vec4 color = fg * alpha;\n fragColor = color;\n}\n";
11
1
  /** WebGPU WGSL shader for rendering textured glyph quads with linear atlas sampling. */
12
2
  export declare const GLYPH_SHADER = "\nstruct Uniforms {\n res: vec2f,\n _pad: vec2f,\n blend: vec2f,\n _pad2: vec2f,\n};\n\n@group(0) @binding(0) var<uniform> uniforms: Uniforms;\n@group(0) @binding(1) var atlasSampler: sampler;\n@group(0) @binding(2) var atlasTex: texture_2d<f32>;\n\nstruct VSIn {\n @location(0) quad: vec2f,\n @location(1) pos: vec2f,\n @location(2) size: vec2f,\n @location(3) uv0: vec2f,\n @location(4) uv1: vec2f,\n @location(5) color: vec4f,\n @location(6) bg: vec4f,\n @location(7) slant: f32,\n @location(8) mode: f32,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) uv: vec2f,\n @location(1) color: vec4f,\n @location(2) bg: vec4f,\n @location(3) mode: f32,\n};\n\n@vertex\nfn vsMain(input: VSIn) -> VSOut {\n let pixel = input.pos +\n vec2f(input.quad.x * input.size.x + input.slant * (1.0 - input.quad.y), input.quad.y * input.size.y);\n let clip = vec2f(\n (pixel.x / uniforms.res.x) * 2.0 - 1.0,\n 1.0 - (pixel.y / uniforms.res.y) * 2.0\n );\n let uv = input.uv0 + (input.uv1 - input.uv0) * input.quad;\n\n var out: VSOut;\n out.position = vec4f(clip.x, clip.y, 0.0, 1.0);\n out.uv = uv;\n out.color = input.color;\n out.bg = input.bg;\n out.mode = input.mode;\n return out;\n}\n\n// sRGB to linear conversion for proper blending\nfn srgbToLinear(c: f32) -> f32 {\n if (c <= 0.04045) {\n return c / 12.92;\n }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\n// Linear to sRGB conversion\nfn linearToSrgb(c: f32) -> f32 {\n if (c <= 0.0031308) {\n return c * 12.92;\n }\n return 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\n\nfn srgbToLinear3(c: vec3f) -> vec3f {\n return vec3f(srgbToLinear(c.x), srgbToLinear(c.y), srgbToLinear(c.z));\n}\n\nfn linearToSrgb3(c: vec3f) -> vec3f {\n return vec3f(linearToSrgb(c.x), linearToSrgb(c.y), linearToSrgb(c.z));\n}\n\nfn luminance(color: vec3f) -> f32 {\n return dot(color, vec3f(0.2126, 0.7152, 0.0722));\n}\n\n@fragment\nfn fsMain(input: VSOut) -> @location(0) vec4f {\n let atlasSample = textureSample(atlasTex, atlasSampler, input.uv);\n let useLinear = uniforms.blend.x > 0.5;\n let useCorrection = uniforms.blend.y > 0.5;\n\n if (input.mode > 0.5) {\n var color = atlasSample;\n if (useLinear) {\n color = vec4f(srgbToLinear3(color.rgb), color.a);\n }\n return vec4f(color.rgb * color.a, color.a);\n }\n\n var alpha = atlasSample.a;\n\n var fg = input.color;\n var bg = input.bg;\n if (useLinear) {\n fg = vec4f(srgbToLinear3(fg.rgb), fg.a);\n bg = vec4f(srgbToLinear3(bg.rgb), bg.a);\n }\n fg = vec4f(fg.rgb * fg.a, fg.a);\n bg = vec4f(bg.rgb * bg.a, bg.a);\n\n if (useCorrection && useLinear) {\n let fg_l = luminance(fg.rgb);\n let bg_l = luminance(bg.rgb);\n if (abs(fg_l - bg_l) > 0.001) {\n let blend_l = srgbToLinear(linearToSrgb(fg_l) * alpha + linearToSrgb(bg_l) * (1.0 - alpha));\n alpha = clamp((blend_l - bg_l) / (fg_l - bg_l), 0.0, 1.0);\n }\n }\n\n var color = fg * alpha;\n return color;\n}\n";
13
3
  /** WebGPU WGSL shader for rendering textured glyph quads with nearest-neighbor atlas sampling. */
@@ -0,0 +1,6 @@
1
+ /** WebGPU WGSL shader for rendering solid-color rectangles. */
2
+ export declare const RECT_SHADER = "\nstruct Uniforms {\n res: vec2f,\n _pad: vec2f,\n blend: vec2f,\n _pad2: vec2f,\n};\n\n@group(0) @binding(0) var<uniform> uniforms: Uniforms;\n\nstruct VSIn {\n @location(0) quad: vec2f,\n @location(1) pos: vec2f,\n @location(2) size: vec2f,\n @location(3) color: vec4f,\n};\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) color: vec4f,\n};\n\n// sRGB to linear conversion for proper blending\nfn srgbToLinear(c: f32) -> f32 {\n if (c <= 0.04045) {\n return c / 12.92;\n }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\nfn srgbToLinear3(c: vec3f) -> vec3f {\n return vec3f(srgbToLinear(c.x), srgbToLinear(c.y), srgbToLinear(c.z));\n}\n\n@vertex\nfn vsMain(input: VSIn) -> VSOut {\n let pixel = input.pos + input.quad * input.size;\n let clip = vec2f(\n (pixel.x / uniforms.res.x) * 2.0 - 1.0,\n 1.0 - (pixel.y / uniforms.res.y) * 2.0\n );\n\n var out: VSOut;\n out.position = vec4f(clip.x, clip.y, 0.0, 1.0);\n out.color = input.color;\n return out;\n}\n\n@fragment\nfn fsMain(input: VSOut) -> @location(0) vec4f {\n let useLinear = uniforms.blend.x > 0.5;\n var color = input.color;\n if (useLinear) {\n color = vec4f(srgbToLinear3(color.rgb), color.a);\n }\n color = vec4f(color.rgb * color.a, color.a);\n return color;\n}\n";
3
+ /** WebGL2 vertex shader for rendering solid-color rectangles. */
4
+ export declare const RECT_SHADER_GL_VERT = "#version 300 es\nprecision highp float;\n\nuniform vec2 u_resolution;\n\nlayout(location = 0) in vec2 a_quad;\nlayout(location = 1) in vec2 a_pos;\nlayout(location = 2) in vec2 a_size;\nlayout(location = 3) in vec4 a_color;\n\nout vec4 v_color;\n\nvoid main() {\n vec2 pixel = a_pos + a_quad * a_size;\n vec2 clip = vec2(\n (pixel.x / u_resolution.x) * 2.0 - 1.0,\n 1.0 - (pixel.y / u_resolution.y) * 2.0\n );\n gl_Position = vec4(clip, 0.0, 1.0);\n v_color = a_color;\n}\n";
5
+ /** WebGL2 fragment shader for rendering solid-color rectangles with alpha blending. */
6
+ export declare const RECT_SHADER_GL_FRAG = "#version 300 es\nprecision highp float;\n\nuniform vec2 u_blend;\n\nin vec4 v_color;\nout vec4 fragColor;\n\n// sRGB to linear conversion for proper blending\nfloat srgbToLinear(float c) {\n if (c <= 0.04045) {\n return c / 12.92;\n }\n return pow((c + 0.055) / 1.055, 2.4);\n}\n\nvec3 srgbToLinear(vec3 c) {\n return vec3(srgbToLinear(c.r), srgbToLinear(c.g), srgbToLinear(c.b));\n}\n\nvoid main() {\n bool useLinear = u_blend.x > 0.5;\n vec4 color = v_color;\n if (useLinear) {\n color.rgb = srgbToLinear(color.rgb);\n }\n color.rgb *= color.a;\n fragColor = color;\n}\n";
@@ -0,0 +1,3 @@
1
+ import type { Color, RectData } from "./types";
2
+ /** Rasterize a Unicode Block Element (U+2580-U+259F) into rect instances. */
3
+ export declare function drawBlockElement(cp: number, x: number, y: number, cellW: number, cellH: number, color: Color, out: RectData): boolean;
@@ -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-mkkhfg0z.js";
11
+ } from "./chunk-pab3ge3d.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;