gt-react 11.4.3 β 11.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.client.cjs +93 -37
- package/dist/index.client.cjs.map +1 -1
- package/dist/index.client.d.cts +4 -19
- package/dist/index.client.d.cts.map +1 -1
- package/dist/index.client.d.mts +4 -19
- package/dist/index.client.d.mts.map +1 -1
- package/dist/index.client.mjs +94 -38
- package/dist/index.client.mjs.map +1 -1
- package/dist/index.rsc.d.cts +3 -13
- package/dist/index.rsc.d.cts.map +1 -1
- package/dist/index.rsc.d.mts +3 -13
- package/dist/index.rsc.d.mts.map +1 -1
- package/dist/index.server.cjs +9 -12
- package/dist/index.server.cjs.map +1 -1
- package/dist/index.server.d.cts +3 -15
- package/dist/index.server.d.cts.map +1 -1
- package/dist/index.server.d.mts +3 -15
- package/dist/index.server.d.mts.map +1 -1
- package/dist/index.server.mjs +10 -13
- package/dist/index.server.mjs.map +1 -1
- package/dist/index.types.d.cts +4 -19
- package/dist/index.types.d.cts.map +1 -1
- package/dist/index.types.d.mts +4 -19
- package/dist/index.types.d.mts.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.cjs","names":["ReadonlyConditionStore","I18nStore","InternalGTProvider","InternalLocaleSelector","InternalRegionSelector"],"sources":["../../core/dist/diagnostics-DKA2SkZB.mjs","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/hooks/useHandleMissingTranslations.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"sourcesContent":["//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\nexport { formatDiagnosticErrorDetails as n, createDiagnosticMessage as t };\n\n//# sourceMappingURL=diagnostics-DKA2SkZB.mjs.map","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for server-rendered React runtimes.\n */\nexport function initializeGTSRA(config: InitializeGTParams): void {\n internalInitializeGTSRA(addRuntimeCredentials(config));\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","'server-only';\n\nimport {\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n OnMissingTranslation,\n} from '@generaltranslation/react-core/pure';\nimport { I18nStore } from '@generaltranslation/react-core/components';\nimport { useMemo } from 'react';\n\n/**\n * Returns handle missing translation callback for server runtime\n * These DO get invoked during server render which is not pure, but this\n * is acceptable for dev hot reload because we MUST trigger a translate\n * call on the server to persist translations\n */\nexport function useHandleMissingTranslations(i18nStore: I18nStore): {\n onMissingTranslation: OnMissingTranslation;\n onMissingDictionaryEntry: OnMissingDictionaryEntry;\n onMissingDictionaryObj: OnMissingDictionaryObj;\n} {\n return useMemo(\n () => ({\n onMissingTranslation: (lookup) => i18nStore.translate(lookup),\n onMissingDictionaryEntry: (lookup) =>\n i18nStore.translateDictionaryEntry(lookup),\n onMissingDictionaryObj: (lookup) =>\n i18nStore.translateDictionaryObject(lookup),\n }),\n [i18nStore]\n );\n}\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { ReadonlyConditionStore } from '@generaltranslation/react-core/pure';\nimport { useMemo, useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { useHandleMissingTranslations } from '../hooks/useHandleMissingTranslations';\n\n/**\n * Consumes snapshot from server\n * Implementation for server-side only\n */\nexport function ServerGTProvider({\n locale,\n region,\n enableI18n,\n ...props\n}: SharedGTProviderProps) {\n const conditionStore = useMemo(() => {\n return new ReadonlyConditionStore({ locale, region, enableI18n });\n }, [locale, region, enableI18n]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n const {\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n } = useHandleMissingTranslations(i18nStoreRef.current);\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n onMissingTranslation={onMissingTranslation}\n onMissingDictionaryEntry={onMissingDictionaryEntry}\n onMissingDictionaryObj={onMissingDictionaryObj}\n />\n );\n}\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"πΊπΈ\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","'use client';\n\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\n// SSR/context-capable React runtime surface. This entrypoint may import hooks,\n// providers, and context modules, so it must be consumed as a client boundary by\n// React Server Component frameworks.\n\nexport { initializeGTSRA as initializeGT } from './setup/initializeGTSRA';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\ntype InitializeGTSPA = typeof import('./setup/initializeGTSPA').initializeGTSPA;\ntype CreateOrUpdateBrowserConditionStore =\n typeof import('./condition-store/createBrowserConditionStore').createOrUpdateBrowserConditionStore;\n\nconst createBrowserConditionStoreServerError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'createOrUpdateBrowserConditionStore() cannot be called from the server runtime entry point',\n why: 'createOrUpdateBrowserConditionStore() initializes browser-only condition state.',\n fix: 'Call createOrUpdateBrowserConditionStore() from the browser runtime entry point.',\n});\n\nexport const initializeGTSPA: InitializeGTSPA = async () => {\n throw new Error(\n createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'initializeGTSPA() cannot be called from the server runtime entry point',\n why: 'initializeGTSPA() initializes browser-only SPA state and translation cache behavior.',\n fix: 'Use initializeGT() for server-rendered React runtimes or import initializeGTSPA from the browser entry point.',\n })\n );\n};\n\nexport const createOrUpdateBrowserConditionStore: CreateOrUpdateBrowserConditionStore =\n () => {\n throw new Error(createBrowserConditionStoreServerError);\n };\n\n// ===== Components ===== //\nexport { ServerGTProvider as GTProvider } from './provider/ServerGTProvider';\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;;AACA,SAAS,eAAe,MAAM;CAC7B,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,UAAU,KAAK,QAAQ,GAAG,UAAU,GAAG,QAAQ;;AAEvD,SAAS,cAAc,MAAM;CAC5B,MAAM,UAAU,KAAK,MAAM;CAC3B,IAAI,MAAM,QAAQ;AAClB,QAAO,MAAM,GAAG;EACf,MAAM,OAAO,QAAQ,MAAM;AAC3B,MAAI,SAAS,OAAO,SAAS,OAAO,SAAS,IAAK;AAClD,SAAO;;AAER,QAAO,QAAQ,MAAM,GA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wBAAD;EACU;EACC;EACG;EACZ,WAAW;EACX,GAAI;EACJ,CAAA;;;;ACtCN,MAAM,yCAAyC,wBAAwB;CACrE,QAAQ;CACR,UAAU;CACV,cACE;CACF,KAAK;CACL,KAAK;CACN,CAAC;AAEF,MAAa,kBAAmC,YAAY;AAC1D,OAAM,IAAI,MACR,wBAAwB;EACtB,QAAQ;EACR,UAAU;EACV,cACE;EACF,KAAK;EACL,KAAK;EACN,CAAC,CACH;;AAGH,MAAa,4CACL;AACJ,OAAM,IAAI,MAAM,uCAAuC;;AAuB3D,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"index.server.cjs","names":["I18nStore","InternalGTProvider","InternalLocaleSelector","InternalRegionSelector"],"sources":["../../core/dist/diagnostics-DKA2SkZB.mjs","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/hooks/useHandleMissingTranslations.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"sourcesContent":["//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\nexport { formatDiagnosticErrorDetails as n, createDiagnosticMessage as t };\n\n//# sourceMappingURL=diagnostics-DKA2SkZB.mjs.map","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for server-rendered React runtimes.\n */\nexport function initializeGTSRA(config: InitializeGTParams): void {\n internalInitializeGTSRA(addRuntimeCredentials(config));\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","'server-only';\n\nimport {\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n OnMissingTranslation,\n} from '@generaltranslation/react-core/pure';\nimport { I18nStore } from '@generaltranslation/react-core/components';\nimport { useMemo } from 'react';\n\n/**\n * Returns handle missing translation callback for server runtime\n * These DO get invoked during server render which is not pure, but this\n * is acceptable for dev hot reload because we MUST trigger a translate\n * call on the server to persist translations\n */\nexport function useHandleMissingTranslations(i18nStore: I18nStore): {\n onMissingTranslation: OnMissingTranslation;\n onMissingDictionaryEntry: OnMissingDictionaryEntry;\n onMissingDictionaryObj: OnMissingDictionaryObj;\n} {\n return useMemo(\n () => ({\n onMissingTranslation: (lookup) => i18nStore.translate(lookup),\n onMissingDictionaryEntry: (lookup) =>\n i18nStore.translateDictionaryEntry(lookup),\n onMissingDictionaryObj: (lookup) =>\n i18nStore.translateDictionaryObject(lookup),\n }),\n [i18nStore]\n );\n}\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { useHandleMissingTranslations } from '../hooks/useHandleMissingTranslations';\n\n/**\n * Consumes snapshot from server\n * Implementation for server-side only\n */\nexport function ServerGTProvider({\n locale,\n region,\n enableI18n,\n ...props\n}: SharedGTProviderProps) {\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n const {\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n } = useHandleMissingTranslations(i18nStoreRef.current);\n\n return (\n <InternalGTProvider\n {...props}\n locale={locale}\n region={region}\n enableI18n={enableI18n ?? true}\n setLocale={noopSetLocale}\n setRegion={noopSetRegion}\n setEnableI18n={noopSetEnableI18n}\n i18nStore={i18nStoreRef.current}\n onMissingTranslation={onMissingTranslation}\n onMissingDictionaryEntry={onMissingDictionaryEntry}\n onMissingDictionaryObj={onMissingDictionaryObj}\n />\n );\n}\n\nconst noopSetLocale = (_locale: string) => undefined;\nconst noopSetRegion = (_region: string | undefined) => undefined;\nconst noopSetEnableI18n = (_enabled: boolean) => undefined;\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"πΊπΈ\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","'use client';\n\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\n// SSR/context-capable React runtime surface. This entrypoint may import hooks,\n// providers, and context modules, so it must be consumed as a client boundary by\n// React Server Component frameworks.\n\nexport { initializeGTSRA as initializeGT } from './setup/initializeGTSRA';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\ntype InitializeGTSPA = typeof import('./setup/initializeGTSPA').initializeGTSPA;\ntype CreateOrUpdateBrowserConditionStore =\n typeof import('./condition-store/createBrowserConditionStore').createOrUpdateBrowserConditionStore;\n\nconst createBrowserConditionStoreServerError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'createOrUpdateBrowserConditionStore() cannot be called from the server runtime entry point',\n why: 'createOrUpdateBrowserConditionStore() initializes browser-only condition state.',\n fix: 'Call createOrUpdateBrowserConditionStore() from the browser runtime entry point.',\n});\n\nexport const initializeGTSPA: InitializeGTSPA = async () => {\n throw new Error(\n createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'initializeGTSPA() cannot be called from the server runtime entry point',\n why: 'initializeGTSPA() initializes browser-only SPA state and translation cache behavior.',\n fix: 'Use initializeGT() for server-rendered React runtimes or import initializeGTSPA from the browser entry point.',\n })\n );\n};\n\nexport const createOrUpdateBrowserConditionStore: CreateOrUpdateBrowserConditionStore =\n () => {\n throw new Error(createBrowserConditionStoreServerError);\n };\n\n// ===== Components ===== //\nexport { ServerGTProvider as GTProvider } from './provider/ServerGTProvider';\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;;AACA,SAAS,eAAe,MAAM;CAC7B,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,UAAU,KAAK,QAAQ,GAAG,UAAU,GAAG,QAAQ;;AAEvD,SAAS,cAAc,MAAM;CAC5B,MAAM,UAAU,KAAK,MAAM;CAC3B,IAAI,MAAM,QAAQ;AAClB,QAAO,MAAM,GAAG;EACf,MAAM,OAAO,QAAQ,MAAM;AAC3B,MAAI,SAAS,OAAO,SAAS,OAAO,SAAS,IAAK;AAClD,SAAO;;AAER,QAAO,QAAQ,MAAM,GAAG,IAAI;;AAE7B,SAAS,cAAc,SAAS;AAC/B,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,aAAa,MAAM,QAAQ,QAAQ,GAAG,QAAQ,KAAK,KAAK,GAAG;AACjE,KAAI,CAAC,WAAW,MAAM,CAAE,QAAO;AAC/B,QAAO,eAAe,YAAY,aAAa;;AAMhD,SAAS,wBAAwB,EAAE,QAAQ,UAAU,cAAc,aAAa,KAAK,KAAK,QAAQ,SAAS,WAAW;CACrH,MAAM,SAAS,SAAS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J,OAAM,IAAI,MAAM,uCAAuC;;AAuB3D,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
package/dist/index.server.d.cts
CHANGED
|
@@ -48,12 +48,7 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
48
48
|
_getLocale?: GetLocale;
|
|
49
49
|
_getRegion?: GetRegion;
|
|
50
50
|
_getEnableI18n?: GetEnableI18n;
|
|
51
|
-
_reload?: ReloadType;
|
|
52
|
-
_serverConditions?: {
|
|
53
|
-
locale: string;
|
|
54
|
-
region?: string;
|
|
55
|
-
enableI18n?: boolean;
|
|
56
|
-
};
|
|
51
|
+
_reload?: ReloadType;
|
|
57
52
|
};
|
|
58
53
|
/**
|
|
59
54
|
* Condition store implementation for Browser.
|
|
@@ -63,8 +58,6 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
63
58
|
private customGetLocale?;
|
|
64
59
|
private customGetRegion?;
|
|
65
60
|
private customGetEnableI18n?;
|
|
66
|
-
private serverConditions?;
|
|
67
|
-
private pending;
|
|
68
61
|
constructor(config: BrowserConditionStoreParams);
|
|
69
62
|
getLocale: () => string;
|
|
70
63
|
setLocale: (locale: LocaleCandidates) => void;
|
|
@@ -236,13 +229,8 @@ declare function useRegionSelector(options?: InternalRegionSelectorOptions): {
|
|
|
236
229
|
* - {@link InternalGTProviderProps} - requires translations and dictionaries
|
|
237
230
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
238
231
|
*/
|
|
239
|
-
type SharedGTProviderProps = Omit<InternalGTProviderProps, '
|
|
240
|
-
locale: string;
|
|
241
|
-
_serverConditions?: {
|
|
242
|
-
locale: string;
|
|
243
|
-
region?: string;
|
|
244
|
-
enableI18n?: boolean;
|
|
245
|
-
};
|
|
232
|
+
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'i18nStore' | 'region' | 'enableI18n' | 'setLocale' | 'setRegion' | 'setEnableI18n'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
233
|
+
locale: string;
|
|
246
234
|
};
|
|
247
235
|
//#endregion
|
|
248
236
|
//#region src/provider/ServerGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AFfjC;;KEqBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;
|
|
1
|
+
{"version":3,"file":"index.server.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCU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AA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KA8BvB,mBAAA;EACV,OAAA;EACA,WAAA,GAAc,SAAA;EACd,aAAA;IAAA,CACG,MAAA;MAEK,IAAA;MAAe,KAAA;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;KCzDE,eAAA,UAAe,iBAAA;AAAA,KACf,mCAAA,UAAmC,qCAAA;AAAA,cAY3B,eAAA,EAAiB,eAAA;AAAA,cAajB,mCAAA,EAAqC,mCAAA;AAAA,iBAyB5B,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.server.d.mts
CHANGED
|
@@ -48,12 +48,7 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
48
48
|
_getLocale?: GetLocale;
|
|
49
49
|
_getRegion?: GetRegion;
|
|
50
50
|
_getEnableI18n?: GetEnableI18n;
|
|
51
|
-
_reload?: ReloadType;
|
|
52
|
-
_serverConditions?: {
|
|
53
|
-
locale: string;
|
|
54
|
-
region?: string;
|
|
55
|
-
enableI18n?: boolean;
|
|
56
|
-
};
|
|
51
|
+
_reload?: ReloadType;
|
|
57
52
|
};
|
|
58
53
|
/**
|
|
59
54
|
* Condition store implementation for Browser.
|
|
@@ -63,8 +58,6 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
63
58
|
private customGetLocale?;
|
|
64
59
|
private customGetRegion?;
|
|
65
60
|
private customGetEnableI18n?;
|
|
66
|
-
private serverConditions?;
|
|
67
|
-
private pending;
|
|
68
61
|
constructor(config: BrowserConditionStoreParams);
|
|
69
62
|
getLocale: () => string;
|
|
70
63
|
setLocale: (locale: LocaleCandidates$1) => void;
|
|
@@ -236,13 +229,8 @@ declare function useRegionSelector(options?: InternalRegionSelectorOptions): {
|
|
|
236
229
|
* - {@link InternalGTProviderProps} - requires translations and dictionaries
|
|
237
230
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
238
231
|
*/
|
|
239
|
-
type SharedGTProviderProps = Omit<InternalGTProviderProps, '
|
|
240
|
-
locale: string;
|
|
241
|
-
_serverConditions?: {
|
|
242
|
-
locale: string;
|
|
243
|
-
region?: string;
|
|
244
|
-
enableI18n?: boolean;
|
|
245
|
-
};
|
|
232
|
+
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'i18nStore' | 'region' | 'enableI18n' | 'setLocale' | 'setRegion' | 'setEnableI18n'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
233
|
+
locale: string;
|
|
246
234
|
};
|
|
247
235
|
//#endregion
|
|
248
236
|
//#region src/provider/ServerGTProvider.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AFfjC;;KEqBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;
|
|
1
|
+
{"version":3,"file":"index.server.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/utils/TxProps.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/provider/GTProviderProps.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"mappings":";;;;;;;;;;;;;;KAGY,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;AFfjC;;KEqBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;AFvBZ;cE6Ba,qBAAA,YAAiC,+BAAA;EAAA,QACpC,YAAA;EAAA,QACA,eAAA;EAAA,QACA,eAAA;EAAA,QACA,mBAAA;cAEI,MAAA,EAAQ,2BAAA;EAsBpB,SAAA;EAIA,SAAA,GAAa,MAAA,EAAQ,kBAAA;EASrB,SAAA;EAQA,SAAA,GAAa,MAAA;EAKb,aAAA;EAYA,aAAA,GAAiB,UAAA;ED5EP;;;ECoFV,YAAA,GAAgB,MAAA,EAAQ,kBAAA;EDpFW;;;EC+FnC,YAAA,GAAgB,MAAA;ED9Fe;;;ECwG/B,gBAAA,GAAoB,UAAA;EApHjB;;;;;EAgIH,MAAA;AAAA;;;KC/HU,iCAAA,GAAoC,IAAA,CAC9C,2BAAA;EAGA,MAAA,GAAS,gBAAA;EACT,UAAA;AAAA;;;;;;AHhBF;;;;;AACA;iBG6BgB,qCAAA,CACd,MAAA,EAAQ,iCAAA,GAAiC,qB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AA,CAAA;EACd,OAAA,EAAS,QAAA;EAAA,GACN;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KAgBvB,mBAAA;EACV,OAAA;EACA,WAAA;IAAA,CAAiB,GAAA;EAAA;EACjB,aAAA,GAAgB,aAAA;EAAA,CACf,GAAA;AAAA;;;;;;;;;;;;AbhCH;;;;;AACA;;;;;iBcoBgB,cAAA,CAAA;EACd,OAAA,EAAS,QAAA;EACT,aAAA;EACA,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,GACG;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KA8BvB,mBAAA;EACV,OAAA;EACA,WAAA,GAAc,SAAA;EACd,aAAA;IAAA,CACG,MAAA;MAEK,IAAA;MAAe,KAAA;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;KCzDE,eAAA,UAAe,iBAAA;AAAA,KACf,mCAAA,UAAmC,qCAAA;AAAA,cAY3B,eAAA,EAAiB,eAAA;AAAA,cAajB,mCAAA,EAAqC,mCAAA;AAAA,iBAyB5B,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ReactI18nCache,
|
|
2
|
+
import { ReactI18nCache, createRenderPipeline, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getFormatLocales, getI18nConfig, getLocaleProperties, getLocales, getReactI18nCache, getTranslationsSnapshot, getVersionId, gtFallback, internalInitializeGTSRA, mFallback, msg, resolveCanonicalLocale, setReactI18nCache, t } from "@generaltranslation/react-core/pure";
|
|
3
3
|
import { GtInternalRuntimeTranslateJsx, GtInternalRuntimeTranslateString, getCookieValue, getRuntimeEnvironment, parseAcceptLanguage } from "gt-i18n/internal";
|
|
4
4
|
import { useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useInternalLocaleSelector, useInternalRegionSelector, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useMessages, useRegion, useSetEnableI18n, useSetLocale, useSetLocale as useSetLocale$1, useSetRegion, useSetRegion as useSetRegion$1, useTranslations } from "@generaltranslation/react-core/hooks";
|
|
5
5
|
import { Branch, Currency, DateTime, Derive, GtInternalTranslateJsx, GtInternalVar, I18nStore, InternalGTProvider, InternalLocaleSelector, InternalRegionSelector, Num, Plural, RelativeTime, T, Var } from "@generaltranslation/react-core/components";
|
|
@@ -179,29 +179,26 @@ function useHandleMissingTranslations(i18nStore) {
|
|
|
179
179
|
* Implementation for server-side only
|
|
180
180
|
*/
|
|
181
181
|
function ServerGTProvider({ locale, region, enableI18n, ...props }) {
|
|
182
|
-
const conditionStore = useMemo(() => {
|
|
183
|
-
return new ReadonlyConditionStore({
|
|
184
|
-
locale,
|
|
185
|
-
region,
|
|
186
|
-
enableI18n
|
|
187
|
-
});
|
|
188
|
-
}, [
|
|
189
|
-
locale,
|
|
190
|
-
region,
|
|
191
|
-
enableI18n
|
|
192
|
-
]);
|
|
193
182
|
const i18nStoreRef = useRef(null);
|
|
194
183
|
if (i18nStoreRef.current == null) i18nStoreRef.current = new I18nStore();
|
|
195
184
|
const { onMissingTranslation, onMissingDictionaryEntry, onMissingDictionaryObj } = useHandleMissingTranslations(i18nStoreRef.current);
|
|
196
185
|
return /* @__PURE__ */ jsx(InternalGTProvider, {
|
|
197
186
|
...props,
|
|
198
|
-
|
|
187
|
+
locale,
|
|
188
|
+
region,
|
|
189
|
+
enableI18n: enableI18n ?? true,
|
|
190
|
+
setLocale: noopSetLocale,
|
|
191
|
+
setRegion: noopSetRegion,
|
|
192
|
+
setEnableI18n: noopSetEnableI18n,
|
|
199
193
|
i18nStore: i18nStoreRef.current,
|
|
200
194
|
onMissingTranslation,
|
|
201
195
|
onMissingDictionaryEntry,
|
|
202
196
|
onMissingDictionaryObj
|
|
203
197
|
});
|
|
204
198
|
}
|
|
199
|
+
const noopSetLocale = (_locale) => void 0;
|
|
200
|
+
const noopSetRegion = (_region) => void 0;
|
|
201
|
+
const noopSetEnableI18n = (_enabled) => void 0;
|
|
205
202
|
//#endregion
|
|
206
203
|
//#region src/components/LocaleSelector.tsx
|
|
207
204
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.mjs","names":["useSetLocale","useSetRegion","useSetLocale"],"sources":["../../core/dist/diagnostics-DKA2SkZB.mjs","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/hooks/useHandleMissingTranslations.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"sourcesContent":["//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\nexport { formatDiagnosticErrorDetails as n, createDiagnosticMessage as t };\n\n//# sourceMappingURL=diagnostics-DKA2SkZB.mjs.map","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for server-rendered React runtimes.\n */\nexport function initializeGTSRA(config: InitializeGTParams): void {\n internalInitializeGTSRA(addRuntimeCredentials(config));\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","'server-only';\n\nimport {\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n OnMissingTranslation,\n} from '@generaltranslation/react-core/pure';\nimport { I18nStore } from '@generaltranslation/react-core/components';\nimport { useMemo } from 'react';\n\n/**\n * Returns handle missing translation callback for server runtime\n * These DO get invoked during server render which is not pure, but this\n * is acceptable for dev hot reload because we MUST trigger a translate\n * call on the server to persist translations\n */\nexport function useHandleMissingTranslations(i18nStore: I18nStore): {\n onMissingTranslation: OnMissingTranslation;\n onMissingDictionaryEntry: OnMissingDictionaryEntry;\n onMissingDictionaryObj: OnMissingDictionaryObj;\n} {\n return useMemo(\n () => ({\n onMissingTranslation: (lookup) => i18nStore.translate(lookup),\n onMissingDictionaryEntry: (lookup) =>\n i18nStore.translateDictionaryEntry(lookup),\n onMissingDictionaryObj: (lookup) =>\n i18nStore.translateDictionaryObject(lookup),\n }),\n [i18nStore]\n );\n}\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { ReadonlyConditionStore } from '@generaltranslation/react-core/pure';\nimport { useMemo, useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { useHandleMissingTranslations } from '../hooks/useHandleMissingTranslations';\n\n/**\n * Consumes snapshot from server\n * Implementation for server-side only\n */\nexport function ServerGTProvider({\n locale,\n region,\n enableI18n,\n ...props\n}: SharedGTProviderProps) {\n const conditionStore = useMemo(() => {\n return new ReadonlyConditionStore({ locale, region, enableI18n });\n }, [locale, region, enableI18n]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n const {\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n } = useHandleMissingTranslations(i18nStoreRef.current);\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n onMissingTranslation={onMissingTranslation}\n onMissingDictionaryEntry={onMissingDictionaryEntry}\n onMissingDictionaryObj={onMissingDictionaryObj}\n />\n );\n}\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"πΊπΈ\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","'use client';\n\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\n// SSR/context-capable React runtime surface. This entrypoint may import hooks,\n// providers, and context modules, so it must be consumed as a client boundary by\n// React Server Component frameworks.\n\nexport { initializeGTSRA as initializeGT } from './setup/initializeGTSRA';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\ntype InitializeGTSPA = typeof import('./setup/initializeGTSPA').initializeGTSPA;\ntype CreateOrUpdateBrowserConditionStore =\n typeof import('./condition-store/createBrowserConditionStore').createOrUpdateBrowserConditionStore;\n\nconst createBrowserConditionStoreServerError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'createOrUpdateBrowserConditionStore() cannot be called from the server runtime entry point',\n why: 'createOrUpdateBrowserConditionStore() initializes browser-only condition state.',\n fix: 'Call createOrUpdateBrowserConditionStore() from the browser runtime entry point.',\n});\n\nexport const initializeGTSPA: InitializeGTSPA = async () => {\n throw new Error(\n createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'initializeGTSPA() cannot be called from the server runtime entry point',\n why: 'initializeGTSPA() initializes browser-only SPA state and translation cache behavior.',\n fix: 'Use initializeGT() for server-rendered React runtimes or import initializeGTSPA from the browser entry point.',\n })\n );\n};\n\nexport const createOrUpdateBrowserConditionStore: CreateOrUpdateBrowserConditionStore =\n () => {\n throw new Error(createBrowserConditionStoreServerError);\n };\n\n// ===== Components ===== //\nexport { ServerGTProvider as GTProvider } from './provider/ServerGTProvider';\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;AACA,SAAS,eAAe,MAAM;CAC7B,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,UAAU,KAAK,QAAQ,GAAG,UAAU,GAAG,QAAQ;;AAEvD,SAAS,cAAc,MAAM;CAC5B,MAAM,UAAU,KAAK,MAAM;CAC3B,IAAI,MAAM,QAAQ;AAClB,QAAO,MAAM,GAAG;EACf,MAAM,OAAO,QAAQ,MAAM;AAC3B,MAAI,SAAS,OAAO,SAAS,OAAO,SAAS,IAAK;AAClD,SAAO;;AAER,QAAO,QAAQ,MAAM,GAAG,IAAI;;AAE7B,SAAS,cAAc,SAAS;AAC/B,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,aAAa,MAAM,QAAQ,QAAQ,GAAG,QAAQ,KAAK,KAAK,GAAG;AACjE,KAAI,CAAC,WAAW,MAAM,CAAE,QAAO;AAC/B,QAAO,eAAe,YAAY,aAAa;;AAMhD,SAAS,wBAAwB,EAAE,QAAQ,UAAU,cAAc,aAAa,KAAK,KAAK,QAAQ,SAAS,WAAW;CACrH,MAAM,SAAS,SAAS,WAAW,GAAG,OAAO,GAAG,SAAS,KAAK,GAAG,OAAO,KAAK,WAAW,GAAG,SAAS,KAAK;CACzG,MAAM,aAAa,MAAM,GAAG,cAAc,aAAa,CAAC,WAAW,cAAc,IAAI,KAAK;CAC1F,MAAM,sBAAsB,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,SAAS,KAAK,cAAc,OAAO,CA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,CAAA;;;;;;;;;;;;;;;;;;;;;;;ACHN,SAAgB,eAAe,EAC7B,SAAS,UACT,eACA,+BACA,2BACA,mBAAmB,OACnB,GAAG,SAC6C;CAEhD,MAAM,EAAE,QAAQ,SAAS,YAAY,QAAQ,WAAW,cACtD,kBAAkB;EAChB,SAAS;EACT;EACA;EACA;EACD,CAAC;CAEJ,MAAM,gBAAgB,WAAmB;AACvC,MAAI,kBAAkB;GACpB,MAAM,eAAe,WAAW,IAAI,OAAO,EAAE;AAE7C,OAAI,gBAAgB,WAAW,aAAc,WAAU,aAAa;;AAEtE,YAAU,OAAO;;AAGnB,QACE,oBAAC,wBAAD;EACU;EACC;EACG;EACZ,WAAW;EACX,GAAI;EACJ,CAAA;;;;ACtCN,MAAM,yCAAyC,wBAAwB;CACrE,QAAQ;CACR,UAAU;CACV,cACE;CACF,KAAK;CACL,KAAK;CACN,CAAC;AAEF,MAAa,kBAAmC,YAAY;AAC1D,OAAM,IAAI,MACR,wBAAwB;EACtB,QAAQ;EACR,UAAU;EACV,cACE;EACF,KAAK;EACL,KAAK;EACN,CAAC,CACH;;AAGH,MAAa,4CACL;AACJ,OAAM,IAAI,MAAM,uCAAuC;;AAuB3D,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
|
1
|
+
{"version":3,"file":"index.server.mjs","names":["useSetLocale","useSetRegion","useSetLocale"],"sources":["../../core/dist/diagnostics-DKA2SkZB.mjs","../src/setup/runtimeCredentials.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/hooks/useHandleMissingTranslations.ts","../src/provider/ServerGTProvider.tsx","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/index.server.ts"],"sourcesContent":["//#region src/logging/diagnostics.ts\nfunction ensureSentence(text) {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return \"\";\n\treturn /[.!?)]$/.test(trimmed) ? trimmed : `${trimmed}.`;\n}\nfunction stripSentence(text) {\n\tconst trimmed = text.trim();\n\tlet end = trimmed.length;\n\twhile (end > 0) {\n\t\tconst char = trimmed[end - 1];\n\t\tif (char !== \".\" && char !== \"!\" && char !== \"?\") break;\n\t\tend -= 1;\n\t}\n\treturn trimmed.slice(0, end);\n}\nfunction formatDetails(details) {\n\tif (!details) return \"\";\n\tconst detailText = Array.isArray(details) ? details.join(\", \") : details;\n\tif (!detailText.trim()) return \"\";\n\treturn ensureSentence(`Details: ${detailText}`);\n}\nfunction formatDiagnosticErrorDetails(error) {\n\tif (error == null) return void 0;\n\treturn String(error);\n}\nfunction createDiagnosticMessage({ source, severity, whatHappened, reassurance, why, fix, wayOut, details, docsUrl }) {\n\tconst prefix = source ? severity ? `${source} ${severity}:` : `${source}:` : severity ? `${severity}:` : \"\";\n\tconst whatAndWhy = why ? `${stripSentence(whatHappened)} because ${stripSentence(why)}` : whatHappened;\n\tconst shouldCombineWayOut = !!fix && !!wayOut && /^[a-z]/.test(stripSentence(wayOut));\n\tconst messageParts = [\n\t\twhatAndWhy,\n\t\treassurance,\n\t\tshouldCombineWayOut ? `${stripSentence(fix)}, or ${stripSentence(wayOut)}` : fix,\n\t\tshouldCombineWayOut ? void 0 : wayOut,\n\t\tformatDetails(details)\n\t].filter((part) => !!part).map(ensureSentence);\n\tif (docsUrl) messageParts.push(`Learn more: ${docsUrl}`);\n\tconst message = messageParts.join(\" \");\n\treturn prefix ? `${prefix} ${message}` : message;\n}\n//#endregion\nexport { formatDiagnosticErrorDetails as n, createDiagnosticMessage as t };\n\n//# sourceMappingURL=diagnostics-DKA2SkZB.mjs.map","import { getRuntimeEnvironment } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\ntype RuntimeCredentials = Pick<I18nConfigParams, 'projectId' | 'devApiKey'>;\ntype RuntimeEnv = {\n DEV?: boolean;\n VITE_GT_PROJECT_ID?: string;\n VITE_GT_DEV_API_KEY?: string;\n};\n\nexport function addRuntimeCredentials<T extends RuntimeCredentials>(\n config: T\n): T {\n const credentials = getRuntimeCredentials();\n return {\n ...config,\n projectId: config.projectId || credentials.projectId,\n devApiKey: config.devApiKey || credentials.devApiKey,\n };\n}\n\nfunction getRuntimeCredentials(): RuntimeCredentials {\n return {\n projectId:\n readImportMetaVite(\n () =>\n (\n import.meta as ImportMeta & {\n env?: RuntimeEnv;\n }\n ).env?.VITE_GT_PROJECT_ID\n ) || readProcessEnvViteProjectId(),\n devApiKey:\n getRuntimeEnvironment() === 'development'\n ? readImportMetaVite(() =>\n (import.meta as ImportMeta & { env?: RuntimeEnv }).env?.DEV\n ? (import.meta as ImportMeta & { env?: RuntimeEnv }).env\n ?.VITE_GT_DEV_API_KEY\n : undefined\n ) || readProcessEnvViteDevApiKey()\n : undefined,\n };\n}\n\nfunction readImportMetaVite(\n readValue: () => string | undefined\n): string | undefined {\n try {\n return normalizeEnvValue(readValue());\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteProjectId(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);\n } catch {\n return undefined;\n }\n}\n\nfunction readProcessEnvViteDevApiKey(): string | undefined {\n try {\n return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);\n } catch {\n return undefined;\n }\n}\n\nfunction normalizeEnvValue(value: string | undefined): string | undefined {\n return value || undefined;\n}\n","import {\n internalInitializeGTSRA,\n type ReactInitializeGTParams,\n} from '@generaltranslation/react-core/pure';\nimport { addRuntimeCredentials } from './runtimeCredentials';\n\nexport type InitializeGTParams = ReactInitializeGTParams;\n\n/**\n * Initialize GT for server-rendered React runtimes.\n */\nexport function initializeGTSRA(config: InitializeGTParams): void {\n internalInitializeGTSRA(addRuntimeCredentials(config));\n}\n","import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getCookieValue, parseAcceptLanguage } from 'gt-i18n/internal';\n\ntype RequestWithHeaders = Pick<Request, 'headers'>;\n\n/**\n * Resolve the user's locale from a Web Request.\n *\n * The configured locale cookie takes precedence over the Accept-Language\n * header. If neither contains a supported locale, the configured default\n * locale is returned.\n *\n * This is intended for incoming server requests. A Request created in the\n * browser does not automatically include document cookies or Accept-Language.\n */\nexport function parseLocale(request: RequestWithHeaders): string {\n const i18nConfig = getI18nConfig();\n const candidates: string[] = [];\n const cookieLocale = getCookieValue(\n request.headers.get('cookie'),\n i18nConfig.getLocaleCookieName()\n );\n\n if (cookieLocale) {\n candidates.push(cookieLocale);\n }\n\n candidates.push(\n ...parseAcceptLanguage(request.headers.get('accept-language'))\n );\n\n return i18nConfig.resolveSupportedLocale(candidates);\n}\n","import {\n useInternalLocaleSelector,\n useSetLocale,\n} from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a locale selector.\n * Provides locale management utilities for the application.\n *\n * @param locales an optional list of locales to use for the drop down. These locales must be a subset of the locales provided by the `<GTProvider>` context. When not provided, the list of locales from the `<GTProvider>` context is used.\n *\n * @returns {Object} An object containing locale-related utilities:\n * @returns {string} return.locale - The currently selected locale.\n * @returns {string[]} return.locales - The list of all available locales.\n * @returns {function} return.setLocale - Function to update the current locale.\n * @returns {(locale: string) => LocaleProperties} return.getLocaleProperties - Function to retrieve properties for a given locale.\n */\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n","import {\n useInternalRegionSelector,\n useSetLocale,\n useSetRegion,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\n/**\n * Gets the list of properties for using a region selector.\n * Provides region management utilities for the application.\n *\n * @param {Object} [options] - Optional configuration object.\n * @param {string[]} [options.regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from supported locales.\n * @param {Object} [options.customMapping] - Optional mapping to override region display names, emojis, or associated locales.\n * @param {boolean} [options.prioritizeCurrentLocaleRegion=true] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [options.sortRegionsAlphabetically=true] - If true, regions are sorted alphabetically by display name.\n *\n * @returns {Object} An object containing region-related utilities:\n * @returns {string | undefined} return.region - The currently selected region code.\n * @returns {function} return.setRegion - Function to update the current region.\n * @returns {string[]} return.regions - The ordered list of available region codes.\n * @returns {Map<string, RegionData>} return.regionData - Map of region codes to their display data (name, emoji, locale).\n * @returns {string} return.locale - The current locale.\n * @returns {function} return.setLocale - Function to update the current locale.\n */\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setRegion = useSetRegion();\n const setLocale = useSetLocale();\n return { setRegion, setLocale, ...useInternalRegionSelector(options) };\n}\n","'server-only';\n\nimport {\n OnMissingDictionaryEntry,\n OnMissingDictionaryObj,\n OnMissingTranslation,\n} from '@generaltranslation/react-core/pure';\nimport { I18nStore } from '@generaltranslation/react-core/components';\nimport { useMemo } from 'react';\n\n/**\n * Returns handle missing translation callback for server runtime\n * These DO get invoked during server render which is not pure, but this\n * is acceptable for dev hot reload because we MUST trigger a translate\n * call on the server to persist translations\n */\nexport function useHandleMissingTranslations(i18nStore: I18nStore): {\n onMissingTranslation: OnMissingTranslation;\n onMissingDictionaryEntry: OnMissingDictionaryEntry;\n onMissingDictionaryObj: OnMissingDictionaryObj;\n} {\n return useMemo(\n () => ({\n onMissingTranslation: (lookup) => i18nStore.translate(lookup),\n onMissingDictionaryEntry: (lookup) =>\n i18nStore.translateDictionaryEntry(lookup),\n onMissingDictionaryObj: (lookup) =>\n i18nStore.translateDictionaryObject(lookup),\n }),\n [i18nStore]\n );\n}\n","import {\n I18nStore,\n InternalGTProvider,\n} from '@generaltranslation/react-core/components';\nimport { useRef } from 'react';\nimport type { SharedGTProviderProps } from './GTProviderProps';\nimport { useHandleMissingTranslations } from '../hooks/useHandleMissingTranslations';\n\n/**\n * Consumes snapshot from server\n * Implementation for server-side only\n */\nexport function ServerGTProvider({\n locale,\n region,\n enableI18n,\n ...props\n}: SharedGTProviderProps) {\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n const {\n onMissingTranslation,\n onMissingDictionaryEntry,\n onMissingDictionaryObj,\n } = useHandleMissingTranslations(i18nStoreRef.current);\n\n return (\n <InternalGTProvider\n {...props}\n locale={locale}\n region={region}\n enableI18n={enableI18n ?? true}\n setLocale={noopSetLocale}\n setRegion={noopSetRegion}\n setEnableI18n={noopSetEnableI18n}\n i18nStore={i18nStoreRef.current}\n onMissingTranslation={onMissingTranslation}\n onMissingDictionaryEntry={onMissingDictionaryEntry}\n onMissingDictionaryObj={onMissingDictionaryObj}\n />\n );\n}\n\nconst noopSetLocale = (_locale: string) => undefined;\nconst noopSetRegion = (_region: string | undefined) => undefined;\nconst noopSetEnableI18n = (_enabled: boolean) => undefined;\n","import type React from 'react';\nimport { InternalLocaleSelector } from '@generaltranslation/react-core/components';\nimport { CustomMapping } from 'generaltranslation/types';\nimport { useLocaleSelector } from './useLocaleSelector';\n\n/**\n * A dropdown component that allows users to select a locale.\n * @param {string[]} [locales] - An optional list of locales to use for the dropdown. If not provided, the list of locales from the `<GTProvider>` context is used.\n * @param {object} [customNames] - (deprecated) An optional object to map locales to custom names. Use `customMapping` instead.\n * @param {CustomMapping} [customMapping] - An optional object to map locales to custom display names, emojis, or other properties.\n * @returns {React.ReactElement | null} The rendered locale dropdown component or null to prevent rendering.\n */\nexport function LocaleSelector({\n locales: _locales,\n ...props\n}: LocaleSelectorProps): React.JSX.Element | null {\n // Get locale selector properties\n const { locale, locales, getLocaleProperties, setLocale } =\n useLocaleSelector(_locales);\n\n return (\n <InternalLocaleSelector\n locale={locale}\n locales={locales}\n setLocale={setLocale}\n getLocaleProperties={getLocaleProperties}\n {...props}\n />\n );\n}\n\nexport type LocaleSelectorProps = {\n locales?: string[];\n customNames?: { [key: string]: string };\n customMapping?: CustomMapping;\n [key: string]: any;\n};\n","import type React from 'react';\nimport type { ReactNode } from 'react';\nimport { InternalRegionSelector } from '@generaltranslation/react-core/components';\nimport { useRegionSelector } from './useRegionSelector';\n\n/**\n * A dropdown component that allows users to select a region.\n * @param {string[]} [regions] - An optional array of ISO 3166 region codes to display. If not provided, regions are inferred from the supported locales in the `<GTProvider>` context.\n * @param {React.ReactNode} [placeholder] - Optional placeholder node to display as the first option when no region is selected.\n * @param {object} [customMapping] - An optional object to map region codes to custom display names, emojis, or associated locales.\n * @param {boolean} [prioritizeCurrentLocaleRegion] - If true, the region corresponding to the current locale is prioritized in the list.\n * @param {boolean} [sortRegionsAlphabetically] - If true, regions are sorted alphabetically by display name.\n * @param {boolean} [asLocaleSelector=false] - If true, selecting a region will also update the locale to the region's associated locale.\n * @returns {React.ReactElement | null} The rendered region dropdown component or null to prevent rendering.\n *\n * @example\n * ```tsx\n * <RegionSelector\n * regions={['US', 'CA']}\n * customMapping={{ US: { name: \"United States\", emoji: \"πΊπΈ\" } }}\n * placeholder=\"Select a region\"\n * />\n * ```\n */\nexport function RegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n asLocaleSelector = false,\n ...props\n}: RegionSelectorProps): React.JSX.Element | null {\n // Get region selector properties\n const { region, regions, regionData, locale, setRegion, setLocale } =\n useRegionSelector({\n regions: _regions,\n customMapping,\n prioritizeCurrentLocaleRegion,\n sortRegionsAlphabetically,\n });\n\n const changeRegion = (region: string) => {\n if (asLocaleSelector) {\n const regionLocale = regionData.get(region)?.locale;\n // setRegion reloads the page; update the locale cookie first\n if (regionLocale && locale !== regionLocale) setLocale(regionLocale);\n }\n setRegion(region);\n };\n\n return (\n <InternalRegionSelector\n region={region}\n regions={regions}\n regionData={regionData}\n setRegion={changeRegion}\n {...props}\n />\n );\n}\n\nexport type RegionSelectorProps = {\n regions?: string[];\n placeholder?: ReactNode;\n customMapping?: {\n [region: string]:\n | string\n | { name?: string; emoji?: string; locale?: string };\n };\n prioritizeCurrentLocaleRegion?: boolean;\n sortRegionsAlphabetically?: boolean;\n asLocaleSelector?: boolean;\n [key: string]: any;\n};\n","'use client';\n\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport type { ReactNode } from 'react';\nimport type { TxProps } from './utils/TxProps';\n\n// SSR/context-capable React runtime surface. This entrypoint may import hooks,\n// providers, and context modules, so it must be consumed as a client boundary by\n// React Server Component frameworks.\n\nexport { initializeGTSRA as initializeGT } from './setup/initializeGTSRA';\nexport { parseLocale } from './functions/parseLocale';\nexport { useLocaleSelector } from './components/useLocaleSelector';\nexport { useRegionSelector } from './components/useRegionSelector';\n\ntype InitializeGTSPA = typeof import('./setup/initializeGTSPA').initializeGTSPA;\ntype CreateOrUpdateBrowserConditionStore =\n typeof import('./condition-store/createBrowserConditionStore').createOrUpdateBrowserConditionStore;\n\nconst createBrowserConditionStoreServerError = createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'createOrUpdateBrowserConditionStore() cannot be called from the server runtime entry point',\n why: 'createOrUpdateBrowserConditionStore() initializes browser-only condition state.',\n fix: 'Call createOrUpdateBrowserConditionStore() from the browser runtime entry point.',\n});\n\nexport const initializeGTSPA: InitializeGTSPA = async () => {\n throw new Error(\n createDiagnosticMessage({\n source: 'gt-react',\n severity: 'Error',\n whatHappened:\n 'initializeGTSPA() cannot be called from the server runtime entry point',\n why: 'initializeGTSPA() initializes browser-only SPA state and translation cache behavior.',\n fix: 'Use initializeGT() for server-rendered React runtimes or import initializeGTSPA from the browser entry point.',\n })\n );\n};\n\nexport const createOrUpdateBrowserConditionStore: CreateOrUpdateBrowserConditionStore =\n () => {\n throw new Error(createBrowserConditionStoreServerError);\n };\n\n// ===== Components ===== //\nexport { ServerGTProvider as GTProvider } from './provider/ServerGTProvider';\nexport { LocaleSelector } from './components/LocaleSelector';\nexport { RegionSelector } from './components/RegionSelector';\n\n// ===== Components ===== //\nexport {\n Branch,\n Plural,\n Derive,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n Currency,\n DateTime,\n RelativeTime,\n Var,\n Num,\n} from '@generaltranslation/react-core/components';\n\nexport async function Tx(_props: TxProps): Promise<ReactNode> {\n throw new Error('Tx is only supported via RSC');\n}\n\n// ===== Hooks ===== //\nexport {\n useLocale,\n useRegion,\n useCustomMapping,\n useDefaultLocale,\n useEnableI18n,\n useLocales,\n useFormatLocales,\n useGT,\n useMessages,\n useTranslations,\n useLocaleDirection,\n useLocaleProperties,\n useSetLocale,\n useSetRegion,\n useSetEnableI18n,\n} from '@generaltranslation/react-core/hooks';\n\n// ===== Functions ===== //\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n derive,\n declareVar,\n decodeVars,\n mFallback,\n gtFallback,\n getFormatLocales,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getReactI18nCache,\n getTranslationsSnapshot,\n getVersionId,\n createRenderPipeline,\n setReactI18nCache,\n t,\n} from '@generaltranslation/react-core/pure';\n\nexport type {\n RenderPipeline,\n RenderPreparedT,\n} from '@generaltranslation/react-core/pure';\n\nexport type { SharedGTProviderProps } from './provider/GTProviderProps';\nexport {\n GtInternalRuntimeTranslateJsx,\n GtInternalRuntimeTranslateString,\n} from 'gt-i18n/internal';\nexport type {\n GTTranslationOptions,\n RuntimeTranslationOptions,\n} from 'gt-i18n/types';\nexport type {\n SyncResolutionFunction,\n SyncResolutionFunctionWithFallback,\n} from 'gt-i18n/types';\n\n// ===== Singletons ===== //\nexport {\n ReactI18nCache,\n type ReactI18nCacheParams,\n} from '@generaltranslation/react-core/pure';\n"],"mappings":";;;;;;;;AACA,SAAS,eAAe,MAAM;CAC7B,MAAM,UAAU,KAAK,MAAM;AAC3B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,UAAU,KAAK,QAAQ,GAAG,UAAU,GAAG,QAAQ;;AAEvD,SAAS,cAAc,MAAM;CAC5B,MAAM,UAAU,KAAK,MAAM;CAC3B,IAAI,MAAM,QAAQ;AAClB,QAAO,MAAM,GAAG;EACf,MAAM,OAAO,QAAQ,MAAM;AAC3B,MAAI,SAAS,OAAO,SAA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1D,OAAM,IAAI,MACR,wBAAwB;EACtB,QAAQ;EACR,UAAU;EACV,cACE;EACF,KAAK;EACL,KAAK;EACN,CAAC,CACH;;AAGH,MAAa,4CACL;AACJ,OAAM,IAAI,MAAM,uCAAuC;;AAuB3D,eAAsB,GAAG,QAAqC;AAC5D,OAAM,IAAI,MAAM,+BAA+B"}
|
package/dist/index.types.d.cts
CHANGED
|
@@ -57,12 +57,7 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
57
57
|
_getLocale?: GetLocale;
|
|
58
58
|
_getRegion?: GetRegion;
|
|
59
59
|
_getEnableI18n?: GetEnableI18n;
|
|
60
|
-
_reload?: ReloadType;
|
|
61
|
-
_serverConditions?: {
|
|
62
|
-
locale: string;
|
|
63
|
-
region?: string;
|
|
64
|
-
enableI18n?: boolean;
|
|
65
|
-
};
|
|
60
|
+
_reload?: ReloadType;
|
|
66
61
|
};
|
|
67
62
|
/**
|
|
68
63
|
* Condition store implementation for Browser.
|
|
@@ -72,8 +67,6 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
72
67
|
private customGetLocale?;
|
|
73
68
|
private customGetRegion?;
|
|
74
69
|
private customGetEnableI18n?;
|
|
75
|
-
private serverConditions?;
|
|
76
|
-
private pending;
|
|
77
70
|
constructor(config: BrowserConditionStoreParams);
|
|
78
71
|
getLocale: () => string;
|
|
79
72
|
setLocale: (locale: LocaleCandidates) => void;
|
|
@@ -302,20 +295,12 @@ type RegionSelectorProps = {
|
|
|
302
295
|
* - {@link InternalGTProviderProps} - requires translations and dictionaries
|
|
303
296
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
304
297
|
*/
|
|
305
|
-
type SharedGTProviderProps = Omit<InternalGTProviderProps, '
|
|
306
|
-
locale: string;
|
|
307
|
-
_serverConditions?: {
|
|
308
|
-
locale: string;
|
|
309
|
-
region?: string;
|
|
310
|
-
enableI18n?: boolean;
|
|
311
|
-
};
|
|
298
|
+
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'i18nStore' | 'region' | 'enableI18n' | 'setLocale' | 'setRegion' | 'setEnableI18n'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
299
|
+
locale: string;
|
|
312
300
|
};
|
|
313
301
|
//#endregion
|
|
314
302
|
//#region src/provider/BrowserGTProvider.d.ts
|
|
315
|
-
/**
|
|
316
|
-
* Consumes snapshot from server
|
|
317
|
-
* Implementation for client-side only
|
|
318
|
-
*/
|
|
303
|
+
/** Client-side provider for server-rendered applications. */
|
|
319
304
|
declare function BrowserGTProvider(props: SharedGTProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
320
305
|
//#endregion
|
|
321
306
|
//#region src/index.types.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA
|
|
1
|
+
{"version":3,"file":"index.types.d.cts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA;AAAA;;;;cAMC,qBAAA,YAAiC,+BAAA;EAAA,QACpC,YAAA;EAAA,QACA,eAAA;EAAA,QACA,eAAA;EAAA,QACA,mBAAA;cAEI,MAAA,EAAQ,2BAAA;EAsBpB,SAAA;EAIA,SAAA,GAAa,MAAA,EAAQ,gBAAA;EASrB,SAAA;EAQA,SAAA,GAAa,MAAA;EAKb,aAAA;EAYA,aAAA,GAAiB,UAAA;;;;EAQjB,YAAA,GAAgB,MAAA,EAAQ,gBAAA;EFxGL;;;EEmHnB,YAAA,GAAgB,MAAA;EFlHN;;;EE4HV,gBAAA,GAAoB,UAAA;EF5HG;AAOzB;;;;EE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A;EACjB,aAAA,GAAgB,aAAA;EAAA,CACf,GAAA;AAAA;;;;;;;;;;;;;AXjCH;;;;;;;;;iBYsBgB,cAAA,CAAA;EACd,OAAA,EAAS,QAAA;EACT,aAAA;EACA,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,GACG;AAAA,GACF,mBAAA,GAAsB,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,KA8BvB,mBAAA;EACV,OAAA;EACA,WAAA,GAAc,SAAA;EACd,aAAA;IAAA,CACG,MAAA;MAEK,IAAA;MAAe,KAAA;MAAgB,MAAA;IAAA;EAAA;EAEvC,6BAAA;EACA,yBAAA;EACA,gBAAA;EAAA,CACC,GAAA;AAAA;;;;;;;;;KC/DS,qBAAA,GAAwB,IAAA,CAClC,uBAAA,yFAQA,IAAA,CAAK,2BAAA;EACH,MAAA;AAAA;;;;iBCJY,iBAAA,CAAkB,KAAA,EAAO,qBAAA,GAAqB,oBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCiBxC,EAAA,CAAG,MAAA,EAAQ,OAAA,GAAU,OAAA,CAAQ,SAAA"}
|
package/dist/index.types.d.mts
CHANGED
|
@@ -57,12 +57,7 @@ type BrowserConditionStoreParams = WritableConditionStoreParams & {
|
|
|
57
57
|
_getLocale?: GetLocale;
|
|
58
58
|
_getRegion?: GetRegion;
|
|
59
59
|
_getEnableI18n?: GetEnableI18n;
|
|
60
|
-
_reload?: ReloadType;
|
|
61
|
-
_serverConditions?: {
|
|
62
|
-
locale: string;
|
|
63
|
-
region?: string;
|
|
64
|
-
enableI18n?: boolean;
|
|
65
|
-
};
|
|
60
|
+
_reload?: ReloadType;
|
|
66
61
|
};
|
|
67
62
|
/**
|
|
68
63
|
* Condition store implementation for Browser.
|
|
@@ -72,8 +67,6 @@ declare class BrowserConditionStore implements WritableConditionStoreInterface {
|
|
|
72
67
|
private customGetLocale?;
|
|
73
68
|
private customGetRegion?;
|
|
74
69
|
private customGetEnableI18n?;
|
|
75
|
-
private serverConditions?;
|
|
76
|
-
private pending;
|
|
77
70
|
constructor(config: BrowserConditionStoreParams);
|
|
78
71
|
getLocale: () => string;
|
|
79
72
|
setLocale: (locale: LocaleCandidates$1) => void;
|
|
@@ -302,20 +295,12 @@ type RegionSelectorProps = {
|
|
|
302
295
|
* - {@link InternalGTProviderProps} - requires translations and dictionaries
|
|
303
296
|
* - {@link BrowserConditionStoreParams} - requires locale
|
|
304
297
|
*/
|
|
305
|
-
type SharedGTProviderProps = Omit<InternalGTProviderProps, '
|
|
306
|
-
locale: string;
|
|
307
|
-
_serverConditions?: {
|
|
308
|
-
locale: string;
|
|
309
|
-
region?: string;
|
|
310
|
-
enableI18n?: boolean;
|
|
311
|
-
};
|
|
298
|
+
type SharedGTProviderProps = Omit<InternalGTProviderProps, 'i18nStore' | 'region' | 'enableI18n' | 'setLocale' | 'setRegion' | 'setEnableI18n'> & Omit<BrowserConditionStoreParams, 'locale'> & {
|
|
299
|
+
locale: string;
|
|
312
300
|
};
|
|
313
301
|
//#endregion
|
|
314
302
|
//#region src/provider/BrowserGTProvider.d.ts
|
|
315
|
-
/**
|
|
316
|
-
* Consumes snapshot from server
|
|
317
|
-
* Implementation for client-side only
|
|
318
|
-
*/
|
|
303
|
+
/** Client-side provider for server-rendered applications. */
|
|
319
304
|
declare function BrowserGTProvider(props: SharedGTProviderProps): _$react_jsx_runtime0.JSX.Element;
|
|
320
305
|
//#endregion
|
|
321
306
|
//#region src/index.types.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,UAAA,GAAa,SAAA;EACb,cAAA,GAAiB,aAAA;EACjB,OAAA,GAAU,UAAA
|
|
1
|
+
{"version":3,"file":"index.types.d.mts","names":["CustomMapping","LocaleProperties","Partial","Record","code","name","nativeName","languageCode","languageName","nativeLanguageName","nameWithRegionCode","nativeNameWithRegionCode","regionCode","regionName","nativeRegionName","scriptCode","scriptName","nativeScriptName","maximizedCode","maximizedName","nativeMaximizedName","minimizedCode","minimizedName","nativeMinimizedName","emoji","CustomRegionMapping","region","locale","getRegionProperties","defaultLocale","customMapping","CutoffFormatStyle","TerminatorOptions","terminator","separator","CutoffFormatOptions","maxChars","style","VariableType","Variable","k","i","v","HTML_CONTENT_PROPS","pl","ti","alt","arl","arb","ard","HtmlContentPropKeysRecord","HtmlContentPropValuesRecord","GTProp","JsxChildren","b","t","JsxElement","d","c","JsxChild","StringFormat","DataFormat","StringContent","IcuMessage","StringMessage","I18nextMessage","Content","FormatVariables","Date","S","_","a","f","g","h","l","m","n","o","p","r","s","u","x","y"],"sources":["../src/utils/TxProps.ts","../src/i18n-cache/types.ts","../src/i18n-cache/BrowserI18nCache.ts","../src/condition-store/BrowserConditionStore.ts","../src/condition-store/createBrowserConditionStore.ts","../src/setup/initializeGTSPA.ts","../src/setup/initializeGTSRA.ts","../src/functions/parseLocale.ts","../../format/dist/types-CbRDetV3.d.cts","../src/components/useLocaleSelector.ts","../src/components/useRegionSelector.ts","../src/components/LocaleSelector.tsx","../src/components/RegionSelector.tsx","../src/provider/GTProviderProps.ts","../src/provider/BrowserGTProvider.tsx","../src/index.types.ts"],"mappings":";;;;;;;;;;;;KAEY,OAAA,GAAU,MAAA,SAAe,SAAA;EACnC,QAAA,EAAU,SAAA;EACV,OAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;KCHU,SAAA;AAAA,KACA,SAAA;AAAA,KACA,aAAA;;;;;;KAOA,cAAA;EACV,iBAAA;EACA,gBAAA;AAAA;;;;;;KCUU,sBAAA,GAAyB,0BAAA;EACnC,cAAA,GAAiB,cAAA;AAAA;;;KCZd,oCAAA;EACH,MAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,KAEU,UAAA,IAAc,KAAA,EAAO,oCAAA;;;;AHhBjC;KGsBY,2BAAA,GAA8B,4BAAA;EACxC,UAAA,GAAa,SAAA;EACb,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
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.5",
|
|
4
4
|
"description": "A React library for automatic internationalization.",
|
|
5
5
|
"main": "./dist/index.server.cjs",
|
|
6
6
|
"module": "./dist/index.server.mjs",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"react-dom": ">=18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"generaltranslation": "9.5.
|
|
21
|
-
"@generaltranslation/react-core": "11.4.
|
|
22
|
-
"gt-i18n": "1.0.
|
|
20
|
+
"generaltranslation": "9.5.1",
|
|
21
|
+
"@generaltranslation/react-core": "11.4.5",
|
|
22
|
+
"gt-i18n": "1.0.32"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@types/node": "^22.13.5",
|
|
36
36
|
"@types/react": ">=18.0.0 <20.0.0",
|
|
37
37
|
"@types/react-dom": ">=18.0.0 <20.0.0",
|
|
38
|
+
"jsdom": "^26.1.0",
|
|
38
39
|
"tsdown": "^0.21.10",
|
|
39
40
|
"typescript": "^5.9.2"
|
|
40
41
|
},
|