/** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ const USER_AGENT = navigator?.userAgent ?? ''; export const IN_CHROME = USER_AGENT.includes('Chrome'); export const IN_SAFARI = USER_AGENT.includes('AppleWebKit') && !IN_CHROME; export const IN_FIREFOX = USER_AGENT.includes('Firefox'); export const EXPORT_IMAGE_WATERMARK_SVG = ` `; /** * safari/firefox 中指定样式表 * 1. 样式计算会导致所有css变量被生成到dom元素中,导致svg过大无法正常序列化 * 2. boxShadow 渲染效果有问题排除掉 */ export const EXPORT_IMAGE_STYLE_PROPERTIES = [ 'width', 'height', 'box-sizing', 'display', 'align-items', 'justify-content', 'font-size', 'gap', 'color', 'background', 'background-color', 'font', 'font-family', 'fill', 'stroke', 'stroke-width', 'margin', 'padding', 'padding-left', 'padding-top', 'padding-bottom', 'padding-right', 'flex-direction', 'filter', 'position', 'top', 'left', 'bottom', 'right', 'content', 'line-height', 'text-decoration', 'border-radius', 'opacity', 'border-right', 'border-left', 'border-width', 'border-style', 'border-color', 'margin-right', 'margin-left', 'margin-top', 'margin-bottom', 'white-space', 'overflow', 'text-overflow', 'font-weight', 'min-width', 'min-height', 'transform', 'z-index', 'flex', 'border-width', 'text-wrap', 'word-break', 'vertical-align', 'aspect-ratio', 'object-fit', 'align-content', 'align-self', 'background-attachment', 'background-clip', 'background-image', 'background-origin', 'background-repeat', 'background-size', 'block-size', 'border-block-end-color', 'border-block-end-style', 'border-block-end-width', 'border-block-start-color', 'border-block-start-style', 'border-block-start-width', 'border-bottom-color', 'border-bottom-style', 'border-bottom-width', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-end-end-radius', 'border-end-start-radius', 'border-inline-end-color', 'border-inline-end-style', 'border-inline-end-width', 'border-inline-start-color', 'border-inline-start-style', 'border-inline-start-width', 'border-right-color', 'border-right-style', 'border-right-width', 'border-start-end-radius', 'border-start-start-radius', 'border-top-color', 'border-top-style', 'border-top-width', 'border-top-left-radius', 'border-top-right-radius', 'flex-basis', 'flex-grow', 'flex-shrink', 'flex-wrap', 'font-kerning', 'font-palette', 'font-stretch', 'font-style', 'inline-size', 'inset-block-end', 'inset-block-start', 'inset-inline-end', 'inset-inline-start', 'justify-items', 'justify-self', 'line-break', 'margin-trim', 'margin-inline-end', 'margin-inline-start', 'min-block-size', 'min-inline-size', 'overflow-wrap', 'overflow-x', 'overflow-y', 'perspective-origin', 'transform-box', 'transform-origin', 'transform-style', 'grid-template', 'grid-template-rows', 'grid-template-columns', 'grid-template-areas', ];