@krak-stack/registry 0.1.31 → 0.1.33
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 +21 -0
- package/dist/components/ui/code-block.d.ts +8 -6
- package/dist/components/ui/code-block.js +40 -19
- package/dist/components/ui/copy-button.d.ts +9 -6
- package/dist/components/ui/copy-button.js +15 -8
- package/dist/components/ui/data-table.d.ts +9 -5
- package/dist/components/ui/data-table.js +74 -479
- package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
- package/dist/components/ui/editing-locale-switcher.js +20 -448
- package/dist/components/ui/effect-form.d.ts +39 -10
- package/dist/components/ui/effect-form.js +141 -527
- package/dist/components/ui/error-component.d.ts +4 -2
- package/dist/components/ui/error-component.js +24 -450
- package/dist/components/ui/file-picker.d.ts +4 -2
- package/dist/components/ui/file-picker.js +25 -452
- package/dist/components/ui/form.d.ts +123 -71
- package/dist/components/ui/form.js +81 -474
- package/dist/components/ui/google-map.d.ts +2 -1
- package/dist/components/ui/google-map.js +4 -439
- package/dist/components/ui/icon-input.d.ts +50 -1
- package/dist/components/ui/icon-input.js +30 -446
- package/dist/components/ui/loading.d.ts +7 -1
- package/dist/components/ui/loading.js +4 -438
- package/dist/components/ui/locale-switcher.d.ts +8 -4
- package/dist/components/ui/locale-switcher.js +29 -453
- package/dist/components/ui/pagination.d.ts +5 -3
- package/dist/components/ui/pagination.js +5 -439
- package/dist/components/ui/search-menu.d.ts +4 -2
- package/dist/components/ui/search-menu.js +6 -440
- package/dist/components/ui/theme-switcher.d.ts +5 -3
- package/dist/components/ui/theme-switcher.js +6 -440
- package/dist/components/ui/virtualized-combobox.d.ts +4 -2
- package/dist/components/ui/virtualized-combobox.js +11 -443
- package/dist/lib/docs.d.ts +2 -0
- package/dist/lib/docs.js +86 -481
- package/dist/lib/docs.server.js +0 -21
- package/dist/lib/documentation-toolkit.js +0 -21
- package/dist/lib/markdown/content.d.ts +4 -5
- package/dist/services/agent/client/index.js +75 -463
- package/dist/services/agent/client/widget.d.ts +6 -3
- package/dist/services/notification/client/index.js +8 -440
- package/dist/services/notification/client/notification-menu.d.ts +6 -3
- package/dist/services/notification/public.js +8 -440
- package/dist/services/opentelemetry/api.d.ts +5 -0
- package/dist/services/opentelemetry/api.js +44 -0
- package/dist/services/opentelemetry/browser.d.ts +10 -0
- package/dist/services/opentelemetry/browser.js +59 -0
- package/package.json +9 -1
- package/dist/paraglide/runtime.d.ts +0 -978
|
@@ -115,442 +115,6 @@ function InputGroupInput({
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
// ../../src/paraglide/runtime.js
|
|
119
|
-
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
120
|
-
var baseLocale = "en";
|
|
121
|
-
var locales = ["en", "fr"];
|
|
122
|
-
var cookieName = "locale";
|
|
123
|
-
var cookieMaxAge = 34560000;
|
|
124
|
-
var cookieDomain = "";
|
|
125
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
126
|
-
var strategy = [
|
|
127
|
-
"url",
|
|
128
|
-
"cookie",
|
|
129
|
-
"preferredLanguage",
|
|
130
|
-
"baseLocale"
|
|
131
|
-
];
|
|
132
|
-
var routeStrategies = [
|
|
133
|
-
{
|
|
134
|
-
match: "/api/:path(.*)?",
|
|
135
|
-
exclude: true
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
match: "/sitemap.xml",
|
|
139
|
-
exclude: true
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
match: "/llms.txt",
|
|
143
|
-
exclude: true
|
|
144
|
-
}
|
|
145
|
-
];
|
|
146
|
-
var urlPatterns = [
|
|
147
|
-
{
|
|
148
|
-
pattern: "/:path(.*)?",
|
|
149
|
-
localized: [
|
|
150
|
-
[
|
|
151
|
-
"en",
|
|
152
|
-
"/en/:path(.*)?"
|
|
153
|
-
],
|
|
154
|
-
[
|
|
155
|
-
"fr",
|
|
156
|
-
"/fr/:path(.*)?"
|
|
157
|
-
]
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
];
|
|
161
|
-
var cachedRouteStrategyUrl;
|
|
162
|
-
var cachedRouteStrategy;
|
|
163
|
-
function findMatchingRouteStrategy(url) {
|
|
164
|
-
if (routeStrategies.length === 0) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
168
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
169
|
-
return cachedRouteStrategy;
|
|
170
|
-
}
|
|
171
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
172
|
-
let match;
|
|
173
|
-
for (const routeStrategy of routeStrategies) {
|
|
174
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
175
|
-
if (pattern.exec(urlObject.href)) {
|
|
176
|
-
match = routeStrategy;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
cachedRouteStrategyUrl = urlString;
|
|
181
|
-
cachedRouteStrategy = match;
|
|
182
|
-
return match;
|
|
183
|
-
}
|
|
184
|
-
function getStrategyForUrl(url) {
|
|
185
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
186
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
187
|
-
return routeStrategy.strategy;
|
|
188
|
-
}
|
|
189
|
-
return strategy;
|
|
190
|
-
}
|
|
191
|
-
var serverAsyncLocalStorage = undefined;
|
|
192
|
-
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
193
|
-
var experimentalStaticLocale = undefined;
|
|
194
|
-
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
195
|
-
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
196
|
-
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
197
|
-
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
198
|
-
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
199
|
-
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
200
|
-
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
201
|
-
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
202
|
-
var _locale;
|
|
203
|
-
var localeInitiallySet = false;
|
|
204
|
-
var getLocale = () => {
|
|
205
|
-
if (experimentalStaticLocale !== undefined) {
|
|
206
|
-
return experimentalStaticLocale;
|
|
207
|
-
}
|
|
208
|
-
if (serverAsyncLocalStorage) {
|
|
209
|
-
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
210
|
-
if (locale) {
|
|
211
|
-
return locale;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
let strategyToUse = strategy;
|
|
215
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
216
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
217
|
-
}
|
|
218
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
219
|
-
if (resolved) {
|
|
220
|
-
if (!localeInitiallySet) {
|
|
221
|
-
_locale = resolved;
|
|
222
|
-
localeInitiallySet = true;
|
|
223
|
-
setLocale(resolved, { reload: false });
|
|
224
|
-
}
|
|
225
|
-
return resolved;
|
|
226
|
-
}
|
|
227
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
228
|
-
};
|
|
229
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
230
|
-
let locale;
|
|
231
|
-
for (const strat of strategyToUse) {
|
|
232
|
-
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
233
|
-
locale = extractLocaleFromCookie();
|
|
234
|
-
} else if (strat === "baseLocale") {
|
|
235
|
-
locale = baseLocale;
|
|
236
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
237
|
-
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
238
|
-
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
239
|
-
locale = _locale;
|
|
240
|
-
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
241
|
-
locale = extractLocaleFromNavigator();
|
|
242
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
243
|
-
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
244
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
245
|
-
const handler = customClientStrategies.get(strat);
|
|
246
|
-
if (handler) {
|
|
247
|
-
const result = handler.getLocale();
|
|
248
|
-
if (result instanceof Promise) {
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
if (result !== undefined) {
|
|
252
|
-
return assertIsLocale(result);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const matchedLocale = toLocale(locale);
|
|
257
|
-
if (matchedLocale) {
|
|
258
|
-
return matchedLocale;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
var rtlLanguages = new Set([
|
|
264
|
-
"ar",
|
|
265
|
-
"dv",
|
|
266
|
-
"fa",
|
|
267
|
-
"he",
|
|
268
|
-
"ks",
|
|
269
|
-
"ku",
|
|
270
|
-
"ps",
|
|
271
|
-
"sd",
|
|
272
|
-
"ug",
|
|
273
|
-
"ur",
|
|
274
|
-
"yi"
|
|
275
|
-
]);
|
|
276
|
-
var navigateOrReload = (newLocation) => {
|
|
277
|
-
if (newLocation) {
|
|
278
|
-
window.location.href = newLocation;
|
|
279
|
-
} else {
|
|
280
|
-
window.location.reload();
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
var setLocale = (newLocale, options) => {
|
|
284
|
-
const optionsWithDefaults = {
|
|
285
|
-
reload: true,
|
|
286
|
-
...options
|
|
287
|
-
};
|
|
288
|
-
let currentLocale;
|
|
289
|
-
try {
|
|
290
|
-
currentLocale = getLocale();
|
|
291
|
-
} catch {}
|
|
292
|
-
const customSetLocalePromises = [];
|
|
293
|
-
let newLocation = undefined;
|
|
294
|
-
let strategyToUse = strategy;
|
|
295
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
296
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
297
|
-
}
|
|
298
|
-
for (const strat of strategyToUse) {
|
|
299
|
-
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
300
|
-
_locale = newLocale;
|
|
301
|
-
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
302
|
-
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
306
|
-
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
307
|
-
} else if (strat === "baseLocale") {
|
|
308
|
-
continue;
|
|
309
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
310
|
-
newLocation = localizeUrl(window.location.href, {
|
|
311
|
-
locale: newLocale
|
|
312
|
-
}).href;
|
|
313
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
314
|
-
localStorage.setItem(localStorageKey, newLocale);
|
|
315
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
316
|
-
const handler = customClientStrategies.get(strat);
|
|
317
|
-
if (handler) {
|
|
318
|
-
let result = handler.setLocale(newLocale);
|
|
319
|
-
if (result instanceof Promise) {
|
|
320
|
-
result = result.catch((error) => {
|
|
321
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
322
|
-
cause: error
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
customSetLocalePromises.push(result);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
const runReload = () => {
|
|
331
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
332
|
-
navigateOrReload(newLocation);
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
if (customSetLocalePromises.length) {
|
|
336
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
337
|
-
runReload();
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
runReload();
|
|
341
|
-
return;
|
|
342
|
-
};
|
|
343
|
-
var getUrlOrigin = () => {
|
|
344
|
-
if (serverAsyncLocalStorage) {
|
|
345
|
-
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
346
|
-
} else if (typeof window !== "undefined") {
|
|
347
|
-
return window.location.origin;
|
|
348
|
-
}
|
|
349
|
-
return "http://fallback.com";
|
|
350
|
-
};
|
|
351
|
-
function toLocale(value) {
|
|
352
|
-
if (typeof value !== "string") {
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
const lowerValue = value.toLowerCase();
|
|
356
|
-
for (const locale of locales) {
|
|
357
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
358
|
-
return locale;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
function assertIsLocale(input) {
|
|
364
|
-
const locale = toLocale(input);
|
|
365
|
-
if (locale)
|
|
366
|
-
return locale;
|
|
367
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
368
|
-
}
|
|
369
|
-
function extractLocaleFromCookie() {
|
|
370
|
-
if (typeof document === "undefined" || !document.cookie) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
374
|
-
const locale = match?.[2];
|
|
375
|
-
return toLocale(locale);
|
|
376
|
-
}
|
|
377
|
-
function extractLocaleFromNavigator() {
|
|
378
|
-
if (!navigator?.languages?.length) {
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
const languages = navigator.languages.map((lang) => ({
|
|
382
|
-
fullTag: lang,
|
|
383
|
-
baseTag: lang.split("-")[0]
|
|
384
|
-
}));
|
|
385
|
-
for (const lang of languages) {
|
|
386
|
-
const fullLocale = toLocale(lang.fullTag);
|
|
387
|
-
if (fullLocale) {
|
|
388
|
-
return fullLocale;
|
|
389
|
-
}
|
|
390
|
-
const baseLocale2 = toLocale(lang.baseTag);
|
|
391
|
-
if (baseLocale2) {
|
|
392
|
-
return baseLocale2;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
var cachedUrl;
|
|
398
|
-
var cachedLocale;
|
|
399
|
-
function extractLocaleFromUrl(url) {
|
|
400
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
401
|
-
if (cachedUrl === urlString) {
|
|
402
|
-
return cachedLocale;
|
|
403
|
-
}
|
|
404
|
-
let result;
|
|
405
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
406
|
-
result = defaultUrlPatternExtractLocale(url);
|
|
407
|
-
} else {
|
|
408
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
409
|
-
for (const element of urlPatterns) {
|
|
410
|
-
for (const [locale, localizedPattern] of element.localized) {
|
|
411
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
412
|
-
if (match) {
|
|
413
|
-
result = locale;
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
if (result)
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
cachedUrl = urlString;
|
|
422
|
-
cachedLocale = result;
|
|
423
|
-
return result;
|
|
424
|
-
}
|
|
425
|
-
function defaultUrlPatternExtractLocale(url) {
|
|
426
|
-
const urlObj = new URL(url, "http://dummy.com");
|
|
427
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
428
|
-
return toLocale(pathSegments[0]) || baseLocale;
|
|
429
|
-
}
|
|
430
|
-
function localizeUrl(url, options) {
|
|
431
|
-
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
432
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
433
|
-
return localizeUrlDefaultPattern(url, targetLocale);
|
|
434
|
-
}
|
|
435
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
436
|
-
for (const element of urlPatterns) {
|
|
437
|
-
for (const [, localizedPattern] of element.localized) {
|
|
438
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
439
|
-
if (!match) {
|
|
440
|
-
continue;
|
|
441
|
-
}
|
|
442
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
443
|
-
if (!targetPattern) {
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
447
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
448
|
-
}
|
|
449
|
-
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
450
|
-
if (unlocalizedMatch) {
|
|
451
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
452
|
-
if (targetPattern) {
|
|
453
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
454
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
return urlObj;
|
|
459
|
-
}
|
|
460
|
-
function localizeUrlDefaultPattern(url, locale) {
|
|
461
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
462
|
-
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
463
|
-
if (currentLocale === locale) {
|
|
464
|
-
return urlObj;
|
|
465
|
-
}
|
|
466
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
467
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
468
|
-
pathSegments.shift();
|
|
469
|
-
}
|
|
470
|
-
if (locale === baseLocale) {
|
|
471
|
-
urlObj.pathname = "/" + pathSegments.join("/");
|
|
472
|
-
} else {
|
|
473
|
-
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
474
|
-
}
|
|
475
|
-
return urlObj;
|
|
476
|
-
}
|
|
477
|
-
function fillMissingUrlParts(url, match) {
|
|
478
|
-
if (match.protocol.groups["0"]) {
|
|
479
|
-
url.protocol = match.protocol.groups["0"] ?? "";
|
|
480
|
-
}
|
|
481
|
-
if (match.hostname.groups["0"]) {
|
|
482
|
-
url.hostname = match.hostname.groups["0"] ?? "";
|
|
483
|
-
}
|
|
484
|
-
if (match.username.groups["0"]) {
|
|
485
|
-
url.username = match.username.groups["0"] ?? "";
|
|
486
|
-
}
|
|
487
|
-
if (match.password.groups["0"]) {
|
|
488
|
-
url.password = match.password.groups["0"] ?? "";
|
|
489
|
-
}
|
|
490
|
-
if (match.port.groups["0"]) {
|
|
491
|
-
url.port = match.port.groups["0"] ?? "";
|
|
492
|
-
}
|
|
493
|
-
if (match.pathname.groups["0"]) {
|
|
494
|
-
url.pathname = match.pathname.groups["0"] ?? "";
|
|
495
|
-
}
|
|
496
|
-
if (match.search.groups["0"]) {
|
|
497
|
-
url.search = match.search.groups["0"] ?? "";
|
|
498
|
-
}
|
|
499
|
-
if (match.hash.groups["0"]) {
|
|
500
|
-
url.hash = match.hash.groups["0"] ?? "";
|
|
501
|
-
}
|
|
502
|
-
return url;
|
|
503
|
-
}
|
|
504
|
-
function fillPattern(pattern, values, origin) {
|
|
505
|
-
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
506
|
-
return `${protocol}#PORT-${port}#${slash}`;
|
|
507
|
-
});
|
|
508
|
-
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
509
|
-
if (modifier === "?") {
|
|
510
|
-
return content;
|
|
511
|
-
}
|
|
512
|
-
return content;
|
|
513
|
-
});
|
|
514
|
-
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
515
|
-
const value = values[name];
|
|
516
|
-
if (value === null) {
|
|
517
|
-
return "";
|
|
518
|
-
}
|
|
519
|
-
if (modifier === "?") {
|
|
520
|
-
return value !== undefined ? `${slash}${value}` : "";
|
|
521
|
-
}
|
|
522
|
-
if (modifier === "+" || modifier === "*") {
|
|
523
|
-
if (value === undefined && modifier === "+") {
|
|
524
|
-
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
525
|
-
}
|
|
526
|
-
return value ? `${slash}${value}` : "";
|
|
527
|
-
}
|
|
528
|
-
if (value === undefined) {
|
|
529
|
-
throw new Error(`Missing value for "${name}"`);
|
|
530
|
-
}
|
|
531
|
-
return `${slash}${value}`;
|
|
532
|
-
});
|
|
533
|
-
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
534
|
-
return new URL(filled, origin);
|
|
535
|
-
}
|
|
536
|
-
function aggregateGroups(match) {
|
|
537
|
-
return {
|
|
538
|
-
...match.hash.groups,
|
|
539
|
-
...match.hostname.groups,
|
|
540
|
-
...match.password.groups,
|
|
541
|
-
...match.pathname.groups,
|
|
542
|
-
...match.port.groups,
|
|
543
|
-
...match.protocol.groups,
|
|
544
|
-
...match.search.groups,
|
|
545
|
-
...match.username.groups
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
var customServerStrategies = new Map;
|
|
549
|
-
var customClientStrategies = new Map;
|
|
550
|
-
function isCustomStrategy(strategy2) {
|
|
551
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
118
|
// ../../src/components/ui/virtualized-combobox.tsx
|
|
555
119
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
556
120
|
"use client";
|
|
@@ -568,22 +132,24 @@ var messages = {
|
|
|
568
132
|
selectMore: "Sélectionner davantage"
|
|
569
133
|
}
|
|
570
134
|
};
|
|
571
|
-
var virtualizedComboboxMessages = (
|
|
572
|
-
...
|
|
573
|
-
...
|
|
135
|
+
var virtualizedComboboxMessages = (locale, translations) => ({
|
|
136
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
137
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
138
|
+
...translations?.[locale]
|
|
574
139
|
});
|
|
575
140
|
var optionEquals = (item, selected) => item.value === selected.value;
|
|
576
141
|
var VirtualizedComboboxList = ({
|
|
577
142
|
emptyLabel,
|
|
578
143
|
groupSelections,
|
|
579
144
|
itemIndexRef,
|
|
145
|
+
locale = "en",
|
|
580
146
|
messages: messageOverrides,
|
|
581
147
|
renderItem,
|
|
582
148
|
selectedValues,
|
|
583
149
|
virtualizerRef
|
|
584
150
|
}) => {
|
|
585
151
|
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
586
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
152
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
587
153
|
const itemEntries = filteredItems.map((item, index) => ({
|
|
588
154
|
kind: "item",
|
|
589
155
|
item,
|
|
@@ -693,12 +259,13 @@ var VirtualizedComboboxContent = ({
|
|
|
693
259
|
emptyLabel,
|
|
694
260
|
groupSelections,
|
|
695
261
|
itemIndexRef,
|
|
262
|
+
locale = "en",
|
|
696
263
|
messages: messageOverrides,
|
|
697
264
|
renderItem,
|
|
698
265
|
selectedValues,
|
|
699
266
|
virtualizerRef
|
|
700
267
|
}) => {
|
|
701
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
268
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
702
269
|
return /* @__PURE__ */ jsx4(ComboboxPrimitive.Portal, {
|
|
703
270
|
children: /* @__PURE__ */ jsx4(ComboboxPrimitive.Positioner, {
|
|
704
271
|
align: "start",
|
|
@@ -722,6 +289,7 @@ var VirtualizedComboboxContent = ({
|
|
|
722
289
|
emptyLabel,
|
|
723
290
|
groupSelections,
|
|
724
291
|
itemIndexRef,
|
|
292
|
+
locale,
|
|
725
293
|
messages: messageOverrides,
|
|
726
294
|
renderItem,
|
|
727
295
|
selectedValues,
|
|
@@ -771,7 +339,7 @@ var useComboboxVirtualizerRef = (providedRef) => {
|
|
|
771
339
|
var VirtualizedComboboxSingle = (props) => {
|
|
772
340
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
773
341
|
const itemIndexRef = useRef(new Map);
|
|
774
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
342
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
775
343
|
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Root, {
|
|
776
344
|
disabled: props.disabled,
|
|
777
345
|
inputValue: props.searchValue,
|
|
@@ -812,7 +380,7 @@ var VirtualizedComboboxSingle = (props) => {
|
|
|
812
380
|
var VirtualizedComboboxMultiple = (props) => {
|
|
813
381
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
814
382
|
const itemIndexRef = useRef(new Map);
|
|
815
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
383
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
816
384
|
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Root, {
|
|
817
385
|
disabled: props.disabled,
|
|
818
386
|
inputValue: props.searchValue,
|
package/dist/lib/docs.d.ts
CHANGED