@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
package/dist/lib/docs.js
CHANGED
|
@@ -209,11 +209,21 @@ function Button({
|
|
|
209
209
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
210
210
|
import { useEffect, useRef, useState } from "react";
|
|
211
211
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
212
|
+
var messages = {
|
|
213
|
+
en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
|
|
214
|
+
fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
|
|
215
|
+
};
|
|
216
|
+
var copyButtonMessages = (locale = "en", translations) => ({
|
|
217
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
218
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
219
|
+
...translations?.[locale]
|
|
220
|
+
});
|
|
212
221
|
function CopyButton({
|
|
213
222
|
value,
|
|
214
223
|
valueDescription,
|
|
215
224
|
copyVariant = "default",
|
|
216
|
-
|
|
225
|
+
locale = "en",
|
|
226
|
+
messages: messages2,
|
|
217
227
|
onCopied,
|
|
218
228
|
onCopyError,
|
|
219
229
|
resetDelay = 1500,
|
|
@@ -224,11 +234,7 @@ function CopyButton({
|
|
|
224
234
|
}) {
|
|
225
235
|
const [copyState, setCopyState] = useState("idle");
|
|
226
236
|
const copyTimeout = useRef(undefined);
|
|
227
|
-
const labels =
|
|
228
|
-
copy: messages?.copy ?? "Copy",
|
|
229
|
-
copied: messages?.copied ?? "Copied",
|
|
230
|
-
copyFailed: messages?.copyFailed ?? "Copy failed"
|
|
231
|
-
};
|
|
237
|
+
const labels = copyButtonMessages(locale, messages2);
|
|
232
238
|
const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
|
|
233
239
|
const isLarge = copyVariant === "large";
|
|
234
240
|
const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
|
|
@@ -250,7 +256,7 @@ function CopyButton({
|
|
|
250
256
|
onCopied?.();
|
|
251
257
|
} catch (error) {
|
|
252
258
|
setCopyState("failed");
|
|
253
|
-
onCopyError?.(error instanceof Error ? error : new Error(
|
|
259
|
+
onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
|
|
254
260
|
}
|
|
255
261
|
resetCopyState();
|
|
256
262
|
};
|
|
@@ -306,21 +312,34 @@ var themeCss = `${createThemeCss({
|
|
|
306
312
|
color: inherit;
|
|
307
313
|
}
|
|
308
314
|
[data-code-theme] pre.th-code code { font: inherit; }`;
|
|
315
|
+
var messages2 = {
|
|
316
|
+
en: {
|
|
317
|
+
codeDescription: (language) => `${language} code`,
|
|
318
|
+
copy: "Copy",
|
|
319
|
+
copied: "Copied",
|
|
320
|
+
copyFailed: "Copy failed"
|
|
321
|
+
},
|
|
322
|
+
fr: {
|
|
323
|
+
codeDescription: (language) => `code ${language}`,
|
|
324
|
+
copy: "Copier",
|
|
325
|
+
copied: "Copié",
|
|
326
|
+
copyFailed: "Échec de la copie"
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var codeBlockMessages = (locale = "en", translations) => ({
|
|
330
|
+
...locale.startsWith("fr") ? messages2.fr : messages2.en,
|
|
331
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
332
|
+
...translations?.[locale]
|
|
333
|
+
});
|
|
309
334
|
function CodeBlock({
|
|
310
335
|
code,
|
|
311
336
|
language = "text",
|
|
312
|
-
|
|
337
|
+
locale = "en",
|
|
338
|
+
messages: messages3
|
|
313
339
|
}) {
|
|
314
340
|
const normalizedLanguage = language.toLowerCase() || "text";
|
|
315
341
|
const highlighted = highlight(code, { lang: normalizedLanguage });
|
|
316
|
-
const
|
|
317
|
-
if (messages?.copy !== undefined)
|
|
318
|
-
copyMessages.copy = messages.copy;
|
|
319
|
-
if (messages?.copied !== undefined)
|
|
320
|
-
copyMessages.copied = messages.copied;
|
|
321
|
-
if (messages?.copyFailed !== undefined) {
|
|
322
|
-
copyMessages.copyFailed = messages.copyFailed;
|
|
323
|
-
}
|
|
342
|
+
const labels = codeBlockMessages(locale, messages3);
|
|
324
343
|
return /* @__PURE__ */ jsxs3("div", {
|
|
325
344
|
className: "not-prose bg-muted overflow-hidden rounded-md border text-[var(--th-token)]",
|
|
326
345
|
"data-code-theme": true,
|
|
@@ -337,9 +356,10 @@ function CodeBlock({
|
|
|
337
356
|
}),
|
|
338
357
|
/* @__PURE__ */ jsx4(CopyButton, {
|
|
339
358
|
value: code,
|
|
340
|
-
valueDescription:
|
|
359
|
+
valueDescription: labels.codeDescription(highlighted.lang),
|
|
341
360
|
variant: "secondary",
|
|
342
|
-
|
|
361
|
+
locale,
|
|
362
|
+
messages: { [locale]: labels }
|
|
343
363
|
})
|
|
344
364
|
]
|
|
345
365
|
}),
|
|
@@ -357,7 +377,8 @@ var MarkdownContent = ({
|
|
|
357
377
|
className,
|
|
358
378
|
codeBlocks,
|
|
359
379
|
html,
|
|
360
|
-
|
|
380
|
+
locale = "en",
|
|
381
|
+
messages: messages3
|
|
361
382
|
}) => {
|
|
362
383
|
const content = [];
|
|
363
384
|
let remainingHtml = html;
|
|
@@ -375,7 +396,8 @@ var MarkdownContent = ({
|
|
|
375
396
|
children: /* @__PURE__ */ jsx5(CodeBlock, {
|
|
376
397
|
code: block.code,
|
|
377
398
|
language: block.language,
|
|
378
|
-
|
|
399
|
+
locale,
|
|
400
|
+
messages: messages3
|
|
379
401
|
})
|
|
380
402
|
}, `code-${index}`));
|
|
381
403
|
remainingHtml = remainingHtml.slice(markerIndex + marker.length);
|
|
@@ -617,445 +639,9 @@ function CommandShortcut({
|
|
|
617
639
|
});
|
|
618
640
|
}
|
|
619
641
|
|
|
620
|
-
// ../../src/paraglide/runtime.js
|
|
621
|
-
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
622
|
-
var baseLocale = "en";
|
|
623
|
-
var locales = ["en", "fr"];
|
|
624
|
-
var cookieName = "locale";
|
|
625
|
-
var cookieMaxAge = 34560000;
|
|
626
|
-
var cookieDomain = "";
|
|
627
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
628
|
-
var strategy = [
|
|
629
|
-
"url",
|
|
630
|
-
"cookie",
|
|
631
|
-
"preferredLanguage",
|
|
632
|
-
"baseLocale"
|
|
633
|
-
];
|
|
634
|
-
var routeStrategies = [
|
|
635
|
-
{
|
|
636
|
-
match: "/api/:path(.*)?",
|
|
637
|
-
exclude: true
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
match: "/sitemap.xml",
|
|
641
|
-
exclude: true
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
match: "/llms.txt",
|
|
645
|
-
exclude: true
|
|
646
|
-
}
|
|
647
|
-
];
|
|
648
|
-
var urlPatterns = [
|
|
649
|
-
{
|
|
650
|
-
pattern: "/:path(.*)?",
|
|
651
|
-
localized: [
|
|
652
|
-
[
|
|
653
|
-
"en",
|
|
654
|
-
"/en/:path(.*)?"
|
|
655
|
-
],
|
|
656
|
-
[
|
|
657
|
-
"fr",
|
|
658
|
-
"/fr/:path(.*)?"
|
|
659
|
-
]
|
|
660
|
-
]
|
|
661
|
-
}
|
|
662
|
-
];
|
|
663
|
-
var cachedRouteStrategyUrl;
|
|
664
|
-
var cachedRouteStrategy;
|
|
665
|
-
function findMatchingRouteStrategy(url) {
|
|
666
|
-
if (routeStrategies.length === 0) {
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
670
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
671
|
-
return cachedRouteStrategy;
|
|
672
|
-
}
|
|
673
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
674
|
-
let match;
|
|
675
|
-
for (const routeStrategy of routeStrategies) {
|
|
676
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
677
|
-
if (pattern.exec(urlObject.href)) {
|
|
678
|
-
match = routeStrategy;
|
|
679
|
-
break;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
cachedRouteStrategyUrl = urlString;
|
|
683
|
-
cachedRouteStrategy = match;
|
|
684
|
-
return match;
|
|
685
|
-
}
|
|
686
|
-
function getStrategyForUrl(url) {
|
|
687
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
688
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
689
|
-
return routeStrategy.strategy;
|
|
690
|
-
}
|
|
691
|
-
return strategy;
|
|
692
|
-
}
|
|
693
|
-
var serverAsyncLocalStorage = undefined;
|
|
694
|
-
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
695
|
-
var experimentalStaticLocale = undefined;
|
|
696
|
-
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
697
|
-
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
698
|
-
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
699
|
-
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
700
|
-
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
701
|
-
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
702
|
-
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
703
|
-
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
704
|
-
var _locale;
|
|
705
|
-
var localeInitiallySet = false;
|
|
706
|
-
var getLocale = () => {
|
|
707
|
-
if (experimentalStaticLocale !== undefined) {
|
|
708
|
-
return experimentalStaticLocale;
|
|
709
|
-
}
|
|
710
|
-
if (serverAsyncLocalStorage) {
|
|
711
|
-
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
712
|
-
if (locale) {
|
|
713
|
-
return locale;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
let strategyToUse = strategy;
|
|
717
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
718
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
719
|
-
}
|
|
720
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
721
|
-
if (resolved) {
|
|
722
|
-
if (!localeInitiallySet) {
|
|
723
|
-
_locale = resolved;
|
|
724
|
-
localeInitiallySet = true;
|
|
725
|
-
setLocale(resolved, { reload: false });
|
|
726
|
-
}
|
|
727
|
-
return resolved;
|
|
728
|
-
}
|
|
729
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
730
|
-
};
|
|
731
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
732
|
-
let locale;
|
|
733
|
-
for (const strat of strategyToUse) {
|
|
734
|
-
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
735
|
-
locale = extractLocaleFromCookie();
|
|
736
|
-
} else if (strat === "baseLocale") {
|
|
737
|
-
locale = baseLocale;
|
|
738
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
739
|
-
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
740
|
-
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
741
|
-
locale = _locale;
|
|
742
|
-
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
743
|
-
locale = extractLocaleFromNavigator();
|
|
744
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
745
|
-
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
746
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
747
|
-
const handler = customClientStrategies.get(strat);
|
|
748
|
-
if (handler) {
|
|
749
|
-
const result = handler.getLocale();
|
|
750
|
-
if (result instanceof Promise) {
|
|
751
|
-
continue;
|
|
752
|
-
}
|
|
753
|
-
if (result !== undefined) {
|
|
754
|
-
return assertIsLocale(result);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
const matchedLocale = toLocale(locale);
|
|
759
|
-
if (matchedLocale) {
|
|
760
|
-
return matchedLocale;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
return;
|
|
764
|
-
}
|
|
765
|
-
var rtlLanguages = new Set([
|
|
766
|
-
"ar",
|
|
767
|
-
"dv",
|
|
768
|
-
"fa",
|
|
769
|
-
"he",
|
|
770
|
-
"ks",
|
|
771
|
-
"ku",
|
|
772
|
-
"ps",
|
|
773
|
-
"sd",
|
|
774
|
-
"ug",
|
|
775
|
-
"ur",
|
|
776
|
-
"yi"
|
|
777
|
-
]);
|
|
778
|
-
var navigateOrReload = (newLocation) => {
|
|
779
|
-
if (newLocation) {
|
|
780
|
-
window.location.href = newLocation;
|
|
781
|
-
} else {
|
|
782
|
-
window.location.reload();
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
var setLocale = (newLocale, options) => {
|
|
786
|
-
const optionsWithDefaults = {
|
|
787
|
-
reload: true,
|
|
788
|
-
...options
|
|
789
|
-
};
|
|
790
|
-
let currentLocale;
|
|
791
|
-
try {
|
|
792
|
-
currentLocale = getLocale();
|
|
793
|
-
} catch {}
|
|
794
|
-
const customSetLocalePromises = [];
|
|
795
|
-
let newLocation = undefined;
|
|
796
|
-
let strategyToUse = strategy;
|
|
797
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
798
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
799
|
-
}
|
|
800
|
-
for (const strat of strategyToUse) {
|
|
801
|
-
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
802
|
-
_locale = newLocale;
|
|
803
|
-
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
804
|
-
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
805
|
-
continue;
|
|
806
|
-
}
|
|
807
|
-
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
808
|
-
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
809
|
-
} else if (strat === "baseLocale") {
|
|
810
|
-
continue;
|
|
811
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
812
|
-
newLocation = localizeUrl(window.location.href, {
|
|
813
|
-
locale: newLocale
|
|
814
|
-
}).href;
|
|
815
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
816
|
-
localStorage.setItem(localStorageKey, newLocale);
|
|
817
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
818
|
-
const handler = customClientStrategies.get(strat);
|
|
819
|
-
if (handler) {
|
|
820
|
-
let result = handler.setLocale(newLocale);
|
|
821
|
-
if (result instanceof Promise) {
|
|
822
|
-
result = result.catch((error) => {
|
|
823
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
824
|
-
cause: error
|
|
825
|
-
});
|
|
826
|
-
});
|
|
827
|
-
customSetLocalePromises.push(result);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
const runReload = () => {
|
|
833
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
834
|
-
navigateOrReload(newLocation);
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
if (customSetLocalePromises.length) {
|
|
838
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
839
|
-
runReload();
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
runReload();
|
|
843
|
-
return;
|
|
844
|
-
};
|
|
845
|
-
var getUrlOrigin = () => {
|
|
846
|
-
if (serverAsyncLocalStorage) {
|
|
847
|
-
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
848
|
-
} else if (typeof window !== "undefined") {
|
|
849
|
-
return window.location.origin;
|
|
850
|
-
}
|
|
851
|
-
return "http://fallback.com";
|
|
852
|
-
};
|
|
853
|
-
function toLocale(value) {
|
|
854
|
-
if (typeof value !== "string") {
|
|
855
|
-
return;
|
|
856
|
-
}
|
|
857
|
-
const lowerValue = value.toLowerCase();
|
|
858
|
-
for (const locale of locales) {
|
|
859
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
860
|
-
return locale;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
function assertIsLocale(input) {
|
|
866
|
-
const locale = toLocale(input);
|
|
867
|
-
if (locale)
|
|
868
|
-
return locale;
|
|
869
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
870
|
-
}
|
|
871
|
-
function extractLocaleFromCookie() {
|
|
872
|
-
if (typeof document === "undefined" || !document.cookie) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
876
|
-
const locale = match?.[2];
|
|
877
|
-
return toLocale(locale);
|
|
878
|
-
}
|
|
879
|
-
function extractLocaleFromNavigator() {
|
|
880
|
-
if (!navigator?.languages?.length) {
|
|
881
|
-
return;
|
|
882
|
-
}
|
|
883
|
-
const languages = navigator.languages.map((lang) => ({
|
|
884
|
-
fullTag: lang,
|
|
885
|
-
baseTag: lang.split("-")[0]
|
|
886
|
-
}));
|
|
887
|
-
for (const lang of languages) {
|
|
888
|
-
const fullLocale = toLocale(lang.fullTag);
|
|
889
|
-
if (fullLocale) {
|
|
890
|
-
return fullLocale;
|
|
891
|
-
}
|
|
892
|
-
const baseLocale2 = toLocale(lang.baseTag);
|
|
893
|
-
if (baseLocale2) {
|
|
894
|
-
return baseLocale2;
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
var cachedUrl;
|
|
900
|
-
var cachedLocale;
|
|
901
|
-
function extractLocaleFromUrl(url) {
|
|
902
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
903
|
-
if (cachedUrl === urlString) {
|
|
904
|
-
return cachedLocale;
|
|
905
|
-
}
|
|
906
|
-
let result;
|
|
907
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
908
|
-
result = defaultUrlPatternExtractLocale(url);
|
|
909
|
-
} else {
|
|
910
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
911
|
-
for (const element of urlPatterns) {
|
|
912
|
-
for (const [locale, localizedPattern] of element.localized) {
|
|
913
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
914
|
-
if (match) {
|
|
915
|
-
result = locale;
|
|
916
|
-
break;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
if (result)
|
|
920
|
-
break;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
cachedUrl = urlString;
|
|
924
|
-
cachedLocale = result;
|
|
925
|
-
return result;
|
|
926
|
-
}
|
|
927
|
-
function defaultUrlPatternExtractLocale(url) {
|
|
928
|
-
const urlObj = new URL(url, "http://dummy.com");
|
|
929
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
930
|
-
return toLocale(pathSegments[0]) || baseLocale;
|
|
931
|
-
}
|
|
932
|
-
function localizeUrl(url, options) {
|
|
933
|
-
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
934
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
935
|
-
return localizeUrlDefaultPattern(url, targetLocale);
|
|
936
|
-
}
|
|
937
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
938
|
-
for (const element of urlPatterns) {
|
|
939
|
-
for (const [, localizedPattern] of element.localized) {
|
|
940
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
941
|
-
if (!match) {
|
|
942
|
-
continue;
|
|
943
|
-
}
|
|
944
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
945
|
-
if (!targetPattern) {
|
|
946
|
-
continue;
|
|
947
|
-
}
|
|
948
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
949
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
950
|
-
}
|
|
951
|
-
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
952
|
-
if (unlocalizedMatch) {
|
|
953
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
954
|
-
if (targetPattern) {
|
|
955
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
956
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
return urlObj;
|
|
961
|
-
}
|
|
962
|
-
function localizeUrlDefaultPattern(url, locale) {
|
|
963
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
964
|
-
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
965
|
-
if (currentLocale === locale) {
|
|
966
|
-
return urlObj;
|
|
967
|
-
}
|
|
968
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
969
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
970
|
-
pathSegments.shift();
|
|
971
|
-
}
|
|
972
|
-
if (locale === baseLocale) {
|
|
973
|
-
urlObj.pathname = "/" + pathSegments.join("/");
|
|
974
|
-
} else {
|
|
975
|
-
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
976
|
-
}
|
|
977
|
-
return urlObj;
|
|
978
|
-
}
|
|
979
|
-
function fillMissingUrlParts(url, match) {
|
|
980
|
-
if (match.protocol.groups["0"]) {
|
|
981
|
-
url.protocol = match.protocol.groups["0"] ?? "";
|
|
982
|
-
}
|
|
983
|
-
if (match.hostname.groups["0"]) {
|
|
984
|
-
url.hostname = match.hostname.groups["0"] ?? "";
|
|
985
|
-
}
|
|
986
|
-
if (match.username.groups["0"]) {
|
|
987
|
-
url.username = match.username.groups["0"] ?? "";
|
|
988
|
-
}
|
|
989
|
-
if (match.password.groups["0"]) {
|
|
990
|
-
url.password = match.password.groups["0"] ?? "";
|
|
991
|
-
}
|
|
992
|
-
if (match.port.groups["0"]) {
|
|
993
|
-
url.port = match.port.groups["0"] ?? "";
|
|
994
|
-
}
|
|
995
|
-
if (match.pathname.groups["0"]) {
|
|
996
|
-
url.pathname = match.pathname.groups["0"] ?? "";
|
|
997
|
-
}
|
|
998
|
-
if (match.search.groups["0"]) {
|
|
999
|
-
url.search = match.search.groups["0"] ?? "";
|
|
1000
|
-
}
|
|
1001
|
-
if (match.hash.groups["0"]) {
|
|
1002
|
-
url.hash = match.hash.groups["0"] ?? "";
|
|
1003
|
-
}
|
|
1004
|
-
return url;
|
|
1005
|
-
}
|
|
1006
|
-
function fillPattern(pattern, values, origin) {
|
|
1007
|
-
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
1008
|
-
return `${protocol}#PORT-${port}#${slash}`;
|
|
1009
|
-
});
|
|
1010
|
-
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
1011
|
-
if (modifier === "?") {
|
|
1012
|
-
return content;
|
|
1013
|
-
}
|
|
1014
|
-
return content;
|
|
1015
|
-
});
|
|
1016
|
-
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
1017
|
-
const value = values[name];
|
|
1018
|
-
if (value === null) {
|
|
1019
|
-
return "";
|
|
1020
|
-
}
|
|
1021
|
-
if (modifier === "?") {
|
|
1022
|
-
return value !== undefined ? `${slash}${value}` : "";
|
|
1023
|
-
}
|
|
1024
|
-
if (modifier === "+" || modifier === "*") {
|
|
1025
|
-
if (value === undefined && modifier === "+") {
|
|
1026
|
-
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
1027
|
-
}
|
|
1028
|
-
return value ? `${slash}${value}` : "";
|
|
1029
|
-
}
|
|
1030
|
-
if (value === undefined) {
|
|
1031
|
-
throw new Error(`Missing value for "${name}"`);
|
|
1032
|
-
}
|
|
1033
|
-
return `${slash}${value}`;
|
|
1034
|
-
});
|
|
1035
|
-
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
1036
|
-
return new URL(filled, origin);
|
|
1037
|
-
}
|
|
1038
|
-
function aggregateGroups(match) {
|
|
1039
|
-
return {
|
|
1040
|
-
...match.hash.groups,
|
|
1041
|
-
...match.hostname.groups,
|
|
1042
|
-
...match.password.groups,
|
|
1043
|
-
...match.pathname.groups,
|
|
1044
|
-
...match.port.groups,
|
|
1045
|
-
...match.protocol.groups,
|
|
1046
|
-
...match.search.groups,
|
|
1047
|
-
...match.username.groups
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
var customServerStrategies = new Map;
|
|
1051
|
-
var customClientStrategies = new Map;
|
|
1052
|
-
function isCustomStrategy(strategy2) {
|
|
1053
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
642
|
// ../../src/components/ui/search-menu.tsx
|
|
1057
643
|
import { jsx as jsx9, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
1058
|
-
var
|
|
644
|
+
var messages3 = {
|
|
1059
645
|
en: {
|
|
1060
646
|
title: "Search",
|
|
1061
647
|
description: "Search for an item to open.",
|
|
@@ -1071,18 +657,20 @@ var messages = {
|
|
|
1071
657
|
emptyMessage: "Aucun résultat trouvé."
|
|
1072
658
|
}
|
|
1073
659
|
};
|
|
1074
|
-
var searchMenuMessages = (
|
|
1075
|
-
...
|
|
1076
|
-
...
|
|
660
|
+
var searchMenuMessages = (locale, translations) => ({
|
|
661
|
+
...locale.startsWith("fr") ? messages3.fr : messages3.en,
|
|
662
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
663
|
+
...translations?.[locale]
|
|
1077
664
|
});
|
|
1078
665
|
function SearchMenu({
|
|
1079
666
|
groups,
|
|
667
|
+
locale = "en",
|
|
1080
668
|
title,
|
|
1081
669
|
description,
|
|
1082
670
|
placeholder,
|
|
1083
671
|
inputPlaceholder,
|
|
1084
672
|
emptyMessage,
|
|
1085
|
-
messages:
|
|
673
|
+
messages: messages4,
|
|
1086
674
|
shortcutLabel = "⌘K",
|
|
1087
675
|
className,
|
|
1088
676
|
open,
|
|
@@ -1092,7 +680,7 @@ function SearchMenu({
|
|
|
1092
680
|
onQueryChange,
|
|
1093
681
|
shouldFilter
|
|
1094
682
|
}) {
|
|
1095
|
-
const labels = searchMenuMessages(
|
|
683
|
+
const labels = searchMenuMessages(locale, messages4);
|
|
1096
684
|
const resolvedTitle = title ?? labels.title;
|
|
1097
685
|
const resolvedDescription = description ?? labels.description;
|
|
1098
686
|
const resolvedPlaceholder = placeholder ?? labels.placeholder;
|
|
@@ -1842,7 +1430,7 @@ var seo = ({
|
|
|
1842
1430
|
origin,
|
|
1843
1431
|
path = "/",
|
|
1844
1432
|
locale,
|
|
1845
|
-
locales
|
|
1433
|
+
locales,
|
|
1846
1434
|
defaultLocale,
|
|
1847
1435
|
robots = "index, follow",
|
|
1848
1436
|
siteName = "KrakStack",
|
|
@@ -1879,7 +1467,7 @@ var seo = ({
|
|
|
1879
1467
|
{ property: "og:image", content: image }
|
|
1880
1468
|
] : []
|
|
1881
1469
|
].filter((tag) => !Object.hasOwn(tag, "content") || tag.content);
|
|
1882
|
-
const alternateLocales =
|
|
1470
|
+
const alternateLocales = locales ?? [];
|
|
1883
1471
|
const links = canonical ? [
|
|
1884
1472
|
{ rel: "canonical", href: canonical },
|
|
1885
1473
|
...origin && alternateLocales.length > 0 ? alternateLocales.map((alternateLocale) => ({
|
|
@@ -2137,8 +1725,8 @@ var validateDocsPages = (pages, config) => {
|
|
|
2137
1725
|
}
|
|
2138
1726
|
}
|
|
2139
1727
|
if (config.requireLocaleParity !== false && config.locales.length > 1) {
|
|
2140
|
-
const
|
|
2141
|
-
const basePages = pages.filter((page) => page.locale ===
|
|
1728
|
+
const baseLocale = config.locales[0];
|
|
1729
|
+
const basePages = pages.filter((page) => page.locale === baseLocale);
|
|
2142
1730
|
for (const locale of config.locales.slice(1)) {
|
|
2143
1731
|
const localizedBySlug = new Map(pages.filter((page) => page.locale === locale).map((page) => [page.slug, page]));
|
|
2144
1732
|
for (const page of basePages) {
|
|
@@ -2147,11 +1735,11 @@ var validateDocsPages = (pages, config) => {
|
|
|
2147
1735
|
throw new Error(`Missing ${locale} page for ${page.slug}`);
|
|
2148
1736
|
}
|
|
2149
1737
|
if (page.path !== localized.path || page.order !== localized.order || page.section !== localized.section || page.type !== localized.type || page.icon !== localized.icon || page.createdAt !== localized.createdAt || page.updatedAt !== localized.updatedAt || JSON.stringify(page.tags ?? []) !== JSON.stringify(localized.tags ?? []) || JSON.stringify(page.legacySlugs ?? []) !== JSON.stringify(localized.legacySlugs ?? [])) {
|
|
2150
|
-
throw new Error(`Metadata differs between ${
|
|
1738
|
+
throw new Error(`Metadata differs between ${baseLocale} and ${locale} for ${page.slug}`);
|
|
2151
1739
|
}
|
|
2152
1740
|
}
|
|
2153
1741
|
if (basePages.length !== localizedBySlug.size) {
|
|
2154
|
-
throw new Error(`${
|
|
1742
|
+
throw new Error(`${baseLocale} and ${locale} documentation page counts differ`);
|
|
2155
1743
|
}
|
|
2156
1744
|
}
|
|
2157
1745
|
}
|
|
@@ -2371,12 +1959,14 @@ var docsPageTypeMessages = {
|
|
|
2371
1959
|
}
|
|
2372
1960
|
};
|
|
2373
1961
|
var defaultSectionLabel = (locale, section) => Object.entries(docsSectionMessages[locale]).find(([key]) => key === section)?.[1] ?? humanizeDocsValue(section);
|
|
2374
|
-
var
|
|
1962
|
+
var messages4 = {
|
|
2375
1963
|
en: {
|
|
2376
1964
|
title: "Documentation",
|
|
2377
1965
|
description: "Guides and technical reference.",
|
|
2378
1966
|
copied: "Copied",
|
|
2379
|
-
copyCode: "Copy
|
|
1967
|
+
copyCode: "Copy",
|
|
1968
|
+
copyCodeDescription: (language) => `${language} code`,
|
|
1969
|
+
copyFailed: "Copy failed",
|
|
2380
1970
|
copyLink: "Copy link",
|
|
2381
1971
|
copyTable: "Copy table",
|
|
2382
1972
|
downloadTable: "Download table",
|
|
@@ -2404,7 +1994,9 @@ var messages2 = {
|
|
|
2404
1994
|
title: "Documentation",
|
|
2405
1995
|
description: "Guides et référence technique.",
|
|
2406
1996
|
copied: "Copié",
|
|
2407
|
-
copyCode: "Copier
|
|
1997
|
+
copyCode: "Copier",
|
|
1998
|
+
copyCodeDescription: (language) => `code ${language}`,
|
|
1999
|
+
copyFailed: "Échec de la copie",
|
|
2408
2000
|
copyLink: "Copier le lien",
|
|
2409
2001
|
copyTable: "Copier le tableau",
|
|
2410
2002
|
downloadTable: "Télécharger le tableau",
|
|
@@ -2430,18 +2022,27 @@ var messages2 = {
|
|
|
2430
2022
|
}
|
|
2431
2023
|
};
|
|
2432
2024
|
var getDocsMessages = (locale, overrides) => ({
|
|
2433
|
-
...locale.startsWith("fr") ?
|
|
2025
|
+
...locale.startsWith("fr") ? messages4.fr : messages4.en,
|
|
2434
2026
|
...overrides
|
|
2435
2027
|
});
|
|
2436
2028
|
var iconFor = (icons, name) => name ? icons[name] : undefined;
|
|
2437
2029
|
var DocsArticle = ({
|
|
2438
|
-
|
|
2030
|
+
locale,
|
|
2031
|
+
messages: messages5,
|
|
2439
2032
|
page
|
|
2440
2033
|
}) => {
|
|
2441
2034
|
return /* @__PURE__ */ jsx14(MarkdownContent, {
|
|
2442
2035
|
codeBlocks: page.codeBlocks,
|
|
2443
2036
|
html: page.html,
|
|
2444
|
-
|
|
2037
|
+
locale,
|
|
2038
|
+
messages: {
|
|
2039
|
+
[locale]: {
|
|
2040
|
+
codeDescription: messages5.copyCodeDescription,
|
|
2041
|
+
copy: messages5.copyCode,
|
|
2042
|
+
copied: messages5.copied,
|
|
2043
|
+
copyFailed: messages5.copyFailed
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2445
2046
|
});
|
|
2446
2047
|
};
|
|
2447
2048
|
var useActiveDocsHeading = (headings) => {
|
|
@@ -2555,7 +2156,7 @@ var DocsMobileTableOfContents = ({
|
|
|
2555
2156
|
var DocsSearch = ({
|
|
2556
2157
|
docs,
|
|
2557
2158
|
locale,
|
|
2558
|
-
messages:
|
|
2159
|
+
messages: messages5
|
|
2559
2160
|
}) => {
|
|
2560
2161
|
const [query, setQuery] = useState6("");
|
|
2561
2162
|
const deferredQuery = useDeferredValue(query);
|
|
@@ -2577,7 +2178,7 @@ var DocsSearch = ({
|
|
|
2577
2178
|
});
|
|
2578
2179
|
}
|
|
2579
2180
|
return {
|
|
2580
|
-
heading:
|
|
2181
|
+
heading: messages5.sectionLabel(section),
|
|
2581
2182
|
items: sectionResults.map(({ page, heading }) => heading ? {
|
|
2582
2183
|
id: `${page.path}#${heading.id}`,
|
|
2583
2184
|
label: heading.title,
|
|
@@ -2606,12 +2207,15 @@ var DocsSearch = ({
|
|
|
2606
2207
|
});
|
|
2607
2208
|
return /* @__PURE__ */ jsx14(SearchMenu, {
|
|
2608
2209
|
groups,
|
|
2210
|
+
locale,
|
|
2609
2211
|
messages: {
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2212
|
+
[locale]: {
|
|
2213
|
+
title: messages5.searchTitle,
|
|
2214
|
+
description: messages5.searchDescription,
|
|
2215
|
+
placeholder: messages5.searchPlaceholder,
|
|
2216
|
+
inputPlaceholder: messages5.searchInputPlaceholder,
|
|
2217
|
+
emptyMessage: messages5.searchEmpty
|
|
2218
|
+
}
|
|
2615
2219
|
},
|
|
2616
2220
|
query,
|
|
2617
2221
|
onQueryChange: setQuery,
|
|
@@ -2759,6 +2363,7 @@ var DocsContent = ({ docs, resolution }) => {
|
|
|
2759
2363
|
label: resolvedMessages.onThisPage
|
|
2760
2364
|
}),
|
|
2761
2365
|
/* @__PURE__ */ jsx14(DocsArticle, {
|
|
2366
|
+
locale: page.locale,
|
|
2762
2367
|
messages: resolvedMessages,
|
|
2763
2368
|
page
|
|
2764
2369
|
})
|