1 line
8.6 KiB
JSON
1 line
8.6 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useMessage from '../message/useMessage';\nimport useModal from '../modal/useModal';\nimport useNotification from '../notification/useNotification';\nimport AppContext, { AppConfigContext } from './context';\nimport useStyle from './style';\nconst useApp = () => React.useContext(AppContext);\nconst App = props => {\n const {\n prefixCls: customizePrefixCls,\n children,\n className,\n rootClassName,\n message,\n notification,\n style,\n component = 'div'\n } = props;\n const {\n getPrefixCls\n } = useContext(ConfigContext);\n const prefixCls = getPrefixCls('app', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const customClassName = classNames(hashId, prefixCls, className, rootClassName, cssVarCls);\n const appConfig = useContext(AppConfigContext);\n const mergedAppConfig = React.useMemo(() => ({\n message: Object.assign(Object.assign({}, appConfig.message), message),\n notification: Object.assign(Object.assign({}, appConfig.notification), notification)\n }), [message, notification, appConfig.message, appConfig.notification]);\n const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.message);\n const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.notification);\n const [ModalApi, ModalContextHolder] = useModal();\n const memoizedContextValue = React.useMemo(() => ({\n message: messageApi,\n notification: notificationApi,\n modal: ModalApi\n }), [messageApi, notificationApi, ModalApi]);\n // https://github.com/ant-design/ant-design/issues/48802#issuecomment-2097813526\n devUseWarning('App')(!(cssVarCls && component === false), 'usage', 'When using cssVar, ensure `component` is assigned a valid React component string.');\n // ============================ Render ============================\n const Component = component === false ? React.Fragment : component;\n const rootProps = {\n className: customClassName,\n style\n };\n return wrapCSSVar( /*#__PURE__*/React.createElement(AppContext.Provider, {\n value: memoizedContextValue\n }, /*#__PURE__*/React.createElement(AppConfigContext.Provider, {\n value: mergedAppConfig\n }, /*#__PURE__*/React.createElement(Component, Object.assign({}, component === false ? undefined : rootProps), ModalContextHolder, messageContextHolder, notificationContextHolder, children))));\n};\nif (process.env.NODE_ENV !== 'production') {\n App.displayName = 'App';\n}\nApp.useApp = useApp;\nexport default App;","map":{"version":3,"names":["React","useContext","classNames","devUseWarning","ConfigContext","useMessage","useModal","useNotification","AppContext","AppConfigContext","useStyle","useApp","App","props","prefixCls","customizePrefixCls","children","className","rootClassName","message","notification","style","component","getPrefixCls","wrapCSSVar","hashId","cssVarCls","customClassName","appConfig","mergedAppConfig","useMemo","Object","assign","messageApi","messageContextHolder","notificationApi","notificationContextHolder","ModalApi","ModalContextHolder","memoizedContextValue","modal","Component","Fragment","rootProps","createElement","Provider","value","undefined","process","env","NODE_ENV","displayName"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/app/index.js"],"sourcesContent":["\"use client\";\n\nimport React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useMessage from '../message/useMessage';\nimport useModal from '../modal/useModal';\nimport useNotification from '../notification/useNotification';\nimport AppContext, { AppConfigContext } from './context';\nimport useStyle from './style';\nconst useApp = () => React.useContext(AppContext);\nconst
|