@create-flow/common-ui 0.3.7 → 0.5.0

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.
@@ -0,0 +1,41 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ interface LocaleInfo {
5
+ code: string;
6
+ name: string;
7
+ nativeName: string;
8
+ direction: 'ltr' | 'rtl';
9
+ }
10
+ interface I18nContextValue {
11
+ locale: string;
12
+ setLocale: (locale: string) => void;
13
+ t: (key: string, vars?: Record<string, string | number>) => string;
14
+ availableLocales: LocaleInfo[];
15
+ isRtl: boolean;
16
+ }
17
+ declare const LOCALE_AFFINITY: Record<string, string[]>;
18
+ declare function normalizeLocale(raw: string): string;
19
+ declare function buildFallbackChain(rawLocale: string): string[];
20
+ declare function findBestLocale(raw: string): string;
21
+ /**
22
+ * Extract locale from a server request (query params + Accept-Language header).
23
+ * Pure function — no fs dependency. Returns the best locale string.
24
+ */
25
+ declare function extractLocaleFromRequest(request: Request, isLocaleAvailable: (locale: string) => boolean): string;
26
+ /**
27
+ * Interpolate variables into a translation string.
28
+ * Pure function — no fs dependency.
29
+ */
30
+ declare function interpolate(value: string, vars?: Record<string, string | number>): string;
31
+ interface I18nProviderProps {
32
+ defaultLocale?: string;
33
+ /** When set, only these locale codes appear in availableLocales (from SiteSettings). */
34
+ supportedLocales?: string[];
35
+ children: React.ReactNode;
36
+ onLocaleChange?: (locale: string) => void;
37
+ }
38
+ declare function I18nProvider({ defaultLocale, supportedLocales, children, onLocaleChange, }: I18nProviderProps): react_jsx_runtime.JSX.Element;
39
+ declare function useI18n(): I18nContextValue;
40
+
41
+ export { type I18nContextValue as I, LOCALE_AFFINITY as L, I18nProvider as a, type I18nProviderProps as b, type LocaleInfo as c, buildFallbackChain as d, extractLocaleFromRequest as e, findBestLocale as f, interpolate as i, normalizeLocale as n, useI18n as u };
@@ -0,0 +1,41 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ interface LocaleInfo {
5
+ code: string;
6
+ name: string;
7
+ nativeName: string;
8
+ direction: 'ltr' | 'rtl';
9
+ }
10
+ interface I18nContextValue {
11
+ locale: string;
12
+ setLocale: (locale: string) => void;
13
+ t: (key: string, vars?: Record<string, string | number>) => string;
14
+ availableLocales: LocaleInfo[];
15
+ isRtl: boolean;
16
+ }
17
+ declare const LOCALE_AFFINITY: Record<string, string[]>;
18
+ declare function normalizeLocale(raw: string): string;
19
+ declare function buildFallbackChain(rawLocale: string): string[];
20
+ declare function findBestLocale(raw: string): string;
21
+ /**
22
+ * Extract locale from a server request (query params + Accept-Language header).
23
+ * Pure function — no fs dependency. Returns the best locale string.
24
+ */
25
+ declare function extractLocaleFromRequest(request: Request, isLocaleAvailable: (locale: string) => boolean): string;
26
+ /**
27
+ * Interpolate variables into a translation string.
28
+ * Pure function — no fs dependency.
29
+ */
30
+ declare function interpolate(value: string, vars?: Record<string, string | number>): string;
31
+ interface I18nProviderProps {
32
+ defaultLocale?: string;
33
+ /** When set, only these locale codes appear in availableLocales (from SiteSettings). */
34
+ supportedLocales?: string[];
35
+ children: React.ReactNode;
36
+ onLocaleChange?: (locale: string) => void;
37
+ }
38
+ declare function I18nProvider({ defaultLocale, supportedLocales, children, onLocaleChange, }: I18nProviderProps): react_jsx_runtime.JSX.Element;
39
+ declare function useI18n(): I18nContextValue;
40
+
41
+ export { type I18nContextValue as I, LOCALE_AFFINITY as L, I18nProvider as a, type I18nProviderProps as b, type LocaleInfo as c, buildFallbackChain as d, extractLocaleFromRequest as e, findBestLocale as f, interpolate as i, normalizeLocale as n, useI18n as u };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Pure i18n utility functions — no React dependency.
3
+ * Shared by both client (I18nContext.tsx) and server (server.ts) entry points.
4
+ */
5
+ declare const LOCALE_AFFINITY: Record<string, string[]>;
6
+ declare function normalizeLocale(raw: string): string;
7
+ declare function buildFallbackChain(rawLocale: string): string[];
8
+ declare function extractLocaleFromRequest(request: Request, isLocaleAvailable: (locale: string) => boolean): string;
9
+ declare function interpolate(value: string, vars?: Record<string, string | number>): string;
10
+
11
+ export { LOCALE_AFFINITY as L, buildFallbackChain as b, extractLocaleFromRequest as e, interpolate as i, normalizeLocale as n };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Pure i18n utility functions — no React dependency.
3
+ * Shared by both client (I18nContext.tsx) and server (server.ts) entry points.
4
+ */
5
+ declare const LOCALE_AFFINITY: Record<string, string[]>;
6
+ declare function normalizeLocale(raw: string): string;
7
+ declare function buildFallbackChain(rawLocale: string): string[];
8
+ declare function extractLocaleFromRequest(request: Request, isLocaleAvailable: (locale: string) => boolean): string;
9
+ declare function interpolate(value: string, vars?: Record<string, string | number>): string;
10
+
11
+ export { LOCALE_AFFINITY as L, buildFallbackChain as b, extractLocaleFromRequest as e, interpolate as i, normalizeLocale as n };