@kuncat/avoidant 0.2.2 → 0.2.4

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 (87) hide show
  1. package/dist/components/AvoidantGame.svelte +1 -2
  2. package/dist/components/MapControls.svelte +1 -1
  3. package/dist/components/board.svelte +38 -23
  4. package/dist/components/label-connectors.d.ts +6 -0
  5. package/dist/components/label-connectors.js +73 -0
  6. package/dist/components/map-camera.js +1 -1
  7. package/dist/paraglide/messages/_index.d.ts +8 -8
  8. package/dist/paraglide/messages/_index.js +9 -9
  9. package/dist/paraglide/messages/action_back.js +2 -2
  10. package/dist/paraglide/messages/action_copy.js +2 -2
  11. package/dist/paraglide/messages/action_exit.js +2 -2
  12. package/dist/paraglide/messages/action_invite.js +2 -2
  13. package/dist/paraglide/messages/action_join.js +2 -2
  14. package/dist/paraglide/messages/action_join_game.js +2 -2
  15. package/dist/paraglide/messages/action_new_game.js +2 -2
  16. package/dist/paraglide/messages/action_random.js +2 -2
  17. package/dist/paraglide/messages/action_start.js +2 -2
  18. package/dist/paraglide/messages/aria_close_invitation.js +2 -2
  19. package/dist/paraglide/messages/aria_score_summary.js +2 -2
  20. package/dist/paraglide/messages/cells_count.js +2 -2
  21. package/dist/paraglide/messages/cells_per_face.js +2 -2
  22. package/dist/paraglide/messages/default_player_name.js +2 -2
  23. package/dist/paraglide/messages/error_join_connect_failed.js +2 -2
  24. package/dist/paraglide/messages/error_join_failed.js +2 -2
  25. package/dist/paraglide/messages/error_join_ticket_invalid.js +2 -2
  26. package/dist/paraglide/messages/error_join_ticket_required.js +2 -2
  27. package/dist/paraglide/messages/faces_count.js +2 -2
  28. package/dist/paraglide/messages/field_cell_density.js +2 -2
  29. package/dist/paraglide/messages/field_invitation_url.js +2 -2
  30. package/dist/paraglide/messages/field_map_shape.js +2 -2
  31. package/dist/paraglide/messages/field_map_size.js +2 -2
  32. package/dist/paraglide/messages/field_player_name.js +2 -2
  33. package/dist/paraglide/messages/field_radius.js +2 -2
  34. package/dist/paraglide/messages/field_radius_x.js +2 -2
  35. package/dist/paraglide/messages/field_radius_y.js +2 -2
  36. package/dist/paraglide/messages/field_radius_z.js +2 -2
  37. package/dist/paraglide/messages/field_relay_servers.js +2 -2
  38. package/dist/paraglide/messages/field_seed.js +2 -2
  39. package/dist/paraglide/messages/field_size.js +2 -2
  40. package/dist/paraglide/messages/field_spikiness.js +2 -2
  41. package/dist/paraglide/messages/field_subdivisions.js +2 -2
  42. package/dist/paraglide/messages/field_surface_detail.js +2 -2
  43. package/dist/paraglide/messages/field_ticket_or_invitation_url.js +2 -2
  44. package/dist/paraglide/messages/field_tutorial_mode.js +2 -2
  45. package/dist/paraglide/messages/field_void_fraction.js +2 -2
  46. package/dist/paraglide/messages/label_advanced_settings.js +2 -2
  47. package/dist/paraglide/messages/label_players.js +2 -2
  48. package/dist/paraglide/messages/label_safe_cells_explored.js +2 -2
  49. package/dist/paraglide/messages/label_safe_cells_remaining.js +2 -2
  50. package/dist/paraglide/messages/label_score.js +2 -2
  51. package/dist/paraglide/messages/label_streak.js +2 -2
  52. package/dist/paraglide/messages/label_voids_discovered.js +2 -2
  53. package/dist/paraglide/messages/package.json +4 -0
  54. package/dist/paraglide/messages/preset_custom.js +2 -2
  55. package/dist/paraglide/messages/preset_large.js +2 -2
  56. package/dist/paraglide/messages/preset_medium.js +2 -2
  57. package/dist/paraglide/messages/preset_small.js +2 -2
  58. package/dist/paraglide/messages/shape_label.js +2 -2
  59. package/dist/paraglide/messages/status_generating_map.js +2 -2
  60. package/dist/paraglide/messages/status_initialization_failed.js +2 -2
  61. package/dist/paraglide/messages/status_joining_game.js +2 -2
  62. package/dist/paraglide/messages/status_loading.js +2 -2
  63. package/dist/paraglide/messages/status_preparing.js +2 -2
  64. package/dist/paraglide/messages/text_avoided.js +2 -2
  65. package/dist/paraglide/messages/text_density_summary.js +2 -2
  66. package/dist/paraglide/messages/text_invite_after_opening.js +2 -2
  67. package/dist/paraglide/messages/text_relay_servers_hint.js +2 -2
  68. package/dist/paraglide/messages/tutorial_action_dismiss.js +2 -2
  69. package/dist/paraglide/messages/tutorial_action_next.js +2 -2
  70. package/dist/paraglide/messages/tutorial_after_safe_deducible.js +2 -2
  71. package/dist/paraglide/messages/tutorial_after_safe_guess.js +2 -2
  72. package/dist/paraglide/messages/tutorial_after_void.js +2 -2
  73. package/dist/paraglide/messages/tutorial_awaiting_first_click.js +2 -2
  74. package/dist/paraglide/messages/tutorial_intro.d.ts +1 -1
  75. package/dist/paraglide/messages/tutorial_intro.js +5 -5
  76. package/dist/paraglide/messages/tutorial_won.js +2 -2
  77. package/dist/paraglide/registry.d.ts +13 -0
  78. package/dist/paraglide/registry.js +15 -0
  79. package/dist/paraglide/runtime.d.ts +90 -26
  80. package/dist/paraglide/runtime.js +597 -109
  81. package/dist/paraglide/server.d.ts +1 -1
  82. package/dist/paraglide/server.js +27 -10
  83. package/dist/wasm/avoidant_wasm.d.ts +56 -11
  84. package/dist/wasm/avoidant_wasm.js +325 -189
  85. package/dist/wasm/avoidant_wasm_bg.wasm +0 -0
  86. package/dist/wasm/avoidant_wasm_bg.wasm.d.ts +25 -11
  87. package/package.json +29 -29
@@ -1,20 +1,12 @@
1
1
  /**
2
- * Returns the strategy to use for a specific URL.
3
- *
4
- * If no route strategy matches (or the matching rule is `exclude: true`),
5
- * the global strategy is returned.
2
+ * Returns the current server-side async local storage instance.
6
3
  *
7
- * @param {string | URL} url
8
- * @returns {typeof strategy}
9
- */
10
- export function getStrategyForUrl(url: string | URL): typeof strategy;
11
- /**
12
- * Returns whether the given URL is excluded from middleware i18n processing.
4
+ * Accessing the mutable value through a function keeps it observable when
5
+ * module interceptors wrap exported bindings and snapshot their initial value.
13
6
  *
14
- * @param {string | URL} url
15
- * @returns {boolean}
7
+ * @returns {ParaglideAsyncLocalStorage | undefined}
16
8
  */
17
- export function isExcludedByRouteStrategy(url: string | URL): boolean;
9
+ export function getServerAsyncLocalStorage(): ParaglideAsyncLocalStorage | undefined;
18
10
  /**
19
11
  * Sets the server side async local storage.
20
12
  *
@@ -134,7 +126,7 @@ export function extractLocaleFromUrl(url: URL | string): Locale | undefined;
134
126
  * For client-side UI components, use `localizeHref()` instead, which provides
135
127
  * a more convenient API with relative paths and automatic locale detection.
136
128
  *
137
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
129
+ * @see https://paraglidejs.com/i18n-routing
138
130
  *
139
131
  * @example
140
132
  * ```typescript
@@ -181,7 +173,7 @@ export function localizeUrl(url: string | URL, options?: {
181
173
  * For client-side UI components, use `deLocalizeHref()` instead, which provides
182
174
  * a more convenient API with relative paths.
183
175
  *
184
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
176
+ * @see https://paraglidejs.com/i18n-routing
185
177
  *
186
178
  * @example
187
179
  * ```typescript
@@ -219,6 +211,37 @@ export function deLocalizeUrl(url: string | URL): URL;
219
211
  * @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.
220
212
  */
221
213
  export function aggregateGroups(match: any): Record<string, string | null | undefined>;
214
+ /**
215
+ * Match route policy against both the public URL and its canonical URL.
216
+ *
217
+ * The function is deliberately separate from variables.js: configuration is
218
+ * inert data, while canonicalization and route selection form a routing layer.
219
+ *
220
+ * @param {string | URL} url
221
+ * @returns {{ match: string; strategy?: typeof strategy; exclude?: boolean } | undefined}
222
+ */
223
+ export function findMatchingRouteStrategy(url: string | URL): {
224
+ match: string;
225
+ strategy?: typeof strategy;
226
+ exclude?: boolean;
227
+ } | undefined;
228
+ /**
229
+ * Returns the strategy to use for a specific URL.
230
+ *
231
+ * If no route strategy matches (or the matching rule is `exclude: true`),
232
+ * the global strategy is returned.
233
+ *
234
+ * @param {string | URL} url
235
+ * @returns {typeof strategy}
236
+ */
237
+ export function getStrategyForUrl(url: string | URL): typeof strategy;
238
+ /**
239
+ * Returns whether the given URL is excluded from middleware i18n processing.
240
+ *
241
+ * @param {string | URL} url
242
+ * @returns {boolean}
243
+ */
244
+ export function isExcludedByRouteStrategy(url: string | URL): boolean;
222
245
  /**
223
246
  * @typedef {object} ShouldRedirectServerInput
224
247
  * @property {Request} request
@@ -246,7 +269,7 @@ export function aggregateGroups(match: any): Record<string, string | null | unde
246
269
  *
247
270
  * When called in the browser without arguments, the current `window.location.href` is used.
248
271
  *
249
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing#client-side-redirects
272
+ * @see https://paraglidejs.com/i18n-routing#redirects
250
273
  *
251
274
  * @example
252
275
  * // Client side usage (e.g. TanStack Router beforeLoad hook)
@@ -302,7 +325,7 @@ export function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedir
302
325
  * - Automatically detects current locale if not specified
303
326
  * - Handles string input/output instead of URL objects
304
327
  *
305
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
328
+ * @see https://paraglidejs.com/i18n-routing
306
329
  *
307
330
  * @example
308
331
  * ```typescript
@@ -344,7 +367,7 @@ export function localizeHref(href: string, options?: {
344
367
  * - Returns relative paths when possible
345
368
  * - Handles string input/output instead of URL objects
346
369
  *
347
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/i18n-routing
370
+ * @see https://paraglidejs.com/i18n-routing
348
371
  *
349
372
  * @example
350
373
  * ```typescript
@@ -390,7 +413,7 @@ export function trackMessageCall(safeModuleId: string, locale: Locale): void;
390
413
  * The function respects your `urlPatterns` configuration - if you have translated pathnames
391
414
  * (e.g., `/about` → `/ueber-uns` for German), it will generate the correct localized paths.
392
415
  *
393
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/static-site-generation
416
+ * @see https://paraglidejs.com/static-site-generation
394
417
  *
395
418
  * @example
396
419
  * // Basic usage - generate all locale variants for a list of paths
@@ -435,7 +458,7 @@ export function isCustomStrategy(strategy: unknown): boolean;
435
458
  /**
436
459
  * Defines a custom strategy that is executed on the server.
437
460
  *
438
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#write-your-own-strategy
461
+ * @see https://paraglidejs.com/strategy#write-your-own-strategy
439
462
  *
440
463
  * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
441
464
  * @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement
@@ -446,7 +469,7 @@ export function defineCustomServerStrategy(strategy: string, handler: CustomServ
446
469
  /**
447
470
  * Defines a custom strategy that is executed on the client.
448
471
  *
449
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#write-your-own-strategy
472
+ * @see https://paraglidejs.com/strategy#write-your-own-strategy
450
473
  *
451
474
  * @param {string} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.
452
475
  * @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the
@@ -509,6 +532,12 @@ export const urlPatterns: Array<{
509
532
  pattern: string;
510
533
  localized: Array<[Locale, string]>;
511
534
  }>;
535
+ /**
536
+ * Controls trailing slash canonicalization for localized URLs.
537
+ *
538
+ * @type {"always" | "never" | undefined}
539
+ */
540
+ export const trailingSlash: "always" | "never" | undefined;
512
541
  /**
513
542
  * @typedef {{
514
543
  * getStore(): {
@@ -543,14 +572,17 @@ export function overwriteGetLocale(fn: () => Locale): void;
543
572
  * Set the locale.
544
573
  *
545
574
  * Updates the locale using your configured strategies (cookie, localStorage, URL, etc.).
546
- * By default, this reloads the page on the client to reflect the new locale. Reloading
547
- * can be disabled by passing `reload: false` as an option, but you'll need to ensure
548
- * the UI updates to reflect the new locale.
575
+ * By default, this navigates the client to the localized URL or reloads the current
576
+ * document to reflect the new locale. `reload: false` is a narrow browser-only escape
577
+ * hatch for a fully client-rendered, non-URL-routed surface that owns its reactive
578
+ * updates and document state. It does not re-render the UI or update the document.
579
+ * Do not use it for normal locale pickers, URL-routed pages, or switching an SSR,
580
+ * SSG, or hydrated document. It is incompatible with per-locale builds.
549
581
  *
550
582
  * If any custom strategy's `setLocale` function is async, then this function
551
583
  * will become async as well.
552
584
  *
553
- * @see https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy
585
+ * @see https://paraglidejs.com/strategy
554
586
  *
555
587
  * @example
556
588
  * setLocale('en');
@@ -565,7 +597,7 @@ export function overwriteSetLocale(fn: SetLocaleFn): void;
565
597
  /**
566
598
  * The origin of the current URL.
567
599
  *
568
- * Defaults to "http://y.com" in non-browser environments. If this
600
+ * Defaults to "http://example.com" in non-browser environments. If this
569
601
  * behavior is not desired, the implementation can be overwritten
570
602
  * by `overwriteGetUrlOrigin()`.
571
603
  *
@@ -649,6 +681,38 @@ export type ExtractLocaleFromRequestOptions = {
649
681
  */
650
682
  effectiveRequestUrl?: string | URL | undefined;
651
683
  };
684
+ /**
685
+ * A small, deliberately conservative subset of URLPattern routing.
686
+ *
687
+ * The compiler emits routes such as `/:path(.*)?`, `/de/:path*`, or
688
+ * `https://example.com/:path*`. For those routes matching is equivalent to a
689
+ * pathname prefix check and (optionally) an origin check. Everything that has
690
+ * a dynamic host, a custom path regexp, or another URLPattern modifier keeps
691
+ * using the generic implementation above.
692
+ */
693
+ export type FastPathPattern = {
694
+ protocol: string | undefined;
695
+ hostname: string | undefined;
696
+ port: string | undefined;
697
+ pathnamePrefix: string;
698
+ pathMode: "segments" | "catch-all-optional" | "catch-all-required";
699
+ };
700
+ /**
701
+ * A small, deliberately conservative subset of URLPattern routing.
702
+ *
703
+ * The compiler emits routes such as `/:path(.*)?`, `/de/:path*`, or
704
+ * `https://example.com/:path*`. For those routes matching is equivalent to a
705
+ * pathname prefix check and (optionally) an origin check. Everything that has
706
+ * a dynamic host, a custom path regexp, or another URLPattern modifier keeps
707
+ * using the generic implementation above.
708
+ */
709
+ export type FastPathRoute = {
710
+ base: FastPathPattern;
711
+ localized: Array<{
712
+ locale: string;
713
+ pattern: FastPathPattern;
714
+ }>;
715
+ };
652
716
  export type BuiltInStrategy = "cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage";
653
717
  export type CustomStrategy = `custom_${string}`;
654
718
  export type Strategy = BuiltInStrategy | CustomStrategy;