mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
12 KiB
Plaintext
1 line
12 KiB
Plaintext
{"version":3,"file":"jss-plugin-default-unit.js","sources":["../src/defaultUnits.js","../src/index.js"],"sourcesContent":["// @flow\n\nimport {hasCSSTOMSupport} from 'jss'\n\nexport const px: string | Function = hasCSSTOMSupport && CSS ? CSS.px : 'px'\nexport const ms: string | Function = hasCSSTOMSupport && CSS ? CSS.ms : 'ms'\nexport const percent: string | Function = hasCSSTOMSupport && CSS ? CSS.percent : '%'\n\n/**\n * Generated jss-plugin-default-unit CSS property units\n *\n * @type object\n */\nexport default {\n // Animation properties\n 'animation-delay': ms,\n 'animation-duration': ms,\n\n // Background properties\n 'background-position': px,\n 'background-position-x': px,\n 'background-position-y': px,\n 'background-size': px,\n\n // Border Properties\n border: px,\n 'border-bottom': px,\n 'border-bottom-left-radius': px,\n 'border-bottom-right-radius': px,\n 'border-bottom-width': px,\n 'border-left': px,\n 'border-left-width': px,\n 'border-radius': px,\n 'border-right': px,\n 'border-right-width': px,\n 'border-top': px,\n 'border-top-left-radius': px,\n 'border-top-right-radius': px,\n 'border-top-width': px,\n 'border-width': px,\n 'border-block': px,\n 'border-block-end': px,\n 'border-block-end-width': px,\n 'border-block-start': px,\n 'border-block-start-width': px,\n 'border-block-width': px,\n 'border-inline': px,\n 'border-inline-end': px,\n 'border-inline-end-width': px,\n 'border-inline-start': px,\n 'border-inline-start-width': px,\n 'border-inline-width': px,\n 'border-start-start-radius': px,\n 'border-start-end-radius': px,\n 'border-end-start-radius': px,\n 'border-end-end-radius': px,\n\n // Margin properties\n margin: px,\n 'margin-bottom': px,\n 'margin-left': px,\n 'margin-right': px,\n 'margin-top': px,\n 'margin-block': px,\n 'margin-block-end': px,\n 'margin-block-start': px,\n 'margin-inline': px,\n 'margin-inline-end': px,\n 'margin-inline-start': px,\n\n // Padding properties\n padding: px,\n 'padding-bottom': px,\n 'padding-left': px,\n 'padding-right': px,\n 'padding-top': px,\n 'padding-block': px,\n 'padding-block-end': px,\n 'padding-block-start': px,\n 'padding-inline': px,\n 'padding-inline-end': px,\n 'padding-inline-start': px,\n\n // Mask properties\n 'mask-position-x': px,\n 'mask-position-y': px,\n 'mask-size': px,\n\n // Width and height properties\n height: px,\n width: px,\n 'min-height': px,\n 'max-height': px,\n 'min-width': px,\n 'max-width': px,\n\n // Position properties\n bottom: px,\n left: px,\n top: px,\n right: px,\n inset: px,\n 'inset-block': px,\n 'inset-block-end': px,\n 'inset-block-start': px,\n 'inset-inline': px,\n 'inset-inline-end': px,\n 'inset-inline-start': px,\n\n // Shadow properties\n 'box-shadow': px,\n 'text-shadow': px,\n\n // Column properties\n 'column-gap': px,\n 'column-rule': px,\n 'column-rule-width': px,\n 'column-width': px,\n\n // Font and text properties\n 'font-size': px,\n 'font-size-delta': px,\n 'letter-spacing': px,\n 'text-decoration-thickness': px,\n 'text-indent': px,\n 'text-stroke': px,\n 'text-stroke-width': px,\n 'word-spacing': px,\n\n // Motion properties\n motion: px,\n 'motion-offset': px,\n\n // Outline properties\n outline: px,\n 'outline-offset': px,\n 'outline-width': px,\n\n // Perspective properties\n perspective: px,\n 'perspective-origin-x': percent,\n 'perspective-origin-y': percent,\n\n // Transform properties\n 'transform-origin': percent,\n 'transform-origin-x': percent,\n 'transform-origin-y': percent,\n 'transform-origin-z': percent,\n\n // Transition properties\n 'transition-delay': ms,\n 'transition-duration': ms,\n\n // Alignment properties\n 'vertical-align': px,\n 'flex-basis': px,\n\n // Some random properties\n 'shape-margin': px,\n size: px,\n gap: px,\n\n // Grid properties\n grid: px,\n 'grid-gap': px,\n 'row-gap': px,\n 'grid-row-gap': px,\n 'grid-column-gap': px,\n 'grid-template-rows': px,\n 'grid-template-columns': px,\n 'grid-auto-rows': px,\n 'grid-auto-columns': px,\n\n // Not existing properties.\n // Used to avoid issues with jss-plugin-expand integration.\n 'box-shadow-x': px,\n 'box-shadow-y': px,\n 'box-shadow-blur': px,\n 'box-shadow-spread': px,\n 'font-line-height': px,\n 'text-shadow-x': px,\n 'text-shadow-y': px,\n 'text-shadow-blur': px\n}\n","// @flow\nimport type {Plugin} from 'jss'\nimport defaultUnits, {px} from './defaultUnits'\n\nexport type Options = {[key: string]: string | ((val: number) => string)}\n\n/**\n * Clones the object and adds a camel cased property version.\n */\nfunction addCamelCasedVersion(obj) {\n const regExp = /(-[a-z])/g\n const replace = str => str[1].toUpperCase()\n const newObj = {}\n for (const key in obj) {\n newObj[key] = obj[key]\n newObj[key.replace(regExp, replace)] = obj[key]\n }\n return newObj\n}\n\nconst units = addCamelCasedVersion(defaultUnits)\n\n/**\n * Recursive deep style passing function\n */\nfunction iterate(prop: string, value: any, options: Options) {\n if (value == null) return value\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n value[i] = iterate(prop, value[i], options)\n }\n } else if (typeof value === 'object') {\n if (prop === 'fallbacks') {\n for (const innerProp in value) {\n value[innerProp] = iterate(innerProp, value[innerProp], options)\n }\n } else {\n for (const innerProp in value) {\n value[innerProp] = iterate(`${prop}-${innerProp}`, value[innerProp], options)\n }\n }\n // eslint-disable-next-line no-restricted-globals\n } else if (typeof value === 'number' && isNaN(value) === false) {\n const unit = options[prop] || units[prop]\n\n // Add the unit if available, except for the special case of 0px.\n if (unit && !(value === 0 && unit === px)) {\n return typeof unit === 'function' ? unit(value).toString() : `${value}${unit}`\n }\n\n return value.toString()\n }\n\n return value\n}\n\n/**\n * Add unit to numeric values.\n */\nexport default function defaultUnit(options: Options = {}): Plugin {\n const camelCasedOptions = addCamelCasedVersion(options)\n\n function onProcessStyle(style, rule) {\n if (rule.type !== 'style') return style\n\n for (const prop in style) {\n style[prop] = iterate(prop, style[prop], camelCasedOptions)\n }\n\n return style\n }\n\n function onChangeValue(value, prop) {\n return iterate(prop, value, camelCasedOptions)\n }\n\n return {onProcessStyle, onChangeValue}\n}\n"],"names":["px","hasCSSTOMSupport","CSS","ms","percent","border","margin","padding","height","width","bottom","left","top","right","inset","motion","outline","perspective","size","gap","grid","addCamelCasedVersion","obj","regExp","replace","str","toUpperCase","newObj","key","units","defaultUnits","iterate","prop","value","options","Array","isArray","i","length","innerProp","isNaN","unit","toString","defaultUnit","camelCasedOptions","onProcessStyle","style","rule","type","onChangeValue"],"mappings":";;;;;;EAIO,IAAMA,EAAqB,GAAGC,oBAAgB,IAAIC,GAApB,GAA0BA,GAAG,CAACF,EAA9B,GAAmC,IAAjE;EACA,IAAMG,EAAqB,GAAGF,oBAAgB,IAAIC,GAApB,GAA0BA,GAAG,CAACC,EAA9B,GAAmC,IAAjE;EACA,IAAMC,OAA0B,GAAGH,oBAAgB,IAAIC,GAApB,GAA0BA,GAAG,CAACE,OAA9B,GAAwC,GAA3E;EAEP;;;;;;AAKA,qBAAe;EACb;EACA,qBAAmBD,EAFN;EAGb,wBAAsBA,EAHT;EAKb;EACA,yBAAuBH,EANV;EAOb,2BAAyBA,EAPZ;EAQb,2BAAyBA,EARZ;EASb,qBAAmBA,EATN;EAWb;EACAK,EAAAA,MAAM,EAAEL,EAZK;EAab,mBAAiBA,EAbJ;EAcb,+BAA6BA,EAdhB;EAeb,gCAA8BA,EAfjB;EAgBb,yBAAuBA,EAhBV;EAiBb,iBAAeA,EAjBF;EAkBb,uBAAqBA,EAlBR;EAmBb,mBAAiBA,EAnBJ;EAoBb,kBAAgBA,EApBH;EAqBb,wBAAsBA,EArBT;EAsBb,gBAAcA,EAtBD;EAuBb,4BAA0BA,EAvBb;EAwBb,6BAA2BA,EAxBd;EAyBb,sBAAoBA,EAzBP;EA0Bb,kBAAgBA,EA1BH;EA2Bb,kBAAgBA,EA3BH;EA4Bb,sBAAoBA,EA5BP;EA6Bb,4BAA0BA,EA7Bb;EA8Bb,wBAAsBA,EA9BT;EA+Bb,8BAA4BA,EA/Bf;EAgCb,wBAAsBA,EAhCT;EAiCb,mBAAiBA,EAjCJ;EAkCb,uBAAqBA,EAlCR;EAmCb,6BAA2BA,EAnCd;EAoCb,yBAAuBA,EApCV;E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