koto-react 1.0.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 @@
1
+ {"version":3,"file":"index.js","sources":["../node_modules/idb/build/index.js","../src/storage.ts","../src/utils.ts","../src/locales.ts","../src/Provider.tsx","../src/hoc.tsx","../src/t.ts","../src/index.ts"],"sourcesContent":["const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);\n\nlet idbProxyableTypes;\nlet cursorAdvanceMethods;\n// This is a function to prevent it throwing up in node environments.\nfunction getIdbProxyableTypes() {\n return (idbProxyableTypes ||\n (idbProxyableTypes = [\n IDBDatabase,\n IDBObjectStore,\n IDBIndex,\n IDBCursor,\n IDBTransaction,\n ]));\n}\n// This is a function to prevent it throwing up in node environments.\nfunction getCursorAdvanceMethods() {\n return (cursorAdvanceMethods ||\n (cursorAdvanceMethods = [\n IDBCursor.prototype.advance,\n IDBCursor.prototype.continue,\n IDBCursor.prototype.continuePrimaryKey,\n ]));\n}\nconst transactionDoneMap = new WeakMap();\nconst transformCache = new WeakMap();\nconst reverseTransformCache = new WeakMap();\nfunction promisifyRequest(request) {\n const promise = new Promise((resolve, reject) => {\n const unlisten = () => {\n request.removeEventListener('success', success);\n request.removeEventListener('error', error);\n };\n const success = () => {\n resolve(wrap(request.result));\n unlisten();\n };\n const error = () => {\n reject(request.error);\n unlisten();\n };\n request.addEventListener('success', success);\n request.addEventListener('error', error);\n });\n // This mapping exists in reverseTransformCache but doesn't exist in transformCache. This\n // is because we create many promises from a single IDBRequest.\n reverseTransformCache.set(promise, request);\n return promise;\n}\nfunction cacheDonePromiseForTransaction(tx) {\n // Early bail if we've already created a done promise for this transaction.\n if (transactionDoneMap.has(tx))\n return;\n const done = new Promise((resolve, reject) => {\n const unlisten = () => {\n tx.removeEventListener('complete', complete);\n tx.removeEventListener('error', error);\n tx.removeEventListener('abort', error);\n };\n const complete = () => {\n resolve();\n unlisten();\n };\n const error = () => {\n reject(tx.error || new DOMException('AbortError', 'AbortError'));\n unlisten();\n };\n tx.addEventListener('complete', complete);\n tx.addEventListener('error', error);\n tx.addEventListener('abort', error);\n });\n // Cache it for later retrieval.\n transactionDoneMap.set(tx, done);\n}\nlet idbProxyTraps = {\n get(target, prop, receiver) {\n if (target instanceof IDBTransaction) {\n // Special handling for transaction.done.\n if (prop === 'done')\n return transactionDoneMap.get(target);\n // Make tx.store return the only store in the transaction, or undefined if there are many.\n if (prop === 'store') {\n return receiver.objectStoreNames[1]\n ? undefined\n : receiver.objectStore(receiver.objectStoreNames[0]);\n }\n }\n // Else transform whatever we get back.\n return wrap(target[prop]);\n },\n set(target, prop, value) {\n target[prop] = value;\n return true;\n },\n has(target, prop) {\n if (target instanceof IDBTransaction &&\n (prop === 'done' || prop === 'store')) {\n return true;\n }\n return prop in target;\n },\n};\nfunction replaceTraps(callback) {\n idbProxyTraps = callback(idbProxyTraps);\n}\nfunction wrapFunction(func) {\n // Due to expected object equality (which is enforced by the caching in `wrap`), we\n // only create one new func per func.\n // Cursor methods are special, as the behaviour is a little more different to standard IDB. In\n // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the\n // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense\n // with real promises, so each advance methods returns a new promise for the cursor object, or\n // undefined if the end of the cursor has been reached.\n if (getCursorAdvanceMethods().includes(func)) {\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n func.apply(unwrap(this), args);\n return wrap(this.request);\n };\n }\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n return wrap(func.apply(unwrap(this), args));\n };\n}\nfunction transformCachableValue(value) {\n if (typeof value === 'function')\n return wrapFunction(value);\n // This doesn't return, it just creates a 'done' promise for the transaction,\n // which is later returned for transaction.done (see idbObjectHandler).\n if (value instanceof IDBTransaction)\n cacheDonePromiseForTransaction(value);\n if (instanceOfAny(value, getIdbProxyableTypes()))\n return new Proxy(value, idbProxyTraps);\n // Return the same value back if we're not going to transform it.\n return value;\n}\nfunction wrap(value) {\n // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because\n // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.\n if (value instanceof IDBRequest)\n return promisifyRequest(value);\n // If we've already transformed this value before, reuse the transformed value.\n // This is faster, but it also provides object equality.\n if (transformCache.has(value))\n return transformCache.get(value);\n const newValue = transformCachableValue(value);\n // Not all types are transformed.\n // These may be primitive types, so they can't be WeakMap keys.\n if (newValue !== value) {\n transformCache.set(value, newValue);\n reverseTransformCache.set(newValue, value);\n }\n return newValue;\n}\nconst unwrap = (value) => reverseTransformCache.get(value);\n\n/**\n * Open a database.\n *\n * @param name Name of the database.\n * @param version Schema version.\n * @param callbacks Additional callbacks.\n */\nfunction openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) {\n const request = indexedDB.open(name, version);\n const openPromise = wrap(request);\n if (upgrade) {\n request.addEventListener('upgradeneeded', (event) => {\n upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);\n });\n }\n if (blocked) {\n request.addEventListener('blocked', (event) => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event.newVersion, event));\n }\n openPromise\n .then((db) => {\n if (terminated)\n db.addEventListener('close', () => terminated());\n if (blocking) {\n db.addEventListener('versionchange', (event) => blocking(event.oldVersion, event.newVersion, event));\n }\n })\n .catch(() => { });\n return openPromise;\n}\n/**\n * Delete a database.\n *\n * @param name Name of the database.\n */\nfunction deleteDB(name, { blocked } = {}) {\n const request = indexedDB.deleteDatabase(name);\n if (blocked) {\n request.addEventListener('blocked', (event) => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event));\n }\n return wrap(request).then(() => undefined);\n}\n\nconst readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];\nconst writeMethods = ['put', 'add', 'delete', 'clear'];\nconst cachedMethods = new Map();\nfunction getMethod(target, prop) {\n if (!(target instanceof IDBDatabase &&\n !(prop in target) &&\n typeof prop === 'string')) {\n return;\n }\n if (cachedMethods.get(prop))\n return cachedMethods.get(prop);\n const targetFuncName = prop.replace(/FromIndex$/, '');\n const useIndex = prop !== targetFuncName;\n const isWrite = writeMethods.includes(targetFuncName);\n if (\n // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.\n !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) ||\n !(isWrite || readMethods.includes(targetFuncName))) {\n return;\n }\n const method = async function (storeName, ...args) {\n // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(\n const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');\n let target = tx.store;\n if (useIndex)\n target = target.index(args.shift());\n // Must reject if op rejects.\n // If it's a write operation, must reject if tx.done rejects.\n // Must reject with op rejection first.\n // Must resolve with op value.\n // Must handle both promises (no unhandled rejections)\n return (await Promise.all([\n target[targetFuncName](...args),\n isWrite && tx.done,\n ]))[0];\n };\n cachedMethods.set(prop, method);\n return method;\n}\nreplaceTraps((oldTraps) => ({\n ...oldTraps,\n get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),\n has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),\n}));\n\nconst advanceMethodProps = ['continue', 'continuePrimaryKey', 'advance'];\nconst methodMap = {};\nconst advanceResults = new WeakMap();\nconst ittrProxiedCursorToOriginalProxy = new WeakMap();\nconst cursorIteratorTraps = {\n get(target, prop) {\n if (!advanceMethodProps.includes(prop))\n return target[prop];\n let cachedFunc = methodMap[prop];\n if (!cachedFunc) {\n cachedFunc = methodMap[prop] = function (...args) {\n advanceResults.set(this, ittrProxiedCursorToOriginalProxy.get(this)[prop](...args));\n };\n }\n return cachedFunc;\n },\n};\nasync function* iterate(...args) {\n // tslint:disable-next-line:no-this-assignment\n let cursor = this;\n if (!(cursor instanceof IDBCursor)) {\n cursor = await cursor.openCursor(...args);\n }\n if (!cursor)\n return;\n cursor = cursor;\n const proxiedCursor = new Proxy(cursor, cursorIteratorTraps);\n ittrProxiedCursorToOriginalProxy.set(proxiedCursor, cursor);\n // Map this double-proxy back to the original, so other cursor methods work.\n reverseTransformCache.set(proxiedCursor, unwrap(cursor));\n while (cursor) {\n yield proxiedCursor;\n // If one of the advancing methods was not called, call continue().\n cursor = await (advanceResults.get(proxiedCursor) || cursor.continue());\n advanceResults.delete(proxiedCursor);\n }\n}\nfunction isIteratorProp(target, prop) {\n return ((prop === Symbol.asyncIterator &&\n instanceOfAny(target, [IDBIndex, IDBObjectStore, IDBCursor])) ||\n (prop === 'iterate' && instanceOfAny(target, [IDBIndex, IDBObjectStore])));\n}\nreplaceTraps((oldTraps) => ({\n ...oldTraps,\n get(target, prop, receiver) {\n if (isIteratorProp(target, prop))\n return iterate;\n return oldTraps.get(target, prop, receiver);\n },\n has(target, prop) {\n return isIteratorProp(target, prop) || oldTraps.has(target, prop);\n },\n}));\n\nexport { deleteDB, openDB, unwrap, wrap };\n","import { openDB, DBSchema, IDBPDatabase } from 'idb';\nimport { TranslationData, StoredTranslations, ApiResponse, LocaleMetadata } from './types';\n\ninterface KotoDB extends DBSchema {\n translations: {\n key: string;\n value: StoredTranslations;\n };\n}\n\nconst DB_NAME = 'koto-translations';\nconst DB_VERSION = 3;\nconst STORE_NAME = 'translations';\nconst CACHE_DURATION = 1000 * 60 * 60; // 1 hour\n\nclass TranslationStorage {\n private db: IDBPDatabase<KotoDB> | null = null;\n\n async init(): Promise<void> {\n if (this.db) return;\n\n this.db = await openDB<KotoDB>(DB_NAME, DB_VERSION, {\n upgrade(db) {\n // Create or keep translations store\n if (!db.objectStoreNames.contains(STORE_NAME)) {\n db.createObjectStore(STORE_NAME);\n }\n },\n });\n }\n\n async getTranslations(locale: string): Promise<StoredTranslations | null> {\n await this.init();\n if (!this.db) return null;\n\n try {\n const stored = await this.db.get(STORE_NAME, locale);\n \n if (!stored) return null;\n \n // Check if cache is still valid\n const now = Date.now();\n if (now - stored.timestamp > CACHE_DURATION) {\n // Cache expired\n await this.db.delete(STORE_NAME, locale);\n return null;\n }\n \n return stored;\n } catch (error) {\n console.error('Error getting translations from IndexedDB:', error);\n return null;\n }\n }\n\n async setTranslations(locale: string, translations: TranslationData, apiResponse?: ApiResponse): Promise<void> {\n await this.init();\n if (!this.db) return;\n\n try {\n // Process translations based on API response format\n const processedTranslations = this.processTranslations(translations);\n \n const stored: StoredTranslations = {\n locale,\n translations: processedTranslations,\n timestamp: Date.now(),\n version: apiResponse?.version,\n };\n \n // Include metadata if provided in API response\n if (apiResponse?.localeInfo || apiResponse?.localeName) {\n stored.metadata = {\n name: apiResponse.localeName || apiResponse.localeInfo?.name,\n nativeName: apiResponse.localeNativeName || apiResponse.localeInfo?.nativeName,\n direction: apiResponse.direction || apiResponse.localeInfo?.direction || 'ltr',\n };\n }\n \n await this.db.put(STORE_NAME, stored, locale);\n } catch (error) {\n console.error('Error storing translations in IndexedDB:', error);\n }\n }\n\n private processTranslations(translations: TranslationData | Record<string, string>): TranslationData {\n // Handle different response formats\n if (typeof translations === 'object' && translations !== null) {\n // Check if it's already in the right format\n if (this.isNestedStructure(translations)) {\n return translations;\n }\n \n // Check if it's a flat key-value structure\n if (this.isFlatStructure(translations)) {\n return this.buildNestedFromFlat(translations as Record<string, string>);\n }\n }\n \n // Return as-is if we can't determine the structure\n return translations;\n }\n\n private isNestedStructure(obj: TranslationData | Record<string, string>): boolean {\n // Check if any value is an object (nested structure)\n return Object.values(obj).some(val => \n typeof val === 'object' && val !== null && !Array.isArray(val)\n );\n }\n\n private isFlatStructure(obj: TranslationData | Record<string, string>): boolean {\n // Check if all values are strings and keys contain dots\n return Object.entries(obj).every(([, val]) => \n typeof val === 'string'\n ) && Object.keys(obj).some(key => key.includes('.'));\n }\n\n private buildNestedFromFlat(flatData: Record<string, string>): TranslationData {\n const result: TranslationData = {};\n \n for (const [key, value] of Object.entries(flatData)) {\n const keys = key.split('.');\n let current: TranslationData = result;\n \n for (let i = 0; i < keys.length - 1; i++) {\n const k = keys[i];\n if (!(k in current)) {\n current[k] = {};\n }\n current = current[k] as TranslationData;\n }\n \n current[keys[keys.length - 1]] = value;\n }\n \n return result;\n }\n\n\n async clearTranslations(locale?: string): Promise<void> {\n await this.init();\n if (!this.db) return;\n\n try {\n if (locale) {\n await this.db.delete(STORE_NAME, locale);\n } else {\n await this.db.clear(STORE_NAME);\n }\n } catch (error) {\n console.error('Error clearing translations from IndexedDB:', error);\n }\n }\n\n async getAllLocales(): Promise<string[]> {\n await this.init();\n if (!this.db) return [];\n\n try {\n return await this.db.getAllKeys(STORE_NAME);\n } catch (error) {\n console.error('Error getting locales from IndexedDB:', error);\n return [];\n }\n }\n\n async getSupportedLocales(): Promise<Array<{ code: string; metadata?: LocaleMetadata }>> {\n await this.init();\n if (!this.db) return [];\n \n try {\n const allData = await this.db.getAll(STORE_NAME);\n \n return allData.map(data => ({\n code: data.locale,\n metadata: data.metadata,\n }));\n } catch (error) {\n console.error('Error getting supported locales:', error);\n return [];\n }\n }\n\n async processApiResponse(locale: string, response: ApiResponse): Promise<TranslationData> {\n // Handle different response formats dynamically\n let translations: TranslationData = {};\n \n // Check for translations in various possible locations\n if (response.translations) {\n translations = response.translations;\n } else if (response.data) {\n translations = response.data;\n } else if (typeof response === 'object' && !response.error) {\n // Direct translation object - must be TranslationData format\n translations = response as TranslationData;\n }\n \n // Store with API metadata\n await this.setTranslations(locale, translations, response);\n \n return this.processTranslations(translations);\n }\n}\n\nexport const storage = new TranslationStorage();","import { TranslationData } from './types';\n\n/**\n * Get a nested translation value using dot notation\n * @param translations - The translations object\n * @param key - The dot-notated key (e.g., 'checkout.payment.title')\n * @returns The translation value or null if not found\n */\nexport function getNestedTranslation(\n translations: TranslationData,\n key: string\n): string | null {\n const keys = key.split('.');\n let current: string | TranslationData = translations;\n\n for (const k of keys) {\n if (current && typeof current === 'object' && k in current) {\n current = current[k] as TranslationData;\n } else {\n return null;\n }\n }\n\n return typeof current === 'string' ? current : null;\n}\n\n/**\n * Flatten nested translation object\n * @param obj - The nested translation object\n * @param prefix - The prefix for keys\n * @returns Flattened object with dot-notated keys\n */\nexport function flattenTranslations(\n obj: TranslationData,\n prefix = ''\n): Record<string, string> {\n const flattened: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(obj)) {\n const newKey = prefix ? `${prefix}.${key}` : key;\n \n if (typeof value === 'string') {\n flattened[newKey] = value;\n } else if (typeof value === 'object' && value !== null) {\n Object.assign(flattened, flattenTranslations(value, newKey));\n }\n }\n\n return flattened;\n}\n\n/**\n * Unflatten dot-notated keys to nested object\n * @param obj - The flattened object\n * @returns Nested translation object\n */\nexport function unflattenTranslations(obj: Record<string, string>): TranslationData {\n const result: TranslationData = {};\n\n for (const [key, value] of Object.entries(obj)) {\n const keys = key.split('.');\n let current: TranslationData = result;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const k = keys[i];\n if (!(k in current)) {\n current[k] = {};\n }\n current = current[k] as TranslationData;\n }\n\n current[keys[keys.length - 1]] = value;\n }\n\n return result;\n}","import { LocaleInfo } from './types';\n\n/**\n * Available locales following BCP 47 standard (IETF language tags)\n * Format: language[-script][-region]\n * Examples: en, en-US, zh-CN, zh-Hans-CN\n * \n * These locale codes must match exactly what's in your database\n * Following the same standard as react-i18next\n */\nexport const AVAILABLE_LOCALES: LocaleInfo[] = [\n // English variants\n { code: 'en', name: 'English', nativeName: 'English', direction: 'ltr', enabled: true },\n { code: 'en-US', name: 'English (US)', nativeName: 'English (US)', direction: 'ltr', enabled: true },\n { code: 'en-GB', name: 'English (UK)', nativeName: 'English (UK)', direction: 'ltr', enabled: true },\n \n // Chinese variants - using script subtags\n { code: 'zh', name: 'Chinese', nativeName: '中文', direction: 'ltr', enabled: true },\n { code: 'zh-CN', name: 'Chinese (Simplified)', nativeName: '简体中文', direction: 'ltr', enabled: true },\n { code: 'zh-TW', name: 'Chinese (Traditional)', nativeName: '繁體中文', direction: 'ltr', enabled: true },\n { code: 'zh-Hans', name: 'Chinese (Simplified)', nativeName: '简体中文', direction: 'ltr', enabled: true },\n { code: 'zh-Hant', name: 'Chinese (Traditional)', nativeName: '繁體中文', direction: 'ltr', enabled: true },\n \n // Spanish variants\n { code: 'es', name: 'Spanish', nativeName: 'Español', direction: 'ltr', enabled: true },\n { code: 'es-ES', name: 'Spanish (Spain)', nativeName: 'Español (España)', direction: 'ltr', enabled: true },\n { code: 'es-MX', name: 'Spanish (Mexico)', nativeName: 'Español (México)', direction: 'ltr', enabled: true },\n \n // Portuguese variants\n { code: 'pt', name: 'Portuguese', nativeName: 'Português', direction: 'ltr', enabled: true },\n { code: 'pt-BR', name: 'Portuguese (Brazil)', nativeName: 'Português (Brasil)', direction: 'ltr', enabled: true },\n { code: 'pt-PT', name: 'Portuguese (Portugal)', nativeName: 'Português (Portugal)', direction: 'ltr', enabled: true },\n \n // French variants\n { code: 'fr', name: 'French', nativeName: 'Français', direction: 'ltr', enabled: true },\n { code: 'fr-FR', name: 'French (France)', nativeName: 'Français (France)', direction: 'ltr', enabled: true },\n { code: 'fr-CA', name: 'French (Canada)', nativeName: 'Français (Canada)', direction: 'ltr', enabled: true },\n \n // German variants\n { code: 'de', name: 'German', nativeName: 'Deutsch', direction: 'ltr', enabled: true },\n { code: 'de-DE', name: 'German (Germany)', nativeName: 'Deutsch (Deutschland)', direction: 'ltr', enabled: true },\n { code: 'de-AT', name: 'German (Austria)', nativeName: 'Deutsch (Österreich)', direction: 'ltr', enabled: true },\n { code: 'de-CH', name: 'German (Switzerland)', nativeName: 'Deutsch (Schweiz)', direction: 'ltr', enabled: true },\n \n // Other languages\n { code: 'it', name: 'Italian', nativeName: 'Italiano', direction: 'ltr', enabled: true },\n { code: 'it-IT', name: 'Italian (Italy)', nativeName: 'Italiano (Italia)', direction: 'ltr', enabled: true },\n { code: 'ja', name: 'Japanese', nativeName: '日本語', direction: 'ltr', enabled: true },\n { code: 'ja-JP', name: 'Japanese (Japan)', nativeName: '日本語 (日本)', direction: 'ltr', enabled: true },\n { code: 'ko', name: 'Korean', nativeName: '한국어', direction: 'ltr', enabled: true },\n { code: 'ko-KR', name: 'Korean (Korea)', nativeName: '한국어 (대한민국)', direction: 'ltr', enabled: true },\n { code: 'ru', name: 'Russian', nativeName: 'Русский', direction: 'ltr', enabled: true },\n { code: 'ru-RU', name: 'Russian (Russia)', nativeName: 'Русский (Россия)', direction: 'ltr', enabled: true },\n \n // RTL languages\n { code: 'ar', name: 'Arabic', nativeName: 'العربية', direction: 'rtl', enabled: true },\n { code: 'ar-SA', name: 'Arabic (Saudi Arabia)', nativeName: 'العربية (المملكة العربية السعودية)', direction: 'rtl', enabled: true },\n { code: 'ar-AE', name: 'Arabic (UAE)', nativeName: 'العربية (الإمارات)', direction: 'rtl', enabled: true },\n { code: 'he', name: 'Hebrew', nativeName: 'עברית', direction: 'rtl', enabled: true },\n { code: 'he-IL', name: 'Hebrew (Israel)', nativeName: 'עברית (ישראל)', direction: 'rtl', enabled: true },\n \n // Other Asian languages\n { code: 'hi', name: 'Hindi', nativeName: 'हिन्दी', direction: 'ltr', enabled: true },\n { code: 'hi-IN', name: 'Hindi (India)', nativeName: 'हिन्दी (भारत)', direction: 'ltr', enabled: true },\n { code: 'th', name: 'Thai', nativeName: 'ไทย', direction: 'ltr', enabled: true },\n { code: 'th-TH', name: 'Thai (Thailand)', nativeName: 'ไทย (ประเทศไทย)', direction: 'ltr', enabled: true },\n { code: 'vi', name: 'Vietnamese', nativeName: 'Tiếng Việt', direction: 'ltr', enabled: true },\n { code: 'vi-VN', name: 'Vietnamese (Vietnam)', nativeName: 'Tiếng Việt (Việt Nam)', direction: 'ltr', enabled: true },\n { code: 'id', name: 'Indonesian', nativeName: 'Bahasa Indonesia', direction: 'ltr', enabled: true },\n { code: 'id-ID', name: 'Indonesian (Indonesia)', nativeName: 'Bahasa Indonesia (Indonesia)', direction: 'ltr', enabled: true },\n \n // European languages\n { code: 'nl', name: 'Dutch', nativeName: 'Nederlands', direction: 'ltr', enabled: true },\n { code: 'nl-NL', name: 'Dutch (Netherlands)', nativeName: 'Nederlands (Nederland)', direction: 'ltr', enabled: true },\n { code: 'nl-BE', name: 'Dutch (Belgium)', nativeName: 'Nederlands (België)', direction: 'ltr', enabled: true },\n { code: 'pl', name: 'Polish', nativeName: 'Polski', direction: 'ltr', enabled: true },\n { code: 'pl-PL', name: 'Polish (Poland)', nativeName: 'Polski (Polska)', direction: 'ltr', enabled: true },\n { code: 'tr', name: 'Turkish', nativeName: 'Türkçe', direction: 'ltr', enabled: true },\n { code: 'tr-TR', name: 'Turkish (Turkey)', nativeName: 'Türkçe (Türkiye)', direction: 'ltr', enabled: true },\n { code: 'sv', name: 'Swedish', nativeName: 'Svenska', direction: 'ltr', enabled: true },\n { code: 'sv-SE', name: 'Swedish (Sweden)', nativeName: 'Svenska (Sverige)', direction: 'ltr', enabled: true },\n { code: 'da', name: 'Danish', nativeName: 'Dansk', direction: 'ltr', enabled: true },\n { code: 'da-DK', name: 'Danish (Denmark)', nativeName: 'Dansk (Danmark)', direction: 'ltr', enabled: true },\n { code: 'no', name: 'Norwegian', nativeName: 'Norsk', direction: 'ltr', enabled: true },\n { code: 'nb-NO', name: 'Norwegian Bokmål', nativeName: 'Norsk Bokmål', direction: 'ltr', enabled: true },\n { code: 'fi', name: 'Finnish', nativeName: 'Suomi', direction: 'ltr', enabled: true },\n { code: 'fi-FI', name: 'Finnish (Finland)', nativeName: 'Suomi (Suomi)', direction: 'ltr', enabled: true },\n { code: 'cs', name: 'Czech', nativeName: 'Čeština', direction: 'ltr', enabled: true },\n { code: 'cs-CZ', name: 'Czech (Czech Republic)', nativeName: 'Čeština (Česká republika)', direction: 'ltr', enabled: true },\n { code: 'hu', name: 'Hungarian', nativeName: 'Magyar', direction: 'ltr', enabled: true },\n { code: 'hu-HU', name: 'Hungarian (Hungary)', nativeName: 'Magyar (Magyarország)', direction: 'ltr', enabled: true },\n { code: 'el', name: 'Greek', nativeName: 'Ελληνικά', direction: 'ltr', enabled: true },\n { code: 'el-GR', name: 'Greek (Greece)', nativeName: 'Ελληνικά (Ελλάδα)', direction: 'ltr', enabled: true },\n];\n\n/**\n * Get locale info by code\n */\nexport function getLocaleInfo(code: string): LocaleInfo | undefined {\n return AVAILABLE_LOCALES.find(locale => locale.code === code);\n}\n\n/**\n * Check if a locale code is supported\n */\nexport function isLocaleSupported(code: string): boolean {\n return AVAILABLE_LOCALES.some(locale => locale.code === code);\n}\n\n/**\n * Get fallback locale code\n * For example: en-US -> en, zh-CN -> zh\n */\nexport function getFallbackLocale(code: string): string | undefined {\n // Already a base locale\n if (!code.includes('-')) {\n return undefined;\n }\n \n // Extract base language code\n const baseCode = code.split('-')[0];\n return isLocaleSupported(baseCode) ? baseCode : undefined;\n}\n\n/**\n * Resolve locale with fallback\n * Tries the exact locale, then fallback to base language\n */\nexport function resolveLocale(code: string): string {\n // Exact match\n if (isLocaleSupported(code)) {\n return code;\n }\n \n // Try fallback\n const fallback = getFallbackLocale(code);\n if (fallback) {\n return fallback;\n }\n \n // Default to English\n return 'en';\n}","import React, { createContext, useContext, useEffect, useState, useCallback, useMemo } from 'react';\nimport { KotoConfig, KotoContextValue, TranslationData, LocaleInfo } from './types';\nimport { storage } from './storage';\nimport { getNestedTranslation } from './utils';\nimport { AVAILABLE_LOCALES } from './locales';\n\nconst KotoContext = createContext<KotoContextValue | null>(null);\n\nexport interface KotoProviderProps extends KotoConfig {\n children: React.ReactNode;\n}\n\nconst LOCALE_STORAGE_KEY = 'koto-selected-locale';\n\nexport function KotoProvider({\n children, \n apiKey,\n projectId, \n defaultLocale,\n apiUrl = 'https://api.koto.dev/v1/translations'\n}: KotoProviderProps) {\n // Initialize locale from localStorage or use defaultLocale\n const getInitialLocale = () => {\n if (typeof window !== 'undefined') {\n const savedLocale = localStorage.getItem(LOCALE_STORAGE_KEY);\n if (savedLocale) {\n return savedLocale;\n }\n }\n return defaultLocale;\n };\n \n const [translations, setTranslations] = useState<TranslationData>({});\n const [locale, setLocale] = useState(getInitialLocale());\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n // Use hardcoded locales that match the database\n const availableLocales = AVAILABLE_LOCALES;\n\n // Fetch translations from API\n const fetchTranslations = useCallback(async (currentLocale: string) => {\n try {\n const response = await fetch(`${apiUrl}?locale=${currentLocale}&projectId=${projectId}`, {\n headers: {\n 'x-api-key': apiKey,\n 'Content-Type': 'application/json',\n },\n });\n\n if (!response.ok) {\n throw new Error(`Failed to fetch translations: ${response.statusText}`);\n }\n\n const data = await response.json();\n \n // Let storage handle the response format dynamically\n return await storage.processApiResponse(currentLocale, data);\n } catch (err) {\n throw err instanceof Error ? err : new Error('Failed to fetch translations');\n }\n }, [apiKey, projectId, apiUrl]);\n\n // Load translations (from cache or API)\n const loadTranslations = useCallback(async (currentLocale: string) => {\n setLoading(true);\n setError(null);\n\n try {\n // Try to get from IndexedDB first\n const cached = await storage.getTranslations(currentLocale);\n \n if (cached) {\n setTranslations(cached.translations);\n setLoading(false);\n \n // Fetch fresh data in background\n fetchTranslations(currentLocale)\n .then((freshTranslations: TranslationData) => {\n setTranslations(freshTranslations);\n })\n .catch(console.error);\n } else {\n // No cache, fetch from API\n const freshTranslations = await fetchTranslations(currentLocale);\n setTranslations(freshTranslations);\n setLoading(false);\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to load translations'));\n setLoading(false);\n }\n }, [fetchTranslations]);\n\n // Translation function\n const t = useCallback((key: string, fallback?: string): string => {\n const translation = getNestedTranslation(translations, key);\n return translation || fallback || key;\n }, [translations]);\n\n // Function to change locale\n const changeLocale = useCallback((newLocale: string) => {\n if (newLocale !== locale) {\n setLocale(newLocale);\n // Save to localStorage\n if (typeof window !== 'undefined') {\n localStorage.setItem(LOCALE_STORAGE_KEY, newLocale);\n }\n }\n }, [locale]);\n\n // Get available locales (returns hardcoded list)\n const getAvailableLocales = useCallback((): LocaleInfo[] => {\n return availableLocales;\n }, [availableLocales]);\n\n // Load translations on mount and locale change\n useEffect(() => {\n loadTranslations(locale);\n }, [locale, loadTranslations]);\n\n // Context value\n const value = useMemo<KotoContextValue>(() => ({\n translations,\n locale,\n loading,\n error,\n t,\n setLocale: changeLocale,\n availableLocales,\n getAvailableLocales,\n }), [translations, locale, loading, error, t, changeLocale, availableLocales, getAvailableLocales]);\n\n return (\n <KotoContext.Provider value={value}>\n {children}\n </KotoContext.Provider>\n );\n}\n\n// Hook to use Koto context\nexport function useKoto(): KotoContextValue {\n const context = useContext(KotoContext);\n if (!context) {\n throw new Error('useKoto must be used within a KotoProvider');\n }\n return context;\n}\n\n// Hook to use translation function\nexport function useTranslation() {\n const { t, locale, loading, setLocale, availableLocales, getAvailableLocales } = useKoto();\n return { t, locale, loading, setLocale, availableLocales, getAvailableLocales };\n}","import React, { ComponentType } from 'react';\nimport { useKoto } from './Provider';\nimport { KotoContextValue } from './types';\n\n/**\n * Higher-Order Component for class components\n * Wraps a component and injects translation props\n */\nexport function withTranslation<P extends object>(\n Component: ComponentType<P & WithTranslationProps>\n): ComponentType<Omit<P, keyof WithTranslationProps>> {\n const ComponentWithTranslation = (props: Omit<P, keyof WithTranslationProps>) => {\n const { t, locale, loading, setLocale, translations, error } = useKoto();\n \n return (\n <Component\n {...(props as P)}\n t={t}\n locale={locale}\n loading={loading}\n setLocale={setLocale}\n translations={translations}\n error={error}\n />\n );\n };\n \n ComponentWithTranslation.displayName = `withTranslation(${Component.displayName || Component.name || 'Component'})`;\n \n return ComponentWithTranslation;\n}\n\n/**\n * Props injected by withTranslation HOC\n */\nexport interface WithTranslationProps {\n t: KotoContextValue['t'];\n locale: KotoContextValue['locale'];\n loading: KotoContextValue['loading'];\n setLocale: KotoContextValue['setLocale'];\n translations?: KotoContextValue['translations'];\n error?: KotoContextValue['error'];\n}\n\n/**\n * Render prop component for more flexible usage\n */\nexport interface TranslationProps {\n children: (props: KotoContextValue) => React.ReactNode;\n}\n\nexport function Translation({ children }: TranslationProps) {\n const kotoContext = useKoto();\n return <>{children(kotoContext)}</>;\n}\n\n/**\n * Consumer component for direct context access\n * Useful for class components that need conditional rendering\n */\nexport class KotoConsumer extends React.Component<TranslationProps> {\n render() {\n return <Translation>{this.props.children}</Translation>;\n }\n}","import { storage } from './storage';\nimport { getNestedTranslation } from './utils';\nimport { TranslationData } from './types';\n\n// Global cache for translations\nlet globalTranslations: TranslationData = {};\nlet globalLocale: string = 'en';\nlet isInitialized = false;\n\n/**\n * Initialize the translation function with a locale\n * This should be called once when the app starts\n */\nexport async function initTranslations(locale: string): Promise<void> {\n globalLocale = locale;\n \n // Try to load from IndexedDB\n const cached = await storage.getTranslations(locale);\n if (cached) {\n globalTranslations = cached.translations;\n isInitialized = true;\n }\n}\n\n/**\n * Set translations directly (useful when fetched from API)\n */\nexport function setTranslations(translations: TranslationData, locale: string): void {\n globalTranslations = translations;\n globalLocale = locale;\n isInitialized = true;\n \n // Store in IndexedDB for future use\n storage.setTranslations(locale, translations);\n}\n\n/**\n * Get current locale\n */\nexport function getLocale(): string {\n return globalLocale;\n}\n\n/**\n * Translation function\n * @param key - The translation key (e.g., 'checkout.payment.title')\n * @param fallback - Optional fallback value if translation not found\n * @returns The translated string or the key if not found\n */\nexport function t(key: string, fallback?: string): string {\n if (!isInitialized) {\n console.warn('Translations not initialized. Call initTranslations() first.');\n return fallback || key;\n }\n\n const translation = getNestedTranslation(globalTranslations, key);\n return translation || fallback || key;\n}\n\n/**\n * Translation function with interpolation\n * @param key - The translation key\n * @param params - Object with values to interpolate\n * @param fallback - Optional fallback value\n * @returns The translated and interpolated string\n * \n * @example\n * // Translation: \"Hello, {{name}}!\"\n * ti('greeting', { name: 'John' }) // \"Hello, John!\"\n */\nexport function ti(key: string, params: Record<string, string | number>, fallback?: string): string {\n let translation = t(key, fallback);\n \n // Replace placeholders with values\n Object.entries(params).forEach(([paramKey, value]) => {\n const placeholder = new RegExp(`{{\\\\s*${paramKey}\\\\s*}}`, 'g');\n translation = translation.replace(placeholder, String(value));\n });\n \n return translation;\n}\n\n/**\n * Pluralization helper\n * @param key - The base translation key\n * @param count - The count for pluralization\n * @param params - Optional parameters for interpolation\n * @returns The pluralized translation\n * \n * @example\n * // Translations:\n * // \"items.zero\": \"No items\"\n * // \"items.one\": \"One item\"\n * // \"items.other\": \"{{count}} items\"\n * tp('items', 0) // \"No items\"\n * tp('items', 1) // \"One item\"\n * tp('items', 5) // \"5 items\"\n */\nexport function tp(key: string, count: number, params?: Record<string, string | number>): string {\n let pluralKey = key;\n \n if (count === 0) {\n pluralKey = `${key}.zero`;\n } else if (count === 1) {\n pluralKey = `${key}.one`;\n } else {\n pluralKey = `${key}.other`;\n }\n \n // Try the plural key first, fall back to base key\n let translation = t(pluralKey);\n if (translation === pluralKey) {\n translation = t(key);\n }\n \n // Apply interpolation with count included\n const allParams = { count, ...params };\n return ti(translation, allParams);\n}\n\n// Export default translation function\nexport default t;","// Provider and hooks\nexport { KotoProvider, useKoto, useTranslation } from './Provider';\nexport type { KotoProviderProps } from './Provider';\n\n// Class component support\nexport { withTranslation, Translation, KotoConsumer } from './hoc';\nexport type { WithTranslationProps, TranslationProps } from './hoc';\n\n// Translation functions\nexport { t, ti, tp, initTranslations, setTranslations, getLocale } from './t';\n\n// Storage utilities\nexport { storage } from './storage';\n\n// Types\nexport type {\n TranslationData,\n KotoConfig,\n KotoContextValue,\n StoredTranslations,\n LocaleInfo,\n} from './types';\n\n// Locale utilities\nexport {\n AVAILABLE_LOCALES,\n getLocaleInfo,\n isLocaleSupported,\n getFallbackLocale,\n resolveLocale\n} from './locales';\n\n// Utils\nexport { getNestedTranslation, flattenTranslations, unflattenTranslations } from './utils';\n\n// Backward-compatible re-exports for migration\nexport { KotoProvider as HermesProvider, useKoto as useHermes } from './Provider';\nexport { KotoConsumer as HermesConsumer } from './hoc';\n\n// Default export is the translation function\nimport { t } from './t';\nexport default t;"],"names":["createContext","useState","useCallback","useEffect","useMemo","useContext"],"mappings":";;;;;;AAAA,MAAM,aAAa,GAAG,CAAC,MAAM,EAA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AM,CAAC,KAAK,CAAC,CAAC;AAC/D,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,WAAW;AACpB;AAEA;;;;;;;;;;;;;;;AAeG;SACa,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,MAAwC,EAAA;IACrF,IAAI,SAAS,GAAG,GAAG;AAEnB,IAAA,IAAI,KAAK,KAAK,CAAC,EAAE;AACf,QAAA,SAAS,GAAG,CAAA,EAAG,GAAG,CAAA,KAAA,CAAO;IAC3B;AAAO,SAAA,IAAI,KAAK,KAAK,CAAC,EAAE;AACtB,QAAA,SAAS,GAAG,CAAA,EAAG,GAAG,CAAA,IAAA,CAAM;IAC1B;SAAO;AACL,QAAA,SAAS,GAAG,CAAA,EAAG,GAAG,CAAA,MAAA,CAAQ;IAC5B;;AAGA,IAAA,IAAI,WAAW,GAAG,CAAC,CAAC,SAAS,CAAC;AAC9B,IAAA,IAAI,WAAW,KAAK,SAAS,EAAE;AAC7B,QAAA,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC;IACtB;;IAGA,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE;AACtC,IAAA,OAAO,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;AACnC;;ACtHA;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,29 @@
1
+ import { LocaleInfo } from './types';
2
+ /**
3
+ * Available locales following BCP 47 standard (IETF language tags)
4
+ * Format: language[-script][-region]
5
+ * Examples: en, en-US, zh-CN, zh-Hans-CN
6
+ *
7
+ * These locale codes must match exactly what's in your database
8
+ * Following the same standard as react-i18next
9
+ */
10
+ export declare const AVAILABLE_LOCALES: LocaleInfo[];
11
+ /**
12
+ * Get locale info by code
13
+ */
14
+ export declare function getLocaleInfo(code: string): LocaleInfo | undefined;
15
+ /**
16
+ * Check if a locale code is supported
17
+ */
18
+ export declare function isLocaleSupported(code: string): boolean;
19
+ /**
20
+ * Get fallback locale code
21
+ * For example: en-US -> en, zh-CN -> zh
22
+ */
23
+ export declare function getFallbackLocale(code: string): string | undefined;
24
+ /**
25
+ * Resolve locale with fallback
26
+ * Tries the exact locale, then fallback to base language
27
+ */
28
+ export declare function resolveLocale(code: string): string;
29
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../src/locales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAAU,EAmFzC,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAElE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASlE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAclD"}
@@ -0,0 +1,21 @@
1
+ import { TranslationData, StoredTranslations, ApiResponse, LocaleMetadata } from './types';
2
+ declare class TranslationStorage {
3
+ private db;
4
+ init(): Promise<void>;
5
+ getTranslations(locale: string): Promise<StoredTranslations | null>;
6
+ setTranslations(locale: string, translations: TranslationData, apiResponse?: ApiResponse): Promise<void>;
7
+ private processTranslations;
8
+ private isNestedStructure;
9
+ private isFlatStructure;
10
+ private buildNestedFromFlat;
11
+ clearTranslations(locale?: string): Promise<void>;
12
+ getAllLocales(): Promise<string[]>;
13
+ getSupportedLocales(): Promise<Array<{
14
+ code: string;
15
+ metadata?: LocaleMetadata;
16
+ }>>;
17
+ processApiResponse(locale: string, response: ApiResponse): Promise<TranslationData>;
18
+ }
19
+ export declare const storage: TranslationStorage;
20
+ export {};
21
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAc3F,cAAM,kBAAkB;IACtB,OAAO,CAAC,EAAE,CAAqC;IAEzC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAwBnE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B9G,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,mBAAmB;IAsBrB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAejD,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAYlC,mBAAmB,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC;IAiBlF,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC;CAmB1F;AAED,eAAO,MAAM,OAAO,oBAA2B,CAAC"}
package/dist/t.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ import { TranslationData } from './types';
2
+ /**
3
+ * Initialize the translation function with a locale
4
+ * This should be called once when the app starts
5
+ */
6
+ export declare function initTranslations(locale: string): Promise<void>;
7
+ /**
8
+ * Set translations directly (useful when fetched from API)
9
+ */
10
+ export declare function setTranslations(translations: TranslationData, locale: string): void;
11
+ /**
12
+ * Get current locale
13
+ */
14
+ export declare function getLocale(): string;
15
+ /**
16
+ * Translation function
17
+ * @param key - The translation key (e.g., 'checkout.payment.title')
18
+ * @param fallback - Optional fallback value if translation not found
19
+ * @returns The translated string or the key if not found
20
+ */
21
+ export declare function t(key: string, fallback?: string): string;
22
+ /**
23
+ * Translation function with interpolation
24
+ * @param key - The translation key
25
+ * @param params - Object with values to interpolate
26
+ * @param fallback - Optional fallback value
27
+ * @returns The translated and interpolated string
28
+ *
29
+ * @example
30
+ * // Translation: "Hello, {{name}}!"
31
+ * ti('greeting', { name: 'John' }) // "Hello, John!"
32
+ */
33
+ export declare function ti(key: string, params: Record<string, string | number>, fallback?: string): string;
34
+ /**
35
+ * Pluralization helper
36
+ * @param key - The base translation key
37
+ * @param count - The count for pluralization
38
+ * @param params - Optional parameters for interpolation
39
+ * @returns The pluralized translation
40
+ *
41
+ * @example
42
+ * // Translations:
43
+ * // "items.zero": "No items"
44
+ * // "items.one": "One item"
45
+ * // "items.other": "{{count}} items"
46
+ * tp('items', 0) // "No items"
47
+ * tp('items', 1) // "One item"
48
+ * tp('items', 5) // "5 items"
49
+ */
50
+ export declare function tp(key: string, count: number, params?: Record<string, string | number>): string;
51
+ export default t;
52
+ //# sourceMappingURL=t.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"t.d.ts","sourceRoot":"","sources":["../src/t.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO1C;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASpE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAOnF;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;;GAKG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAUlG;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAoB/F;AAGD,eAAe,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ export interface TranslationData {
2
+ [key: string]: string | TranslationData;
3
+ }
4
+ export interface KotoConfig {
5
+ apiKey: string;
6
+ projectId: string;
7
+ defaultLocale: string;
8
+ apiUrl?: string;
9
+ }
10
+ export interface LocaleInfo {
11
+ code: string;
12
+ name: string;
13
+ nativeName?: string;
14
+ direction?: 'ltr' | 'rtl';
15
+ enabled?: boolean;
16
+ }
17
+ export interface KotoContextValue {
18
+ translations: TranslationData;
19
+ locale: string;
20
+ loading: boolean;
21
+ error: Error | null;
22
+ t: (key: string, fallback?: string) => string;
23
+ setLocale: (locale: string) => void;
24
+ availableLocales: LocaleInfo[];
25
+ getAvailableLocales: () => LocaleInfo[];
26
+ }
27
+ export interface StoredTranslations {
28
+ locale: string;
29
+ translations: TranslationData;
30
+ timestamp: number;
31
+ version?: string;
32
+ metadata?: LocaleMetadata;
33
+ }
34
+ export interface LocaleMetadata {
35
+ name?: string;
36
+ nativeName?: string;
37
+ direction?: 'ltr' | 'rtl';
38
+ }
39
+ export interface ApiResponse {
40
+ translations?: TranslationData;
41
+ data?: TranslationData | Record<string, string>;
42
+ locale?: string;
43
+ version?: string;
44
+ localeInfo?: LocaleMetadata;
45
+ localeName?: string;
46
+ localeNativeName?: string;
47
+ direction?: 'ltr' | 'rtl';
48
+ availableLocales?: LocaleInfo[];
49
+ error?: string;
50
+ }
51
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;CACzC;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,eAAe,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,gBAAgB,EAAE,UAAU,EAAE,CAAC;IAC/B,mBAAmB,EAAE,MAAM,UAAU,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,eAAe,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,gBAAgB,CAAC,EAAE,UAAU,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,22 @@
1
+ import { TranslationData } from './types';
2
+ /**
3
+ * Get a nested translation value using dot notation
4
+ * @param translations - The translations object
5
+ * @param key - The dot-notated key (e.g., 'checkout.payment.title')
6
+ * @returns The translation value or null if not found
7
+ */
8
+ export declare function getNestedTranslation(translations: TranslationData, key: string): string | null;
9
+ /**
10
+ * Flatten nested translation object
11
+ * @param obj - The nested translation object
12
+ * @param prefix - The prefix for keys
13
+ * @returns Flattened object with dot-notated keys
14
+ */
15
+ export declare function flattenTranslations(obj: TranslationData, prefix?: string): Record<string, string>;
16
+ /**
17
+ * Unflatten dot-notated keys to nested object
18
+ * @param obj - The flattened object
19
+ * @returns Nested translation object
20
+ */
21
+ export declare function unflattenTranslations(obj: Record<string, string>): TranslationData;
22
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,eAAe,EAC7B,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAaf;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,MAAM,SAAK,GACV,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,CAmBlF"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "koto-react",
3
+ "version": "1.0.0",
4
+ "description": "Koto - React translation library with IndexedDB caching",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "rollup -c",
14
+ "dev": "rollup -c -w",
15
+ "test": "jest",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "keywords": [
19
+ "koto",
20
+ "react",
21
+ "translations",
22
+ "i18n",
23
+ "indexeddb",
24
+ "localization"
25
+ ],
26
+ "author": "kea0811",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/kea0811/koto-react.git"
31
+ },
32
+ "homepage": "https://github.com/kea0811/koto-react",
33
+ "bugs": {
34
+ "url": "https://github.com/kea0811/koto-react/issues"
35
+ },
36
+ "peerDependencies": {
37
+ "react": ">=16.8.0",
38
+ "react-dom": ">=16.8.0"
39
+ },
40
+ "devDependencies": {
41
+ "@rollup/plugin-commonjs": "^25.0.7",
42
+ "@rollup/plugin-node-resolve": "^15.2.3",
43
+ "@rollup/plugin-typescript": "^11.1.5",
44
+ "@types/react": "^18.2.45",
45
+ "@types/react-dom": "^18.2.18",
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0",
48
+ "rollup": "^4.9.2",
49
+ "rollup-plugin-peer-deps-external": "^2.2.4",
50
+ "tslib": "^2.6.2",
51
+ "typescript": "^5.3.3"
52
+ },
53
+ "dependencies": {
54
+ "idb": "^8.0.0"
55
+ }
56
+ }