@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.
- package/dist/components/ui/code-block.d.ts +8 -6
- package/dist/components/ui/code-block.js +44 -19
- package/dist/components/ui/copy-button.d.ts +9 -6
- package/dist/components/ui/copy-button.js +17 -8
- package/dist/components/ui/data-table.d.ts +9 -5
- package/dist/components/ui/data-table.js +90 -486
- package/dist/components/ui/editing-locale-switcher.d.ts +8 -4
- package/dist/components/ui/editing-locale-switcher.js +26 -448
- package/dist/components/ui/effect-form.d.ts +39 -10
- package/dist/components/ui/effect-form.js +171 -541
- package/dist/components/ui/error-component.d.ts +4 -2
- package/dist/components/ui/error-component.js +28 -450
- package/dist/components/ui/file-picker.d.ts +4 -2
- package/dist/components/ui/file-picker.js +27 -452
- package/dist/components/ui/form.d.ts +123 -71
- package/dist/components/ui/form.js +95 -476
- package/dist/components/ui/google-map.d.ts +3 -2
- package/dist/components/ui/google-map.js +6 -439
- package/dist/components/ui/icon-input.d.ts +50 -1
- package/dist/components/ui/icon-input.js +38 -448
- package/dist/components/ui/krakstack-provider.d.ts +9 -0
- package/dist/components/ui/krakstack-provider.js +28 -0
- package/dist/components/ui/loading.d.ts +7 -1
- package/dist/components/ui/loading.js +6 -438
- package/dist/components/ui/locale-switcher.d.ts +8 -4
- package/dist/components/ui/locale-switcher.js +35 -453
- package/dist/components/ui/pagination.d.ts +5 -3
- package/dist/components/ui/pagination.js +7 -439
- package/dist/components/ui/search-menu.d.ts +4 -2
- package/dist/components/ui/search-menu.js +8 -440
- package/dist/components/ui/theme-switcher.d.ts +5 -3
- package/dist/components/ui/theme-switcher.js +8 -440
- package/dist/components/ui/virtualized-combobox.d.ts +4 -2
- package/dist/components/ui/virtualized-combobox.js +17 -445
- package/dist/lib/docs.d.ts +2 -0
- package/dist/lib/docs.js +92 -481
- package/dist/lib/docs.server.js +4 -20
- package/dist/lib/documentation-toolkit.js +4 -20
- package/dist/lib/markdown/content.d.ts +4 -5
- package/dist/services/agent/client/index.js +81 -463
- package/dist/services/agent/client/widget.d.ts +6 -3
- package/dist/services/notification/client/index.js +11 -440
- package/dist/services/notification/client/notification-menu.d.ts +7 -4
- package/dist/services/notification/public.js +11 -440
- package/package.json +5 -1
- package/dist/paraglide/runtime.d.ts +0 -978
|
@@ -129,443 +129,8 @@ function InputGroupInput({
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// ../../src/paraglide/runtime.js
|
|
133
|
-
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
134
|
-
var baseLocale = "en";
|
|
135
|
-
var locales = ["en", "fr"];
|
|
136
|
-
var cookieName = "locale";
|
|
137
|
-
var cookieMaxAge = 34560000;
|
|
138
|
-
var cookieDomain = "";
|
|
139
|
-
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
140
|
-
var strategy = [
|
|
141
|
-
"url",
|
|
142
|
-
"cookie",
|
|
143
|
-
"preferredLanguage",
|
|
144
|
-
"baseLocale"
|
|
145
|
-
];
|
|
146
|
-
var routeStrategies = [
|
|
147
|
-
{
|
|
148
|
-
match: "/api/:path(.*)?",
|
|
149
|
-
exclude: true
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
match: "/sitemap.xml",
|
|
153
|
-
exclude: true
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
match: "/llms.txt",
|
|
157
|
-
exclude: true
|
|
158
|
-
}
|
|
159
|
-
];
|
|
160
|
-
var urlPatterns = [
|
|
161
|
-
{
|
|
162
|
-
pattern: "/:path(.*)?",
|
|
163
|
-
localized: [
|
|
164
|
-
[
|
|
165
|
-
"en",
|
|
166
|
-
"/en/:path(.*)?"
|
|
167
|
-
],
|
|
168
|
-
[
|
|
169
|
-
"fr",
|
|
170
|
-
"/fr/:path(.*)?"
|
|
171
|
-
]
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
];
|
|
175
|
-
var cachedRouteStrategyUrl;
|
|
176
|
-
var cachedRouteStrategy;
|
|
177
|
-
function findMatchingRouteStrategy(url) {
|
|
178
|
-
if (routeStrategies.length === 0) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
182
|
-
if (cachedRouteStrategyUrl === urlString) {
|
|
183
|
-
return cachedRouteStrategy;
|
|
184
|
-
}
|
|
185
|
-
const urlObject = new URL(urlString, "http://dummy.com");
|
|
186
|
-
let match;
|
|
187
|
-
for (const routeStrategy of routeStrategies) {
|
|
188
|
-
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
189
|
-
if (pattern.exec(urlObject.href)) {
|
|
190
|
-
match = routeStrategy;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
cachedRouteStrategyUrl = urlString;
|
|
195
|
-
cachedRouteStrategy = match;
|
|
196
|
-
return match;
|
|
197
|
-
}
|
|
198
|
-
function getStrategyForUrl(url) {
|
|
199
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
200
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
201
|
-
return routeStrategy.strategy;
|
|
202
|
-
}
|
|
203
|
-
return strategy;
|
|
204
|
-
}
|
|
205
|
-
var serverAsyncLocalStorage = undefined;
|
|
206
|
-
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
207
|
-
var experimentalStaticLocale = undefined;
|
|
208
|
-
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
209
|
-
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
210
|
-
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
211
|
-
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
212
|
-
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
213
|
-
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
214
|
-
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
215
|
-
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
216
|
-
var _locale;
|
|
217
|
-
var localeInitiallySet = false;
|
|
218
|
-
var getLocale = () => {
|
|
219
|
-
if (experimentalStaticLocale !== undefined) {
|
|
220
|
-
return experimentalStaticLocale;
|
|
221
|
-
}
|
|
222
|
-
if (serverAsyncLocalStorage) {
|
|
223
|
-
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
224
|
-
if (locale) {
|
|
225
|
-
return locale;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
let strategyToUse = strategy;
|
|
229
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
230
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
231
|
-
}
|
|
232
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
233
|
-
if (resolved) {
|
|
234
|
-
if (!localeInitiallySet) {
|
|
235
|
-
_locale = resolved;
|
|
236
|
-
localeInitiallySet = true;
|
|
237
|
-
setLocale(resolved, { reload: false });
|
|
238
|
-
}
|
|
239
|
-
return resolved;
|
|
240
|
-
}
|
|
241
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
242
|
-
};
|
|
243
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
244
|
-
let locale;
|
|
245
|
-
for (const strat of strategyToUse) {
|
|
246
|
-
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
247
|
-
locale = extractLocaleFromCookie();
|
|
248
|
-
} else if (strat === "baseLocale") {
|
|
249
|
-
locale = baseLocale;
|
|
250
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
251
|
-
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
252
|
-
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
253
|
-
locale = _locale;
|
|
254
|
-
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
255
|
-
locale = extractLocaleFromNavigator();
|
|
256
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
257
|
-
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
258
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
259
|
-
const handler = customClientStrategies.get(strat);
|
|
260
|
-
if (handler) {
|
|
261
|
-
const result = handler.getLocale();
|
|
262
|
-
if (result instanceof Promise) {
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
if (result !== undefined) {
|
|
266
|
-
return assertIsLocale(result);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const matchedLocale = toLocale(locale);
|
|
271
|
-
if (matchedLocale) {
|
|
272
|
-
return matchedLocale;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
var rtlLanguages = new Set([
|
|
278
|
-
"ar",
|
|
279
|
-
"dv",
|
|
280
|
-
"fa",
|
|
281
|
-
"he",
|
|
282
|
-
"ks",
|
|
283
|
-
"ku",
|
|
284
|
-
"ps",
|
|
285
|
-
"sd",
|
|
286
|
-
"ug",
|
|
287
|
-
"ur",
|
|
288
|
-
"yi"
|
|
289
|
-
]);
|
|
290
|
-
var navigateOrReload = (newLocation) => {
|
|
291
|
-
if (newLocation) {
|
|
292
|
-
window.location.href = newLocation;
|
|
293
|
-
} else {
|
|
294
|
-
window.location.reload();
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
var setLocale = (newLocale, options) => {
|
|
298
|
-
const optionsWithDefaults = {
|
|
299
|
-
reload: true,
|
|
300
|
-
...options
|
|
301
|
-
};
|
|
302
|
-
let currentLocale;
|
|
303
|
-
try {
|
|
304
|
-
currentLocale = getLocale();
|
|
305
|
-
} catch {}
|
|
306
|
-
const customSetLocalePromises = [];
|
|
307
|
-
let newLocation = undefined;
|
|
308
|
-
let strategyToUse = strategy;
|
|
309
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
310
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
311
|
-
}
|
|
312
|
-
for (const strat of strategyToUse) {
|
|
313
|
-
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
314
|
-
_locale = newLocale;
|
|
315
|
-
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
316
|
-
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
317
|
-
continue;
|
|
318
|
-
}
|
|
319
|
-
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
320
|
-
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
321
|
-
} else if (strat === "baseLocale") {
|
|
322
|
-
continue;
|
|
323
|
-
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
324
|
-
newLocation = localizeUrl(window.location.href, {
|
|
325
|
-
locale: newLocale
|
|
326
|
-
}).href;
|
|
327
|
-
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
328
|
-
localStorage.setItem(localStorageKey, newLocale);
|
|
329
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
330
|
-
const handler = customClientStrategies.get(strat);
|
|
331
|
-
if (handler) {
|
|
332
|
-
let result = handler.setLocale(newLocale);
|
|
333
|
-
if (result instanceof Promise) {
|
|
334
|
-
result = result.catch((error) => {
|
|
335
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
336
|
-
cause: error
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
customSetLocalePromises.push(result);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
const runReload = () => {
|
|
345
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
346
|
-
navigateOrReload(newLocation);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
if (customSetLocalePromises.length) {
|
|
350
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
351
|
-
runReload();
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
runReload();
|
|
355
|
-
return;
|
|
356
|
-
};
|
|
357
|
-
var getUrlOrigin = () => {
|
|
358
|
-
if (serverAsyncLocalStorage) {
|
|
359
|
-
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
360
|
-
} else if (typeof window !== "undefined") {
|
|
361
|
-
return window.location.origin;
|
|
362
|
-
}
|
|
363
|
-
return "http://fallback.com";
|
|
364
|
-
};
|
|
365
|
-
function toLocale(value) {
|
|
366
|
-
if (typeof value !== "string") {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
const lowerValue = value.toLowerCase();
|
|
370
|
-
for (const locale of locales) {
|
|
371
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
372
|
-
return locale;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
function assertIsLocale(input) {
|
|
378
|
-
const locale = toLocale(input);
|
|
379
|
-
if (locale)
|
|
380
|
-
return locale;
|
|
381
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
382
|
-
}
|
|
383
|
-
function extractLocaleFromCookie() {
|
|
384
|
-
if (typeof document === "undefined" || !document.cookie) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
388
|
-
const locale = match?.[2];
|
|
389
|
-
return toLocale(locale);
|
|
390
|
-
}
|
|
391
|
-
function extractLocaleFromNavigator() {
|
|
392
|
-
if (!navigator?.languages?.length) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
const languages = navigator.languages.map((lang) => ({
|
|
396
|
-
fullTag: lang,
|
|
397
|
-
baseTag: lang.split("-")[0]
|
|
398
|
-
}));
|
|
399
|
-
for (const lang of languages) {
|
|
400
|
-
const fullLocale = toLocale(lang.fullTag);
|
|
401
|
-
if (fullLocale) {
|
|
402
|
-
return fullLocale;
|
|
403
|
-
}
|
|
404
|
-
const baseLocale2 = toLocale(lang.baseTag);
|
|
405
|
-
if (baseLocale2) {
|
|
406
|
-
return baseLocale2;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
var cachedUrl;
|
|
412
|
-
var cachedLocale;
|
|
413
|
-
function extractLocaleFromUrl(url) {
|
|
414
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
415
|
-
if (cachedUrl === urlString) {
|
|
416
|
-
return cachedLocale;
|
|
417
|
-
}
|
|
418
|
-
let result;
|
|
419
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
420
|
-
result = defaultUrlPatternExtractLocale(url);
|
|
421
|
-
} else {
|
|
422
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
423
|
-
for (const element of urlPatterns) {
|
|
424
|
-
for (const [locale, localizedPattern] of element.localized) {
|
|
425
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
426
|
-
if (match) {
|
|
427
|
-
result = locale;
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
if (result)
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
cachedUrl = urlString;
|
|
436
|
-
cachedLocale = result;
|
|
437
|
-
return result;
|
|
438
|
-
}
|
|
439
|
-
function defaultUrlPatternExtractLocale(url) {
|
|
440
|
-
const urlObj = new URL(url, "http://dummy.com");
|
|
441
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
442
|
-
return toLocale(pathSegments[0]) || baseLocale;
|
|
443
|
-
}
|
|
444
|
-
function localizeUrl(url, options) {
|
|
445
|
-
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
446
|
-
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
447
|
-
return localizeUrlDefaultPattern(url, targetLocale);
|
|
448
|
-
}
|
|
449
|
-
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
450
|
-
for (const element of urlPatterns) {
|
|
451
|
-
for (const [, localizedPattern] of element.localized) {
|
|
452
|
-
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
453
|
-
if (!match) {
|
|
454
|
-
continue;
|
|
455
|
-
}
|
|
456
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
457
|
-
if (!targetPattern) {
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
461
|
-
return fillMissingUrlParts(localizedUrl, match);
|
|
462
|
-
}
|
|
463
|
-
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
464
|
-
if (unlocalizedMatch) {
|
|
465
|
-
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
466
|
-
if (targetPattern) {
|
|
467
|
-
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
468
|
-
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return urlObj;
|
|
473
|
-
}
|
|
474
|
-
function localizeUrlDefaultPattern(url, locale) {
|
|
475
|
-
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
476
|
-
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
477
|
-
if (currentLocale === locale) {
|
|
478
|
-
return urlObj;
|
|
479
|
-
}
|
|
480
|
-
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
481
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
482
|
-
pathSegments.shift();
|
|
483
|
-
}
|
|
484
|
-
if (locale === baseLocale) {
|
|
485
|
-
urlObj.pathname = "/" + pathSegments.join("/");
|
|
486
|
-
} else {
|
|
487
|
-
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
488
|
-
}
|
|
489
|
-
return urlObj;
|
|
490
|
-
}
|
|
491
|
-
function fillMissingUrlParts(url, match) {
|
|
492
|
-
if (match.protocol.groups["0"]) {
|
|
493
|
-
url.protocol = match.protocol.groups["0"] ?? "";
|
|
494
|
-
}
|
|
495
|
-
if (match.hostname.groups["0"]) {
|
|
496
|
-
url.hostname = match.hostname.groups["0"] ?? "";
|
|
497
|
-
}
|
|
498
|
-
if (match.username.groups["0"]) {
|
|
499
|
-
url.username = match.username.groups["0"] ?? "";
|
|
500
|
-
}
|
|
501
|
-
if (match.password.groups["0"]) {
|
|
502
|
-
url.password = match.password.groups["0"] ?? "";
|
|
503
|
-
}
|
|
504
|
-
if (match.port.groups["0"]) {
|
|
505
|
-
url.port = match.port.groups["0"] ?? "";
|
|
506
|
-
}
|
|
507
|
-
if (match.pathname.groups["0"]) {
|
|
508
|
-
url.pathname = match.pathname.groups["0"] ?? "";
|
|
509
|
-
}
|
|
510
|
-
if (match.search.groups["0"]) {
|
|
511
|
-
url.search = match.search.groups["0"] ?? "";
|
|
512
|
-
}
|
|
513
|
-
if (match.hash.groups["0"]) {
|
|
514
|
-
url.hash = match.hash.groups["0"] ?? "";
|
|
515
|
-
}
|
|
516
|
-
return url;
|
|
517
|
-
}
|
|
518
|
-
function fillPattern(pattern, values, origin) {
|
|
519
|
-
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
520
|
-
return `${protocol}#PORT-${port}#${slash}`;
|
|
521
|
-
});
|
|
522
|
-
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
523
|
-
if (modifier === "?") {
|
|
524
|
-
return content;
|
|
525
|
-
}
|
|
526
|
-
return content;
|
|
527
|
-
});
|
|
528
|
-
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
529
|
-
const value = values[name];
|
|
530
|
-
if (value === null) {
|
|
531
|
-
return "";
|
|
532
|
-
}
|
|
533
|
-
if (modifier === "?") {
|
|
534
|
-
return value !== undefined ? `${slash}${value}` : "";
|
|
535
|
-
}
|
|
536
|
-
if (modifier === "+" || modifier === "*") {
|
|
537
|
-
if (value === undefined && modifier === "+") {
|
|
538
|
-
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
539
|
-
}
|
|
540
|
-
return value ? `${slash}${value}` : "";
|
|
541
|
-
}
|
|
542
|
-
if (value === undefined) {
|
|
543
|
-
throw new Error(`Missing value for "${name}"`);
|
|
544
|
-
}
|
|
545
|
-
return `${slash}${value}`;
|
|
546
|
-
});
|
|
547
|
-
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
548
|
-
return new URL(filled, origin);
|
|
549
|
-
}
|
|
550
|
-
function aggregateGroups(match) {
|
|
551
|
-
return {
|
|
552
|
-
...match.hash.groups,
|
|
553
|
-
...match.hostname.groups,
|
|
554
|
-
...match.password.groups,
|
|
555
|
-
...match.pathname.groups,
|
|
556
|
-
...match.port.groups,
|
|
557
|
-
...match.protocol.groups,
|
|
558
|
-
...match.search.groups,
|
|
559
|
-
...match.username.groups
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
var customServerStrategies = new Map;
|
|
563
|
-
var customClientStrategies = new Map;
|
|
564
|
-
function isCustomStrategy(strategy2) {
|
|
565
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
566
|
-
}
|
|
567
|
-
|
|
568
132
|
// ../../src/components/ui/virtualized-combobox.tsx
|
|
133
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
569
134
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
570
135
|
"use client";
|
|
571
136
|
var messages = {
|
|
@@ -582,22 +147,24 @@ var messages = {
|
|
|
582
147
|
selectMore: "Sélectionner davantage"
|
|
583
148
|
}
|
|
584
149
|
};
|
|
585
|
-
var virtualizedComboboxMessages = (
|
|
586
|
-
...
|
|
587
|
-
...
|
|
150
|
+
var virtualizedComboboxMessages = (locale, translations) => ({
|
|
151
|
+
...locale.startsWith("fr") ? messages.fr : messages.en,
|
|
152
|
+
...translations?.[locale.split("-")[0] ?? locale],
|
|
153
|
+
...translations?.[locale]
|
|
588
154
|
});
|
|
589
155
|
var optionEquals = (item, selected) => item.value === selected.value;
|
|
590
156
|
var VirtualizedComboboxList = ({
|
|
591
157
|
emptyLabel,
|
|
592
158
|
groupSelections,
|
|
593
159
|
itemIndexRef,
|
|
160
|
+
locale = "en",
|
|
594
161
|
messages: messageOverrides,
|
|
595
162
|
renderItem,
|
|
596
163
|
selectedValues,
|
|
597
164
|
virtualizerRef
|
|
598
165
|
}) => {
|
|
599
166
|
const filteredItems = ComboboxPrimitive.useFilteredItems();
|
|
600
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
167
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
601
168
|
const itemEntries = filteredItems.map((item, index) => ({
|
|
602
169
|
kind: "item",
|
|
603
170
|
item,
|
|
@@ -707,12 +274,13 @@ var VirtualizedComboboxContent = ({
|
|
|
707
274
|
emptyLabel,
|
|
708
275
|
groupSelections,
|
|
709
276
|
itemIndexRef,
|
|
277
|
+
locale = "en",
|
|
710
278
|
messages: messageOverrides,
|
|
711
279
|
renderItem,
|
|
712
280
|
selectedValues,
|
|
713
281
|
virtualizerRef
|
|
714
282
|
}) => {
|
|
715
|
-
const labels = virtualizedComboboxMessages(messageOverrides);
|
|
283
|
+
const labels = virtualizedComboboxMessages(locale, messageOverrides);
|
|
716
284
|
return /* @__PURE__ */ jsx4(ComboboxPrimitive.Portal, {
|
|
717
285
|
children: /* @__PURE__ */ jsx4(ComboboxPrimitive.Positioner, {
|
|
718
286
|
align: "start",
|
|
@@ -736,6 +304,7 @@ var VirtualizedComboboxContent = ({
|
|
|
736
304
|
emptyLabel,
|
|
737
305
|
groupSelections,
|
|
738
306
|
itemIndexRef,
|
|
307
|
+
locale,
|
|
739
308
|
messages: messageOverrides,
|
|
740
309
|
renderItem,
|
|
741
310
|
selectedValues,
|
|
@@ -785,7 +354,7 @@ var useComboboxVirtualizerRef = (providedRef) => {
|
|
|
785
354
|
var VirtualizedComboboxSingle = (props) => {
|
|
786
355
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
787
356
|
const itemIndexRef = useRef(new Map);
|
|
788
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
357
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
789
358
|
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Root, {
|
|
790
359
|
disabled: props.disabled,
|
|
791
360
|
inputValue: props.searchValue,
|
|
@@ -826,7 +395,7 @@ var VirtualizedComboboxSingle = (props) => {
|
|
|
826
395
|
var VirtualizedComboboxMultiple = (props) => {
|
|
827
396
|
const virtualizerRef = useComboboxVirtualizerRef(props.virtualizerRef);
|
|
828
397
|
const itemIndexRef = useRef(new Map);
|
|
829
|
-
const labels = virtualizedComboboxMessages(props.messages);
|
|
398
|
+
const labels = virtualizedComboboxMessages(props.locale ?? "en", props.messages);
|
|
830
399
|
return /* @__PURE__ */ jsxs(ComboboxPrimitive.Root, {
|
|
831
400
|
disabled: props.disabled,
|
|
832
401
|
inputValue: props.searchValue,
|
|
@@ -866,14 +435,18 @@ var VirtualizedComboboxMultiple = (props) => {
|
|
|
866
435
|
});
|
|
867
436
|
};
|
|
868
437
|
function VirtualizedCombobox(props) {
|
|
438
|
+
const locale = useKrakstackLocale(props.locale);
|
|
869
439
|
return props.multiple ? /* @__PURE__ */ jsx4(VirtualizedComboboxMultiple, {
|
|
870
|
-
...props
|
|
440
|
+
...props,
|
|
441
|
+
locale
|
|
871
442
|
}) : /* @__PURE__ */ jsx4(VirtualizedComboboxSingle, {
|
|
872
|
-
...props
|
|
443
|
+
...props,
|
|
444
|
+
locale
|
|
873
445
|
});
|
|
874
446
|
}
|
|
875
447
|
|
|
876
448
|
// ../../src/components/ui/icon-input.tsx
|
|
449
|
+
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
877
450
|
import { jsx as jsx5, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
878
451
|
var IconifySearchResponse = Schema.Struct({
|
|
879
452
|
icons: Schema.Array(Schema.String)
|
|
@@ -896,6 +469,7 @@ var iconSearchAtoms = Atom.family((key) => {
|
|
|
896
469
|
var useIconSearchAtom = (collection, query) => useAtomValue(iconSearchAtoms(`${collection}\x00${query}`));
|
|
897
470
|
var labels = {
|
|
898
471
|
en: {
|
|
472
|
+
...virtualizedComboboxMessages("en"),
|
|
899
473
|
browse: "Browse Iconify",
|
|
900
474
|
empty: "No icons found.",
|
|
901
475
|
searchPlaceholder: "Search icons",
|
|
@@ -903,6 +477,7 @@ var labels = {
|
|
|
903
477
|
select: "Select icon"
|
|
904
478
|
},
|
|
905
479
|
fr: {
|
|
480
|
+
...virtualizedComboboxMessages("fr"),
|
|
906
481
|
browse: "Parcourir Iconify",
|
|
907
482
|
empty: "Aucune icône trouvée.",
|
|
908
483
|
searchPlaceholder: "Rechercher des icônes",
|
|
@@ -910,21 +485,28 @@ var labels = {
|
|
|
910
485
|
select: "Sélectionner une icône"
|
|
911
486
|
}
|
|
912
487
|
};
|
|
913
|
-
var iconInputLabels = () =>
|
|
488
|
+
var iconInputLabels = (locale, messages2) => ({
|
|
489
|
+
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
490
|
+
...messages2?.[locale.split("-")[0] ?? locale],
|
|
491
|
+
...messages2?.[locale]
|
|
492
|
+
});
|
|
914
493
|
var iconifyCollectionUrl = (collection) => `https://icon-sets.iconify.design/${encodeURIComponent(collection)}/`;
|
|
915
494
|
function IconInput({
|
|
916
495
|
collection = "lucide",
|
|
917
496
|
disabled,
|
|
918
497
|
id,
|
|
498
|
+
locale: localeOverride,
|
|
499
|
+
messages: messages2,
|
|
919
500
|
onValueChange,
|
|
920
501
|
value
|
|
921
502
|
}) {
|
|
503
|
+
const locale = useKrakstackLocale2(localeOverride);
|
|
922
504
|
const [isOpen, setIsOpen] = useState(false);
|
|
923
505
|
const [query, setQuery] = useState("");
|
|
924
506
|
const deferredQuery = useDeferredValue(query);
|
|
925
507
|
const iconSearchResult = useIconSearchAtom(collection, deferredQuery);
|
|
926
508
|
const icons = AsyncResult.isSuccess(iconSearchResult) ? iconSearchResult.value : [];
|
|
927
|
-
const copy = iconInputLabels();
|
|
509
|
+
const copy = iconInputLabels(locale, messages2);
|
|
928
510
|
const isWaiting = deferredQuery.trim() !== "" && AsyncResult.isWaiting(iconSearchResult);
|
|
929
511
|
const items = icons.map((icon) => ({ label: icon, value: icon }));
|
|
930
512
|
const selectedItem = value ? { label: value, value } : null;
|
|
@@ -959,7 +541,15 @@ function IconInput({
|
|
|
959
541
|
]
|
|
960
542
|
}),
|
|
961
543
|
items,
|
|
962
|
-
|
|
544
|
+
locale,
|
|
545
|
+
messages: {
|
|
546
|
+
[locale]: {
|
|
547
|
+
clear: copy.clear,
|
|
548
|
+
search: copy.searchPlaceholder,
|
|
549
|
+
selected: copy.selected,
|
|
550
|
+
selectMore: copy.selectMore
|
|
551
|
+
}
|
|
552
|
+
},
|
|
963
553
|
onOpenChange: (open) => {
|
|
964
554
|
setIsOpen(open);
|
|
965
555
|
if (open)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type KrakstackProviderProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
locale: string;
|
|
5
|
+
locales?: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const KrakstackProvider: ({ children, locale, locales, }: KrakstackProviderProps) => import("react").JSX.Element;
|
|
8
|
+
export declare const useKrakstackLocale: (locale?: string) => string;
|
|
9
|
+
export declare const useKrakstackLocales: (locales?: readonly string[]) => readonly string[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// ../../src/components/ui/krakstack-provider.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var KrakstackContext = createContext({
|
|
5
|
+
locale: "en",
|
|
6
|
+
locales: ["en"]
|
|
7
|
+
});
|
|
8
|
+
var KrakstackProvider = ({
|
|
9
|
+
children,
|
|
10
|
+
locale,
|
|
11
|
+
locales = [locale]
|
|
12
|
+
}) => /* @__PURE__ */ jsx(KrakstackContext.Provider, {
|
|
13
|
+
value: { locale, locales },
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
var useKrakstackLocale = (locale) => {
|
|
17
|
+
const context = useContext(KrakstackContext);
|
|
18
|
+
return locale ?? context.locale;
|
|
19
|
+
};
|
|
20
|
+
var useKrakstackLocales = (locales) => {
|
|
21
|
+
const context = useContext(KrakstackContext);
|
|
22
|
+
return locales ?? context.locales;
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
KrakstackProvider,
|
|
26
|
+
useKrakstackLocale,
|
|
27
|
+
useKrakstackLocales
|
|
28
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
type LoadingVariant = "centered" | "inline";
|
|
2
|
-
export
|
|
2
|
+
export type LoadingMessages = {
|
|
3
|
+
loading: string;
|
|
4
|
+
};
|
|
5
|
+
export type LoadingMessageTranslations = Partial<Record<string, Partial<LoadingMessages>>>;
|
|
6
|
+
export declare function Loading({ className, label, locale: localeOverride, messages, variant, }: {
|
|
3
7
|
className?: string | undefined;
|
|
4
8
|
label?: string | undefined;
|
|
9
|
+
locale?: string | undefined;
|
|
10
|
+
messages?: LoadingMessageTranslations | undefined;
|
|
5
11
|
variant?: LoadingVariant | undefined;
|
|
6
12
|
}): import("react").JSX.Element;
|
|
7
13
|
export {};
|