shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$text_html$utils$textStyleToCSS = function(global, require, module, exports) { function dropShadowToCSS(dropShadowStyle) { dropShadowStyle = {...dropShadowStyle}; const color = Color.Color.shared.setValue(dropShadowStyle.color).setAlpha(dropShadowStyle.alpha ?? 1).toHexa(), position = `${Math.round(Math.cos(dropShadowStyle.angle) * dropShadowStyle.distance)}px ${Math.round(Math.sin(dropShadowStyle.angle) * dropShadowStyle.distance)}px`; return 0 < dropShadowStyle.blur ? `text-shadow: ${position} ${dropShadowStyle.blur}px ${color}` : `text-shadow: ${position} ${color}`; } function strokeToCSS(stroke) { const color = Color.Color.shared.setValue(stroke.color).setAlpha(stroke.alpha ?? 1).toHexa(); return [`-webkit-text-stroke-width: ${stroke.width}px`, `-webkit-text-stroke-color: ${color}`, `text-stroke-width: ${stroke.width}px`, `text-stroke-color: ${color}`, "paint-order: stroke"].join(";"); } var Color = require("module$node_modules$pixi_DOT_js$lib$color$Color"), TextStyle = require("module$node_modules$pixi_DOT_js$lib$scene$text$TextStyle"); "use strict"; const templates = {fontSize:"font-size: {{VALUE}}px", fontFamily:"font-family: {{VALUE}}", fontWeight:"font-weight: {{VALUE}}", fontStyle:"font-style: {{VALUE}}", fontVariant:"font-variant: {{VALUE}}", letterSpacing:"letter-spacing: {{VALUE}}px", align:"text-align: {{VALUE}}", padding:"padding: {{VALUE}}px", whiteSpace:"white-space: {{VALUE}}", lineHeight:"line-height: {{VALUE}}px", wordWrapWidth:"max-width: {{VALUE}}px"}, transform = {fill:value => `color: ${Color.Color.shared.setValue(value).toHexa()}`, breakWords:value => `word-break: ${value ? "break-all" : "normal"}`, stroke:strokeToCSS, dropShadow:value => !0 === value ? dropShadowToCSS(TextStyle.TextStyle.defaultDropShadow) : value && "object" === typeof value ? dropShadowToCSS({...TextStyle.TextStyle.defaultDropShadow, ...value}) : ""}; exports.textStyleToCSS = function(style) { var stroke = style._stroke, fill = style._fill; stroke = [`div { ${[`color: ${Color.Color.shared.setValue(fill.color).setAlpha(fill.alpha ?? 1).toHexa()}`, `font-size: ${style.fontSize}px`, `font-family: ${style.fontFamily}`, `font-weight: ${style.fontWeight}`, `font-style: ${style.fontStyle}`, `font-variant: ${style.fontVariant}`, `letter-spacing: ${style.letterSpacing}px`, `text-align: ${style.align}`, `padding: ${style.padding}px`, `white-space: ${"pre" === style.whiteSpace && style.wordWrap ? "pre-wrap" : style.whiteSpace}`, ...(style.lineHeight ? [`line-height: ${style.lineHeight}px`] : []), ...(style.wordWrap ? [`word-break: ${style.breakWords ? "break-word" : "normal"}`, `max-width: ${style.wordWrapWidth}px`] : []), ...(stroke ? [strokeToCSS(stroke)] : []), ...(style.dropShadow ? [dropShadowToCSS(style.dropShadow)] : []), ...style.cssOverrides].join(";")} }`]; style = style.tagStyles; for (const i in style) { fill = style[i]; const cssTagStyle = []; for (const j in fill) { transform[j] ? cssTagStyle.push(transform[j](fill[j])) : templates[j] && cssTagStyle.push(templates[j].replace("{{VALUE}}", fill[j])); } stroke.push(`${i} { ${cssTagStyle.join(";")} }`); } return stroke.join(" "); }; }; //# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$text_html$utils$textStyleToCSS.js.map