langie 1.9.25
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/LICENSE +201 -0
- package/README.md +188 -0
- package/dist/components/index.cjs +2327 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.css +280 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.mjs +2288 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/core.cjs +225 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +101 -0
- package/dist/core.d.ts +101 -0
- package/dist/core.mjs +196 -0
- package/dist/core.mjs.map +1 -0
- package/dist/index.cjs +2898 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +280 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.mjs +2826 -0
- package/dist/index.mjs.map +1 -0
- package/dist/teleport.css +35 -0
- package/dist/teleport.css.map +1 -0
- package/dist/teleport.d.cts +2 -0
- package/dist/teleport.d.ts +2 -0
- package/package.json +93 -0
- package/src/components.d.ts +47 -0
- package/src/env.d.ts +1 -0
- package/src/index.d.ts +161 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare module 'langie/components' {
|
|
2
|
+
import type { DefineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
// Component type definitions
|
|
5
|
+
export interface LanguageSelectProps {
|
|
6
|
+
showFlags?: boolean
|
|
7
|
+
showNativeNames?: boolean
|
|
8
|
+
class?: string
|
|
9
|
+
modelValue?: any
|
|
10
|
+
placeholder?: string
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
isDark?: boolean
|
|
13
|
+
languages?: any[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SimpleLanguageSelectProps {
|
|
17
|
+
showNativeNames?: boolean
|
|
18
|
+
placeholder?: string
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
class?: string
|
|
21
|
+
modelValue?: any
|
|
22
|
+
languages?: any[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ltProps {
|
|
26
|
+
msg?: string
|
|
27
|
+
ctx?: string
|
|
28
|
+
orig?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface InterfaceLanguageSelectProps {
|
|
32
|
+
placeholder?: string
|
|
33
|
+
disabled?: boolean
|
|
34
|
+
isDark?: boolean
|
|
35
|
+
class?: string
|
|
36
|
+
modelValue?: any
|
|
37
|
+
languages?: any[]
|
|
38
|
+
translatorHost?: string
|
|
39
|
+
apiKey?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Component declarations
|
|
43
|
+
export const LanguageSelect: DefineComponent<LanguageSelectProps>
|
|
44
|
+
export const SimpleLanguageSelect: DefineComponent<SimpleLanguageSelectProps>
|
|
45
|
+
export const InterfaceLanguageSelect: DefineComponent<InterfaceLanguageSelectProps>
|
|
46
|
+
export const lt: DefineComponent<ltProps>
|
|
47
|
+
}
|
package/src/env.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript declarations for langie
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// API field constants
|
|
6
|
+
declare const API_FIELD_TEXT: 't'
|
|
7
|
+
declare const API_FIELD_FROM: 'from'
|
|
8
|
+
declare const API_FIELD_TO: 'to'
|
|
9
|
+
declare const API_FIELD_CTX: 'ctx'
|
|
10
|
+
declare const API_FIELD_TRANSLATIONS: 'translations'
|
|
11
|
+
|
|
12
|
+
// Core exports
|
|
13
|
+
export declare function useLangie(options?: TranslatorOptions): {
|
|
14
|
+
availableLanguages: import('vue').Ref<TranslatorLanguage[]>
|
|
15
|
+
translations: { [key: string]: string }
|
|
16
|
+
uiTranslations: { [key: string]: string }
|
|
17
|
+
currentLanguage: import('vue').Ref<string>
|
|
18
|
+
isLoading: import('vue').Ref<boolean>
|
|
19
|
+
setLanguage: (lang: string) => void
|
|
20
|
+
fetchLanguages: (opts?: { force?: boolean; country?: string }) => Promise<TranslatorLanguage[]>
|
|
21
|
+
l: (text: string, ctx?: string, originalLang?: string) => string
|
|
22
|
+
lr: (text: string, ctx?: string, originalLang?: string) => string
|
|
23
|
+
fetchAndCacheBatch: (
|
|
24
|
+
items: { text: string; ctx?: string }[],
|
|
25
|
+
from?: string,
|
|
26
|
+
to?: string,
|
|
27
|
+
globalCtx?: string
|
|
28
|
+
) => Promise<void>
|
|
29
|
+
getTranslationError: (text: string, ctx?: string, from?: string, to?: string) => string | null
|
|
30
|
+
cleanup: () => void
|
|
31
|
+
getBatchingStats: () => {
|
|
32
|
+
pendingRequests: number
|
|
33
|
+
queuedBatches: number
|
|
34
|
+
queuedThisTick: number
|
|
35
|
+
hasFlushTimeout: boolean
|
|
36
|
+
}
|
|
37
|
+
setLtDefaults: (defaults: { ctx?: string; orig?: string }) => void
|
|
38
|
+
getLtDefaults: () => { ctx: string; orig: string }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare function translateBatch(
|
|
42
|
+
translations: TranslateRequestBody[]
|
|
43
|
+
): Promise<TranslateServiceResponse[]>
|
|
44
|
+
|
|
45
|
+
// Type exports
|
|
46
|
+
export interface TranslatorLanguage {
|
|
47
|
+
code: string
|
|
48
|
+
name: string
|
|
49
|
+
native_name: string
|
|
50
|
+
popularity?: number
|
|
51
|
+
flag_country?: string
|
|
52
|
+
value?: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface TranslateRequestBody {
|
|
56
|
+
[API_FIELD_TEXT]: string
|
|
57
|
+
[API_FIELD_FROM]?: string
|
|
58
|
+
[API_FIELD_TO]?: string
|
|
59
|
+
[API_FIELD_CTX]?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface TranslateServiceResponse {
|
|
63
|
+
[API_FIELD_TEXT]?: string
|
|
64
|
+
[API_FIELD_FROM]?: string
|
|
65
|
+
[API_FIELD_TRANSLATIONS]?: TranslateServiceResponse[]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface TranslatorOptions {
|
|
69
|
+
translatorHost?: string
|
|
70
|
+
apiKey?: string
|
|
71
|
+
defaultLanguage?: string
|
|
72
|
+
fallbackLanguage?: string
|
|
73
|
+
initialBatchDelay?: number
|
|
74
|
+
followupBatchDelay?: number
|
|
75
|
+
maxBatchSize?: number
|
|
76
|
+
minPopularity?: number
|
|
77
|
+
country?: string
|
|
78
|
+
region?: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Constant exports
|
|
82
|
+
export declare const DEFAULT_API_HOST: string
|
|
83
|
+
export declare const DEV_API_HOST: string
|
|
84
|
+
export declare const COLORS: {
|
|
85
|
+
primary: { blue: string; blueHover: string }
|
|
86
|
+
text: { primary: string; secondary: string }
|
|
87
|
+
neutral: { gray400: string }
|
|
88
|
+
border: { flag: string; dark: string }
|
|
89
|
+
}
|
|
90
|
+
export declare const THEME_COLORS: {
|
|
91
|
+
light: {
|
|
92
|
+
background: string
|
|
93
|
+
backgroundDisabled: string
|
|
94
|
+
border: string
|
|
95
|
+
ring: string
|
|
96
|
+
placeholder: string
|
|
97
|
+
optionPointed: string
|
|
98
|
+
optionPointedText: string
|
|
99
|
+
optionSelected: string
|
|
100
|
+
optionSelectedText: string
|
|
101
|
+
dropdownBackground: string
|
|
102
|
+
dropdownBorder: string
|
|
103
|
+
}
|
|
104
|
+
dark: {
|
|
105
|
+
background: string
|
|
106
|
+
backgroundDisabled: string
|
|
107
|
+
border: string
|
|
108
|
+
placeholder: string
|
|
109
|
+
ring: string
|
|
110
|
+
optionPointed: string
|
|
111
|
+
optionPointedText: string
|
|
112
|
+
optionSelected: string
|
|
113
|
+
optionSelectedText: string
|
|
114
|
+
dropdownBackground: string
|
|
115
|
+
dropdownBorder: string
|
|
116
|
+
dropdownText: string
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export declare const CSS_VARS: {
|
|
120
|
+
'--langie-primary': string
|
|
121
|
+
'--langie-primary-hover': string
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Theme utilities
|
|
125
|
+
export declare function setThemeColors(colors: { primary?: string; primaryHover?: string }): void
|
|
126
|
+
export declare function clearThemeColors(): void
|
|
127
|
+
|
|
128
|
+
// Language aliases
|
|
129
|
+
export interface AliasEntry {
|
|
130
|
+
primary: string | string[]
|
|
131
|
+
suggestions: string[]
|
|
132
|
+
}
|
|
133
|
+
export declare const LANGUAGE_ALIAS_TABLE: Record<string, AliasEntry>
|
|
134
|
+
|
|
135
|
+
// Vue component exports (for runtime use, not TypeScript declarations)
|
|
136
|
+
export declare const LanguageSelect: any
|
|
137
|
+
export declare const SimpleLanguageSelect: any
|
|
138
|
+
export declare const InterfaceLanguageSelect: any
|
|
139
|
+
export declare const lt: any
|
|
140
|
+
|
|
141
|
+
// Runtime translation helper – same as returned from useLangie but accessible directly after global initialisation
|
|
142
|
+
export declare function l(text: string, ctx?: string, originalLang?: string): string
|
|
143
|
+
|
|
144
|
+
// Country code detection utility
|
|
145
|
+
export declare function getCountryCode(): Promise<string>
|
|
146
|
+
|
|
147
|
+
// Language mapping utilities
|
|
148
|
+
export declare const BROWSER_LANGUAGE_MAP: Record<string, string>
|
|
149
|
+
export declare function detectBrowserLanguage(): string
|
|
150
|
+
|
|
151
|
+
// lt component defaults management
|
|
152
|
+
export declare function setLtDefaults(defaults: { ctx?: string; orig?: string }): void
|
|
153
|
+
export declare function getLtDefaults(): { ctx: string; orig: string }
|
|
154
|
+
|
|
155
|
+
// Region and geolocation utilities
|
|
156
|
+
export declare function getRegionForCountry(country: string): string
|
|
157
|
+
export declare function getGeoRequestParams(
|
|
158
|
+
country?: string,
|
|
159
|
+
language?: string,
|
|
160
|
+
timezone?: string
|
|
161
|
+
): Record<string, string>
|