PromoCursed/node_modules/.cache/babel-loader/e6989383cbe95047432fa1cf74d0d481c9880dac03702119ff8f995b564ac0c3.json

1 line
5.5 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import * as React from 'react';\nimport { getStyleStr } from './utils';\n/**\n * Base size of the canvas, 1 for parallel layout and 2 for alternate layout\n * Only alternate layout is currently supported\n */\nexport const BaseSize = 2;\nexport const FontGap = 3;\n// Prevent external hidden elements from adding accent styles\nconst emphasizedStyle = {\n visibility: 'visible !important'\n};\nexport default function useWatermark(markStyle) {\n const [watermarkMap] = React.useState(() => new Map());\n const appendWatermark = (base64Url, markWidth, container) => {\n if (container) {\n if (!watermarkMap.get(container)) {\n const newWatermarkEle = document.createElement('div');\n watermarkMap.set(container, newWatermarkEle);\n }\n const watermarkEle = watermarkMap.get(container);\n watermarkEle.setAttribute('style', getStyleStr(Object.assign(Object.assign(Object.assign({}, markStyle), {\n backgroundImage: `url('${base64Url}')`,\n backgroundSize: `${Math.floor(markWidth)}px`\n }), emphasizedStyle)));\n // Prevents using the browser `Hide Element` to hide watermarks\n watermarkEle.removeAttribute('class');\n if (watermarkEle.parentElement !== container) {\n container.append(watermarkEle);\n }\n }\n return watermarkMap.get(container);\n };\n const removeWatermark = container => {\n const watermarkEle = watermarkMap.get(container);\n if (watermarkEle && container) {\n container.removeChild(watermarkEle);\n }\n watermarkMap.delete(container);\n };\n const isWatermarkEle = ele => Array.from(watermarkMap.values()).includes(ele);\n return [appendWatermark, removeWatermark, isWatermarkEle];\n}","map":{"version":3,"names":["React","getStyleStr","BaseSize","FontGap","emphasizedStyle","visibility","useWatermark","markStyle","watermarkMap","useState","Map","appendWatermark","base64Url","markWidth","container","get","newWatermarkEle","document","createElement","set","watermarkEle","setAttribute","Object","assign","backgroundImage","backgroundSize","Math","floor","removeAttribute","parentElement","append","removeWatermark","removeChild","delete","isWatermarkEle","ele","Array","from","values","includes"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/watermark/useWatermark.js"],"sourcesContent":["import * as React from 'react';\nimport { getStyleStr } from './utils';\n/**\n * Base size of the canvas, 1 for parallel layout and 2 for alternate layout\n * Only alternate layout is currently supported\n */\nexport const BaseSize = 2;\nexport const FontGap = 3;\n// Prevent external hidden elements from adding accent styles\nconst emphasizedStyle = {\n visibility: 'visible !important'\n};\nexport default function useWatermark(markStyle) {\n const [watermarkMap] = React.useState(() => new Map());\n const appendWatermark = (base64Url, markWidth, container) => {\n if (container) {\n if (!watermarkMap.get(container)) {\n const newWatermarkEle = document.createElement('div');\n watermarkMap.set(container, newWatermarkEle);\n }\n const watermarkEle = watermarkMap.get(container);\n watermarkEle.setAttribute('style', getStyleStr(Object.assign(Object.assign(Object.assign({}, markStyle), {\n backgroundImage: `url('${base64Url}')`,\n backgroundSize: `${Math.floor(markWidth)}px`\n }), emphasizedStyle)));\n // Prevents using the browser `Hide Element` to hide watermarks\n watermarkEle.removeAttribute('class');\n if (watermarkEle.parentElement !== container) {\n container.append(watermarkEle);\n }\n }\n return watermarkMap.get(container);\n };\n const removeWatermark = container => {\n const watermarkEle = watermarkMap.get(container);\n if (watermarkEle && container) {\n container.removeChild(watermarkEle);\n }\n watermarkMap.delete(container);\n };\n const isWatermarkEle = ele => Array.from(watermarkMap.values()).includes(ele);\n return [appendWatermark, removeWatermark, isWatermarkEle];\n}"],