vireglass 2.3.0 → 2.3.1

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.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { V as VireGlassOptics } from './material-CnUmdKg1.cjs';
2
2
  export { A as ADAPT_RADIUS, b as ALL_EFFECTS_ON, D as DEBUG_MODES, E as EFFECTS, L as LEGACY_NAMES, c as LEGACY_OPTICS, d as LegacyOpticsName, M as MATERIAL_PRESETS, e as MATERIAL_RANGES, f as MaterialPresetName, P as PRESET_NAMES, g as PRODUCT_DIM, h as VIREGLASS_CLEAR_MATERIAL, i as VIREGLASS_CONTROL_MATERIAL, j as VIREGLASS_LYRICS_MATERIAL, k as VIREGLASS_MATERIAL, l as VIREGLASS_MATERIAL_V4, m as VIREGLASS_MATERIAL_V5, n as VIREGLASS_SHEET_MATERIAL, o as VireGlassDebugMode, p as VireGlassEffect, a as VireGlassMaterial, q as VireGlassNumericKey, r as VireGlassTint, s as VireGlassToggles, t as activeMaterial, u as applyToggles, v as debugIndex, w as materialForInk, x as resolveMaterial, y as resolveOptics } from './material-CnUmdKg1.cjs';
3
3
  export { M as MAX_BEVEL_FRACTION, a as MAX_STRETCH, R as RIM_FRACTION, V as VireGlassGeometry, b as bevelDp, c as bevelFraction, d as capsuleGeometry, e as circleGeometry, h as halfMinDp, l as lensPadDp, m as morphReachDp, r as rimDp, f as roundedRectGeometry, s as shadowOpacity, g as shadowOpacityFrom, i as shadowReachDp, j as sizeDp, k as sizeGain, n as surfacePadDp, t as thicknessDp } from './geometry-RhKd7CM5.cjs';
4
- import { V as VireGlassAccent } from './adapters-DugC6Qri.cjs';
5
- export { A as ACCENT_AMOUNT, D as DYNAMIC_UNIFORMS, I as ICON_UNIFORMS, O as OVERLAY_UNIFORMS, R as REST_LIGHT, S as SURFACE_LENGTH_UNIFORMS, a as SurfaceUniforms, b as VireGlassMorph, c as VireGlassTouch, l as lensMagnify, m as morphBetween, d as morphOutOf, t as toDeviceSurfaceUniforms, e as toLensProps, f as toSurfaceUniforms } from './adapters-DugC6Qri.cjs';
4
+ import { V as VireGlassAccent } from './adapters-BOPIRMnL.cjs';
5
+ export { A as ACCENT_AMOUNT, D as DYNAMIC_UNIFORMS, I as ICON_UNIFORMS, O as OVERLAY_UNIFORMS, R as REST_LIGHT, S as SURFACE_LENGTH_UNIFORMS, a as SurfaceUniforms, b as VireGlassMorph, c as VireGlassTouch, l as lensMagnify, m as morphBetween, d as morphOutOf, t as toDeviceSurfaceUniforms, e as toLensProps, f as toSurfaceUniforms } from './adapters-BOPIRMnL.cjs';
6
6
  export { a as GRADIENT, b as GroupDecision, c as GroupMember, G as GroupPlane, d as GroupSink, e as GroupState, M as MorphShape, N as NO_ACCESSIBILITY, f as SCROLL_EDGE_ENGAGE_DP, g as SETTLE, h as SMOOTH, S as ScrollEdgeStyle, T as TouchWarp, i as VG_FALLOFF, j as VG_SDF, V as VireGlassAccessibility, k as aggregate, l as applyAccessibility, m as contrastRimLuma, n as createGroupState, o as elasticAllowed, p as neckToBridge, q as probeValuesAt, s as sceneDistance, r as sceneGradient, t as scrollEdgeReachDp, u as scrollEdgeStrength, v as scrollEdgeStyle, w as sdfRoundedRect, x as sdfRoundedRectGradient, y as smin, z as smoothPlane, A as touchWarp } from './group-model-DwtixGhG.cjs';
7
7
  export { B as BackdropSample, C as CONFIRMATIONS, F as FADE_MS, a as FLIP_LUMA, I as INK_DARK, b as INK_LIGHT, R as RETURN_LUMA, c as ambientFrom, d as decisiveLuma, s as shouldInkBeLight } from './adaptation-BSbbdExK.cjs';
8
8
 
@@ -275,11 +275,16 @@ declare function convertShaderUniforms(src: string): string;
275
275
  * parentheses inside.
276
276
  */
277
277
  declare function convertEvalCalls(src: string): string;
278
+ /** Comments are prose, and the rewrites here are regexes over raw text: a comment mentioning
279
+ * "return" became one, and a brace in a comment ended the entry point early. Newlines inside
280
+ * block comments survive, so a compile error still points at the source line. */
281
+ declare function stripComments(src: string): string;
278
282
  /**
279
283
  * Early `return <expression>;` inside `main` → `fragColor = <expression>; return;`. Takes ONLY
280
284
  * the body of main (see `convertEntryPoint`) — ordinary `return`s in helper functions live
281
285
  * outside this text and are untouched. Expressions never contain a `;` of their own (shaders have
282
- * none — the only `;` lives inside `for(...)`, which isn't a return), so `[^;]+` is safe.
286
+ * none — the only `;` lives inside `for(...)`, which isn't a return), so `[^;]+` is safe once
287
+ * comments are gone (`stripComments`).
283
288
  */
284
289
  declare function convertReturns(mainBody: string): string;
285
290
  /**
@@ -304,4 +309,4 @@ declare function addPrologue(src: string): string;
304
309
  * found. */
305
310
  declare function toGLSL(shaderSource: string): string;
306
311
 
307
- export { type DeformOptions, type DeformSample, FRESNEL_EXPONENT, GLASS_SCALE_DEFAULT, LENS_SHADER, SURFACE_SHADER, type ShapeParent, type ShapeSpec, VireGlassAccent, VireGlassOptics, absorption, accentAmount, accentTone, addPrologue, applyAppear, applyGlassScale, blur, bodyDensity, colorPickup, concentricFit, concentricInset, concentricRadius, convertEntryPoint, convertEvalCalls, convertHalfTypes, convertReturns, convertShaderUniforms, convertVecTypes, createDeform, diffraction, dispersion, edgeDensity, edgeLight, fresnelF0, fresnelStrength, gatherRadius, iorSpread, iridescence, mediumTint, raiseIntoGlass, refractionScale, refractionStrength, resolveShape, shadowTint, specularPower, specularStrength, toAGSL, toGLSL };
312
+ export { type DeformOptions, type DeformSample, FRESNEL_EXPONENT, GLASS_SCALE_DEFAULT, LENS_SHADER, SURFACE_SHADER, type ShapeParent, type ShapeSpec, VireGlassAccent, VireGlassOptics, absorption, accentAmount, accentTone, addPrologue, applyAppear, applyGlassScale, blur, bodyDensity, colorPickup, concentricFit, concentricInset, concentricRadius, convertEntryPoint, convertEvalCalls, convertHalfTypes, convertReturns, convertShaderUniforms, convertVecTypes, createDeform, diffraction, dispersion, edgeDensity, edgeLight, fresnelF0, fresnelStrength, gatherRadius, iorSpread, iridescence, mediumTint, raiseIntoGlass, refractionScale, refractionStrength, resolveShape, shadowTint, specularPower, specularStrength, stripComments, toAGSL, toGLSL };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { V as VireGlassOptics } from './material-CnUmdKg1.js';
2
2
  export { A as ADAPT_RADIUS, b as ALL_EFFECTS_ON, D as DEBUG_MODES, E as EFFECTS, L as LEGACY_NAMES, c as LEGACY_OPTICS, d as LegacyOpticsName, M as MATERIAL_PRESETS, e as MATERIAL_RANGES, f as MaterialPresetName, P as PRESET_NAMES, g as PRODUCT_DIM, h as VIREGLASS_CLEAR_MATERIAL, i as VIREGLASS_CONTROL_MATERIAL, j as VIREGLASS_LYRICS_MATERIAL, k as VIREGLASS_MATERIAL, l as VIREGLASS_MATERIAL_V4, m as VIREGLASS_MATERIAL_V5, n as VIREGLASS_SHEET_MATERIAL, o as VireGlassDebugMode, p as VireGlassEffect, a as VireGlassMaterial, q as VireGlassNumericKey, r as VireGlassTint, s as VireGlassToggles, t as activeMaterial, u as applyToggles, v as debugIndex, w as materialForInk, x as resolveMaterial, y as resolveOptics } from './material-CnUmdKg1.js';
3
3
  export { M as MAX_BEVEL_FRACTION, a as MAX_STRETCH, R as RIM_FRACTION, V as VireGlassGeometry, b as bevelDp, c as bevelFraction, d as capsuleGeometry, e as circleGeometry, h as halfMinDp, l as lensPadDp, m as morphReachDp, r as rimDp, f as roundedRectGeometry, s as shadowOpacity, g as shadowOpacityFrom, i as shadowReachDp, j as sizeDp, k as sizeGain, n as surfacePadDp, t as thicknessDp } from './geometry-GvXtt-_S.js';
4
- import { V as VireGlassAccent } from './adapters-BfeAopGO.js';
5
- export { A as ACCENT_AMOUNT, D as DYNAMIC_UNIFORMS, I as ICON_UNIFORMS, O as OVERLAY_UNIFORMS, R as REST_LIGHT, S as SURFACE_LENGTH_UNIFORMS, a as SurfaceUniforms, b as VireGlassMorph, c as VireGlassTouch, l as lensMagnify, m as morphBetween, d as morphOutOf, t as toDeviceSurfaceUniforms, e as toLensProps, f as toSurfaceUniforms } from './adapters-BfeAopGO.js';
4
+ import { V as VireGlassAccent } from './adapters-B_amRBqc.js';
5
+ export { A as ACCENT_AMOUNT, D as DYNAMIC_UNIFORMS, I as ICON_UNIFORMS, O as OVERLAY_UNIFORMS, R as REST_LIGHT, S as SURFACE_LENGTH_UNIFORMS, a as SurfaceUniforms, b as VireGlassMorph, c as VireGlassTouch, l as lensMagnify, m as morphBetween, d as morphOutOf, t as toDeviceSurfaceUniforms, e as toLensProps, f as toSurfaceUniforms } from './adapters-B_amRBqc.js';
6
6
  export { a as GRADIENT, b as GroupDecision, c as GroupMember, G as GroupPlane, d as GroupSink, e as GroupState, M as MorphShape, N as NO_ACCESSIBILITY, f as SCROLL_EDGE_ENGAGE_DP, g as SETTLE, h as SMOOTH, S as ScrollEdgeStyle, T as TouchWarp, i as VG_FALLOFF, j as VG_SDF, V as VireGlassAccessibility, k as aggregate, l as applyAccessibility, m as contrastRimLuma, n as createGroupState, o as elasticAllowed, p as neckToBridge, q as probeValuesAt, s as sceneDistance, r as sceneGradient, t as scrollEdgeReachDp, u as scrollEdgeStrength, v as scrollEdgeStyle, w as sdfRoundedRect, x as sdfRoundedRectGradient, y as smin, z as smoothPlane, A as touchWarp } from './group-model-z4N27qsC.js';
7
7
  export { B as BackdropSample, C as CONFIRMATIONS, F as FADE_MS, a as FLIP_LUMA, I as INK_DARK, b as INK_LIGHT, R as RETURN_LUMA, c as ambientFrom, d as decisiveLuma, s as shouldInkBeLight } from './adaptation-BSbbdExK.js';
8
8
 
@@ -275,11 +275,16 @@ declare function convertShaderUniforms(src: string): string;
275
275
  * parentheses inside.
276
276
  */
277
277
  declare function convertEvalCalls(src: string): string;
278
+ /** Comments are prose, and the rewrites here are regexes over raw text: a comment mentioning
279
+ * "return" became one, and a brace in a comment ended the entry point early. Newlines inside
280
+ * block comments survive, so a compile error still points at the source line. */
281
+ declare function stripComments(src: string): string;
278
282
  /**
279
283
  * Early `return <expression>;` inside `main` → `fragColor = <expression>; return;`. Takes ONLY
280
284
  * the body of main (see `convertEntryPoint`) — ordinary `return`s in helper functions live
281
285
  * outside this text and are untouched. Expressions never contain a `;` of their own (shaders have
282
- * none — the only `;` lives inside `for(...)`, which isn't a return), so `[^;]+` is safe.
286
+ * none — the only `;` lives inside `for(...)`, which isn't a return), so `[^;]+` is safe once
287
+ * comments are gone (`stripComments`).
283
288
  */
284
289
  declare function convertReturns(mainBody: string): string;
285
290
  /**
@@ -304,4 +309,4 @@ declare function addPrologue(src: string): string;
304
309
  * found. */
305
310
  declare function toGLSL(shaderSource: string): string;
306
311
 
307
- export { type DeformOptions, type DeformSample, FRESNEL_EXPONENT, GLASS_SCALE_DEFAULT, LENS_SHADER, SURFACE_SHADER, type ShapeParent, type ShapeSpec, VireGlassAccent, VireGlassOptics, absorption, accentAmount, accentTone, addPrologue, applyAppear, applyGlassScale, blur, bodyDensity, colorPickup, concentricFit, concentricInset, concentricRadius, convertEntryPoint, convertEvalCalls, convertHalfTypes, convertReturns, convertShaderUniforms, convertVecTypes, createDeform, diffraction, dispersion, edgeDensity, edgeLight, fresnelF0, fresnelStrength, gatherRadius, iorSpread, iridescence, mediumTint, raiseIntoGlass, refractionScale, refractionStrength, resolveShape, shadowTint, specularPower, specularStrength, toAGSL, toGLSL };
312
+ export { type DeformOptions, type DeformSample, FRESNEL_EXPONENT, GLASS_SCALE_DEFAULT, LENS_SHADER, SURFACE_SHADER, type ShapeParent, type ShapeSpec, VireGlassAccent, VireGlassOptics, absorption, accentAmount, accentTone, addPrologue, applyAppear, applyGlassScale, blur, bodyDensity, colorPickup, concentricFit, concentricInset, concentricRadius, convertEntryPoint, convertEvalCalls, convertHalfTypes, convertReturns, convertShaderUniforms, convertVecTypes, createDeform, diffraction, dispersion, edgeDensity, edgeLight, fresnelF0, fresnelStrength, gatherRadius, iorSpread, iridescence, mediumTint, raiseIntoGlass, refractionScale, refractionStrength, resolveShape, shadowTint, specularPower, specularStrength, stripComments, toAGSL, toGLSL };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { SURFACE_SHADER, addPrologue, convertEntryPoint, convertEvalCalls, convertHalfTypes, convertReturns, convertShaderUniforms, convertVecTypes, toGLSL } from './chunk-PM2SWCSF.js';
1
+ export { SURFACE_SHADER, addPrologue, convertEntryPoint, convertEvalCalls, convertHalfTypes, convertReturns, convertShaderUniforms, convertVecTypes, stripComments, toGLSL } from './chunk-UDPJLNFW.js';
2
2
  export { GLASS_SCALE_DEFAULT, GRADIENT, NO_ACCESSIBILITY, SCROLL_EDGE_ENGAGE_DP, SETTLE, SMOOTH, accentAmount, accentTone, aggregate, applyAccessibility, applyAppear, applyGlassScale, concentricFit, concentricInset, concentricRadius, contrastRimLuma, createDeform, createGroupState, elasticAllowed, probeValuesAt, raiseIntoGlass, resolveShape, scrollEdgeReachDp, scrollEdgeStrength, scrollEdgeStyle, shadowTint, smoothPlane } from './chunk-CTTZNZFV.js';
3
3
  export { CONFIRMATIONS, FADE_MS, FLIP_LUMA, INK_DARK, INK_LIGHT, RETURN_LUMA, ambientFrom, decisiveLuma, shouldInkBeLight } from './chunk-JNRZNMJJ.js';
4
- export { ACCENT_AMOUNT, ADAPT_RADIUS, ALL_EFFECTS_ON, DEBUG_MODES, DYNAMIC_UNIFORMS, EFFECTS, FRESNEL_EXPONENT, ICON_UNIFORMS, LEGACY_NAMES, LEGACY_OPTICS, LENS_SHADER, MATERIAL_PRESETS, MATERIAL_RANGES, OVERLAY_UNIFORMS, PRESET_NAMES, PRODUCT_DIM, REST_LIGHT, SURFACE_LENGTH_UNIFORMS, VG_FALLOFF, VG_SDF, VIREGLASS_CLEAR_MATERIAL, VIREGLASS_CONTROL_MATERIAL, VIREGLASS_LYRICS_MATERIAL, VIREGLASS_MATERIAL, VIREGLASS_MATERIAL_V4, VIREGLASS_MATERIAL_V5, VIREGLASS_SHEET_MATERIAL, absorption, activeMaterial, applyToggles, blur, bodyDensity, colorPickup, debugIndex, diffraction, dispersion, edgeDensity, edgeLight, fresnelF0, fresnelStrength, gatherRadius, iorSpread, iridescence, lensMagnify, materialForInk, mediumTint, morphBetween, morphOutOf, neckToBridge, refractionScale, refractionStrength, resolveMaterial, resolveOptics, sceneDistance, sceneGradient, sdfRoundedRect, sdfRoundedRectGradient, smin, specularPower, specularStrength, toDeviceSurfaceUniforms, toLensProps, toSurfaceUniforms, touchWarp } from './chunk-H5QTBF67.js';
4
+ export { ACCENT_AMOUNT, ADAPT_RADIUS, ALL_EFFECTS_ON, DEBUG_MODES, DYNAMIC_UNIFORMS, EFFECTS, FRESNEL_EXPONENT, ICON_UNIFORMS, LEGACY_NAMES, LEGACY_OPTICS, LENS_SHADER, MATERIAL_PRESETS, MATERIAL_RANGES, OVERLAY_UNIFORMS, PRESET_NAMES, PRODUCT_DIM, REST_LIGHT, SURFACE_LENGTH_UNIFORMS, VG_FALLOFF, VG_SDF, VIREGLASS_CLEAR_MATERIAL, VIREGLASS_CONTROL_MATERIAL, VIREGLASS_LYRICS_MATERIAL, VIREGLASS_MATERIAL, VIREGLASS_MATERIAL_V4, VIREGLASS_MATERIAL_V5, VIREGLASS_SHEET_MATERIAL, absorption, activeMaterial, applyToggles, blur, bodyDensity, colorPickup, debugIndex, diffraction, dispersion, edgeDensity, edgeLight, fresnelF0, fresnelStrength, gatherRadius, iorSpread, iridescence, lensMagnify, materialForInk, mediumTint, morphBetween, morphOutOf, neckToBridge, refractionScale, refractionStrength, resolveMaterial, resolveOptics, sceneDistance, sceneGradient, sdfRoundedRect, sdfRoundedRectGradient, smin, specularPower, specularStrength, toDeviceSurfaceUniforms, toLensProps, toSurfaceUniforms, touchWarp } from './chunk-V47YU75P.js';
5
5
  export { MAX_BEVEL_FRACTION, MAX_STRETCH, RIM_FRACTION, bevelDp, bevelFraction, capsuleGeometry, circleGeometry, halfMinDp, lensPadDp, morphReachDp, rimDp, roundedRectGeometry, shadowOpacity, shadowOpacityFrom, shadowReachDp, sizeDp, sizeGain, surfacePadDp, thicknessDp } from './chunk-SLRPHDV7.js';
6
6
  import './chunk-MMPK6DCK.js';
7
7
 
@@ -1459,6 +1459,26 @@ function convertEvalCalls(src) {
1459
1459
  out += src.slice(cursor);
1460
1460
  return out;
1461
1461
  }
1462
+ function stripComments(src) {
1463
+ let out = "";
1464
+ let i = 0;
1465
+ while (i < src.length) {
1466
+ if (src.startsWith("//", i)) {
1467
+ const end = src.indexOf("\n", i);
1468
+ i = end < 0 ? src.length : end;
1469
+ } else if (src.startsWith("/*", i)) {
1470
+ const end = src.indexOf("*/", i + 2);
1471
+ if (end < 0) throw new Error("vireglass/targets/glsl: unterminated block comment");
1472
+ const stop = end + 2;
1473
+ out += src.slice(i, stop).replace(/[^\n]/g, "");
1474
+ i = stop;
1475
+ } else {
1476
+ out += src[i];
1477
+ i += 1;
1478
+ }
1479
+ }
1480
+ return out;
1481
+ }
1462
1482
  function convertReturns(mainBody) {
1463
1483
  return mainBody.replace(/\breturn\s+([^;]+);/g, "fragColor = $1; return;");
1464
1484
  }
@@ -1489,7 +1509,7 @@ function addPrologue(src) {
1489
1509
  return "#version 300 es\nprecision highp float;\n\nout vec4 fragColor;\nuniform vec2 u_resolution;\n\n" + src;
1490
1510
  }
1491
1511
  function toGLSL(shaderSource) {
1492
- let out = shaderSource;
1512
+ let out = stripComments(shaderSource);
1493
1513
  out = convertEntryPoint(out);
1494
1514
  out = convertShaderUniforms(out);
1495
1515
  out = convertEvalCalls(out);