(meta: Omit<BackgroundConfigType, "display:name">, defaultOpacity: number = null)
| 70 | } |
| 71 | |
| 72 | export function computeBgStyleFromMeta(meta: Omit<BackgroundConfigType, "display:name">, defaultOpacity: number = null): React.CSSProperties { |
| 73 | const bgAttr = meta?.["bg"]; |
| 74 | if (isBlank(bgAttr)) { |
| 75 | return null; |
| 76 | } |
| 77 | try { |
| 78 | const processedBg = processBackgroundUrls(bgAttr); |
| 79 | const rtn: React.CSSProperties = {}; |
| 80 | rtn.background = processedBg; |
| 81 | rtn.opacity = boundNumber(meta["bg:opacity"], 0, 1) ?? defaultOpacity; |
| 82 | if (!isBlank(meta?.["bg:blendmode"])) { |
| 83 | rtn.backgroundBlendMode = meta["bg:blendmode"]; |
| 84 | } |
| 85 | return rtn; |
| 86 | } catch (e) { |
| 87 | console.error("error processing background", e); |
| 88 | return null; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | export function formatRemoteUri(path: string, connection: string): string { |
| 93 | connection = connection ?? "local"; |
no test coverage detected