@clypra-studio/engine 1.6.0 → 1.7.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,4 +1,4 @@
1
- import { S as SceneDocument, T as TextTemplate, a as TemplateLayer, L as LayerAnimation, b as TemplateKeyframe, R as ResponsiveAnchorConfig, c as TextStyleSpan, d as TextSplitAnimator, e as TemplateVariableDefinition } from './types-CoshNXmU.js';
1
+ import { S as SceneDocument, T as TextTemplate, a as TemplateLayer, L as LayerAnimation, b as TemplateKeyframe, R as ResponsiveAnchorConfig, c as TextStyleSpan, d as TextSplitAnimator, e as TemplateVariableDefinition } from './types-BsF33bC4.cjs';
2
2
 
3
3
  declare const CANONICAL_SCHEMA_VERSION: 2;
4
4
  declare const CANONICAL_RENDERER_VERSION: "1.4.0";
@@ -192,6 +192,45 @@ interface TemplateTextNodeStyle {
192
192
  letterSpacing?: number;
193
193
  overflow?: "wrap" | "shrink" | "expand-panel" | "clip";
194
194
  verticalAlign?: "top" | "middle" | "bottom";
195
+ strokeColor?: string;
196
+ strokeWidth?: number;
197
+ shadowColor?: string;
198
+ shadowBlur?: number;
199
+ shadowOffsetX?: number;
200
+ shadowOffsetY?: number;
201
+ stroke?: {
202
+ color: string;
203
+ width: number;
204
+ };
205
+ shadow?: {
206
+ color: string;
207
+ blur: number;
208
+ offsetX: number;
209
+ offsetY: number;
210
+ };
211
+ fontId?: string;
212
+ backgroundColor?: string;
213
+ background?: {
214
+ color: string;
215
+ padding: number;
216
+ borderRadius: number;
217
+ };
218
+ }
219
+ interface TemplateCustomization {
220
+ primaryText?: string;
221
+ secondaryText?: string;
222
+ accentText?: string;
223
+ primaryColor?: string;
224
+ secondaryColor?: string;
225
+ layerColors?: Record<string, string>;
226
+ layerFontSizes?: Record<string, number>;
227
+ layerFontWeights?: Record<string, string | number>;
228
+ layerTexts?: Record<string, string>;
229
+ }
230
+ interface ResolveTemplateControlValuesOptions {
231
+ customization?: TemplateCustomization | null;
232
+ templateControlValues?: Record<string, unknown> | null;
233
+ fallbackText?: string;
195
234
  }
196
235
  interface TemplateBackgroundPanel {
197
236
  color?: string;
@@ -235,6 +274,10 @@ interface TemplateTextNode {
235
274
  contentHash: string;
236
275
  snapshot?: unknown;
237
276
  };
277
+ role?: "primary" | "secondary" | "accent" | "none";
278
+ textRole?: "caption" | "title";
279
+ fontId?: string;
280
+ maxWidth?: number;
238
281
  parentId?: string;
239
282
  }
240
283
  interface TemplateShapeNodeStyle {
@@ -488,4 +531,4 @@ type CanonicalRenderInput = {
488
531
  /** Extensible capability registry for all package-owned render semantics. */
489
532
  declare function renderCanonicalToCanvas(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, input: CanonicalRenderInput): CanonicalRenderResult;
490
533
 
491
- export { type TextEffectRenderInput as $, type TemplateControlType as A, type TemplateDependencyManifest as B, type CompiledTextTemplate as C, type TemplateDurationPolicy as D, type EvaluatedTemplateScene as E, type TemplateFontRef as F, type TemplateImageNode as G, type TemplateLayerV2 as H, type TemplateMetadata as I, type TemplateNode as J, type TemplateNodeAnimation as K, type TemplatePreviewArtifacts as L, type TemplatePropertyKeyframes as M, type TemplateProtectedRegion as N, type TemplateRenderTarget as O, type PublishedRevision as P, type TemplateRevision as Q, type RenderPlan as R, type SceneDocumentV2 as S, type TextTemplateArtifact as T, type TemplateShapeNode as U, type TemplateShapeNodeStyle as V, type TemplateStyleRef as W, type TemplateTextNode as X, type TemplateTextNodeStyle as Y, type TemplateTimelineMarker as Z, type TemplateTiming as _, type TemplateRenderContext as a, type TextTemplateCanvas as a0, type TextTemplateClip as a1, type TextTemplateDocument as a2, type TextTemplateDocumentV2 as a3, type TextTemplateFlexLayout as a4, type TextTemplateRenderInput as a5, canonicalContentHash as a6, canonicalizeSceneDocument as a7, evaluateTextEffect as a8, evaluateTextTemplate as a9, getRenderCapabilities as aa, getTextTemplateControls as ab, normalizeTextEffect as ac, normalizeTextTemplate as ad, renderCanonicalToCanvas as ae, renderTextEffectToCanvas as af, renderTextTemplateToCanvas as ag, resolveTemplateFontFamily as ah, resolveTextTemplateArtifact as ai, CANONICAL_RENDERER_VERSION as b, CANONICAL_SCHEMA_VERSION as c, type CanonicalRenderContext as d, type CanonicalRenderInput as e, type CanonicalRenderResult as f, type CapabilityReport as g, type CapabilityStatus as h, type CompiledTemplateRenderLayer as i, type RenderCapability as j, type RenderDiagnostic as k, type RenderDiagnostics as l, type RenderEnvironment as m, type RenderIdentity as n, type RenderTarget as o, TEXT_TEMPLATE_KIND as p, TEXT_TEMPLATE_RENDERER_VERSION as q, TEXT_TEMPLATE_SCHEMA_VERSION as r, type TemplateAssetRef as s, type TemplateBackgroundPanel as t, type TemplateCapabilityReport as u, type TemplateContainerNode as v, type TemplateContainerNodeStyle as w, type TemplateControl as x, type TemplateControlConstraints as y, type TemplateControlOption as z };
534
+ export { type TemplateTimelineMarker as $, type TemplateControlConstraints as A, type TemplateControlOption as B, type CompiledTextTemplate as C, type TemplateControlType as D, type EvaluatedTemplateScene as E, type TemplateDependencyManifest as F, type TemplateDurationPolicy as G, type TemplateFontRef as H, type TemplateImageNode as I, type TemplateLayerV2 as J, type TemplateMetadata as K, type TemplateNode as L, type TemplateNodeAnimation as M, type TemplatePreviewArtifacts as N, type TemplatePropertyKeyframes as O, type PublishedRevision as P, type TemplateProtectedRegion as Q, type RenderPlan as R, type SceneDocumentV2 as S, type TextTemplateArtifact as T, type TemplateRenderTarget as U, type TemplateRevision as V, type TemplateShapeNode as W, type TemplateShapeNodeStyle as X, type TemplateStyleRef as Y, type TemplateTextNode as Z, type TemplateTextNodeStyle as _, type ResolveTemplateControlValuesOptions as a, type TemplateTiming as a0, type TextEffectRenderInput as a1, type TextTemplateCanvas as a2, type TextTemplateClip as a3, type TextTemplateDocument as a4, type TextTemplateDocumentV2 as a5, type TextTemplateFlexLayout as a6, type TextTemplateRenderInput as a7, canonicalContentHash as a8, canonicalizeSceneDocument as a9, evaluateTextEffect as aa, evaluateTextTemplate as ab, getRenderCapabilities as ac, getTextTemplateControls as ad, normalizeTextEffect as ae, normalizeTextTemplate as af, renderCanonicalToCanvas as ag, renderTextEffectToCanvas as ah, renderTextTemplateToCanvas as ai, resolveTemplateFontFamily as aj, resolveTextTemplateArtifact as ak, type TemplateCustomization as b, type TemplateRenderContext as c, CANONICAL_RENDERER_VERSION as d, CANONICAL_SCHEMA_VERSION as e, type CanonicalRenderContext as f, type CanonicalRenderInput as g, type CanonicalRenderResult as h, type CapabilityReport as i, type CapabilityStatus as j, type CompiledTemplateRenderLayer as k, type RenderCapability as l, type RenderDiagnostic as m, type RenderDiagnostics as n, type RenderEnvironment as o, type RenderIdentity as p, type RenderTarget as q, TEXT_TEMPLATE_KIND as r, TEXT_TEMPLATE_RENDERER_VERSION as s, TEXT_TEMPLATE_SCHEMA_VERSION as t, type TemplateAssetRef as u, type TemplateBackgroundPanel as v, type TemplateCapabilityReport as w, type TemplateContainerNode as x, type TemplateContainerNodeStyle as y, type TemplateControl as z };
@@ -1,4 +1,4 @@
1
- import { S as SceneDocument, T as TextTemplate, a as TemplateLayer, L as LayerAnimation, b as TemplateKeyframe, R as ResponsiveAnchorConfig, c as TextStyleSpan, d as TextSplitAnimator, e as TemplateVariableDefinition } from './types-CoshNXmU.cjs';
1
+ import { S as SceneDocument, T as TextTemplate, a as TemplateLayer, L as LayerAnimation, b as TemplateKeyframe, R as ResponsiveAnchorConfig, c as TextStyleSpan, d as TextSplitAnimator, e as TemplateVariableDefinition } from './types-BsF33bC4.js';
2
2
 
3
3
  declare const CANONICAL_SCHEMA_VERSION: 2;
4
4
  declare const CANONICAL_RENDERER_VERSION: "1.4.0";
@@ -192,6 +192,45 @@ interface TemplateTextNodeStyle {
192
192
  letterSpacing?: number;
193
193
  overflow?: "wrap" | "shrink" | "expand-panel" | "clip";
194
194
  verticalAlign?: "top" | "middle" | "bottom";
195
+ strokeColor?: string;
196
+ strokeWidth?: number;
197
+ shadowColor?: string;
198
+ shadowBlur?: number;
199
+ shadowOffsetX?: number;
200
+ shadowOffsetY?: number;
201
+ stroke?: {
202
+ color: string;
203
+ width: number;
204
+ };
205
+ shadow?: {
206
+ color: string;
207
+ blur: number;
208
+ offsetX: number;
209
+ offsetY: number;
210
+ };
211
+ fontId?: string;
212
+ backgroundColor?: string;
213
+ background?: {
214
+ color: string;
215
+ padding: number;
216
+ borderRadius: number;
217
+ };
218
+ }
219
+ interface TemplateCustomization {
220
+ primaryText?: string;
221
+ secondaryText?: string;
222
+ accentText?: string;
223
+ primaryColor?: string;
224
+ secondaryColor?: string;
225
+ layerColors?: Record<string, string>;
226
+ layerFontSizes?: Record<string, number>;
227
+ layerFontWeights?: Record<string, string | number>;
228
+ layerTexts?: Record<string, string>;
229
+ }
230
+ interface ResolveTemplateControlValuesOptions {
231
+ customization?: TemplateCustomization | null;
232
+ templateControlValues?: Record<string, unknown> | null;
233
+ fallbackText?: string;
195
234
  }
196
235
  interface TemplateBackgroundPanel {
197
236
  color?: string;
@@ -235,6 +274,10 @@ interface TemplateTextNode {
235
274
  contentHash: string;
236
275
  snapshot?: unknown;
237
276
  };
277
+ role?: "primary" | "secondary" | "accent" | "none";
278
+ textRole?: "caption" | "title";
279
+ fontId?: string;
280
+ maxWidth?: number;
238
281
  parentId?: string;
239
282
  }
240
283
  interface TemplateShapeNodeStyle {
@@ -488,4 +531,4 @@ type CanonicalRenderInput = {
488
531
  /** Extensible capability registry for all package-owned render semantics. */
489
532
  declare function renderCanonicalToCanvas(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, input: CanonicalRenderInput): CanonicalRenderResult;
490
533
 
491
- export { type TextEffectRenderInput as $, type TemplateControlType as A, type TemplateDependencyManifest as B, type CompiledTextTemplate as C, type TemplateDurationPolicy as D, type EvaluatedTemplateScene as E, type TemplateFontRef as F, type TemplateImageNode as G, type TemplateLayerV2 as H, type TemplateMetadata as I, type TemplateNode as J, type TemplateNodeAnimation as K, type TemplatePreviewArtifacts as L, type TemplatePropertyKeyframes as M, type TemplateProtectedRegion as N, type TemplateRenderTarget as O, type PublishedRevision as P, type TemplateRevision as Q, type RenderPlan as R, type SceneDocumentV2 as S, type TextTemplateArtifact as T, type TemplateShapeNode as U, type TemplateShapeNodeStyle as V, type TemplateStyleRef as W, type TemplateTextNode as X, type TemplateTextNodeStyle as Y, type TemplateTimelineMarker as Z, type TemplateTiming as _, type TemplateRenderContext as a, type TextTemplateCanvas as a0, type TextTemplateClip as a1, type TextTemplateDocument as a2, type TextTemplateDocumentV2 as a3, type TextTemplateFlexLayout as a4, type TextTemplateRenderInput as a5, canonicalContentHash as a6, canonicalizeSceneDocument as a7, evaluateTextEffect as a8, evaluateTextTemplate as a9, getRenderCapabilities as aa, getTextTemplateControls as ab, normalizeTextEffect as ac, normalizeTextTemplate as ad, renderCanonicalToCanvas as ae, renderTextEffectToCanvas as af, renderTextTemplateToCanvas as ag, resolveTemplateFontFamily as ah, resolveTextTemplateArtifact as ai, CANONICAL_RENDERER_VERSION as b, CANONICAL_SCHEMA_VERSION as c, type CanonicalRenderContext as d, type CanonicalRenderInput as e, type CanonicalRenderResult as f, type CapabilityReport as g, type CapabilityStatus as h, type CompiledTemplateRenderLayer as i, type RenderCapability as j, type RenderDiagnostic as k, type RenderDiagnostics as l, type RenderEnvironment as m, type RenderIdentity as n, type RenderTarget as o, TEXT_TEMPLATE_KIND as p, TEXT_TEMPLATE_RENDERER_VERSION as q, TEXT_TEMPLATE_SCHEMA_VERSION as r, type TemplateAssetRef as s, type TemplateBackgroundPanel as t, type TemplateCapabilityReport as u, type TemplateContainerNode as v, type TemplateContainerNodeStyle as w, type TemplateControl as x, type TemplateControlConstraints as y, type TemplateControlOption as z };
534
+ export { type TemplateTimelineMarker as $, type TemplateControlConstraints as A, type TemplateControlOption as B, type CompiledTextTemplate as C, type TemplateControlType as D, type EvaluatedTemplateScene as E, type TemplateDependencyManifest as F, type TemplateDurationPolicy as G, type TemplateFontRef as H, type TemplateImageNode as I, type TemplateLayerV2 as J, type TemplateMetadata as K, type TemplateNode as L, type TemplateNodeAnimation as M, type TemplatePreviewArtifacts as N, type TemplatePropertyKeyframes as O, type PublishedRevision as P, type TemplateProtectedRegion as Q, type RenderPlan as R, type SceneDocumentV2 as S, type TextTemplateArtifact as T, type TemplateRenderTarget as U, type TemplateRevision as V, type TemplateShapeNode as W, type TemplateShapeNodeStyle as X, type TemplateStyleRef as Y, type TemplateTextNode as Z, type TemplateTextNodeStyle as _, type ResolveTemplateControlValuesOptions as a, type TemplateTiming as a0, type TextEffectRenderInput as a1, type TextTemplateCanvas as a2, type TextTemplateClip as a3, type TextTemplateDocument as a4, type TextTemplateDocumentV2 as a5, type TextTemplateFlexLayout as a6, type TextTemplateRenderInput as a7, canonicalContentHash as a8, canonicalizeSceneDocument as a9, evaluateTextEffect as aa, evaluateTextTemplate as ab, getRenderCapabilities as ac, getTextTemplateControls as ad, normalizeTextEffect as ae, normalizeTextTemplate as af, renderCanonicalToCanvas as ag, renderTextEffectToCanvas as ah, renderTextTemplateToCanvas as ai, resolveTemplateFontFamily as aj, resolveTextTemplateArtifact as ak, type TemplateCustomization as b, type TemplateRenderContext as c, CANONICAL_RENDERER_VERSION as d, CANONICAL_SCHEMA_VERSION as e, type CanonicalRenderContext as f, type CanonicalRenderInput as g, type CanonicalRenderResult as h, type CapabilityReport as i, type CapabilityStatus as j, type CompiledTemplateRenderLayer as k, type RenderCapability as l, type RenderDiagnostic as m, type RenderDiagnostics as n, type RenderEnvironment as o, type RenderIdentity as p, type RenderTarget as q, TEXT_TEMPLATE_KIND as r, TEXT_TEMPLATE_RENDERER_VERSION as s, TEXT_TEMPLATE_SCHEMA_VERSION as t, type TemplateAssetRef as u, type TemplateBackgroundPanel as v, type TemplateCapabilityReport as w, type TemplateContainerNode as x, type TemplateContainerNodeStyle as y, type TemplateControl as z };
package/dist/index.cjs CHANGED
@@ -348,6 +348,7 @@ __export(index_exports, {
348
348
  resolveMediaLayout: () => resolveMediaLayout,
349
349
  resolveNodeForBreakpoint: () => resolveNodeForBreakpoint,
350
350
  resolveSpatialConstraints: () => resolveSpatialConstraints,
351
+ resolveTemplateControlValues: () => resolveTemplateControlValues,
351
352
  resolveTemplateFontFamily: () => resolveTemplateFontFamily,
352
353
  resolveTextTemplateArtifact: () => resolveTextTemplateArtifact,
353
354
  restoreLetterSpacing: () => restoreLetterSpacing,
@@ -551,6 +552,12 @@ var BoundingBoxSchema = import_zod.z.object({
551
552
  mode: import_zod.z.enum(["ink", "panel"]).optional()
552
553
  });
553
554
  var EffectFullDefinitionSchema = EffectIndexItemSchema.extend({
555
+ schemaVersion: import_zod.z.number().optional(),
556
+ revisionId: import_zod.z.string().optional(),
557
+ contentHash: import_zod.z.string().optional(),
558
+ rendererVersion: import_zod.z.string().optional(),
559
+ revision: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
560
+ scene: import_zod.z.any().optional(),
554
561
  version: import_zod.z.string().optional(),
555
562
  description: import_zod.z.string(),
556
563
  tags: import_zod.z.array(import_zod.z.string()),
@@ -13753,7 +13760,26 @@ function legacyLayerToNode(layer2, index) {
13753
13760
  lineHeight: resolveNumericProperty(text?.lineHeight, 1.2),
13754
13761
  letterSpacing: resolveNumericProperty(text?.letterSpacing, 0),
13755
13762
  overflow: text?.overflow,
13756
- verticalAlign: text?.verticalAlign
13763
+ verticalAlign: text?.verticalAlign,
13764
+ strokeColor: text?.stroke?.color ?? text?.strokeColor ? resolveStringProperty(text?.stroke?.color ?? text?.strokeColor, "#000000") : void 0,
13765
+ strokeWidth: text?.stroke?.width ?? text?.strokeWidth ? resolveNumericProperty(text?.stroke?.width ?? text?.strokeWidth, 0) : void 0,
13766
+ shadowColor: text?.shadow?.color ?? text?.shadowColor ? resolveStringProperty(text?.shadow?.color ?? text?.shadowColor, "#000000") : void 0,
13767
+ shadowBlur: text?.shadow?.blur ?? text?.shadowBlur ? resolveNumericProperty(text?.shadow?.blur ?? text?.shadowBlur, 0) : void 0,
13768
+ shadowOffsetX: text?.shadow?.offsetX ?? text?.shadowOffsetX ? resolveNumericProperty(text?.shadow?.offsetX ?? text?.shadowOffsetX, 0) : void 0,
13769
+ shadowOffsetY: text?.shadow?.offsetY ?? text?.shadowOffsetY ? resolveNumericProperty(text?.shadow?.offsetY ?? text?.shadowOffsetY, 0) : void 0,
13770
+ stroke: text?.stroke ? {
13771
+ color: resolveStringProperty(text.stroke.color, "#000000"),
13772
+ width: resolveNumericProperty(text.stroke.width, 1)
13773
+ } : void 0,
13774
+ shadow: text?.shadow ? {
13775
+ color: resolveStringProperty(text.shadow.color, "#000000"),
13776
+ blur: resolveNumericProperty(text.shadow.blur, 0),
13777
+ offsetX: resolveNumericProperty(text.shadow.offsetX, 0),
13778
+ offsetY: resolveNumericProperty(text.shadow.offsetY, 0)
13779
+ } : void 0,
13780
+ fontId: text?.fontId || layer2?.fontId ? resolveStringProperty(text?.fontId ?? layer2?.fontId, "") : void 0,
13781
+ backgroundColor: text?.backgroundColor || layer2?.backgroundColor ? resolveStringProperty(text?.backgroundColor ?? layer2?.backgroundColor, "") : void 0,
13782
+ background: text?.background || layer2?.background ? clone2(text?.background ?? layer2?.background) : void 0
13757
13783
  },
13758
13784
  backgroundPanel: text?.backgroundColor || text?.backgroundPanel ? {
13759
13785
  color: text?.backgroundPanel?.color ?? text?.backgroundColor ? resolveStringProperty(
@@ -13798,9 +13824,10 @@ function legacyLayerToNode(layer2, index) {
13798
13824
  charFillColors: Array.isArray(text?.charFillColors) ? clone2(text.charFillColors) : void 0,
13799
13825
  splitAnimator: text?.splitAnimator ? clone2(text.splitAnimator) : void 0,
13800
13826
  textEffectRef: text?.styleRef ? clone2(text.styleRef) : void 0,
13801
- // Kept as optional metadata for compatibility with role-based editor
13802
- // customizations. The canonical renderer does not depend on roles.
13803
- ...layer2?.role ? { role: String(layer2.role) } : {}
13827
+ role: layer2?.role || text?.role || text?.textRole ? String(layer2?.role ?? text?.role ?? text?.textRole) : void 0,
13828
+ textRole: text?.textRole || (layer2?.role === "primary" || layer2?.role === "secondary" ? "title" : void 0),
13829
+ fontId: text?.fontId || layer2?.fontId ? resolveStringProperty(text?.fontId ?? layer2?.fontId, "") : void 0,
13830
+ maxWidth: resolveNumericProperty(text?.maxWidth ?? layer2?.maxWidth, 0) || void 0
13804
13831
  };
13805
13832
  }
13806
13833
  function inferControls(nodes) {
@@ -13955,6 +13982,51 @@ function normalizeTextTemplateArtifact(input) {
13955
13982
  } : void 0
13956
13983
  };
13957
13984
  }
13985
+ function resolveTemplateControlValues(artifact, optionsOrCustomization, fallbackText) {
13986
+ if (!artifact?.controls) return {};
13987
+ const options = optionsOrCustomization && ("customization" in optionsOrCustomization || "templateControlValues" in optionsOrCustomization || "fallbackText" in optionsOrCustomization) ? optionsOrCustomization : {
13988
+ customization: optionsOrCustomization,
13989
+ fallbackText
13990
+ };
13991
+ const customization = options.customization;
13992
+ const existingValues = options.templateControlValues;
13993
+ const targetFallbackText = options.fallbackText;
13994
+ const firstTextNode = artifact.document?.nodes?.find(
13995
+ (candidate) => candidate.type === "text"
13996
+ );
13997
+ const values = { ...existingValues || {} };
13998
+ for (const control of artifact.controls) {
13999
+ if (control.type !== "text" && control.type !== "color") continue;
14000
+ const node = artifact.document?.nodes?.find(
14001
+ (candidate) => candidate.id === control.target.nodeId
14002
+ );
14003
+ const role = node?.role || "";
14004
+ const labelLower = (control.label || "").toLowerCase();
14005
+ if (control.type === "text") {
14006
+ const explicitText = customization?.layerTexts?.[control.target.nodeId];
14007
+ let roleText;
14008
+ if (role === "primary" || labelLower.includes("primary")) {
14009
+ roleText = customization?.primaryText;
14010
+ } else if (role === "secondary" || labelLower.includes("secondary")) {
14011
+ roleText = customization?.secondaryText;
14012
+ } else if (role === "accent" || labelLower.includes("accent")) {
14013
+ roleText = customization?.accentText;
14014
+ }
14015
+ const firstNodeFallback = targetFallbackText !== void 0 && firstTextNode && control.target.nodeId === firstTextNode.id ? targetFallbackText : void 0;
14016
+ values[control.id] = explicitText ?? roleText ?? firstNodeFallback ?? values[control.id] ?? control.defaultValue;
14017
+ } else if (control.type === "color") {
14018
+ const explicitColor = customization?.layerColors?.[control.target.nodeId];
14019
+ let roleColor;
14020
+ if (role === "secondary" || labelLower.includes("secondary")) {
14021
+ roleColor = customization?.secondaryColor;
14022
+ } else {
14023
+ roleColor = customization?.primaryColor;
14024
+ }
14025
+ values[control.id] = explicitColor ?? roleColor ?? values[control.id] ?? control.defaultValue;
14026
+ }
14027
+ }
14028
+ return values;
14029
+ }
13958
14030
 
13959
14031
  // src/textTemplates/validator.ts
13960
14032
  var MAX_NODES = 500;
@@ -14510,6 +14582,25 @@ function letterSpacedText(ctx, text, x, y, maxWidth, letterSpacing) {
14510
14582
  }
14511
14583
  ctx.textAlign = align;
14512
14584
  }
14585
+ function letterSpacedStrokeText(ctx, text, x, y, maxWidth, letterSpacing) {
14586
+ if (!letterSpacing) {
14587
+ ctx.strokeText(text, x, y, maxWidth);
14588
+ return;
14589
+ }
14590
+ const glyphs = Array.from(text);
14591
+ const widths = glyphs.map((glyph) => ctx.measureText(glyph).width);
14592
+ const total = widths.reduce((sum, value) => sum + value, 0) + Math.max(0, glyphs.length - 1) * letterSpacing;
14593
+ const align = ctx.textAlign;
14594
+ let cursor = x;
14595
+ if (align === "center") cursor -= total / 2;
14596
+ if (align === "right") cursor -= total;
14597
+ ctx.textAlign = "left";
14598
+ for (let index = 0; index < glyphs.length; index += 1) {
14599
+ ctx.strokeText(glyphs[index], cursor, y);
14600
+ cursor += widths[index] + letterSpacing;
14601
+ }
14602
+ ctx.textAlign = align;
14603
+ }
14513
14604
  var FONT_ALIAS_MAP = {
14514
14605
  "inter": "Inter Variable",
14515
14606
  "inter variable": "Inter Variable",
@@ -14564,6 +14655,17 @@ function drawTextLayer(ctx, layer2, style) {
14564
14655
  ctx.fillStyle = cssColor(style.textColor, "#FFFFFF");
14565
14656
  ctx.textAlign = style.textAlign ?? "left";
14566
14657
  ctx.textBaseline = style.verticalAlign === "top" ? "top" : style.verticalAlign === "bottom" ? "bottom" : "middle";
14658
+ const shadowColor = style.shadow?.color ?? style.shadowColor;
14659
+ const shadowBlur = finite2(style.shadow?.blur ?? style.shadowBlur, 0);
14660
+ const shadowOffsetX = finite2(style.shadow?.offsetX ?? style.shadowOffsetX, 0);
14661
+ const shadowOffsetY = finite2(style.shadow?.offsetY ?? style.shadowOffsetY, 0);
14662
+ const hasShadow = !!shadowColor && (shadowBlur > 0 || shadowOffsetX !== 0 || shadowOffsetY !== 0);
14663
+ if (hasShadow) {
14664
+ ctx.shadowColor = cssColor(shadowColor, "#000000");
14665
+ ctx.shadowBlur = shadowBlur;
14666
+ ctx.shadowOffsetX = shadowOffsetX;
14667
+ ctx.shadowOffsetY = shadowOffsetY;
14668
+ }
14567
14669
  const lineHeight = fontSize * finite2(style.lineHeight, 1.2);
14568
14670
  const maxWidth = Math.max(1, layer2.width);
14569
14671
  const lines = style.overflow === "wrap" ? wrapText(ctx, text, maxWidth) : [text];
@@ -14573,6 +14675,22 @@ function drawTextLayer(ctx, layer2, style) {
14573
14675
  for (let index = 0; index < lines.length; index += 1) {
14574
14676
  letterSpacedText(ctx, lines[index], anchorX, startY + index * lineHeight, maxWidth, finite2(style.letterSpacing, 0));
14575
14677
  }
14678
+ if (hasShadow) {
14679
+ ctx.shadowColor = "transparent";
14680
+ ctx.shadowBlur = 0;
14681
+ ctx.shadowOffsetX = 0;
14682
+ ctx.shadowOffsetY = 0;
14683
+ }
14684
+ const strokeColor = style.stroke?.color ?? style.strokeColor;
14685
+ const strokeWidth = finite2(style.stroke?.width ?? style.strokeWidth, 0);
14686
+ if (strokeWidth > 0 && strokeColor) {
14687
+ ctx.strokeStyle = cssColor(strokeColor, "#000000");
14688
+ ctx.lineWidth = strokeWidth;
14689
+ ctx.lineJoin = "round";
14690
+ for (let index = 0; index < lines.length; index += 1) {
14691
+ letterSpacedStrokeText(ctx, lines[index], anchorX, startY + index * lineHeight, maxWidth, finite2(style.letterSpacing, 0));
14692
+ }
14693
+ }
14576
14694
  }
14577
14695
  function drawSplitTextLayer(ctx, layer2, style, animator, progress) {
14578
14696
  const text = layer2.text ?? "";
@@ -25730,6 +25848,7 @@ var VERSION = "1.4.0";
25730
25848
  resolveMediaLayout,
25731
25849
  resolveNodeForBreakpoint,
25732
25850
  resolveSpatialConstraints,
25851
+ resolveTemplateControlValues,
25733
25852
  resolveTemplateFontFamily,
25734
25853
  resolveTextTemplateArtifact,
25735
25854
  restoreLetterSpacing,