@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
|
@@ -450,442 +450,6 @@ function AttachmentGroup({ className, ...props }) {
|
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
// ../../src/paraglide/runtime.js
|
|
454
|
-
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
455
|
-
var baseLocale = "en";
|
|
456
|
-
var locales = ["en", "fr"];
|
|
457
|
-
var cookieName = "locale";
|
|
458
|
-
var cookieMaxAge = 34560000;
|
|
459
|
-
var cookieDomain = "";
|
|
460
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
461
|
-
var strategy = [
|
|
462
|
-
"url",
|
|
463
|
-
"cookie",
|
|
464
|
-
"preferredLanguage",
|
|
465
|
-
"baseLocale"
|
|
466
|
-
];
|
|
467
|
-
var routeStrategies = [
|
|
468
|
-
{
|
|
469
|
-
match: "/api/:path(.*)?",
|
|
470
|
-
exclude: true
|
|
471
|
-
},
|
|
472
|
-
{
|
|
473
|
-
match: "/sitemap.xml",
|
|
474
|
-
exclude: true
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
match: "/llms.txt",
|
|
478
|
-
exclude: true
|
|
479
|
-
}
|
|
480
|
-
];
|
|
481
|
-
var urlPatterns = [
|
|
482
|
-
{
|
|
483
|
-
pattern: "/:path(.*)?",
|
|
484
|
-
localized: [
|
|
485
|
-
[
|
|
486
|
-
"en",
|
|
487
|
-
"/en/:path(.*)?"
|
|
488
|
-
],
|
|
489
|
-
[
|
|
490
|
-
"fr",
|
|
491
|
-
"/fr/:path(.*)?"
|
|
492
|
-
]
|
|
493
|
-
]
|
|
494
|
-
}
|
|
495
|
-
];
|
|
496
|
-
var cachedRouteStrategyUrl;
|
|
497
|
-
var cachedRouteStrategy;
|
|
498
|
-
function findMatchingRouteStrategy(url) {
|
|
499
|
-
if (routeStrategies.length === 0) {
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
503
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
504
|
-
return cachedRouteStrategy;
|
|
505
|
-
}
|
|
506
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
507
|
-
let match;
|
|
508
|
-
for (const routeStrategy of routeStrategies) {
|
|
509
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
510
|
-
if (pattern.exec(urlObject.href)) {
|
|
511
|
-
match = routeStrategy;
|
|
512
|
-
break;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
cachedRouteStrategyUrl = urlString;
|
|
516
|
-
cachedRouteStrategy = match;
|
|
517
|
-
return match;
|
|
518
|
-
}
|
|
519
|
-
function getStrategyForUrl(url) {
|
|
520
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
521
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
522
|
-
return routeStrategy.strategy;
|
|
523
|
-
}
|
|
524
|
-
return strategy;
|
|
525
|
-
}
|
|
526
|
-
var serverAsyncLocalStorage = undefined;
|
|
527
|
-
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
528
|
-
var experimentalStaticLocale = undefined;
|
|
529
|
-
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
530
|
-
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
531
|
-
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
532
|
-
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
533
|
-
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
534
|
-
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
535
|
-
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
536
|
-
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
537
|
-
var _locale;
|
|
538
|
-
var localeInitiallySet = false;
|
|
539
|
-
var getLocale = () => {
|
|
540
|
-
if (experimentalStaticLocale !== undefined) {
|
|
541
|
-
return experimentalStaticLocale;
|
|
542
|
-
}
|
|
543
|
-
if (serverAsyncLocalStorage) {
|
|
544
|
-
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
545
|
-
if (locale) {
|
|
546
|
-
return locale;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
let strategyToUse = strategy;
|
|
550
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
551
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
552
|
-
}
|
|
553
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
554
|
-
if (resolved) {
|
|
555
|
-
if (!localeInitiallySet) {
|
|
556
|
-
_locale = resolved;
|
|
557
|
-
localeInitiallySet = true;
|
|
558
|
-
setLocale(resolved, { reload: false });
|
|
559
|
-
}
|
|
560
|
-
return resolved;
|
|
561
|
-
}
|
|
562
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
563
|
-
};
|
|
564
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
565
|
-
let locale;
|
|
566
|
-
for (const strat of strategyToUse) {
|
|
567
|
-
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
568
|
-
locale = extractLocaleFromCookie();
|
|
569
|
-
} else if (strat === "baseLocale") {
|
|
570
|
-
locale = baseLocale;
|
|
571
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
572
|
-
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
573
|
-
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
574
|
-
locale = _locale;
|
|
575
|
-
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
576
|
-
locale = extractLocaleFromNavigator();
|
|
577
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
578
|
-
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
579
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
580
|
-
const handler = customClientStrategies.get(strat);
|
|
581
|
-
if (handler) {
|
|
582
|
-
const result = handler.getLocale();
|
|
583
|
-
if (result instanceof Promise) {
|
|
584
|
-
continue;
|
|
585
|
-
}
|
|
586
|
-
if (result !== undefined) {
|
|
587
|
-
return assertIsLocale(result);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
const matchedLocale = toLocale(locale);
|
|
592
|
-
if (matchedLocale) {
|
|
593
|
-
return matchedLocale;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
var rtlLanguages = new Set([
|
|
599
|
-
"ar",
|
|
600
|
-
"dv",
|
|
601
|
-
"fa",
|
|
602
|
-
"he",
|
|
603
|
-
"ks",
|
|
604
|
-
"ku",
|
|
605
|
-
"ps",
|
|
606
|
-
"sd",
|
|
607
|
-
"ug",
|
|
608
|
-
"ur",
|
|
609
|
-
"yi"
|
|
610
|
-
]);
|
|
611
|
-
var navigateOrReload = (newLocation) => {
|
|
612
|
-
if (newLocation) {
|
|
613
|
-
window.location.href = newLocation;
|
|
614
|
-
} else {
|
|
615
|
-
window.location.reload();
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
var setLocale = (newLocale, options) => {
|
|
619
|
-
const optionsWithDefaults = {
|
|
620
|
-
reload: true,
|
|
621
|
-
...options
|
|
622
|
-
};
|
|
623
|
-
let currentLocale;
|
|
624
|
-
try {
|
|
625
|
-
currentLocale = getLocale();
|
|
626
|
-
} catch {}
|
|
627
|
-
const customSetLocalePromises = [];
|
|
628
|
-
let newLocation = undefined;
|
|
629
|
-
let strategyToUse = strategy;
|
|
630
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
631
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
632
|
-
}
|
|
633
|
-
for (const strat of strategyToUse) {
|
|
634
|
-
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
635
|
-
_locale = newLocale;
|
|
636
|
-
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
637
|
-
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
641
|
-
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
642
|
-
} else if (strat === "baseLocale") {
|
|
643
|
-
continue;
|
|
644
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
645
|
-
newLocation = localizeUrl(window.location.href, {
|
|
646
|
-
locale: newLocale
|
|
647
|
-
}).href;
|
|
648
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
649
|
-
localStorage.setItem(localStorageKey, newLocale);
|
|
650
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
651
|
-
const handler = customClientStrategies.get(strat);
|
|
652
|
-
if (handler) {
|
|
653
|
-
let result = handler.setLocale(newLocale);
|
|
654
|
-
if (result instanceof Promise) {
|
|
655
|
-
result = result.catch((error) => {
|
|
656
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
657
|
-
cause: error
|
|
658
|
-
});
|
|
659
|
-
});
|
|
660
|
-
customSetLocalePromises.push(result);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
const runReload = () => {
|
|
666
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
667
|
-
navigateOrReload(newLocation);
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
if (customSetLocalePromises.length) {
|
|
671
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
672
|
-
runReload();
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
runReload();
|
|
676
|
-
return;
|
|
677
|
-
};
|
|
678
|
-
var getUrlOrigin = () => {
|
|
679
|
-
if (serverAsyncLocalStorage) {
|
|
680
|
-
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
681
|
-
} else if (typeof window !== "undefined") {
|
|
682
|
-
return window.location.origin;
|
|
683
|
-
}
|
|
684
|
-
return "http://fallback.com";
|
|
685
|
-
};
|
|
686
|
-
function toLocale(value) {
|
|
687
|
-
if (typeof value !== "string") {
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
const lowerValue = value.toLowerCase();
|
|
691
|
-
for (const locale of locales) {
|
|
692
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
693
|
-
return locale;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
function assertIsLocale(input) {
|
|
699
|
-
const locale = toLocale(input);
|
|
700
|
-
if (locale)
|
|
701
|
-
return locale;
|
|
702
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
703
|
-
}
|
|
704
|
-
function extractLocaleFromCookie() {
|
|
705
|
-
if (typeof document === "undefined" || !document.cookie) {
|
|
706
|
-
return;
|
|
707
|
-
}
|
|
708
|
-
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
709
|
-
const locale = match?.[2];
|
|
710
|
-
return toLocale(locale);
|
|
711
|
-
}
|
|
712
|
-
function extractLocaleFromNavigator() {
|
|
713
|
-
if (!navigator?.languages?.length) {
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
const languages = navigator.languages.map((lang) => ({
|
|
717
|
-
fullTag: lang,
|
|
718
|
-
baseTag: lang.split("-")[0]
|
|
719
|
-
}));
|
|
720
|
-
for (const lang of languages) {
|
|
721
|
-
const fullLocale = toLocale(lang.fullTag);
|
|
722
|
-
if (fullLocale) {
|
|
723
|
-
return fullLocale;
|
|
724
|
-
}
|
|
725
|
-
const baseLocale2 = toLocale(lang.baseTag);
|
|
726
|
-
if (baseLocale2) {
|
|
727
|
-
return baseLocale2;
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
var cachedUrl;
|
|
733
|
-
var cachedLocale;
|
|
734
|
-
function extractLocaleFromUrl(url) {
|
|
735
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
736
|
-
if (cachedUrl === urlString) {
|
|
737
|
-
return cachedLocale;
|
|
738
|
-
}
|
|
739
|
-
let result;
|
|
740
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
741
|
-
result = defaultUrlPatternExtractLocale(url);
|
|
742
|
-
} else {
|
|
743
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
744
|
-
for (const element of urlPatterns) {
|
|
745
|
-
for (const [locale, localizedPattern] of element.localized) {
|
|
746
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
747
|
-
if (match) {
|
|
748
|
-
result = locale;
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
if (result)
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
cachedUrl = urlString;
|
|
757
|
-
cachedLocale = result;
|
|
758
|
-
return result;
|
|
759
|
-
}
|
|
760
|
-
function defaultUrlPatternExtractLocale(url) {
|
|
761
|
-
const urlObj = new URL(url, "http://dummy.com");
|
|
762
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
763
|
-
return toLocale(pathSegments[0]) || baseLocale;
|
|
764
|
-
}
|
|
765
|
-
function localizeUrl(url, options) {
|
|
766
|
-
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
767
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
768
|
-
return localizeUrlDefaultPattern(url, targetLocale);
|
|
769
|
-
}
|
|
770
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
771
|
-
for (const element of urlPatterns) {
|
|
772
|
-
for (const [, localizedPattern] of element.localized) {
|
|
773
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
774
|
-
if (!match) {
|
|
775
|
-
continue;
|
|
776
|
-
}
|
|
777
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
778
|
-
if (!targetPattern) {
|
|
779
|
-
continue;
|
|
780
|
-
}
|
|
781
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
782
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
783
|
-
}
|
|
784
|
-
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
785
|
-
if (unlocalizedMatch) {
|
|
786
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
787
|
-
if (targetPattern) {
|
|
788
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
789
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return urlObj;
|
|
794
|
-
}
|
|
795
|
-
function localizeUrlDefaultPattern(url, locale) {
|
|
796
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
797
|
-
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
798
|
-
if (currentLocale === locale) {
|
|
799
|
-
return urlObj;
|
|
800
|
-
}
|
|
801
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
802
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
803
|
-
pathSegments.shift();
|
|
804
|
-
}
|
|
805
|
-
if (locale === baseLocale) {
|
|
806
|
-
urlObj.pathname = "/" + pathSegments.join("/");
|
|
807
|
-
} else {
|
|
808
|
-
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
809
|
-
}
|
|
810
|
-
return urlObj;
|
|
811
|
-
}
|
|
812
|
-
function fillMissingUrlParts(url, match) {
|
|
813
|
-
if (match.protocol.groups["0"]) {
|
|
814
|
-
url.protocol = match.protocol.groups["0"] ?? "";
|
|
815
|
-
}
|
|
816
|
-
if (match.hostname.groups["0"]) {
|
|
817
|
-
url.hostname = match.hostname.groups["0"] ?? "";
|
|
818
|
-
}
|
|
819
|
-
if (match.username.groups["0"]) {
|
|
820
|
-
url.username = match.username.groups["0"] ?? "";
|
|
821
|
-
}
|
|
822
|
-
if (match.password.groups["0"]) {
|
|
823
|
-
url.password = match.password.groups["0"] ?? "";
|
|
824
|
-
}
|
|
825
|
-
if (match.port.groups["0"]) {
|
|
826
|
-
url.port = match.port.groups["0"] ?? "";
|
|
827
|
-
}
|
|
828
|
-
if (match.pathname.groups["0"]) {
|
|
829
|
-
url.pathname = match.pathname.groups["0"] ?? "";
|
|
830
|
-
}
|
|
831
|
-
if (match.search.groups["0"]) {
|
|
832
|
-
url.search = match.search.groups["0"] ?? "";
|
|
833
|
-
}
|
|
834
|
-
if (match.hash.groups["0"]) {
|
|
835
|
-
url.hash = match.hash.groups["0"] ?? "";
|
|
836
|
-
}
|
|
837
|
-
return url;
|
|
838
|
-
}
|
|
839
|
-
function fillPattern(pattern, values, origin) {
|
|
840
|
-
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
841
|
-
return `${protocol}#PORT-${port}#${slash}`;
|
|
842
|
-
});
|
|
843
|
-
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
844
|
-
if (modifier === "?") {
|
|
845
|
-
return content;
|
|
846
|
-
}
|
|
847
|
-
return content;
|
|
848
|
-
});
|
|
849
|
-
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
850
|
-
const value = values[name];
|
|
851
|
-
if (value === null) {
|
|
852
|
-
return "";
|
|
853
|
-
}
|
|
854
|
-
if (modifier === "?") {
|
|
855
|
-
return value !== undefined ? `${slash}${value}` : "";
|
|
856
|
-
}
|
|
857
|
-
if (modifier === "+" || modifier === "*") {
|
|
858
|
-
if (value === undefined && modifier === "+") {
|
|
859
|
-
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
860
|
-
}
|
|
861
|
-
return value ? `${slash}${value}` : "";
|
|
862
|
-
}
|
|
863
|
-
if (value === undefined) {
|
|
864
|
-
throw new Error(`Missing value for "${name}"`);
|
|
865
|
-
}
|
|
866
|
-
return `${slash}${value}`;
|
|
867
|
-
});
|
|
868
|
-
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
869
|
-
return new URL(filled, origin);
|
|
870
|
-
}
|
|
871
|
-
function aggregateGroups(match) {
|
|
872
|
-
return {
|
|
873
|
-
...match.hash.groups,
|
|
874
|
-
...match.hostname.groups,
|
|
875
|
-
...match.password.groups,
|
|
876
|
-
...match.pathname.groups,
|
|
877
|
-
...match.port.groups,
|
|
878
|
-
...match.protocol.groups,
|
|
879
|
-
...match.search.groups,
|
|
880
|
-
...match.username.groups
|
|
881
|
-
};
|
|
882
|
-
}
|
|
883
|
-
var customServerStrategies = new Map;
|
|
884
|
-
var customClientStrategies = new Map;
|
|
885
|
-
function isCustomStrategy(strategy2) {
|
|
886
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
887
|
-
}
|
|
888
|
-
|
|
889
453
|
// ../../src/components/ui/file-picker.tsx
|
|
890
454
|
import { jsx as jsx7, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
|
|
891
455
|
"use client";
|
|
@@ -909,22 +473,30 @@ var messages = {
|
|
|
909
473
|
replaceFile: "Remplacer le fichier"
|
|
910
474
|
}
|
|
911
475
|
};
|
|
912
|
-
var filePickerMessages = (
|
|
913
|
-
...
|
|
914
|
-
...
|
|
476
|
+
var filePickerMessages = (locale, translations) => ({
|
|
477
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
478
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
479
|
+
...translations?.[locale]
|
|
915
480
|
});
|
|
916
|
-
var formatBytes = (bytes) => {
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
481
|
+
var formatBytes = (bytes, locale) => {
|
|
482
|
+
const units = [
|
|
483
|
+
"byte",
|
|
484
|
+
"kilobyte",
|
|
485
|
+
"megabyte",
|
|
486
|
+
"gigabyte",
|
|
487
|
+
"terabyte"
|
|
488
|
+
];
|
|
489
|
+
const index = Math.min(bytes === 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
|
|
490
|
+
const value = index === 0 ? bytes : Number((bytes / 1024 ** index).toFixed(1));
|
|
491
|
+
return new Intl.NumberFormat(locale, {
|
|
492
|
+
style: "unit",
|
|
493
|
+
unit: units[index],
|
|
494
|
+
unitDisplay: "short"
|
|
495
|
+
}).format(value);
|
|
924
496
|
};
|
|
925
|
-
var fileDescription = (file) => [
|
|
497
|
+
var fileDescription = (file, locale) => [
|
|
926
498
|
file.type || file.name.split(".").pop()?.toUpperCase(),
|
|
927
|
-
formatBytes(file.size)
|
|
499
|
+
formatBytes(file.size, locale)
|
|
928
500
|
].filter(Boolean).join(" · ");
|
|
929
501
|
var FilePicker = ({
|
|
930
502
|
accept = "",
|
|
@@ -934,6 +506,7 @@ var FilePicker = ({
|
|
|
934
506
|
id,
|
|
935
507
|
image,
|
|
936
508
|
invalid = false,
|
|
509
|
+
locale = "en",
|
|
937
510
|
messages: messages2,
|
|
938
511
|
multiple = false,
|
|
939
512
|
name,
|
|
@@ -944,7 +517,7 @@ var FilePicker = ({
|
|
|
944
517
|
required,
|
|
945
518
|
title
|
|
946
519
|
}) => {
|
|
947
|
-
const labels = filePickerMessages(messages2);
|
|
520
|
+
const labels = filePickerMessages(locale, messages2);
|
|
948
521
|
const inputRef = useRef(null);
|
|
949
522
|
const dragDepthRef = useRef(0);
|
|
950
523
|
const [dragging, setDragging] = useState(false);
|
|
@@ -1064,7 +637,7 @@ var FilePicker = ({
|
|
|
1064
637
|
children: selectedFile.name
|
|
1065
638
|
}),
|
|
1066
639
|
/* @__PURE__ */ jsx7(AttachmentDescription, {
|
|
1067
|
-
children: fileDescription(selectedFile)
|
|
640
|
+
children: fileDescription(selectedFile, locale)
|
|
1068
641
|
})
|
|
1069
642
|
]
|
|
1070
643
|
}),
|
|
@@ -1158,7 +731,7 @@ var FilePicker = ({
|
|
|
1158
731
|
children: title
|
|
1159
732
|
}),
|
|
1160
733
|
file ? /* @__PURE__ */ jsx7(AttachmentDescription, {
|
|
1161
|
-
children: fileDescription(file)
|
|
734
|
+
children: fileDescription(file, locale)
|
|
1162
735
|
}) : null
|
|
1163
736
|
]
|
|
1164
737
|
}),
|
|
@@ -1394,22 +967,24 @@ var messages2 = {
|
|
|
1394
967
|
selectMore: "Sélectionner davantage"
|
|
1395
968
|
}
|
|
1396
969
|
};
|
|
1397
|
-
var virtualizedComboboxMessages = (
|
|
1398
|
-
...
|
|
1399
|
-
...
|
|
970
|
+
var virtualizedComboboxMessages = (locale, translations) => ({
|
|
971
|
+
...locale.startsWith("fr") ? messages2.fr : messages2.en,
|
|
972
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
973
|
+
...translations?.[locale]
|
|
1400
974
|
});
|
|
1401
975
|
var optionEquals = (item, selected) => item.value === selected.value;
|
|
1402
976
|
var VirtualizedComboboxList = ({
|
|
1403
977
|
emptyLabel,
|
|
1404
978
|
groupSelections,
|
|
1405
979
|
itemIndexRef,
|
|
980
|
+
locale = "en",
|
|
1406
981
|
messages: messageOverrides,
|
|
1407
982
|
renderItem,
|
|
1408
983
|
selectedValues,
|
|
1409
984
|
virtualizerRef
|
|
1410
985
|
}) => {
|
|
1411
986
|
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
1412
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
987
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
1413
988
|
const itemEntries = filteredItems.map((item, index) => ({
|
|
1414
989
|
kind: "item",
|
|
1415
990
|
item,
|
|
@@ -1519,12 +1094,13 @@ var VirtualizedComboboxContent = ({
|
|
|
1519
1094
|
emptyLabel,
|
|
1520
1095
|
groupSelections,
|
|
1521
1096
|
itemIndexRef,
|
|
1097
|
+
locale = "en",
|
|
1522
1098
|
messages: messageOverrides,
|
|
1523
1099
|
renderItem,
|
|
1524
1100
|
selectedValues,
|
|
1525
1101
|
virtualizerRef
|
|
1526
1102
|
}) => {
|
|
1527
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
1103
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
1528
1104
|
return /* @__PURE__ */ jsx12(ComboboxPrimitive.Portal, {
|
|
1529
1105
|
children: /* @__PURE__ */ jsx12(ComboboxPrimitive.Positioner, {
|
|
1530
1106
|
align: "start",
|
|
@@ -1548,6 +1124,7 @@ var VirtualizedComboboxContent = ({
|
|
|
1548
1124
|
emptyLabel,
|
|
1549
1125
|
groupSelections,
|
|
1550
1126
|
itemIndexRef,
|
|
1127
|
+
locale,
|
|
1551
1128
|
messages: messageOverrides,
|
|
1552
1129
|
renderItem,
|
|
1553
1130
|
selectedValues,
|
|
@@ -1597,7 +1174,7 @@ var useComboboxVirtualizerRef = (providedRef) => {
|
|
|
1597
1174
|
var VirtualizedComboboxSingle = (props) => {
|
|
1598
1175
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1599
1176
|
const itemIndexRef = useRef2(new Map);
|
|
1600
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1177
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
1601
1178
|
return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
|
|
1602
1179
|
disabled: props.disabled,
|
|
1603
1180
|
inputValue: props.searchValue,
|
|
@@ -1638,7 +1215,7 @@ var VirtualizedComboboxSingle = (props) => {
|
|
|
1638
1215
|
var VirtualizedComboboxMultiple = (props) => {
|
|
1639
1216
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
1640
1217
|
const itemIndexRef = useRef2(new Map);
|
|
1641
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1218
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
1642
1219
|
return /* @__PURE__ */ jsxs5(ComboboxPrimitive.Root, {
|
|
1643
1220
|
disabled: props.disabled,
|
|
1644
1221
|
inputValue: props.searchValue,
|
|
@@ -1719,9 +1296,10 @@ var messages3 = {
|
|
|
1719
1296
|
revert: "Revenir aux paramètres par défaut"
|
|
1720
1297
|
}
|
|
1721
1298
|
};
|
|
1722
|
-
var formMessages = (
|
|
1723
|
-
...
|
|
1724
|
-
...
|
|
1299
|
+
var formMessages = (locale = "en", translations) => ({
|
|
1300
|
+
...locale.startsWith("fr") ? messages3.fr : messages3.en,
|
|
1301
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
1302
|
+
...translations?.[locale]
|
|
1725
1303
|
});
|
|
1726
1304
|
var ErrorMessage = ({ text }) => {
|
|
1727
1305
|
return /* @__PURE__ */ jsx13("em", {
|
|
@@ -1943,7 +1521,7 @@ var SelectField = ({
|
|
|
1943
1521
|
});
|
|
1944
1522
|
};
|
|
1945
1523
|
var KeyValueField = (props) => {
|
|
1946
|
-
const labels = formMessages(props.messages);
|
|
1524
|
+
const labels = formMessages(props.locale, props.messages);
|
|
1947
1525
|
const field = useFieldContext();
|
|
1948
1526
|
const invalid = !field.state.meta.isValid;
|
|
1949
1527
|
const keyValues = Object.entries(field.state.value ?? {});
|
|
@@ -2058,6 +1636,7 @@ var SingleSearchableSelectControl = ({
|
|
|
2058
1636
|
initialItems = [],
|
|
2059
1637
|
invalid,
|
|
2060
1638
|
items,
|
|
1639
|
+
locale,
|
|
2061
1640
|
messages: messages4,
|
|
2062
1641
|
name,
|
|
2063
1642
|
onSearchValueChange,
|
|
@@ -2072,6 +1651,7 @@ var SingleSearchableSelectControl = ({
|
|
|
2072
1651
|
ariaLabel,
|
|
2073
1652
|
emptyLabel,
|
|
2074
1653
|
items: mergedItems,
|
|
1654
|
+
locale,
|
|
2075
1655
|
...messages4 ? { messages: messages4 } : {},
|
|
2076
1656
|
onValueChange: (option) => field.handleChange(option?.value ?? ""),
|
|
2077
1657
|
placeholder,
|
|
@@ -2088,6 +1668,7 @@ var MultipleSearchableSelectControl = ({
|
|
|
2088
1668
|
initialItems = [],
|
|
2089
1669
|
invalid,
|
|
2090
1670
|
items,
|
|
1671
|
+
locale,
|
|
2091
1672
|
messages: messages4,
|
|
2092
1673
|
name,
|
|
2093
1674
|
onSearchValueChange,
|
|
@@ -2102,6 +1683,7 @@ var MultipleSearchableSelectControl = ({
|
|
|
2102
1683
|
ariaLabel,
|
|
2103
1684
|
emptyLabel,
|
|
2104
1685
|
items: mergedItems,
|
|
1686
|
+
locale,
|
|
2105
1687
|
...messages4 ? { messages: messages4 } : {},
|
|
2106
1688
|
multiple: true,
|
|
2107
1689
|
onValueChange: (options) => field.handleChange(options.map(({ value }) => value)),
|
|
@@ -2120,7 +1702,7 @@ var SearchableSelectField = ({
|
|
|
2120
1702
|
...props
|
|
2121
1703
|
}) => {
|
|
2122
1704
|
const field = useFieldContext();
|
|
2123
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
1705
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
2124
1706
|
const invalid = !field.state.meta.isValid;
|
|
2125
1707
|
const ariaLabel = Schema2.is(Schema2.String)(label) ? label : labels.search;
|
|
2126
1708
|
const controlProps = {
|
|
@@ -2154,11 +1736,13 @@ var SearchableSelectField = ({
|
|
|
2154
1736
|
var FileField = ({
|
|
2155
1737
|
label,
|
|
2156
1738
|
accept,
|
|
1739
|
+
filePickerMessages: filePickerMessages2,
|
|
1740
|
+
locale = "en",
|
|
2157
1741
|
messages: messages4,
|
|
2158
1742
|
onFileChange,
|
|
2159
1743
|
required = false
|
|
2160
1744
|
}) => {
|
|
2161
|
-
const labels = formMessages(messages4);
|
|
1745
|
+
const labels = formMessages(locale, messages4);
|
|
2162
1746
|
const field = useFieldContext();
|
|
2163
1747
|
const invalid = !field.state.meta.isValid;
|
|
2164
1748
|
return /* @__PURE__ */ jsxs6(Field, {
|
|
@@ -2174,7 +1758,16 @@ var FileField = ({
|
|
|
2174
1758
|
...field.state.value instanceof File ? { file: field.state.value } : {},
|
|
2175
1759
|
id: field.name,
|
|
2176
1760
|
invalid,
|
|
2177
|
-
|
|
1761
|
+
locale,
|
|
1762
|
+
messages: {
|
|
1763
|
+
...filePickerMessages2,
|
|
1764
|
+
[locale]: {
|
|
1765
|
+
...filePickerMessages2?.[locale.split("-")[0] ?? locale],
|
|
1766
|
+
...filePickerMessages2?.[locale],
|
|
1767
|
+
accepts: labels.accepts,
|
|
1768
|
+
deleteFile: labels.delete
|
|
1769
|
+
}
|
|
1770
|
+
},
|
|
2178
1771
|
name: field.name,
|
|
2179
1772
|
onBlur: field.handleBlur,
|
|
2180
1773
|
onChange: (file) => {
|
|
@@ -2195,11 +1788,13 @@ var FileField = ({
|
|
|
2195
1788
|
});
|
|
2196
1789
|
};
|
|
2197
1790
|
var ImageField = ({
|
|
1791
|
+
filePickerMessages: filePickerMessages2,
|
|
2198
1792
|
label,
|
|
1793
|
+
locale = "en",
|
|
2199
1794
|
messages: messages4,
|
|
2200
1795
|
size
|
|
2201
1796
|
}) => {
|
|
2202
|
-
const labels = formMessages(messages4);
|
|
1797
|
+
const labels = formMessages(locale, messages4);
|
|
2203
1798
|
const field = useFieldContext();
|
|
2204
1799
|
const invalid = !field.state.meta.isValid;
|
|
2205
1800
|
const imageUrl = Schema2.is(Schema2.String)(field.state.value) ? field.state.value : undefined;
|
|
@@ -2223,7 +1818,16 @@ var ImageField = ({
|
|
|
2223
1818
|
id: field.name,
|
|
2224
1819
|
image,
|
|
2225
1820
|
invalid,
|
|
2226
|
-
|
|
1821
|
+
locale,
|
|
1822
|
+
messages: {
|
|
1823
|
+
...filePickerMessages2,
|
|
1824
|
+
[locale]: {
|
|
1825
|
+
...filePickerMessages2?.[locale.split("-")[0] ?? locale],
|
|
1826
|
+
...filePickerMessages2?.[locale],
|
|
1827
|
+
accepts: labels.accepts,
|
|
1828
|
+
deleteFile: labels.delete
|
|
1829
|
+
}
|
|
1830
|
+
},
|
|
2227
1831
|
name: field.name,
|
|
2228
1832
|
onBlur: field.handleBlur,
|
|
2229
1833
|
onChange: field.handleChange,
|
|
@@ -2240,9 +1844,10 @@ var ImageField = ({
|
|
|
2240
1844
|
});
|
|
2241
1845
|
};
|
|
2242
1846
|
var BlockNavigation = ({
|
|
1847
|
+
locale = "en",
|
|
2243
1848
|
messages: messages4
|
|
2244
1849
|
}) => {
|
|
2245
|
-
const labels = formMessages(messages4);
|
|
1850
|
+
const labels = formMessages(locale, messages4);
|
|
2246
1851
|
const form = useFormContext();
|
|
2247
1852
|
const shouldBlock = useStore(form.store, (formState) => formState.isDirty && !(formState.isSubmitting || formState.isSubmitted));
|
|
2248
1853
|
return /* @__PURE__ */ jsx13(Block, {
|
|
@@ -2282,9 +1887,10 @@ var BlockNavigation = ({
|
|
|
2282
1887
|
};
|
|
2283
1888
|
var SubmitButton = ({
|
|
2284
1889
|
children,
|
|
1890
|
+
locale = "en",
|
|
2285
1891
|
messages: messages4
|
|
2286
1892
|
}) => {
|
|
2287
|
-
const labels = formMessages(messages4);
|
|
1893
|
+
const labels = formMessages(locale, messages4);
|
|
2288
1894
|
const form = useFormContext();
|
|
2289
1895
|
return /* @__PURE__ */ jsx13(form.Subscribe, {
|
|
2290
1896
|
selector: (formState) => [formState.isSubmitting],
|
|
@@ -2323,7 +1929,7 @@ var FieldWrapper = ({
|
|
|
2323
1929
|
legend,
|
|
2324
1930
|
localized = true,
|
|
2325
1931
|
description,
|
|
2326
|
-
locales
|
|
1932
|
+
locales,
|
|
2327
1933
|
editingLocale
|
|
2328
1934
|
}) => {
|
|
2329
1935
|
return /* @__PURE__ */ jsxs6(FieldSet, {
|
|
@@ -2332,11 +1938,11 @@ var FieldWrapper = ({
|
|
|
2332
1938
|
className: "flex items-center gap-2",
|
|
2333
1939
|
children: [
|
|
2334
1940
|
legend,
|
|
2335
|
-
localized && editingLocale &&
|
|
1941
|
+
localized && editingLocale && locales && /* @__PURE__ */ jsxs6(Badge, {
|
|
2336
1942
|
variant: "outline",
|
|
2337
1943
|
children: [
|
|
2338
1944
|
/* @__PURE__ */ jsx13(Languages, {}),
|
|
2339
|
-
|
|
1945
|
+
locales.find((l) => l.value === editingLocale).label
|
|
2340
1946
|
]
|
|
2341
1947
|
})
|
|
2342
1948
|
]
|
|
@@ -2351,10 +1957,11 @@ var FieldWrapper = ({
|
|
|
2351
1957
|
});
|
|
2352
1958
|
};
|
|
2353
1959
|
var RevertButton = ({
|
|
1960
|
+
locale = "en",
|
|
2354
1961
|
messages: messages4,
|
|
2355
1962
|
original
|
|
2356
1963
|
}) => {
|
|
2357
|
-
const labels = formMessages(messages4);
|
|
1964
|
+
const labels = formMessages(locale, messages4);
|
|
2358
1965
|
const field = useFieldContext();
|
|
2359
1966
|
if (field.state.value !== original) {
|
|
2360
1967
|
return /* @__PURE__ */ jsx13("div", {
|