restty 0.1.9 → 0.1.11

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/dist/index.js CHANGED
@@ -875,12 +875,12 @@ float luminance(vec3 color) {
875
875
  }
876
876
 
877
877
  void main() {
878
- vec4 sample = texture(u_atlas, v_uv);
878
+ vec4 atlasSample = texture(u_atlas, v_uv);
879
879
  bool useLinear = u_blend.x > 0.5;
880
880
  bool useCorrection = u_blend.y > 0.5;
881
881
 
882
882
  if (v_mode > 0.5) {
883
- vec4 color = sample;
883
+ vec4 color = atlasSample;
884
884
  if (useLinear) {
885
885
  color.rgb = srgbToLinear(color.rgb);
886
886
  }
@@ -898,7 +898,7 @@ void main() {
898
898
  fg.rgb *= fg.a;
899
899
  bg.rgb *= bg.a;
900
900
 
901
- float alpha = sample.a;
901
+ float alpha = atlasSample.a;
902
902
  if (useCorrection && useLinear) {
903
903
  float fg_l = luminance(fg.rgb);
904
904
  float bg_l = luminance(bg.rgb);
@@ -993,19 +993,19 @@ fn luminance(color: vec3f) -> f32 {
993
993
 
994
994
  @fragment
995
995
  fn fsMain(input: VSOut) -> @location(0) vec4f {
996
- let sample = textureSample(atlasTex, atlasSampler, input.uv);
996
+ let atlasSample = textureSample(atlasTex, atlasSampler, input.uv);
997
997
  let useLinear = uniforms.blend.x > 0.5;
998
998
  let useCorrection = uniforms.blend.y > 0.5;
999
999
 
1000
1000
  if (input.mode > 0.5) {
1001
- var color = sample;
1001
+ var color = atlasSample;
1002
1002
  if (useLinear) {
1003
1003
  color = vec4f(srgbToLinear3(color.rgb), color.a);
1004
1004
  }
1005
1005
  return vec4f(color.rgb * color.a, color.a);
1006
1006
  }
1007
1007
 
1008
- var alpha = sample.a;
1008
+ var alpha = atlasSample.a;
1009
1009
 
1010
1010
  var fg = input.color;
1011
1011
  var bg = input.bg;
@@ -1110,19 +1110,19 @@ fn luminance(color: vec3f) -> f32 {
1110
1110
 
1111
1111
  @fragment
1112
1112
  fn fsMain(input: VSOut) -> @location(0) vec4f {
1113
- let sample = textureSample(atlasTex, atlasSampler, input.uv);
1113
+ let atlasSample = textureSample(atlasTex, atlasSampler, input.uv);
1114
1114
  let useLinear = uniforms.blend.x > 0.5;
1115
1115
  let useCorrection = uniforms.blend.y > 0.5;
1116
1116
 
1117
1117
  if (input.mode > 0.5) {
1118
- var color = sample;
1118
+ var color = atlasSample;
1119
1119
  if (useLinear) {
1120
1120
  color = vec4f(srgbToLinear3(color.rgb), color.a);
1121
1121
  }
1122
1122
  return vec4f(color.rgb * color.a, color.a);
1123
1123
  }
1124
1124
 
1125
- var alpha = sample.a;
1125
+ var alpha = atlasSample.a;
1126
1126
 
1127
1127
  var fg = input.color;
1128
1128
  var bg = input.bg;
@@ -25482,7 +25482,7 @@ var RESTTY_PANE_STYLE_TEXT = `
25482
25482
  min-height: 0;
25483
25483
  gap: 0;
25484
25484
  padding: 0;
25485
- background: var(--restty-pane-split-background, #111);
25485
+ background: var(--restty-pane-split-background, #000);
25486
25486
  }
25487
25487
 
25488
25488
  .${RESTTY_PANE_ROOT_CLASS} .pane-split.is-vertical {
@@ -25501,7 +25501,7 @@ var RESTTY_PANE_STYLE_TEXT = `
25501
25501
  background: var(--restty-pane-background, #000);
25502
25502
  border: 0;
25503
25503
  overflow: hidden;
25504
- opacity: var(--restty-pane-inactive-opacity, 0.82);
25504
+ opacity: var(--restty-pane-inactive-opacity, 0.9);
25505
25505
  transition: opacity var(--restty-pane-opacity-transition, 140ms) ease-out;
25506
25506
  }
25507
25507
 
@@ -25632,9 +25632,9 @@ body.is-resizing-split {
25632
25632
  }
25633
25633
  `;
25634
25634
  var DEFAULT_RESTTY_PANE_STYLE_OPTIONS = {
25635
- splitBackground: "#111",
25635
+ splitBackground: "#000",
25636
25636
  paneBackground: "#000",
25637
- inactivePaneOpacity: 0.82,
25637
+ inactivePaneOpacity: 0.9,
25638
25638
  activePaneOpacity: 1,
25639
25639
  opacityTransitionMs: 140,
25640
25640
  dividerThicknessPx: 1
@@ -1,2 +1,3 @@
1
1
  export * from "./types";
2
2
  export * from "./pty";
3
+ export * from "./kitty-media";
@@ -0,0 +1,5 @@
1
+ export type KittyMediaRewriteState = {
2
+ remainder?: string;
3
+ };
4
+ export type KittyMediaReadFile = (path: string) => Uint8Array;
5
+ export declare function rewriteKittyFileMediaToDirect(chunk: string, state: KittyMediaRewriteState, readFile: KittyMediaReadFile): string;
@@ -2,6 +2,6 @@ export declare const RECT_SHADER = "\nstruct Uniforms {\n res: vec2f,\n _pad:
2
2
  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";
3
3
  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";
4
4
  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";
5
- 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 sample = 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 = sample;\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 = sample.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";
6
- 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 sample = 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 = sample;\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 = sample.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";
7
- export declare const GLYPH_SHADER_NEAREST = "\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 sample = 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 = sample;\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 = sample.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";
5
+ 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";
6
+ 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";
7
+ export declare const GLYPH_SHADER_NEAREST = "\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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "restty",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Browser terminal rendering library powered by WASM, WebGPU/WebGL2, and TypeScript text shaping.",
5
5
  "keywords": [
6
6
  "terminal",