@krak-stack/registry 0.1.32 → 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/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/package.json +1 -1
- package/dist/paraglide/runtime.d.ts +0 -978
|
@@ -17,8 +17,10 @@ export type ErrorComponentMessages = {
|
|
|
17
17
|
versionLabel: string;
|
|
18
18
|
referenceLabel: string;
|
|
19
19
|
};
|
|
20
|
+
export type ErrorComponentMessageTranslations = Partial<Record<string, Partial<ErrorComponentMessages>>>;
|
|
20
21
|
export type ErrorComponentProps = RouterErrorComponentProps & {
|
|
21
|
-
|
|
22
|
+
locale?: string;
|
|
23
|
+
messages?: ErrorComponentMessageTranslations;
|
|
22
24
|
retryable?: boolean;
|
|
23
25
|
className?: string;
|
|
24
26
|
diagnostics?: {
|
|
@@ -27,4 +29,4 @@ export type ErrorComponentProps = RouterErrorComponentProps & {
|
|
|
27
29
|
reference?: string;
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
|
-
export declare const ErrorComponent: ({ error, messages, retryable, className, diagnostics, }: ErrorComponentProps) => import("react").JSX.Element;
|
|
32
|
+
export declare const ErrorComponent: ({ error, locale, messages, retryable, className, diagnostics, }: ErrorComponentProps) => import("react").JSX.Element;
|
|
@@ -60,11 +60,21 @@ function Button({
|
|
|
60
60
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
61
61
|
import { useEffect, useRef, useState } from "react";
|
|
62
62
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
63
|
+
var messages = {
|
|
64
|
+
en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
|
|
65
|
+
fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
|
|
66
|
+
};
|
|
67
|
+
var copyButtonMessages = (locale = "en", translations) => ({
|
|
68
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
69
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
70
|
+
...translations?.[locale]
|
|
71
|
+
});
|
|
63
72
|
function CopyButton({
|
|
64
73
|
value,
|
|
65
74
|
valueDescription,
|
|
66
75
|
copyVariant = "default",
|
|
67
|
-
|
|
76
|
+
locale = "en",
|
|
77
|
+
messages: messages2,
|
|
68
78
|
onCopied,
|
|
69
79
|
onCopyError,
|
|
70
80
|
resetDelay = 1500,
|
|
@@ -75,11 +85,7 @@ function CopyButton({
|
|
|
75
85
|
}) {
|
|
76
86
|
const [copyState, setCopyState] = useState("idle");
|
|
77
87
|
const copyTimeout = useRef(undefined);
|
|
78
|
-
const labels =
|
|
79
|
-
copy: messages?.copy ?? "Copy",
|
|
80
|
-
copied: messages?.copied ?? "Copied",
|
|
81
|
-
copyFailed: messages?.copyFailed ?? "Copy failed"
|
|
82
|
-
};
|
|
88
|
+
const labels = copyButtonMessages(locale, messages2);
|
|
83
89
|
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
84
90
|
const isLarge = copyVariant === "large";
|
|
85
91
|
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
@@ -101,7 +107,7 @@ function CopyButton({
|
|
|
101
107
|
onCopied?.();
|
|
102
108
|
} catch (error) {
|
|
103
109
|
setCopyState("failed");
|
|
104
|
-
onCopyError?.(error instanceof Error ? error : new Error(
|
|
110
|
+
onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
|
|
105
111
|
}
|
|
106
112
|
resetCopyState();
|
|
107
113
|
};
|
|
@@ -207,442 +213,6 @@ function EmptyContent({ className, ...props }) {
|
|
|
207
213
|
});
|
|
208
214
|
}
|
|
209
215
|
|
|
210
|
-
// ../../src/paraglide/runtime.js
|
|
211
|
-
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
212
|
-
var baseLocale = "en";
|
|
213
|
-
var locales = ["en", "fr"];
|
|
214
|
-
var cookieName = "locale";
|
|
215
|
-
var cookieMaxAge = 34560000;
|
|
216
|
-
var cookieDomain = "";
|
|
217
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
218
|
-
var strategy = [
|
|
219
|
-
"url",
|
|
220
|
-
"cookie",
|
|
221
|
-
"preferredLanguage",
|
|
222
|
-
"baseLocale"
|
|
223
|
-
];
|
|
224
|
-
var routeStrategies = [
|
|
225
|
-
{
|
|
226
|
-
match: "/api/:path(.*)?",
|
|
227
|
-
exclude: true
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
match: "/sitemap.xml",
|
|
231
|
-
exclude: true
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
match: "/llms.txt",
|
|
235
|
-
exclude: true
|
|
236
|
-
}
|
|
237
|
-
];
|
|
238
|
-
var urlPatterns = [
|
|
239
|
-
{
|
|
240
|
-
pattern: "/:path(.*)?",
|
|
241
|
-
localized: [
|
|
242
|
-
[
|
|
243
|
-
"en",
|
|
244
|
-
"/en/:path(.*)?"
|
|
245
|
-
],
|
|
246
|
-
[
|
|
247
|
-
"fr",
|
|
248
|
-
"/fr/:path(.*)?"
|
|
249
|
-
]
|
|
250
|
-
]
|
|
251
|
-
}
|
|
252
|
-
];
|
|
253
|
-
var cachedRouteStrategyUrl;
|
|
254
|
-
var cachedRouteStrategy;
|
|
255
|
-
function findMatchingRouteStrategy(url) {
|
|
256
|
-
if (routeStrategies.length === 0) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
260
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
261
|
-
return cachedRouteStrategy;
|
|
262
|
-
}
|
|
263
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
264
|
-
let match;
|
|
265
|
-
for (const routeStrategy of routeStrategies) {
|
|
266
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
267
|
-
if (pattern.exec(urlObject.href)) {
|
|
268
|
-
match = routeStrategy;
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
cachedRouteStrategyUrl = urlString;
|
|
273
|
-
cachedRouteStrategy = match;
|
|
274
|
-
return match;
|
|
275
|
-
}
|
|
276
|
-
function getStrategyForUrl(url) {
|
|
277
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
278
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
279
|
-
return routeStrategy.strategy;
|
|
280
|
-
}
|
|
281
|
-
return strategy;
|
|
282
|
-
}
|
|
283
|
-
var serverAsyncLocalStorage = undefined;
|
|
284
|
-
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
285
|
-
var experimentalStaticLocale = undefined;
|
|
286
|
-
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
287
|
-
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
288
|
-
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
289
|
-
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
290
|
-
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
291
|
-
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
292
|
-
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
293
|
-
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
294
|
-
var _locale;
|
|
295
|
-
var localeInitiallySet = false;
|
|
296
|
-
var getLocale = () => {
|
|
297
|
-
if (experimentalStaticLocale !== undefined) {
|
|
298
|
-
return experimentalStaticLocale;
|
|
299
|
-
}
|
|
300
|
-
if (serverAsyncLocalStorage) {
|
|
301
|
-
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
302
|
-
if (locale) {
|
|
303
|
-
return locale;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
let strategyToUse = strategy;
|
|
307
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
308
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
309
|
-
}
|
|
310
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
311
|
-
if (resolved) {
|
|
312
|
-
if (!localeInitiallySet) {
|
|
313
|
-
_locale = resolved;
|
|
314
|
-
localeInitiallySet = true;
|
|
315
|
-
setLocale(resolved, { reload: false });
|
|
316
|
-
}
|
|
317
|
-
return resolved;
|
|
318
|
-
}
|
|
319
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
320
|
-
};
|
|
321
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
322
|
-
let locale;
|
|
323
|
-
for (const strat of strategyToUse) {
|
|
324
|
-
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
325
|
-
locale = extractLocaleFromCookie();
|
|
326
|
-
} else if (strat === "baseLocale") {
|
|
327
|
-
locale = baseLocale;
|
|
328
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
329
|
-
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
330
|
-
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
331
|
-
locale = _locale;
|
|
332
|
-
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
333
|
-
locale = extractLocaleFromNavigator();
|
|
334
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
335
|
-
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
336
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
337
|
-
const handler = customClientStrategies.get(strat);
|
|
338
|
-
if (handler) {
|
|
339
|
-
const result = handler.getLocale();
|
|
340
|
-
if (result instanceof Promise) {
|
|
341
|
-
continue;
|
|
342
|
-
}
|
|
343
|
-
if (result !== undefined) {
|
|
344
|
-
return assertIsLocale(result);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
const matchedLocale = toLocale(locale);
|
|
349
|
-
if (matchedLocale) {
|
|
350
|
-
return matchedLocale;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
var rtlLanguages = new Set([
|
|
356
|
-
"ar",
|
|
357
|
-
"dv",
|
|
358
|
-
"fa",
|
|
359
|
-
"he",
|
|
360
|
-
"ks",
|
|
361
|
-
"ku",
|
|
362
|
-
"ps",
|
|
363
|
-
"sd",
|
|
364
|
-
"ug",
|
|
365
|
-
"ur",
|
|
366
|
-
"yi"
|
|
367
|
-
]);
|
|
368
|
-
var navigateOrReload = (newLocation) => {
|
|
369
|
-
if (newLocation) {
|
|
370
|
-
window.location.href = newLocation;
|
|
371
|
-
} else {
|
|
372
|
-
window.location.reload();
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
var setLocale = (newLocale, options) => {
|
|
376
|
-
const optionsWithDefaults = {
|
|
377
|
-
reload: true,
|
|
378
|
-
...options
|
|
379
|
-
};
|
|
380
|
-
let currentLocale;
|
|
381
|
-
try {
|
|
382
|
-
currentLocale = getLocale();
|
|
383
|
-
} catch {}
|
|
384
|
-
const customSetLocalePromises = [];
|
|
385
|
-
let newLocation = undefined;
|
|
386
|
-
let strategyToUse = strategy;
|
|
387
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
388
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
389
|
-
}
|
|
390
|
-
for (const strat of strategyToUse) {
|
|
391
|
-
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
392
|
-
_locale = newLocale;
|
|
393
|
-
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
394
|
-
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
398
|
-
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
399
|
-
} else if (strat === "baseLocale") {
|
|
400
|
-
continue;
|
|
401
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
402
|
-
newLocation = localizeUrl(window.location.href, {
|
|
403
|
-
locale: newLocale
|
|
404
|
-
}).href;
|
|
405
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
406
|
-
localStorage.setItem(localStorageKey, newLocale);
|
|
407
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
408
|
-
const handler = customClientStrategies.get(strat);
|
|
409
|
-
if (handler) {
|
|
410
|
-
let result = handler.setLocale(newLocale);
|
|
411
|
-
if (result instanceof Promise) {
|
|
412
|
-
result = result.catch((error) => {
|
|
413
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
414
|
-
cause: error
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
customSetLocalePromises.push(result);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
const runReload = () => {
|
|
423
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
424
|
-
navigateOrReload(newLocation);
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
if (customSetLocalePromises.length) {
|
|
428
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
429
|
-
runReload();
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
runReload();
|
|
433
|
-
return;
|
|
434
|
-
};
|
|
435
|
-
var getUrlOrigin = () => {
|
|
436
|
-
if (serverAsyncLocalStorage) {
|
|
437
|
-
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
438
|
-
} else if (typeof window !== "undefined") {
|
|
439
|
-
return window.location.origin;
|
|
440
|
-
}
|
|
441
|
-
return "http://fallback.com";
|
|
442
|
-
};
|
|
443
|
-
function toLocale(value) {
|
|
444
|
-
if (typeof value !== "string") {
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
const lowerValue = value.toLowerCase();
|
|
448
|
-
for (const locale of locales) {
|
|
449
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
450
|
-
return locale;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
function assertIsLocale(input) {
|
|
456
|
-
const locale = toLocale(input);
|
|
457
|
-
if (locale)
|
|
458
|
-
return locale;
|
|
459
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
460
|
-
}
|
|
461
|
-
function extractLocaleFromCookie() {
|
|
462
|
-
if (typeof document === "undefined" || !document.cookie) {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
466
|
-
const locale = match?.[2];
|
|
467
|
-
return toLocale(locale);
|
|
468
|
-
}
|
|
469
|
-
function extractLocaleFromNavigator() {
|
|
470
|
-
if (!navigator?.languages?.length) {
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
const languages = navigator.languages.map((lang) => ({
|
|
474
|
-
fullTag: lang,
|
|
475
|
-
baseTag: lang.split("-")[0]
|
|
476
|
-
}));
|
|
477
|
-
for (const lang of languages) {
|
|
478
|
-
const fullLocale = toLocale(lang.fullTag);
|
|
479
|
-
if (fullLocale) {
|
|
480
|
-
return fullLocale;
|
|
481
|
-
}
|
|
482
|
-
const baseLocale2 = toLocale(lang.baseTag);
|
|
483
|
-
if (baseLocale2) {
|
|
484
|
-
return baseLocale2;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
var cachedUrl;
|
|
490
|
-
var cachedLocale;
|
|
491
|
-
function extractLocaleFromUrl(url) {
|
|
492
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
493
|
-
if (cachedUrl === urlString) {
|
|
494
|
-
return cachedLocale;
|
|
495
|
-
}
|
|
496
|
-
let result;
|
|
497
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
498
|
-
result = defaultUrlPatternExtractLocale(url);
|
|
499
|
-
} else {
|
|
500
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
501
|
-
for (const element of urlPatterns) {
|
|
502
|
-
for (const [locale, localizedPattern] of element.localized) {
|
|
503
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
504
|
-
if (match) {
|
|
505
|
-
result = locale;
|
|
506
|
-
break;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
if (result)
|
|
510
|
-
break;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
cachedUrl = urlString;
|
|
514
|
-
cachedLocale = result;
|
|
515
|
-
return result;
|
|
516
|
-
}
|
|
517
|
-
function defaultUrlPatternExtractLocale(url) {
|
|
518
|
-
const urlObj = new URL(url, "http://dummy.com");
|
|
519
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
520
|
-
return toLocale(pathSegments[0]) || baseLocale;
|
|
521
|
-
}
|
|
522
|
-
function localizeUrl(url, options) {
|
|
523
|
-
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
524
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
525
|
-
return localizeUrlDefaultPattern(url, targetLocale);
|
|
526
|
-
}
|
|
527
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
528
|
-
for (const element of urlPatterns) {
|
|
529
|
-
for (const [, localizedPattern] of element.localized) {
|
|
530
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
531
|
-
if (!match) {
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
535
|
-
if (!targetPattern) {
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
538
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
539
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
540
|
-
}
|
|
541
|
-
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
542
|
-
if (unlocalizedMatch) {
|
|
543
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
544
|
-
if (targetPattern) {
|
|
545
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
546
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return urlObj;
|
|
551
|
-
}
|
|
552
|
-
function localizeUrlDefaultPattern(url, locale) {
|
|
553
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
554
|
-
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
555
|
-
if (currentLocale === locale) {
|
|
556
|
-
return urlObj;
|
|
557
|
-
}
|
|
558
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
559
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
560
|
-
pathSegments.shift();
|
|
561
|
-
}
|
|
562
|
-
if (locale === baseLocale) {
|
|
563
|
-
urlObj.pathname = "/" + pathSegments.join("/");
|
|
564
|
-
} else {
|
|
565
|
-
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
566
|
-
}
|
|
567
|
-
return urlObj;
|
|
568
|
-
}
|
|
569
|
-
function fillMissingUrlParts(url, match) {
|
|
570
|
-
if (match.protocol.groups["0"]) {
|
|
571
|
-
url.protocol = match.protocol.groups["0"] ?? "";
|
|
572
|
-
}
|
|
573
|
-
if (match.hostname.groups["0"]) {
|
|
574
|
-
url.hostname = match.hostname.groups["0"] ?? "";
|
|
575
|
-
}
|
|
576
|
-
if (match.username.groups["0"]) {
|
|
577
|
-
url.username = match.username.groups["0"] ?? "";
|
|
578
|
-
}
|
|
579
|
-
if (match.password.groups["0"]) {
|
|
580
|
-
url.password = match.password.groups["0"] ?? "";
|
|
581
|
-
}
|
|
582
|
-
if (match.port.groups["0"]) {
|
|
583
|
-
url.port = match.port.groups["0"] ?? "";
|
|
584
|
-
}
|
|
585
|
-
if (match.pathname.groups["0"]) {
|
|
586
|
-
url.pathname = match.pathname.groups["0"] ?? "";
|
|
587
|
-
}
|
|
588
|
-
if (match.search.groups["0"]) {
|
|
589
|
-
url.search = match.search.groups["0"] ?? "";
|
|
590
|
-
}
|
|
591
|
-
if (match.hash.groups["0"]) {
|
|
592
|
-
url.hash = match.hash.groups["0"] ?? "";
|
|
593
|
-
}
|
|
594
|
-
return url;
|
|
595
|
-
}
|
|
596
|
-
function fillPattern(pattern, values, origin) {
|
|
597
|
-
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
598
|
-
return `${protocol}#PORT-${port}#${slash}`;
|
|
599
|
-
});
|
|
600
|
-
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
601
|
-
if (modifier === "?") {
|
|
602
|
-
return content;
|
|
603
|
-
}
|
|
604
|
-
return content;
|
|
605
|
-
});
|
|
606
|
-
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
607
|
-
const value = values[name];
|
|
608
|
-
if (value === null) {
|
|
609
|
-
return "";
|
|
610
|
-
}
|
|
611
|
-
if (modifier === "?") {
|
|
612
|
-
return value !== undefined ? `${slash}${value}` : "";
|
|
613
|
-
}
|
|
614
|
-
if (modifier === "+" || modifier === "*") {
|
|
615
|
-
if (value === undefined && modifier === "+") {
|
|
616
|
-
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
617
|
-
}
|
|
618
|
-
return value ? `${slash}${value}` : "";
|
|
619
|
-
}
|
|
620
|
-
if (value === undefined) {
|
|
621
|
-
throw new Error(`Missing value for "${name}"`);
|
|
622
|
-
}
|
|
623
|
-
return `${slash}${value}`;
|
|
624
|
-
});
|
|
625
|
-
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
626
|
-
return new URL(filled, origin);
|
|
627
|
-
}
|
|
628
|
-
function aggregateGroups(match) {
|
|
629
|
-
return {
|
|
630
|
-
...match.hash.groups,
|
|
631
|
-
...match.hostname.groups,
|
|
632
|
-
...match.password.groups,
|
|
633
|
-
...match.pathname.groups,
|
|
634
|
-
...match.port.groups,
|
|
635
|
-
...match.protocol.groups,
|
|
636
|
-
...match.search.groups,
|
|
637
|
-
...match.username.groups
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
var customServerStrategies = new Map;
|
|
641
|
-
var customClientStrategies = new Map;
|
|
642
|
-
function isCustomStrategy(strategy2) {
|
|
643
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
216
|
// ../../src/components/ui/error-component.tsx
|
|
647
217
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
648
218
|
var TraceId = Schema.String.check(Schema.isPattern(/^(?!0+$)(?:[a-f0-9]{16}|[a-f0-9]{32})$/i)).annotate({ identifier: "ErrorTraceId" });
|
|
@@ -701,19 +271,20 @@ var defaultMessages = {
|
|
|
701
271
|
};
|
|
702
272
|
var ErrorComponent = ({
|
|
703
273
|
error,
|
|
704
|
-
|
|
274
|
+
locale = "en",
|
|
275
|
+
messages: messages2,
|
|
705
276
|
retryable = true,
|
|
706
277
|
className,
|
|
707
278
|
diagnostics
|
|
708
279
|
}) => {
|
|
709
|
-
const locale = getLocale();
|
|
710
280
|
const pathname = useRouterState({
|
|
711
281
|
select: (state) => state.location.pathname
|
|
712
282
|
});
|
|
713
283
|
const labels = useMemo(() => ({
|
|
714
284
|
...defaultMessages[locale.startsWith("fr") ? "fr" : "en"],
|
|
715
|
-
...
|
|
716
|
-
|
|
285
|
+
...messages2?.[locale.split("-")[0] ?? locale],
|
|
286
|
+
...messages2?.[locale]
|
|
287
|
+
}), [locale, messages2]);
|
|
717
288
|
const reference = diagnostics?.reference ?? getErrorTraceId(error);
|
|
718
289
|
const report = useMemo(() => [
|
|
719
290
|
`${labels.errorLabel}: ${error.name}`,
|
|
@@ -781,11 +352,14 @@ var ErrorComponent = ({
|
|
|
781
352
|
/* @__PURE__ */ jsx5(CopyButton, {
|
|
782
353
|
value: report,
|
|
783
354
|
copyVariant: "large",
|
|
355
|
+
locale,
|
|
784
356
|
variant: "link",
|
|
785
357
|
messages: {
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
358
|
+
[locale]: {
|
|
359
|
+
copy: labels.copy,
|
|
360
|
+
copied: labels.copied,
|
|
361
|
+
copyFailed: labels.copyFailed
|
|
362
|
+
}
|
|
789
363
|
},
|
|
790
364
|
onCopied: () => setCopyResult({ report, status: "copied" }),
|
|
791
365
|
onCopyError: () => setCopyResult({ report, status: "failed" })
|
|
@@ -9,6 +9,7 @@ export type FilePickerMessages = {
|
|
|
9
9
|
replaceFile: string;
|
|
10
10
|
};
|
|
11
11
|
export type FilePickerMessageOverrides = Partial<FilePickerMessages>;
|
|
12
|
+
export type FilePickerMessageTranslations = Partial<Record<string, FilePickerMessageOverrides>>;
|
|
12
13
|
export type FilePickerProps = {
|
|
13
14
|
accept?: string;
|
|
14
15
|
canClear?: boolean;
|
|
@@ -22,7 +23,8 @@ export type FilePickerProps = {
|
|
|
22
23
|
width: number;
|
|
23
24
|
};
|
|
24
25
|
invalid?: boolean;
|
|
25
|
-
|
|
26
|
+
locale?: string;
|
|
27
|
+
messages?: FilePickerMessageTranslations;
|
|
26
28
|
multiple?: boolean;
|
|
27
29
|
name: string;
|
|
28
30
|
onBlur?: () => void;
|
|
@@ -32,4 +34,4 @@ export type FilePickerProps = {
|
|
|
32
34
|
required?: boolean;
|
|
33
35
|
title: ReactNode;
|
|
34
36
|
};
|
|
35
|
-
export declare const FilePicker: ({ accept, canClear, file, files, id, image, invalid, messages, multiple, name, onBlur, onChange, onClear, onFilesChange, required, title, }: FilePickerProps) => import("react").JSX.Element;
|
|
37
|
+
export declare const FilePicker: ({ accept, canClear, file, files, id, image, invalid, locale, messages, multiple, name, onBlur, onChange, onClear, onFilesChange, required, title, }: FilePickerProps) => import("react").JSX.Element;
|