rn-web-cli
Version:
React Native for Web
1 lines • 5.01 kB
Source Map (JSON)
{"version":3,"sources":["node_modules\\react-dom\\lib\\dangerousStyleValue.js"],"names":["CSSProperty","require","warning","isUnitlessNumber","styleWarnings","dangerousStyleValue","name","value","component","isCustomProperty","isEmpty","isNonNumeric","isNaN","hasOwnProperty","process","env","NODE_ENV","owner","_currentElement","_owner","ownerName","getName","warned","warnings","type","trim","module","exports"],"mappings":";;;;;;;;;;AAUA;;AAEA,GAAIA,aAAcC,QAAQ,eAAR,CAAlB;AACA,GAAIC,SAAUD,QAAQ,kBAAR,CAAd;;AAEA,GAAIE,kBAAmBH,YAAYG,gBAAnC;AACA,GAAIC,eAAgB,EAApB;;;;;;;;;;;;AAYA,QAASC,oBAAT,CAA6BC,IAA7B,CAAmCC,KAAnC,CAA0CC,SAA1C,CAAqDC,gBAArD,CAAuE;;;;;;;;;;;AAWrE,GAAIC,SAAUH,OAAS,IAAT,EAAiB,MAAOA,MAAP,GAAiB,SAAlC,EAA+CA,QAAU,EAAvE;AACA,GAAIG,OAAJ,CAAa;AACX,MAAO,EAAP;AACD;;AAED,GAAIC,cAAeC,MAAML,KAAN,CAAnB;AACA,GAAIE,kBAAoBE,YAApB,EAAoCJ,QAAU,CAA9C,EAAmDJ,iBAAiBU,cAAjB,CAAgCP,IAAhC,GAAyCH,iBAAiBG,IAAjB,CAAhG,CAAwH;AACtH,MAAO,GAAKC,KAAZ;AACD;;AAED,GAAI,MAAOA,MAAP,GAAiB,QAArB,CAA+B;AAC7B,GAAIO,QAAQC,GAAR,CAAYC,QAAZ,GAAyB,YAA7B,CAA2C;;;AAGzC,GAAIR,WAAaD,QAAU,GAA3B,CAAgC;AAC9B,GAAIU,OAAQT,UAAUU,eAAV,CAA0BC,MAAtC;AACA,GAAIC,WAAYH,MAAQA,MAAMI,OAAN,EAAR,CAA0B,IAA1C;AACA,GAAID,WAAa,CAAChB,cAAcgB,SAAd,CAAlB,CAA4C;AAC1ChB,cAAcgB,SAAd,EAA2B,EAA3B;AACD;AACD,GAAIE,QAAS,KAAb;AACA,GAAIF,SAAJ,CAAe;AACb,GAAIG,UAAWnB,cAAcgB,SAAd,CAAf;AACAE,OAASC,SAASjB,IAAT,CAAT;AACA,GAAI,CAACgB,MAAL,CAAa;AACXC,SAASjB,IAAT,EAAiB,IAAjB;AACD;AACF;AACD,GAAI,CAACgB,MAAL,CAAa;AACXR,QAAQC,GAAR,CAAYC,QAAZ,GAAyB,YAAzB,CAAwCd,QAAQ,KAAR,CAAe,8DAAgE,4DAAhE,CAA+H,oDAA9I,CAAoMM,UAAUU,eAAV,CAA0BM,IAA9N,CAAoOJ,WAAa,SAAjP,CAA4Pd,IAA5P,CAAkQC,KAAlQ,CAAxC,CAAmT,IAAK,EAAxT;AACD;AACF;AACF;AACDA,MAAQA,MAAMkB,IAAN,EAAR;AACD;AACD,MAAOlB,OAAQ,IAAf;AACD;;AAEDmB,OAAOC,OAAP,CAAiBtB,mBAAjB","file":"dangerousStyleValue.js","sourceRoot":"d:/Work/Office/react-native-on-web/cli/tmpl/project","sourcesContent":["/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\nvar CSSProperty = require('./CSSProperty');\nvar warning = require('fbjs/lib/warning');\n\nvar isUnitlessNumber = CSSProperty.isUnitlessNumber;\nvar styleWarnings = {};\n\n/**\n * Convert a value into the proper css writable value. The style name `name`\n * should be logical (no hyphens), as specified\n * in `CSSProperty.isUnitlessNumber`.\n *\n * @param {string} name CSS property name such as `topMargin`.\n * @param {*} value CSS property value such as `10px`.\n * @param {ReactDOMComponent} component\n * @return {string} Normalized style value with dimensions applied.\n */\nfunction dangerousStyleValue(name, value, component, isCustomProperty) {\n // Note that we've removed escapeTextForBrowser() calls here since the\n // whole string will be escaped when the attribute is injected into\n // the markup. If you provide unsafe user data here they can inject\n // arbitrary CSS which may be problematic (I couldn't repro this):\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet\n // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/\n // This is not an XSS hole but instead a potential CSS injection issue\n // which has lead to a greater discussion about how we're going to\n // trust URLs moving forward. See #2115901\n\n var isEmpty = value == null || typeof value === 'boolean' || value === '';\n if (isEmpty) {\n return '';\n }\n\n var isNonNumeric = isNaN(value);\n if (isCustomProperty || isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {\n return '' + value; // cast to string\n }\n\n if (typeof value === 'string') {\n if (process.env.NODE_ENV !== 'production') {\n // Allow '0' to pass through without warning. 0 is already special and\n // doesn't require units, so we don't need to warn about it.\n if (component && value !== '0') {\n var owner = component._currentElement._owner;\n var ownerName = owner ? owner.getName() : null;\n if (ownerName && !styleWarnings[ownerName]) {\n styleWarnings[ownerName] = {};\n }\n var warned = false;\n if (ownerName) {\n var warnings = styleWarnings[ownerName];\n warned = warnings[name];\n if (!warned) {\n warnings[name] = true;\n }\n }\n if (!warned) {\n process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;\n }\n }\n }\n value = value.trim();\n }\n return value + 'px';\n}\n\nmodule.exports = dangerousStyleValue;"]}