Files
NapCatQQ/.pnpm-store/v3/files/15/4d008e15a75f1a109626a82fc7c67ea28af718b9e785480d54e10a1ee4e2095f1d1ee87f050898b10ea31b8f603f0adb547c2e50e31f7bbffc739f7d0e83f9
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

1 line
3.6 KiB
Plaintext

{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAaD,MAAM,kDAAc,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAgB;AAMvD;;CAEC,GACD,SAAS,6CAAuB,KAAkC;IAChE,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IACzB,IAAI,QAAgB,CAAA,GAAA,sCAAI,EAAE,OAAO,CAAC,IAAO,CAAA;oBACvC;YACA,WAAW,CAAA,GAAA,+BAAI,EAAE,UAAU,QAAQ;QACrC,CAAA,GAAI;QAAC;KAAO;IAEZ,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAMA;;CAEC,GACD,SAAS,oDAA8B,KAAyC;IAC9E,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,gBAAgB,CAAA,GAAA,0CAAe;IAEnC,qBACE,0DAAC,kCAAY,QAAQ;QAAC,OAAO;OAC1B;AAGP;AAKO,SAAS,0CAAa,KAAwB;IACnD,IAAI,UAAC,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEzB,+EAA+E;IAC/E,mEAAmE;IACnE,IAAI,QACF,qBAAO,0DAAC;QAAuB,QAAQ;QAAQ,UAAU;;IAG3D,qBAAO,0DAAC;QAA8B,UAAU;;AAClD;AAKO,SAAS;IACd,IAAI,gBAAgB,CAAA,GAAA,0CAAe;IACnC,IAAI,UAAU,CAAA,GAAA,uBAAS,EAAE;IACzB,OAAO,WAAW;AACpB","sources":["packages/@react-aria/i18n/src/context.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {JSX, ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\n /** Contents that should have the locale applied. */\n children: ReactNode,\n /** The locale to apply to the children. */\n locale?: string\n}\n\nconst I18nContext = React.createContext<Locale | null>(null);\n\ninterface I18nProviderWithLocaleProps extends I18nProviderProps {\n locale: string\n}\n\n/**\n * Internal component that handles the case when locale is provided.\n */\nfunction I18nProviderWithLocale(props: I18nProviderWithLocaleProps): JSX.Element {\n let {locale, children} = props; \n let value: Locale = React.useMemo(() => ({\n locale,\n direction: isRTL(locale) ? 'rtl' : 'ltr'\n }), [locale]);\n\n return (\n <I18nContext.Provider value={value}>\n {children}\n </I18nContext.Provider>\n );\n}\n\ninterface I18nProviderWithDefaultLocaleProps {\n children: ReactNode\n}\n\n/**\n * Internal component that handles the case when no locale is provided.\n */\nfunction I18nProviderWithDefaultLocale(props: I18nProviderWithDefaultLocaleProps): JSX.Element {\n let {children} = props;\n let defaultLocale = useDefaultLocale();\n\n return (\n <I18nContext.Provider value={defaultLocale}>\n {children}\n </I18nContext.Provider>\n );\n}\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: I18nProviderProps): JSX.Element {\n let {locale, children} = props;\n\n // Conditionally render different components to avoid calling useDefaultLocale.\n // This is necessary because useDefaultLocale triggers a re-render.\n if (locale) {\n return <I18nProviderWithLocale locale={locale} children={children} />;\n }\n\n return <I18nProviderWithDefaultLocale children={children} />;\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n let defaultLocale = useDefaultLocale();\n let context = useContext(I18nContext);\n return context || defaultLocale;\n}\n"],"names":[],"version":3,"file":"context.main.js.map"}