@krak-stack/registry 0.1.32 → 0.1.34

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.
Files changed (46) hide show
  1. package/dist/components/ui/code-block.d.ts +8 -6
  2. package/dist/components/ui/code-block.js +44 -19
  3. package/dist/components/ui/copy-button.d.ts +9 -6
  4. package/dist/components/ui/copy-button.js +17 -8
  5. package/dist/components/ui/data-table.d.ts +9 -5
  6. package/dist/components/ui/data-table.js +90 -486
  7. package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
  8. package/dist/components/ui/editing-locale-switcher.js +26 -448
  9. package/dist/components/ui/effect-form.d.ts +39 -10
  10. package/dist/components/ui/effect-form.js +171 -541
  11. package/dist/components/ui/error-component.d.ts +4 -2
  12. package/dist/components/ui/error-component.js +28 -450
  13. package/dist/components/ui/file-picker.d.ts +4 -2
  14. package/dist/components/ui/file-picker.js +27 -452
  15. package/dist/components/ui/form.d.ts +123 -71
  16. package/dist/components/ui/form.js +95 -476
  17. package/dist/components/ui/google-map.d.ts +3 -2
  18. package/dist/components/ui/google-map.js +6 -439
  19. package/dist/components/ui/icon-input.d.ts +50 -1
  20. package/dist/components/ui/icon-input.js +38 -448
  21. package/dist/components/ui/krakstack-provider.d.ts +9 -0
  22. package/dist/components/ui/krakstack-provider.js +28 -0
  23. package/dist/components/ui/loading.d.ts +7 -1
  24. package/dist/components/ui/loading.js +6 -438
  25. package/dist/components/ui/locale-switcher.d.ts +8 -4
  26. package/dist/components/ui/locale-switcher.js +35 -453
  27. package/dist/components/ui/pagination.d.ts +5 -3
  28. package/dist/components/ui/pagination.js +7 -439
  29. package/dist/components/ui/search-menu.d.ts +4 -2
  30. package/dist/components/ui/search-menu.js +8 -440
  31. package/dist/components/ui/theme-switcher.d.ts +5 -3
  32. package/dist/components/ui/theme-switcher.js +8 -440
  33. package/dist/components/ui/virtualized-combobox.d.ts +4 -2
  34. package/dist/components/ui/virtualized-combobox.js +17 -445
  35. package/dist/lib/docs.d.ts +2 -0
  36. package/dist/lib/docs.js +92 -481
  37. package/dist/lib/docs.server.js +4 -20
  38. package/dist/lib/documentation-toolkit.js +4 -20
  39. package/dist/lib/markdown/content.d.ts +4 -5
  40. package/dist/services/agent/client/index.js +81 -463
  41. package/dist/services/agent/client/widget.d.ts +6 -3
  42. package/dist/services/notification/client/index.js +11 -440
  43. package/dist/services/notification/client/notification-menu.d.ts +7 -4
  44. package/dist/services/notification/public.js +11 -440
  45. package/package.json +5 -1
  46. package/dist/paraglide/runtime.d.ts +0 -978
package/dist/lib/docs.js CHANGED
@@ -208,12 +208,23 @@ function Button({
208
208
  // ../../src/components/ui/copy-button.tsx
209
209
  import { Check, Copy, TriangleAlert } from "lucide-react";
210
210
  import { useEffect, useRef, useState } from "react";
211
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
211
212
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
213
+ var messages = {
214
+ en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
215
+ fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
216
+ };
217
+ var copyButtonMessages = (locale = "en", translations) => ({
218
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
219
+ ...translations?.[locale.split("-")[0] ?? locale],
220
+ ...translations?.[locale]
221
+ });
212
222
  function CopyButton({
213
223
  value,
214
224
  valueDescription,
215
225
  copyVariant = "default",
216
- messages,
226
+ locale: localeOverride,
227
+ messages: messages2,
217
228
  onCopied,
218
229
  onCopyError,
219
230
  resetDelay = 1500,
@@ -222,13 +233,10 @@ function CopyButton({
222
233
  "aria-label": ariaLabel,
223
234
  ...props
224
235
  }) {
236
+ const locale = useKrakstackLocale(localeOverride);
225
237
  const [copyState, setCopyState] = useState("idle");
226
238
  const copyTimeout = useRef(undefined);
227
- const labels = {
228
- copy: messages?.copy ?? "Copy",
229
- copied: messages?.copied ?? "Copied",
230
- copyFailed: messages?.copyFailed ?? "Copy failed"
231
- };
239
+ const labels = copyButtonMessages(locale, messages2);
232
240
  const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
233
241
  const isLarge = copyVariant === "large";
234
242
  const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
@@ -250,7 +258,7 @@ function CopyButton({
250
258
  onCopied?.();
251
259
  } catch (error) {
252
260
  setCopyState("failed");
253
- onCopyError?.(error instanceof Error ? error : new Error("Copy failed", { cause: error }));
261
+ onCopyError?.(error instanceof Error ? error : new Error(labels.copyFailed, { cause: error }));
254
262
  }
255
263
  resetCopyState();
256
264
  };
@@ -289,6 +297,7 @@ import { highlight } from "@tanstack/highlight";
289
297
  import { createThemeCss } from "@tanstack/highlight/theme";
290
298
  import { githubDarkTheme } from "@tanstack/highlight/themes/github-dark";
291
299
  import { githubLightTheme } from "@tanstack/highlight/themes/github-light";
300
+ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
292
301
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
293
302
  var themeCss = `${createThemeCss({
294
303
  light: githubLightTheme,
@@ -306,21 +315,35 @@ var themeCss = `${createThemeCss({
306
315
  color: inherit;
307
316
  }
308
317
  [data-code-theme] pre.th-code code { font: inherit; }`;
318
+ var messages2 = {
319
+ en: {
320
+ codeDescription: (language) => `${language} code`,
321
+ copy: "Copy",
322
+ copied: "Copied",
323
+ copyFailed: "Copy failed"
324
+ },
325
+ fr: {
326
+ codeDescription: (language) => `code ${language}`,
327
+ copy: "Copier",
328
+ copied: "Copié",
329
+ copyFailed: "Échec de la copie"
330
+ }
331
+ };
332
+ var codeBlockMessages = (locale = "en", translations) => ({
333
+ ...locale.startsWith("fr") ? messages2.fr : messages2.en,
334
+ ...translations?.[locale.split("-")[0] ?? locale],
335
+ ...translations?.[locale]
336
+ });
309
337
  function CodeBlock({
310
338
  code,
311
339
  language = "text",
312
- messages
340
+ locale: localeOverride,
341
+ messages: messages3
313
342
  }) {
343
+ const locale = useKrakstackLocale2(localeOverride);
314
344
  const normalizedLanguage = language.toLowerCase() || "text";
315
345
  const highlighted = highlight(code, { lang: normalizedLanguage });
316
- const copyMessages = {};
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
- }
346
+ const labels = codeBlockMessages(locale, messages3);
324
347
  return /* @__PURE__ */ jsxs3("div", {
325
348
  className: "not-prose bg-muted overflow-hidden rounded-md border text-[var(--th-token)]",
326
349
  "data-code-theme": true,
@@ -337,9 +360,10 @@ function CodeBlock({
337
360
  }),
338
361
  /* @__PURE__ */ jsx4(CopyButton, {
339
362
  value: code,
340
- valueDescription: `${highlighted.lang} code`,
363
+ valueDescription: labels.codeDescription(highlighted.lang),
341
364
  variant: "secondary",
342
- messages: copyMessages
365
+ locale,
366
+ messages: { [locale]: labels }
343
367
  })
344
368
  ]
345
369
  }),
@@ -357,7 +381,8 @@ var MarkdownContent = ({
357
381
  className,
358
382
  codeBlocks,
359
383
  html,
360
- messages
384
+ locale,
385
+ messages: messages3
361
386
  }) => {
362
387
  const content = [];
363
388
  let remainingHtml = html;
@@ -375,7 +400,8 @@ var MarkdownContent = ({
375
400
  children: /* @__PURE__ */ jsx5(CodeBlock, {
376
401
  code: block.code,
377
402
  language: block.language,
378
- messages: { copy: messages?.copy, copied: messages?.copied }
403
+ locale,
404
+ messages: messages3
379
405
  })
380
406
  }, `code-${index}`));
381
407
  remainingHtml = remainingHtml.slice(markerIndex + marker.length);
@@ -617,445 +643,10 @@ function CommandShortcut({
617
643
  });
618
644
  }
619
645
 
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
646
  // ../../src/components/ui/search-menu.tsx
647
+ import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
1057
648
  import { jsx as jsx9, jsxs as jsxs6, Fragment as Fragment2 } from "react/jsx-runtime";
1058
- var messages = {
649
+ var messages3 = {
1059
650
  en: {
1060
651
  title: "Search",
1061
652
  description: "Search for an item to open.",
@@ -1071,18 +662,20 @@ var messages = {
1071
662
  emptyMessage: "Aucun résultat trouvé."
1072
663
  }
1073
664
  };
1074
- var searchMenuMessages = (overrides) => ({
1075
- ...getLocale().startsWith("fr") ? messages.fr : messages.en,
1076
- ...overrides
665
+ var searchMenuMessages = (locale, translations) => ({
666
+ ...locale.startsWith("fr") ? messages3.fr : messages3.en,
667
+ ...translations?.[locale.split("-")[0] ?? locale],
668
+ ...translations?.[locale]
1077
669
  });
1078
670
  function SearchMenu({
1079
671
  groups,
672
+ locale: localeOverride,
1080
673
  title,
1081
674
  description,
1082
675
  placeholder,
1083
676
  inputPlaceholder,
1084
677
  emptyMessage,
1085
- messages: messages2,
678
+ messages: messages4,
1086
679
  shortcutLabel = "⌘K",
1087
680
  className,
1088
681
  open,
@@ -1092,7 +685,8 @@ function SearchMenu({
1092
685
  onQueryChange,
1093
686
  shouldFilter
1094
687
  }) {
1095
- const labels = searchMenuMessages(messages2);
688
+ const locale = useKrakstackLocale3(localeOverride);
689
+ const labels = searchMenuMessages(locale, messages4);
1096
690
  const resolvedTitle = title ?? labels.title;
1097
691
  const resolvedDescription = description ?? labels.description;
1098
692
  const resolvedPlaceholder = placeholder ?? labels.placeholder;
@@ -1842,7 +1436,7 @@ var seo = ({
1842
1436
  origin,
1843
1437
  path = "/",
1844
1438
  locale,
1845
- locales: locales2,
1439
+ locales,
1846
1440
  defaultLocale,
1847
1441
  robots = "index, follow",
1848
1442
  siteName = "KrakStack",
@@ -1879,7 +1473,7 @@ var seo = ({
1879
1473
  { property: "og:image", content: image }
1880
1474
  ] : []
1881
1475
  ].filter((tag) => !Object.hasOwn(tag, "content") || tag.content);
1882
- const alternateLocales = locales2 ?? [];
1476
+ const alternateLocales = locales ?? [];
1883
1477
  const links = canonical ? [
1884
1478
  { rel: "canonical", href: canonical },
1885
1479
  ...origin && alternateLocales.length > 0 ? alternateLocales.map((alternateLocale) => ({
@@ -2137,8 +1731,8 @@ var validateDocsPages = (pages, config) => {
2137
1731
  }
2138
1732
  }
2139
1733
  if (config.requireLocaleParity !== false && config.locales.length > 1) {
2140
- const baseLocale2 = config.locales[0];
2141
- const basePages = pages.filter((page) => page.locale === baseLocale2);
1734
+ const baseLocale = config.locales[0];
1735
+ const basePages = pages.filter((page) => page.locale === baseLocale);
2142
1736
  for (const locale of config.locales.slice(1)) {
2143
1737
  const localizedBySlug = new Map(pages.filter((page) => page.locale === locale).map((page) => [page.slug, page]));
2144
1738
  for (const page of basePages) {
@@ -2147,11 +1741,11 @@ var validateDocsPages = (pages, config) => {
2147
1741
  throw new Error(`Missing ${locale} page for ${page.slug}`);
2148
1742
  }
2149
1743
  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 ${baseLocale2} and ${locale} for ${page.slug}`);
1744
+ throw new Error(`Metadata differs between ${baseLocale} and ${locale} for ${page.slug}`);
2151
1745
  }
2152
1746
  }
2153
1747
  if (basePages.length !== localizedBySlug.size) {
2154
- throw new Error(`${baseLocale2} and ${locale} documentation page counts differ`);
1748
+ throw new Error(`${baseLocale} and ${locale} documentation page counts differ`);
2155
1749
  }
2156
1750
  }
2157
1751
  }
@@ -2371,12 +1965,14 @@ var docsPageTypeMessages = {
2371
1965
  }
2372
1966
  };
2373
1967
  var defaultSectionLabel = (locale, section) => Object.entries(docsSectionMessages[locale]).find(([key]) => key === section)?.[1] ?? humanizeDocsValue(section);
2374
- var messages2 = {
1968
+ var messages4 = {
2375
1969
  en: {
2376
1970
  title: "Documentation",
2377
1971
  description: "Guides and technical reference.",
2378
1972
  copied: "Copied",
2379
- copyCode: "Copy code",
1973
+ copyCode: "Copy",
1974
+ copyCodeDescription: (language) => `${language} code`,
1975
+ copyFailed: "Copy failed",
2380
1976
  copyLink: "Copy link",
2381
1977
  copyTable: "Copy table",
2382
1978
  downloadTable: "Download table",
@@ -2404,7 +2000,9 @@ var messages2 = {
2404
2000
  title: "Documentation",
2405
2001
  description: "Guides et référence technique.",
2406
2002
  copied: "Copié",
2407
- copyCode: "Copier le code",
2003
+ copyCode: "Copier",
2004
+ copyCodeDescription: (language) => `code ${language}`,
2005
+ copyFailed: "Échec de la copie",
2408
2006
  copyLink: "Copier le lien",
2409
2007
  copyTable: "Copier le tableau",
2410
2008
  downloadTable: "Télécharger le tableau",
@@ -2430,18 +2028,27 @@ var messages2 = {
2430
2028
  }
2431
2029
  };
2432
2030
  var getDocsMessages = (locale, overrides) => ({
2433
- ...locale.startsWith("fr") ? messages2.fr : messages2.en,
2031
+ ...locale.startsWith("fr") ? messages4.fr : messages4.en,
2434
2032
  ...overrides
2435
2033
  });
2436
2034
  var iconFor = (icons, name) => name ? icons[name] : undefined;
2437
2035
  var DocsArticle = ({
2438
- messages: messages3,
2036
+ locale,
2037
+ messages: messages5,
2439
2038
  page
2440
2039
  }) => {
2441
2040
  return /* @__PURE__ */ jsx14(MarkdownContent, {
2442
2041
  codeBlocks: page.codeBlocks,
2443
2042
  html: page.html,
2444
- messages: { copy: messages3.copyCode, copied: messages3.copied }
2043
+ locale,
2044
+ messages: {
2045
+ [locale]: {
2046
+ codeDescription: messages5.copyCodeDescription,
2047
+ copy: messages5.copyCode,
2048
+ copied: messages5.copied,
2049
+ copyFailed: messages5.copyFailed
2050
+ }
2051
+ }
2445
2052
  });
2446
2053
  };
2447
2054
  var useActiveDocsHeading = (headings) => {
@@ -2555,7 +2162,7 @@ var DocsMobileTableOfContents = ({
2555
2162
  var DocsSearch = ({
2556
2163
  docs,
2557
2164
  locale,
2558
- messages: messages3
2165
+ messages: messages5
2559
2166
  }) => {
2560
2167
  const [query, setQuery] = useState6("");
2561
2168
  const deferredQuery = useDeferredValue(query);
@@ -2577,7 +2184,7 @@ var DocsSearch = ({
2577
2184
  });
2578
2185
  }
2579
2186
  return {
2580
- heading: messages3.sectionLabel(section),
2187
+ heading: messages5.sectionLabel(section),
2581
2188
  items: sectionResults.map(({ page, heading }) => heading ? {
2582
2189
  id: `${page.path}#${heading.id}`,
2583
2190
  label: heading.title,
@@ -2606,12 +2213,15 @@ var DocsSearch = ({
2606
2213
  });
2607
2214
  return /* @__PURE__ */ jsx14(SearchMenu, {
2608
2215
  groups,
2216
+ locale,
2609
2217
  messages: {
2610
- title: messages3.searchTitle,
2611
- description: messages3.searchDescription,
2612
- placeholder: messages3.searchPlaceholder,
2613
- inputPlaceholder: messages3.searchInputPlaceholder,
2614
- emptyMessage: messages3.searchEmpty
2218
+ [locale]: {
2219
+ title: messages5.searchTitle,
2220
+ description: messages5.searchDescription,
2221
+ placeholder: messages5.searchPlaceholder,
2222
+ inputPlaceholder: messages5.searchInputPlaceholder,
2223
+ emptyMessage: messages5.searchEmpty
2224
+ }
2615
2225
  },
2616
2226
  query,
2617
2227
  onQueryChange: setQuery,
@@ -2759,6 +2369,7 @@ var DocsContent = ({ docs, resolution }) => {
2759
2369
  label: resolvedMessages.onThisPage
2760
2370
  }),
2761
2371
  /* @__PURE__ */ jsx14(DocsArticle, {
2372
+ locale: page.locale,
2762
2373
  messages: resolvedMessages,
2763
2374
  page
2764
2375
  })