@sveltekit-i18n/base 1.0.0-beta.0 → 1.0.0-beta.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- [![npm version](https://badge.fury.io/js/sveltekit-i18n%2Fbase.svg)](https://badge.fury.io/js/sveltekit-i18n%2Fbase) ![](https://github.com/sveltekit-i18n/base/workflows/Tests/badge.svg)
3
+ [![npm version](https://badge.fury.io/js/@sveltekit-i18n%2Fbase.svg)](https://badge.fury.io/js/@sveltekit-i18n%2Fbase) ![](https://github.com/sveltekit-i18n/base/workflows/Tests/badge.svg)
4
4
 
5
5
  # @sveltekit-i18n/base
6
6
  This repository contains the base functionality of [sveltekit-i18n](https://github.com/sveltekit-i18n/lib) and provides support for external message parsers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltekit-i18n/base",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "Base functionality of sveltekit-i18n library with a support for external message parsers.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/types/index.d.ts DELETED
@@ -1,71 +0,0 @@
1
- import { Readable, Writable } from 'svelte/store';
2
-
3
- type LoadingStore = Readable<boolean> & { toPromise: () => Promise<void[]>, get: () => boolean };
4
-
5
- type Loader = () => Promise<Record<any, any>>;
6
-
7
- type Route = string | RegExp;
8
-
9
- type LoaderModule = {
10
- key: string;
11
- locale: string;
12
- routes?: Route[];
13
- loader: Loader;
14
- };
15
-
16
- type TranslationFunction = (key: string, vars?: Record<any, any>) => string;
17
-
18
- type LocalTranslationFunction = (locale: string, key: string, vars?: Record<any, any>) => string;
19
-
20
- type ExtendedStore<T, Get = () => T, Store = Readable<T>> = Store & { get: Get };
21
-
22
- type ConfigTranslations = { [locale: string]: Record<string, any> };
23
-
24
- type Translations = { [locale: string]: Record<string, string> };
25
-
26
- type Config = {
27
- parser: {
28
- parse: (props: {
29
- key: string;
30
- payload: any;
31
- translations: Translations;
32
- locale: string;
33
- fallbackLocale?: string;
34
- }) => string;
35
- };
36
- loaders?: LoaderModule[];
37
- translations?: ConfigTranslations;
38
- initLocale?: string;
39
- fallbackLocale?: string;
40
- };
41
-
42
- declare class export_default{
43
- constructor(config?: Config);
44
- private loadedKeys;
45
- private currentRoute;
46
- private config;
47
- private isLoading;
48
- private promises;
49
- loading: LoadingStore;
50
- private privateTranslations;
51
- translations: ExtendedStore<Translations>;
52
- locales: ExtendedStore<string[]>;
53
- private internalLocale;
54
- locale: ExtendedStore<string, () => string, Writable<string>>;
55
- private loaderTrigger;
56
- initialized: Readable<boolean>;
57
- private translation;
58
- t: ExtendedStore<TranslationFunction, TranslationFunction>;
59
- l: ExtendedStore<LocalTranslationFunction, LocalTranslationFunction>;
60
- private getLocale;
61
- setLocale: (locale?: string | undefined) => Promise<void>;
62
- setRoute: (route: string) => Promise<void>;
63
- loadConfig: (config: Config) => Promise<void>;
64
- addTranslations: (translations?: ConfigTranslations | undefined, keys?: Record<string, string[]> | undefined) => void;
65
- getTranslationProps: ($locale?: string, $route?: string) => Promise<[ConfigTranslations, Record<string, string[]>] | [
66
- ]>;
67
- private translationLoader;
68
- loadTranslations: (locale: string, route?: string) => Promise<void>;
69
- }
70
-
71
- export { Config, export_default as default };