@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.
Files changed (44) hide show
  1. package/dist/components/ui/code-block.d.ts +8 -6
  2. package/dist/components/ui/code-block.js +40 -19
  3. package/dist/components/ui/copy-button.d.ts +9 -6
  4. package/dist/components/ui/copy-button.js +15 -8
  5. package/dist/components/ui/data-table.d.ts +9 -5
  6. package/dist/components/ui/data-table.js +74 -479
  7. package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
  8. package/dist/components/ui/editing-locale-switcher.js +20 -448
  9. package/dist/components/ui/effect-form.d.ts +39 -10
  10. package/dist/components/ui/effect-form.js +141 -527
  11. package/dist/components/ui/error-component.d.ts +4 -2
  12. package/dist/components/ui/error-component.js +24 -450
  13. package/dist/components/ui/file-picker.d.ts +4 -2
  14. package/dist/components/ui/file-picker.js +25 -452
  15. package/dist/components/ui/form.d.ts +123 -71
  16. package/dist/components/ui/form.js +81 -474
  17. package/dist/components/ui/google-map.d.ts +2 -1
  18. package/dist/components/ui/google-map.js +4 -439
  19. package/dist/components/ui/icon-input.d.ts +50 -1
  20. package/dist/components/ui/icon-input.js +30 -446
  21. package/dist/components/ui/loading.d.ts +7 -1
  22. package/dist/components/ui/loading.js +4 -438
  23. package/dist/components/ui/locale-switcher.d.ts +8 -4
  24. package/dist/components/ui/locale-switcher.js +29 -453
  25. package/dist/components/ui/pagination.d.ts +5 -3
  26. package/dist/components/ui/pagination.js +5 -439
  27. package/dist/components/ui/search-menu.d.ts +4 -2
  28. package/dist/components/ui/search-menu.js +6 -440
  29. package/dist/components/ui/theme-switcher.d.ts +5 -3
  30. package/dist/components/ui/theme-switcher.js +6 -440
  31. package/dist/components/ui/virtualized-combobox.d.ts +4 -2
  32. package/dist/components/ui/virtualized-combobox.js +11 -443
  33. package/dist/lib/docs.d.ts +2 -0
  34. package/dist/lib/docs.js +86 -481
  35. package/dist/lib/docs.server.js +0 -21
  36. package/dist/lib/documentation-toolkit.js +0 -21
  37. package/dist/lib/markdown/content.d.ts +4 -5
  38. package/dist/services/agent/client/index.js +75 -463
  39. package/dist/services/agent/client/widget.d.ts +6 -3
  40. package/dist/services/notification/client/index.js +8 -440
  41. package/dist/services/notification/client/notification-menu.d.ts +6 -3
  42. package/dist/services/notification/public.js +8 -440
  43. package/package.json +1 -1
  44. package/dist/paraglide/runtime.d.ts +0 -978
@@ -252,442 +252,6 @@ function CommandShortcut({
252
252
  });
253
253
  }
254
254
 
255
- // ../../src/paraglide/runtime.js
256
- import"@inlang/paraglide-js/urlpattern-polyfill";
257
- var baseLocale = "en";
258
- var locales = ["en", "fr"];
259
- var cookieName = "locale";
260
- var cookieMaxAge = 34560000;
261
- var cookieDomain = "";
262
- var localStorageKey = "PARAGLIDE_LOCALE";
263
- var strategy = [
264
- "url",
265
- "cookie",
266
- "preferredLanguage",
267
- "baseLocale"
268
- ];
269
- var routeStrategies = [
270
- {
271
- match: "/api/:path(.*)?",
272
- exclude: true
273
- },
274
- {
275
- match: "/sitemap.xml",
276
- exclude: true
277
- },
278
- {
279
- match: "/llms.txt",
280
- exclude: true
281
- }
282
- ];
283
- var urlPatterns = [
284
- {
285
- pattern: "/:path(.*)?",
286
- localized: [
287
- [
288
- "en",
289
- "/en/:path(.*)?"
290
- ],
291
- [
292
- "fr",
293
- "/fr/:path(.*)?"
294
- ]
295
- ]
296
- }
297
- ];
298
- var cachedRouteStrategyUrl;
299
- var cachedRouteStrategy;
300
- function findMatchingRouteStrategy(url) {
301
- if (routeStrategies.length === 0) {
302
- return;
303
- }
304
- const urlString = typeof url === "string" ? url : url.href;
305
- if (cachedRouteStrategyUrl === urlString) {
306
- return cachedRouteStrategy;
307
- }
308
- const urlObject = new URL(urlString, "http://dummy.com");
309
- let match;
310
- for (const routeStrategy of routeStrategies) {
311
- const pattern = new URLPattern(routeStrategy.match, urlObject.href);
312
- if (pattern.exec(urlObject.href)) {
313
- match = routeStrategy;
314
- break;
315
- }
316
- }
317
- cachedRouteStrategyUrl = urlString;
318
- cachedRouteStrategy = match;
319
- return match;
320
- }
321
- function getStrategyForUrl(url) {
322
- const routeStrategy = findMatchingRouteStrategy(url);
323
- if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
324
- return routeStrategy.strategy;
325
- }
326
- return strategy;
327
- }
328
- var serverAsyncLocalStorage = undefined;
329
- var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
330
- var experimentalStaticLocale = undefined;
331
- var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
332
- var TREE_SHAKE_URL_STRATEGY_USED = true;
333
- var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
334
- var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
335
- var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
336
- var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
337
- globalThis.__paraglide = globalThis.__paraglide ?? {};
338
- globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
339
- var _locale;
340
- var localeInitiallySet = false;
341
- var getLocale = () => {
342
- if (experimentalStaticLocale !== undefined) {
343
- return experimentalStaticLocale;
344
- }
345
- if (serverAsyncLocalStorage) {
346
- const locale = serverAsyncLocalStorage?.getStore()?.locale;
347
- if (locale) {
348
- return locale;
349
- }
350
- }
351
- let strategyToUse = strategy;
352
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
353
- strategyToUse = getStrategyForUrl(window.location.href);
354
- }
355
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
356
- if (resolved) {
357
- if (!localeInitiallySet) {
358
- _locale = resolved;
359
- localeInitiallySet = true;
360
- setLocale(resolved, { reload: false });
361
- }
362
- return resolved;
363
- }
364
- throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
365
- };
366
- function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
367
- let locale;
368
- for (const strat of strategyToUse) {
369
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
370
- locale = extractLocaleFromCookie();
371
- } else if (strat === "baseLocale") {
372
- locale = baseLocale;
373
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
374
- locale = extractLocaleFromUrl(urlForUrlStrategy);
375
- } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
376
- locale = _locale;
377
- } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
378
- locale = extractLocaleFromNavigator();
379
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
380
- locale = localStorage.getItem(localStorageKey) ?? undefined;
381
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
382
- const handler = customClientStrategies.get(strat);
383
- if (handler) {
384
- const result = handler.getLocale();
385
- if (result instanceof Promise) {
386
- continue;
387
- }
388
- if (result !== undefined) {
389
- return assertIsLocale(result);
390
- }
391
- }
392
- }
393
- const matchedLocale = toLocale(locale);
394
- if (matchedLocale) {
395
- return matchedLocale;
396
- }
397
- }
398
- return;
399
- }
400
- var rtlLanguages = new Set([
401
- "ar",
402
- "dv",
403
- "fa",
404
- "he",
405
- "ks",
406
- "ku",
407
- "ps",
408
- "sd",
409
- "ug",
410
- "ur",
411
- "yi"
412
- ]);
413
- var navigateOrReload = (newLocation) => {
414
- if (newLocation) {
415
- window.location.href = newLocation;
416
- } else {
417
- window.location.reload();
418
- }
419
- };
420
- var setLocale = (newLocale, options) => {
421
- const optionsWithDefaults = {
422
- reload: true,
423
- ...options
424
- };
425
- let currentLocale;
426
- try {
427
- currentLocale = getLocale();
428
- } catch {}
429
- const customSetLocalePromises = [];
430
- let newLocation = undefined;
431
- let strategyToUse = strategy;
432
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
433
- strategyToUse = getStrategyForUrl(window.location.href);
434
- }
435
- for (const strat of strategyToUse) {
436
- if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
437
- _locale = newLocale;
438
- } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
439
- if (isServer || typeof document === "undefined" || typeof window === "undefined") {
440
- continue;
441
- }
442
- const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
443
- document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
444
- } else if (strat === "baseLocale") {
445
- continue;
446
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
447
- newLocation = localizeUrl(window.location.href, {
448
- locale: newLocale
449
- }).href;
450
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
451
- localStorage.setItem(localStorageKey, newLocale);
452
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
453
- const handler = customClientStrategies.get(strat);
454
- if (handler) {
455
- let result = handler.setLocale(newLocale);
456
- if (result instanceof Promise) {
457
- result = result.catch((error) => {
458
- throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
459
- cause: error
460
- });
461
- });
462
- customSetLocalePromises.push(result);
463
- }
464
- }
465
- }
466
- }
467
- const runReload = () => {
468
- if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
469
- navigateOrReload(newLocation);
470
- }
471
- };
472
- if (customSetLocalePromises.length) {
473
- return Promise.all(customSetLocalePromises).then(() => {
474
- runReload();
475
- });
476
- }
477
- runReload();
478
- return;
479
- };
480
- var getUrlOrigin = () => {
481
- if (serverAsyncLocalStorage) {
482
- return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
483
- } else if (typeof window !== "undefined") {
484
- return window.location.origin;
485
- }
486
- return "http://fallback.com";
487
- };
488
- function toLocale(value) {
489
- if (typeof value !== "string") {
490
- return;
491
- }
492
- const lowerValue = value.toLowerCase();
493
- for (const locale of locales) {
494
- if (locale.toLowerCase() === lowerValue) {
495
- return locale;
496
- }
497
- }
498
- return;
499
- }
500
- function assertIsLocale(input) {
501
- const locale = toLocale(input);
502
- if (locale)
503
- return locale;
504
- throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
505
- }
506
- function extractLocaleFromCookie() {
507
- if (typeof document === "undefined" || !document.cookie) {
508
- return;
509
- }
510
- const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
511
- const locale = match?.[2];
512
- return toLocale(locale);
513
- }
514
- function extractLocaleFromNavigator() {
515
- if (!navigator?.languages?.length) {
516
- return;
517
- }
518
- const languages = navigator.languages.map((lang) => ({
519
- fullTag: lang,
520
- baseTag: lang.split("-")[0]
521
- }));
522
- for (const lang of languages) {
523
- const fullLocale = toLocale(lang.fullTag);
524
- if (fullLocale) {
525
- return fullLocale;
526
- }
527
- const baseLocale2 = toLocale(lang.baseTag);
528
- if (baseLocale2) {
529
- return baseLocale2;
530
- }
531
- }
532
- return;
533
- }
534
- var cachedUrl;
535
- var cachedLocale;
536
- function extractLocaleFromUrl(url) {
537
- const urlString = typeof url === "string" ? url : url.href;
538
- if (cachedUrl === urlString) {
539
- return cachedLocale;
540
- }
541
- let result;
542
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
543
- result = defaultUrlPatternExtractLocale(url);
544
- } else {
545
- const urlObj = typeof url === "string" ? new URL(url) : url;
546
- for (const element of urlPatterns) {
547
- for (const [locale, localizedPattern] of element.localized) {
548
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
549
- if (match) {
550
- result = locale;
551
- break;
552
- }
553
- }
554
- if (result)
555
- break;
556
- }
557
- }
558
- cachedUrl = urlString;
559
- cachedLocale = result;
560
- return result;
561
- }
562
- function defaultUrlPatternExtractLocale(url) {
563
- const urlObj = new URL(url, "http://dummy.com");
564
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
565
- return toLocale(pathSegments[0]) || baseLocale;
566
- }
567
- function localizeUrl(url, options) {
568
- const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
569
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
570
- return localizeUrlDefaultPattern(url, targetLocale);
571
- }
572
- const urlObj = typeof url === "string" ? new URL(url) : url;
573
- for (const element of urlPatterns) {
574
- for (const [, localizedPattern] of element.localized) {
575
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
576
- if (!match) {
577
- continue;
578
- }
579
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
580
- if (!targetPattern) {
581
- continue;
582
- }
583
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
584
- return fillMissingUrlParts(localizedUrl, match);
585
- }
586
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
587
- if (unlocalizedMatch) {
588
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
589
- if (targetPattern) {
590
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
591
- return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
592
- }
593
- }
594
- }
595
- return urlObj;
596
- }
597
- function localizeUrlDefaultPattern(url, locale) {
598
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
599
- const currentLocale = extractLocaleFromUrl(urlObj);
600
- if (currentLocale === locale) {
601
- return urlObj;
602
- }
603
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
604
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
605
- pathSegments.shift();
606
- }
607
- if (locale === baseLocale) {
608
- urlObj.pathname = "/" + pathSegments.join("/");
609
- } else {
610
- urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
611
- }
612
- return urlObj;
613
- }
614
- function fillMissingUrlParts(url, match) {
615
- if (match.protocol.groups["0"]) {
616
- url.protocol = match.protocol.groups["0"] ?? "";
617
- }
618
- if (match.hostname.groups["0"]) {
619
- url.hostname = match.hostname.groups["0"] ?? "";
620
- }
621
- if (match.username.groups["0"]) {
622
- url.username = match.username.groups["0"] ?? "";
623
- }
624
- if (match.password.groups["0"]) {
625
- url.password = match.password.groups["0"] ?? "";
626
- }
627
- if (match.port.groups["0"]) {
628
- url.port = match.port.groups["0"] ?? "";
629
- }
630
- if (match.pathname.groups["0"]) {
631
- url.pathname = match.pathname.groups["0"] ?? "";
632
- }
633
- if (match.search.groups["0"]) {
634
- url.search = match.search.groups["0"] ?? "";
635
- }
636
- if (match.hash.groups["0"]) {
637
- url.hash = match.hash.groups["0"] ?? "";
638
- }
639
- return url;
640
- }
641
- function fillPattern(pattern, values, origin) {
642
- let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
643
- return `${protocol}#PORT-${port}#${slash}`;
644
- });
645
- let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
646
- if (modifier === "?") {
647
- return content;
648
- }
649
- return content;
650
- });
651
- let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
652
- const value = values[name];
653
- if (value === null) {
654
- return "";
655
- }
656
- if (modifier === "?") {
657
- return value !== undefined ? `${slash}${value}` : "";
658
- }
659
- if (modifier === "+" || modifier === "*") {
660
- if (value === undefined && modifier === "+") {
661
- throw new Error(`Missing value for "${name}" (one or more required)`);
662
- }
663
- return value ? `${slash}${value}` : "";
664
- }
665
- if (value === undefined) {
666
- throw new Error(`Missing value for "${name}"`);
667
- }
668
- return `${slash}${value}`;
669
- });
670
- filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
671
- return new URL(filled, origin);
672
- }
673
- function aggregateGroups(match) {
674
- return {
675
- ...match.hash.groups,
676
- ...match.hostname.groups,
677
- ...match.password.groups,
678
- ...match.pathname.groups,
679
- ...match.port.groups,
680
- ...match.protocol.groups,
681
- ...match.search.groups,
682
- ...match.username.groups
683
- };
684
- }
685
- var customServerStrategies = new Map;
686
- var customClientStrategies = new Map;
687
- function isCustomStrategy(strategy2) {
688
- return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
689
- }
690
-
691
255
  // ../../src/components/ui/search-menu.tsx
692
256
  import { jsx as jsx4, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
693
257
  var messages = {
@@ -706,12 +270,14 @@ var messages = {
706
270
  emptyMessage: "Aucun résultat trouvé."
707
271
  }
708
272
  };
709
- var searchMenuMessages = (overrides) => ({
710
- ...getLocale().startsWith("fr") ? messages.fr : messages.en,
711
- ...overrides
273
+ var searchMenuMessages = (locale, translations) => ({
274
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
275
+ ...translations?.[locale.split("-")[0] ?? locale],
276
+ ...translations?.[locale]
712
277
  });
713
278
  function SearchMenu({
714
279
  groups,
280
+ locale = "en",
715
281
  title,
716
282
  description,
717
283
  placeholder,
@@ -727,7 +293,7 @@ function SearchMenu({
727
293
  onQueryChange,
728
294
  shouldFilter
729
295
  }) {
730
- const labels = searchMenuMessages(messages2);
296
+ const labels = searchMenuMessages(locale, messages2);
731
297
  const resolvedTitle = title ?? labels.title;
732
298
  const resolvedDescription = description ?? labels.description;
733
299
  const resolvedPlaceholder = placeholder ?? labels.placeholder;
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
- type ThemeSwitcherMessages = Partial<Record<Theme | "title", string>>;
2
+ export type ThemeSwitcherMessages = Partial<Record<Theme | "title", string>>;
3
+ export type ThemeSwitcherMessageTranslations = Partial<Record<string, ThemeSwitcherMessages>>;
3
4
  export declare const themes: readonly ["light", "dark", "system"];
4
5
  export type Theme = "light" | "dark" | "system";
5
6
  export type SystemTheme = "dark" | "light";
@@ -18,12 +19,13 @@ type ThemeProviderProps = {
18
19
  scriptDisabled?: boolean;
19
20
  };
20
21
  type ThemeSwitcherProps = {
21
- messages?: ThemeSwitcherMessages;
22
+ locale?: string;
23
+ messages?: ThemeSwitcherMessageTranslations;
22
24
  options?: ReadonlyArray<Theme>;
23
25
  value: Theme;
24
26
  onChange: (value: Theme) => void;
25
27
  };
26
28
  export declare const ThemeProvider: ({ children, initialTheme, scriptDisabled, }: ThemeProviderProps) => import("react").JSX.Element;
27
29
  export declare const useTheme: () => ThemeProviderState;
28
- export declare const ThemeSwitcher: ({ messages, options, value, onChange, }: ThemeSwitcherProps) => import("react").JSX.Element;
30
+ export declare const ThemeSwitcher: ({ locale, messages, options, value, onChange, }: ThemeSwitcherProps) => import("react").JSX.Element;
29
31
  export {};