@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
@@ -145,442 +145,6 @@ function DropdownMenuRadioItem({
145
145
  });
146
146
  }
147
147
 
148
- // ../../src/paraglide/runtime.js
149
- import"@inlang/paraglide-js/urlpattern-polyfill";
150
- var baseLocale = "en";
151
- var locales = ["en", "fr"];
152
- var cookieName = "locale";
153
- var cookieMaxAge = 34560000;
154
- var cookieDomain = "";
155
- var localStorageKey = "PARAGLIDE_LOCALE";
156
- var strategy = [
157
- "url",
158
- "cookie",
159
- "preferredLanguage",
160
- "baseLocale"
161
- ];
162
- var routeStrategies = [
163
- {
164
- match: "/api/:path(.*)?",
165
- exclude: true
166
- },
167
- {
168
- match: "/sitemap.xml",
169
- exclude: true
170
- },
171
- {
172
- match: "/llms.txt",
173
- exclude: true
174
- }
175
- ];
176
- var urlPatterns = [
177
- {
178
- pattern: "/:path(.*)?",
179
- localized: [
180
- [
181
- "en",
182
- "/en/:path(.*)?"
183
- ],
184
- [
185
- "fr",
186
- "/fr/:path(.*)?"
187
- ]
188
- ]
189
- }
190
- ];
191
- var cachedRouteStrategyUrl;
192
- var cachedRouteStrategy;
193
- function findMatchingRouteStrategy(url) {
194
- if (routeStrategies.length === 0) {
195
- return;
196
- }
197
- const urlString = typeof url === "string" ? url : url.href;
198
- if (cachedRouteStrategyUrl === urlString) {
199
- return cachedRouteStrategy;
200
- }
201
- const urlObject = new URL(urlString, "http://dummy.com");
202
- let match;
203
- for (const routeStrategy of routeStrategies) {
204
- const pattern = new URLPattern(routeStrategy.match, urlObject.href);
205
- if (pattern.exec(urlObject.href)) {
206
- match = routeStrategy;
207
- break;
208
- }
209
- }
210
- cachedRouteStrategyUrl = urlString;
211
- cachedRouteStrategy = match;
212
- return match;
213
- }
214
- function getStrategyForUrl(url) {
215
- const routeStrategy = findMatchingRouteStrategy(url);
216
- if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
217
- return routeStrategy.strategy;
218
- }
219
- return strategy;
220
- }
221
- var serverAsyncLocalStorage = undefined;
222
- var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
223
- var experimentalStaticLocale = undefined;
224
- var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
225
- var TREE_SHAKE_URL_STRATEGY_USED = true;
226
- var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
227
- var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
228
- var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
229
- var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
230
- globalThis.__paraglide = globalThis.__paraglide ?? {};
231
- globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
232
- var _locale;
233
- var localeInitiallySet = false;
234
- var getLocale = () => {
235
- if (experimentalStaticLocale !== undefined) {
236
- return experimentalStaticLocale;
237
- }
238
- if (serverAsyncLocalStorage) {
239
- const locale = serverAsyncLocalStorage?.getStore()?.locale;
240
- if (locale) {
241
- return locale;
242
- }
243
- }
244
- let strategyToUse = strategy;
245
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
246
- strategyToUse = getStrategyForUrl(window.location.href);
247
- }
248
- const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
249
- if (resolved) {
250
- if (!localeInitiallySet) {
251
- _locale = resolved;
252
- localeInitiallySet = true;
253
- setLocale(resolved, { reload: false });
254
- }
255
- return resolved;
256
- }
257
- throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
258
- };
259
- function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
260
- let locale;
261
- for (const strat of strategyToUse) {
262
- if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
263
- locale = extractLocaleFromCookie();
264
- } else if (strat === "baseLocale") {
265
- locale = baseLocale;
266
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
267
- locale = extractLocaleFromUrl(urlForUrlStrategy);
268
- } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
269
- locale = _locale;
270
- } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
271
- locale = extractLocaleFromNavigator();
272
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
273
- locale = localStorage.getItem(localStorageKey) ?? undefined;
274
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
275
- const handler = customClientStrategies.get(strat);
276
- if (handler) {
277
- const result = handler.getLocale();
278
- if (result instanceof Promise) {
279
- continue;
280
- }
281
- if (result !== undefined) {
282
- return assertIsLocale(result);
283
- }
284
- }
285
- }
286
- const matchedLocale = toLocale(locale);
287
- if (matchedLocale) {
288
- return matchedLocale;
289
- }
290
- }
291
- return;
292
- }
293
- var rtlLanguages = new Set([
294
- "ar",
295
- "dv",
296
- "fa",
297
- "he",
298
- "ks",
299
- "ku",
300
- "ps",
301
- "sd",
302
- "ug",
303
- "ur",
304
- "yi"
305
- ]);
306
- var navigateOrReload = (newLocation) => {
307
- if (newLocation) {
308
- window.location.href = newLocation;
309
- } else {
310
- window.location.reload();
311
- }
312
- };
313
- var setLocale = (newLocale, options) => {
314
- const optionsWithDefaults = {
315
- reload: true,
316
- ...options
317
- };
318
- let currentLocale;
319
- try {
320
- currentLocale = getLocale();
321
- } catch {}
322
- const customSetLocalePromises = [];
323
- let newLocation = undefined;
324
- let strategyToUse = strategy;
325
- if (!isServer && typeof window !== "undefined" && window.location?.href) {
326
- strategyToUse = getStrategyForUrl(window.location.href);
327
- }
328
- for (const strat of strategyToUse) {
329
- if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
330
- _locale = newLocale;
331
- } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
332
- if (isServer || typeof document === "undefined" || typeof window === "undefined") {
333
- continue;
334
- }
335
- const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
336
- document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
337
- } else if (strat === "baseLocale") {
338
- continue;
339
- } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
340
- newLocation = localizeUrl(window.location.href, {
341
- locale: newLocale
342
- }).href;
343
- } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
344
- localStorage.setItem(localStorageKey, newLocale);
345
- } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
346
- const handler = customClientStrategies.get(strat);
347
- if (handler) {
348
- let result = handler.setLocale(newLocale);
349
- if (result instanceof Promise) {
350
- result = result.catch((error) => {
351
- throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
352
- cause: error
353
- });
354
- });
355
- customSetLocalePromises.push(result);
356
- }
357
- }
358
- }
359
- }
360
- const runReload = () => {
361
- if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
362
- navigateOrReload(newLocation);
363
- }
364
- };
365
- if (customSetLocalePromises.length) {
366
- return Promise.all(customSetLocalePromises).then(() => {
367
- runReload();
368
- });
369
- }
370
- runReload();
371
- return;
372
- };
373
- var getUrlOrigin = () => {
374
- if (serverAsyncLocalStorage) {
375
- return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
376
- } else if (typeof window !== "undefined") {
377
- return window.location.origin;
378
- }
379
- return "http://fallback.com";
380
- };
381
- function toLocale(value) {
382
- if (typeof value !== "string") {
383
- return;
384
- }
385
- const lowerValue = value.toLowerCase();
386
- for (const locale of locales) {
387
- if (locale.toLowerCase() === lowerValue) {
388
- return locale;
389
- }
390
- }
391
- return;
392
- }
393
- function assertIsLocale(input) {
394
- const locale = toLocale(input);
395
- if (locale)
396
- return locale;
397
- throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
398
- }
399
- function extractLocaleFromCookie() {
400
- if (typeof document === "undefined" || !document.cookie) {
401
- return;
402
- }
403
- const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
404
- const locale = match?.[2];
405
- return toLocale(locale);
406
- }
407
- function extractLocaleFromNavigator() {
408
- if (!navigator?.languages?.length) {
409
- return;
410
- }
411
- const languages = navigator.languages.map((lang) => ({
412
- fullTag: lang,
413
- baseTag: lang.split("-")[0]
414
- }));
415
- for (const lang of languages) {
416
- const fullLocale = toLocale(lang.fullTag);
417
- if (fullLocale) {
418
- return fullLocale;
419
- }
420
- const baseLocale2 = toLocale(lang.baseTag);
421
- if (baseLocale2) {
422
- return baseLocale2;
423
- }
424
- }
425
- return;
426
- }
427
- var cachedUrl;
428
- var cachedLocale;
429
- function extractLocaleFromUrl(url) {
430
- const urlString = typeof url === "string" ? url : url.href;
431
- if (cachedUrl === urlString) {
432
- return cachedLocale;
433
- }
434
- let result;
435
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
436
- result = defaultUrlPatternExtractLocale(url);
437
- } else {
438
- const urlObj = typeof url === "string" ? new URL(url) : url;
439
- for (const element of urlPatterns) {
440
- for (const [locale, localizedPattern] of element.localized) {
441
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
442
- if (match) {
443
- result = locale;
444
- break;
445
- }
446
- }
447
- if (result)
448
- break;
449
- }
450
- }
451
- cachedUrl = urlString;
452
- cachedLocale = result;
453
- return result;
454
- }
455
- function defaultUrlPatternExtractLocale(url) {
456
- const urlObj = new URL(url, "http://dummy.com");
457
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
458
- return toLocale(pathSegments[0]) || baseLocale;
459
- }
460
- function localizeUrl(url, options) {
461
- const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
462
- if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
463
- return localizeUrlDefaultPattern(url, targetLocale);
464
- }
465
- const urlObj = typeof url === "string" ? new URL(url) : url;
466
- for (const element of urlPatterns) {
467
- for (const [, localizedPattern] of element.localized) {
468
- const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
469
- if (!match) {
470
- continue;
471
- }
472
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
473
- if (!targetPattern) {
474
- continue;
475
- }
476
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
477
- return fillMissingUrlParts(localizedUrl, match);
478
- }
479
- const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
480
- if (unlocalizedMatch) {
481
- const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
482
- if (targetPattern) {
483
- const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
484
- return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
485
- }
486
- }
487
- }
488
- return urlObj;
489
- }
490
- function localizeUrlDefaultPattern(url, locale) {
491
- const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
492
- const currentLocale = extractLocaleFromUrl(urlObj);
493
- if (currentLocale === locale) {
494
- return urlObj;
495
- }
496
- const pathSegments = urlObj.pathname.split("/").filter(Boolean);
497
- if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
498
- pathSegments.shift();
499
- }
500
- if (locale === baseLocale) {
501
- urlObj.pathname = "/" + pathSegments.join("/");
502
- } else {
503
- urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
504
- }
505
- return urlObj;
506
- }
507
- function fillMissingUrlParts(url, match) {
508
- if (match.protocol.groups["0"]) {
509
- url.protocol = match.protocol.groups["0"] ?? "";
510
- }
511
- if (match.hostname.groups["0"]) {
512
- url.hostname = match.hostname.groups["0"] ?? "";
513
- }
514
- if (match.username.groups["0"]) {
515
- url.username = match.username.groups["0"] ?? "";
516
- }
517
- if (match.password.groups["0"]) {
518
- url.password = match.password.groups["0"] ?? "";
519
- }
520
- if (match.port.groups["0"]) {
521
- url.port = match.port.groups["0"] ?? "";
522
- }
523
- if (match.pathname.groups["0"]) {
524
- url.pathname = match.pathname.groups["0"] ?? "";
525
- }
526
- if (match.search.groups["0"]) {
527
- url.search = match.search.groups["0"] ?? "";
528
- }
529
- if (match.hash.groups["0"]) {
530
- url.hash = match.hash.groups["0"] ?? "";
531
- }
532
- return url;
533
- }
534
- function fillPattern(pattern, values, origin) {
535
- let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
536
- return `${protocol}#PORT-${port}#${slash}`;
537
- });
538
- let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
539
- if (modifier === "?") {
540
- return content;
541
- }
542
- return content;
543
- });
544
- let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
545
- const value = values[name];
546
- if (value === null) {
547
- return "";
548
- }
549
- if (modifier === "?") {
550
- return value !== undefined ? `${slash}${value}` : "";
551
- }
552
- if (modifier === "+" || modifier === "*") {
553
- if (value === undefined && modifier === "+") {
554
- throw new Error(`Missing value for "${name}" (one or more required)`);
555
- }
556
- return value ? `${slash}${value}` : "";
557
- }
558
- if (value === undefined) {
559
- throw new Error(`Missing value for "${name}"`);
560
- }
561
- return `${slash}${value}`;
562
- });
563
- filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
564
- return new URL(filled, origin);
565
- }
566
- function aggregateGroups(match) {
567
- return {
568
- ...match.hash.groups,
569
- ...match.hostname.groups,
570
- ...match.password.groups,
571
- ...match.pathname.groups,
572
- ...match.port.groups,
573
- ...match.protocol.groups,
574
- ...match.search.groups,
575
- ...match.username.groups
576
- };
577
- }
578
- var customServerStrategies = new Map;
579
- var customClientStrategies = new Map;
580
- function isCustomStrategy(strategy2) {
581
- return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
582
- }
583
-
584
148
  // ../../src/components/ui/theme-switcher.tsx
585
149
  import { jsx as jsx3, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
586
150
  var messages = {
@@ -597,9 +161,10 @@ var messages = {
597
161
  system: "Système"
598
162
  }
599
163
  };
600
- var themeMessages = (overrides) => ({
601
- ...getLocale().startsWith("fr") ? messages.fr : messages.en,
602
- ...overrides
164
+ var themeMessages = (locale, translations) => ({
165
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
166
+ ...translations?.[locale.split("-")[0] ?? locale],
167
+ ...translations?.[locale]
603
168
  });
604
169
  var DEFAULT_THEME = "system";
605
170
  var DEFAULT_SYSTEM_THEME = "light";
@@ -698,12 +263,13 @@ var useTheme = () => {
698
263
  return context;
699
264
  };
700
265
  var ThemeSwitcher = ({
266
+ locale = "en",
701
267
  messages: messages2,
702
268
  options = themes,
703
269
  value,
704
270
  onChange
705
271
  }) => {
706
- const labels = themeMessages(messages2);
272
+ const labels = themeMessages(locale, messages2);
707
273
  return /* @__PURE__ */ jsxs2(DropdownMenu, {
708
274
  children: [
709
275
  /* @__PURE__ */ jsx3(DropdownMenuTrigger, {
@@ -7,7 +7,8 @@ export interface VirtualizedComboboxMessages {
7
7
  selectMore: string;
8
8
  }
9
9
  export type VirtualizedComboboxMessageOverrides = Partial<VirtualizedComboboxMessages>;
10
- export declare const virtualizedComboboxMessages: (overrides?: VirtualizedComboboxMessageOverrides) => {
10
+ export type VirtualizedComboboxMessageTranslations = Partial<Record<string, VirtualizedComboboxMessageOverrides>>;
11
+ export declare const virtualizedComboboxMessages: (locale: string, translations?: VirtualizedComboboxMessageTranslations) => {
11
12
  clear: string;
12
13
  search: string;
13
14
  selected: (count: number) => string;
@@ -31,7 +32,8 @@ interface VirtualizedComboboxSharedProps<TData> {
31
32
  disabled?: boolean;
32
33
  emptyLabel: ReactNode;
33
34
  items: readonly VirtualizedComboboxOption<TData>[];
34
- messages?: VirtualizedComboboxMessageOverrides;
35
+ locale?: string;
36
+ messages?: VirtualizedComboboxMessageTranslations;
35
37
  onOpenChange?: (open: boolean) => void;
36
38
  onSearchValueChange?: (value: string) => void;
37
39
  open?: boolean;