bluedither 1.0.18 → 1.0.19

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.
@@ -18,17 +18,20 @@ import { resolve, dirname } from 'path';
18
18
  const ENDPOINT = '/__bluedither/commit';
19
19
 
20
20
  function findTokensPath() {
21
- // Search from cwd for bluedither/tokens.json
21
+ // Search from cwd prioritize public/ (Vite serves static from there)
22
22
  const cwd = process.cwd();
23
23
  const paths = [
24
- resolve(cwd, 'bluedither', 'tokens.json'),
25
24
  resolve(cwd, 'public', 'bluedither', 'tokens.json'),
25
+ resolve(cwd, 'bluedither', 'tokens.json'),
26
26
  resolve(cwd, 'theme', 'tokens.json'),
27
27
  ];
28
28
  for (const p of paths) {
29
29
  if (existsSync(p)) return p;
30
30
  }
31
- // Default to bluedither/tokens.json even if it doesn't exist yet
31
+ // Default to public/bluedither if public/ dir exists (Vite project), else bluedither/
32
+ if (existsSync(resolve(cwd, 'public'))) {
33
+ return resolve(cwd, 'public', 'bluedither', 'tokens.json');
34
+ }
32
35
  return resolve(cwd, 'bluedither', 'tokens.json');
33
36
  }
34
37
 
@@ -111,7 +111,9 @@
111
111
  if (t.shader?.scale != null) params.scale = t.shader.scale;
112
112
  if (t.shader?.size != null) params.size = t.shader.size;
113
113
  if (t.shader?.rotation != null) params.rotation = t.shader.rotation;
114
- shader.updateParams(params);
114
+ if (typeof shader.updateParams === 'function') {
115
+ shader.updateParams(params);
116
+ }
115
117
  return true;
116
118
  };
117
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bluedither",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "A bold, dithered-shader hero theme for Claude Code — skill + fine-tuner",
5
5
  "type": "module",
6
6
  "bin": {
@@ -80,9 +80,23 @@ function App() {
80
80
  u_fit: 0, u_offsetX: 0, u_offsetY: 0,
81
81
  }, { alpha: true, premultipliedAlpha: false }, SHADER_PARAMS.speed, 0, 2);
82
82
 
83
- // CRITICAL: expose for tuner
84
- window.__BD_SHADER__ = mount;
85
- return () => { mount.dispose(); window.__BD_SHADER__ = null; };
83
+ // CRITICAL: expose wrapper with updateParams for the tuner
84
+ window.__BD_SHADER__ = {
85
+ updateParams(params) {
86
+ const uniforms = {};
87
+ if (params.colorFront !== undefined) uniforms.u_colorFront = getShaderColorFromString(params.colorFront);
88
+ if (params.colorBack !== undefined) uniforms.u_colorBack = getShaderColorFromString(params.colorBack);
89
+ if (params.shape !== undefined) uniforms.u_shape = DitheringShapes[params.shape] ?? DitheringShapes.warp;
90
+ if (params.type !== undefined) uniforms.u_type = DitheringTypes[params.type] ?? DitheringTypes['2x2'];
91
+ if (params.size !== undefined) uniforms.u_pxSize = params.size;
92
+ if (params.scale !== undefined) uniforms.u_scale = params.scale;
93
+ if (params.rotation !== undefined) uniforms.u_rotation = parseFloat(params.rotation) || 180;
94
+ if (Object.keys(uniforms).length > 0) mount.setUniforms(uniforms);
95
+ if (params.speed !== undefined) mount.setSpeed(params.speed);
96
+ },
97
+ dispose() { mount.dispose(); },
98
+ };
99
+ return () => { window.__BD_SHADER__.dispose(); window.__BD_SHADER__ = null; };
86
100
  }, []);
87
101
 
88
102
  // Load tuner in dev mode only