@clypra-studio/engine 1.10.2 → 2.2.0

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.
@@ -1,2 +1,2 @@
1
- export { B as BubbleAppearance, d as BubbleAssetDefinition, e as BubblePathCommand, f as BubbleRenderMode, g as BubbleRenderOptions, h as BubbleShape, i as BubbleTailPosition, j as BubbleTailSide, k as BubbleTexture, l as CANONICAL_RENDERER_VERSION, n as CanonicalRenderContext, o as CanonicalRenderInput, p as CanonicalRenderResult, F as FreeformBubbleDefinition, P as ParametricBubbleDefinition, u as RenderCapability, w as RenderDiagnostics, x as RenderEnvironment, y as RenderIdentity, D as TEXT_TEMPLATE_RENDERER_VERSION, ac as TextBubbleCategory, ad as TextBubbleLayout, ae as TextBubblePadding, af as TextBubblePreset, ag as TextEffectRenderInput, am as TextTemplateRenderInput, ap as compileBubblePath, aq as compileBubbleSvg, ar as createBubbleAssetDefinition, as as createFreeformBubbleAssetDefinition, at as drawChalkSpeechBubble, au as drawComicBurst, av as drawRibbonBanner, aw as drawSpeechBubble, ax as drawThoughtCloud, ay as drawTornPaper, aC as getTextTemplateControls, aF as pseudoNoise, aG as renderBubbleAssetDefinition, aH as renderBubbleBackground, aI as renderBubblePresetBackground, aJ as renderCanonicalToCanvas, aK as renderTextEffectToCanvas, aL as renderTextTemplateToCanvas, aM as resolveBubbleLayout, aN as resolveTemplateFontFamily, aO as resolveTextTemplateArtifact, aP as validateBubbleAssetDefinition } from '../index-9XU-qEO-.cjs';
1
+ export { B as BubbleAppearance, d as BubbleAssetDefinition, e as BubblePathCommand, f as BubbleRenderMode, g as BubbleRenderOptions, h as BubbleShape, i as BubbleTailPosition, j as BubbleTailSide, k as BubbleTexture, l as CANONICAL_RENDERER_VERSION, n as CanonicalRenderContext, o as CanonicalRenderInput, p as CanonicalRenderResult, F as FreeformBubbleDefinition, P as ParametricBubbleDefinition, u as RenderCapability, w as RenderDiagnostics, x as RenderEnvironment, y as RenderIdentity, D as TEXT_TEMPLATE_RENDERER_VERSION, ag as TextBubbleCategory, ah as TextBubbleLayout, ai as TextBubblePadding, aj as TextBubblePreset, ak as TextEffectRenderInput, aq as TextTemplateRenderInput, at as compileBubblePath, au as compileBubbleSvg, av as createBubbleAssetDefinition, aw as createFreeformBubbleAssetDefinition, ax as drawChalkSpeechBubble, ay as drawComicBurst, az as drawRibbonBanner, aA as drawSpeechBubble, aB as drawThoughtCloud, aC as drawTornPaper, aG as getTextTemplateControls, aJ as pseudoNoise, aK as renderBubbleAssetDefinition, aL as renderBubbleBackground, aM as renderBubblePresetBackground, aN as renderCanonicalToCanvas, aO as renderTextEffectToCanvas, aP as renderTextTemplateToCanvas, aQ as resolveBubbleLayout, aR as resolveTemplateFontFamily, aS as resolveTextTemplateArtifact, aT as validateBubbleAssetDefinition } from '../index-Nn5el7W0.cjs';
2
2
  import '../types-BsF33bC4.cjs';
@@ -1,2 +1,2 @@
1
- export { B as BubbleAppearance, d as BubbleAssetDefinition, e as BubblePathCommand, f as BubbleRenderMode, g as BubbleRenderOptions, h as BubbleShape, i as BubbleTailPosition, j as BubbleTailSide, k as BubbleTexture, l as CANONICAL_RENDERER_VERSION, n as CanonicalRenderContext, o as CanonicalRenderInput, p as CanonicalRenderResult, F as FreeformBubbleDefinition, P as ParametricBubbleDefinition, u as RenderCapability, w as RenderDiagnostics, x as RenderEnvironment, y as RenderIdentity, D as TEXT_TEMPLATE_RENDERER_VERSION, ac as TextBubbleCategory, ad as TextBubbleLayout, ae as TextBubblePadding, af as TextBubblePreset, ag as TextEffectRenderInput, am as TextTemplateRenderInput, ap as compileBubblePath, aq as compileBubbleSvg, ar as createBubbleAssetDefinition, as as createFreeformBubbleAssetDefinition, at as drawChalkSpeechBubble, au as drawComicBurst, av as drawRibbonBanner, aw as drawSpeechBubble, ax as drawThoughtCloud, ay as drawTornPaper, aC as getTextTemplateControls, aF as pseudoNoise, aG as renderBubbleAssetDefinition, aH as renderBubbleBackground, aI as renderBubblePresetBackground, aJ as renderCanonicalToCanvas, aK as renderTextEffectToCanvas, aL as renderTextTemplateToCanvas, aM as resolveBubbleLayout, aN as resolveTemplateFontFamily, aO as resolveTextTemplateArtifact, aP as validateBubbleAssetDefinition } from '../index-Qc3rcMrW.js';
1
+ export { B as BubbleAppearance, d as BubbleAssetDefinition, e as BubblePathCommand, f as BubbleRenderMode, g as BubbleRenderOptions, h as BubbleShape, i as BubbleTailPosition, j as BubbleTailSide, k as BubbleTexture, l as CANONICAL_RENDERER_VERSION, n as CanonicalRenderContext, o as CanonicalRenderInput, p as CanonicalRenderResult, F as FreeformBubbleDefinition, P as ParametricBubbleDefinition, u as RenderCapability, w as RenderDiagnostics, x as RenderEnvironment, y as RenderIdentity, D as TEXT_TEMPLATE_RENDERER_VERSION, ag as TextBubbleCategory, ah as TextBubbleLayout, ai as TextBubblePadding, aj as TextBubblePreset, ak as TextEffectRenderInput, aq as TextTemplateRenderInput, at as compileBubblePath, au as compileBubbleSvg, av as createBubbleAssetDefinition, aw as createFreeformBubbleAssetDefinition, ax as drawChalkSpeechBubble, ay as drawComicBurst, az as drawRibbonBanner, aA as drawSpeechBubble, aB as drawThoughtCloud, aC as drawTornPaper, aG as getTextTemplateControls, aJ as pseudoNoise, aK as renderBubbleAssetDefinition, aL as renderBubbleBackground, aM as renderBubblePresetBackground, aN as renderCanonicalToCanvas, aO as renderTextEffectToCanvas, aP as renderTextTemplateToCanvas, aQ as resolveBubbleLayout, aR as resolveTemplateFontFamily, aS as resolveTextTemplateArtifact, aT as validateBubbleAssetDefinition } from '../index-BRT37RMX.js';
2
2
  import '../types-BsF33bC4.js';
@@ -23,8 +23,8 @@ import {
23
23
  resolveTemplateFontFamily,
24
24
  resolveTextTemplateArtifact,
25
25
  validateBubbleAssetDefinition
26
- } from "../chunk-ZV3RQAUJ.js";
27
- import "../chunk-YBOYDQU5.js";
26
+ } from "../chunk-3AVGIISI.js";
27
+ import "../chunk-4AT7MAXU.js";
28
28
  export {
29
29
  CANONICAL_RENDERER_VERSION,
30
30
  TEXT_TEMPLATE_RENDERER_VERSION,
@@ -376,6 +376,10 @@ function hexToRgb(hex) {
376
376
  b: parseInt(result[3], 16)
377
377
  } : { r: 255, g: 255, b: 255 };
378
378
  }
379
+ function hexToRgba(hex, alpha) {
380
+ const rgb = hexToRgb(hex);
381
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha})`;
382
+ }
379
383
 
380
384
  // src/renderer.ts
381
385
  function getCanvas2DContext(canvas) {
@@ -532,9 +536,11 @@ function renderTextEffectCore(ctx, cfg) {
532
536
  };
533
537
  const renderWithShadowTrick = (mode, sColor, sBlur, sOffsetX, sOffsetY, opacity, overrideStyle = "#000", spread = 0) => {
534
538
  ctx.save();
535
- ctx.globalAlpha = opacity / 100;
539
+ const normalizedOpacity = Math.max(0, Math.min(100, opacity)) / 100;
540
+ const shadowColor2 = /^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(sColor) ? hexToRgba(sColor, normalizedOpacity) : sColor;
541
+ ctx.globalAlpha = /^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(sColor) ? 1 : normalizedOpacity;
536
542
  const shiftX = 1e4;
537
- ctx.shadowColor = sColor;
543
+ ctx.shadowColor = shadowColor2;
538
544
  ctx.shadowBlur = sBlur;
539
545
  ctx.shadowOffsetX = shiftX + sOffsetX;
540
546
  ctx.shadowOffsetY = sOffsetY;