UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

1 lines 3.9 kB
{"version":3,"file":"ng-zorro-antd-core-polyfill.mjs","sources":["../../components/core/polyfill/request-animation.ts","../../components/core/polyfill/public-api.ts","../../components/core/polyfill/ng-zorro-antd-core-polyfill.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/* eslint-disable no-invalid-this */\nconst availablePrefixes = ['moz', 'ms', 'webkit'];\n\nfunction requestAnimationFramePolyfill(): typeof requestAnimationFrame {\n let lastTime = 0;\n return function (callback: FrameRequestCallback): number {\n const currTime = new Date().getTime();\n const timeToCall = Math.max(0, 16 - (currTime - lastTime));\n const id = setTimeout(() => {\n callback(currTime + timeToCall);\n }, timeToCall);\n lastTime = currTime + timeToCall;\n return id;\n };\n}\n\nfunction getRequestAnimationFrame(): typeof requestAnimationFrame {\n if (typeof window === 'undefined') {\n return () => 0;\n }\n if (window.requestAnimationFrame) {\n // https://github.com/vuejs/vue/issues/4465\n return window.requestAnimationFrame.bind(window);\n }\n\n const prefix = availablePrefixes.filter(key => `${key}RequestAnimationFrame` in window)[0];\n\n return prefix ? (window as NzSafeAny)[`${prefix}RequestAnimationFrame`] : requestAnimationFramePolyfill();\n}\nexport function cancelRequestAnimationFrame(id: number): NzSafeAny {\n if (typeof window === 'undefined') {\n return null;\n }\n if (window.cancelAnimationFrame) {\n return window.cancelAnimationFrame(id);\n }\n const prefix = availablePrefixes.filter(\n key => `${key}CancelAnimationFrame` in window || `${key}CancelRequestAnimationFrame` in window\n )[0];\n\n return prefix\n ? (\n (window as NzSafeAny)[`${prefix}CancelAnimationFrame`] ||\n (window as NzSafeAny)[`${prefix}CancelRequestAnimationFrame`]\n )\n // @ts-ignore\n .call(this, id)\n : clearTimeout(id);\n}\n\nexport const reqAnimFrame = getRequestAnimationFrame();\n","/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nexport * from './request-animation';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;AAOA;AACA,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAElD,SAAS,6BAA6B;IACpC,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,OAAO,UAAU,QAA8B;QAC7C,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;QAC3D,MAAM,EAAE,GAAG,UAAU,CAAC;YACpB,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;SACjC,EAAE,UAAU,CAAC,CAAC;QACf,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;QACjC,OAAO,EAAE,CAAC;KACX,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC,CAAC;KAChB;IACD,IAAI,MAAM,CAAC,qBAAqB,EAAE;;QAEhC,OAAO,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAClD;IAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,GAAG,uBAAuB,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3F,OAAO,MAAM,GAAI,MAAoB,CAAC,GAAG,MAAM,uBAAuB,CAAC,GAAG,6BAA6B,EAAE,CAAC;AAC5G,CAAC;SACe,2BAA2B,CAAC,EAAU;IACpD,IAAI,OAAO,M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