mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
1 line
75 KiB
Plaintext
1 line
75 KiB
Plaintext
|
{"version":3,"file":"react-toastify.esm.js","sources":["../src/utils/propValidator.ts","../src/utils/constant.ts","../src/utils/collapseToast.ts","../src/utils/cssTransition.tsx","../src/core/eventManager.ts","../src/hooks/useKeeper.ts","../src/hooks/toastContainerReducer.ts","../src/hooks/useToastContainer.ts","../src/hooks/useToast.ts","../src/components/CloseButton.tsx","../src/components/ProgressBar.tsx","../src/components/Toast.tsx","../src/components/Transitions.tsx","../src/components/ToastContainer.tsx","../src/core/toast.tsx"],"sourcesContent":["import { isValidElement } from 'react';\n\nimport { Id } from '../types';\n\nexport function isNum(v: any): v is Number {\n return typeof v === 'number' && !isNaN(v);\n}\n\nexport function isBool(v: any): v is Boolean {\n return typeof v === 'boolean';\n}\n\nexport function isStr(v: any): v is String {\n return typeof v === 'string';\n}\n\nexport function isFn(v: any): v is Function {\n return typeof v === 'function';\n}\n\nexport function parseClassName(v: any) {\n return isStr(v) || isFn(v) ? v : null;\n}\n\nexport function isToastIdValid(toastId?: Id) {\n return toastId === 0 || toastId;\n}\n\nexport function getAutoCloseDelay(\n toastAutoClose?: false | number,\n containerAutoClose?: false | number\n) {\n return toastAutoClose === false ||\n (isNum(toastAutoClose) && toastAutoClose > 0)\n ? toastAutoClose\n : containerAutoClose;\n}\n\nexport const canUseDom = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\nexport function canBeRendered<T>(content: T): boolean {\n return (\n isValidElement(content) || isStr(content) || isFn(content) || isNum(content)\n );\n}\n","import { ToastPosition, TypeOptions } from '../types';\n\ntype KeyOfPosition =\n | 'TOP_LEFT'\n | 'TOP_RIGHT'\n | 'TOP_CENTER'\n | 'BOTTOM_LEFT'\n | 'BOTTOM_RIGHT'\n | 'BOTTOM_CENTER';\n\ntype KeyOfType = 'INFO' | 'SUCCESS' | 'WARNING' | 'ERROR' | 'DEFAULT' | 'DARK';\n\nexport const POSITION: { [key in KeyOfPosition]: ToastPosition } = {\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right',\n TOP_CENTER: 'top-center',\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n BOTTOM_CENTER: 'bottom-center'\n};\n\nexport const TYPE: { [key in KeyOfType]: TypeOptions } = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n DEFAULT: 'default',\n DARK: 'dark'\n};\n\nexport const enum Default {\n COLLAPSE_DURATION = 300,\n DEBOUNCE_DURATION = 50,\n CSS_NAMESPACE = 'Toastify',\n DRAGGABLE_PERCENT = 80\n}\n\nexport const enum Direction {\n X = 'x',\n Y = 'y'\n}\n","import { Default } from './constant';\n\n/**\n * Used to collapse toast after exit animation\n */\nexport function collapseToast(\n node: HTMLElement,\n done: () => void,\n duration = Default.COLLAPSE_DURATION\n) {\n const height = node.scrollHeight;\n const style = node.style;\n\n requestAnimationFrame(() => {\n style.minHeight = 'initial';\n style.height = height + 'px';\n style.transition = `all ${duration}ms`;\n\n requestAnimationFrame(() => {\n style.height = '0';\n style.padding = '0';\n style.margin = '0';\n setTimeout(done, duration as number);\n });\n });\n}\n","import React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ToastTransitionProps } from '../types';\n\nimport { collapseToast } from './collapseToast';\nimport { Default } from './constant';\n\nexport interface CSSTransitionProps {\n /**\n * Css class to apply when toast enter\n */\n enter: string;\n\n /**\n * Css class to apply when toast leave\n */\n exit: string;\n\n /**\n * Append current toast position to the classname.\n * If multiple classes are provided, only the last one will get the position\n * For instance `myclass--top-center`...\n * `Default: false`\n */\n appendPosition?: boolean;\n\n /**\n * Collapse toast smoothly when exit animation end\n * `Default: true`\n */\n collapse?: boolean;\n\n /**\n * Collapse transition duration\n * `Default: 300`\n */
|