unite-lib 1.1.0 → 1.2.0

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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { Locale, getPokemonName } from './i18n/index.cjs';
1
+ export { Locale, getMapDescription, getMapName, getPokemonName } from './i18n/index.cjs';
2
2
 
3
3
  /**
4
4
  * Battle role in Pokémon Unite (Attacker, Defender, etc.).
@@ -74,12 +74,16 @@ interface Move {
74
74
  /** Image path (relative to package root or baseUrl). */
75
75
  image: string;
76
76
  }
77
+ /** Map image resolution (1x, 2x, 4x). */
78
+ type MapResolution = "1" | "2" | "4";
77
79
  /** Map/arena data. */
78
80
  interface Map {
79
81
  id: string;
80
82
  name: string;
81
- /** Image path (relative to package root or baseUrl). */
83
+ /** Default image path (e.g. 1x). Use getMapImageUrl for a specific resolution. */
82
84
  image: string;
85
+ /** Optional resolution variants (@1x, @2x, @4x). Keys are "1", "2", "4". */
86
+ images?: Partial<Record<MapResolution, string>>;
83
87
  /** Optional description. */
84
88
  description?: string;
85
89
  }
@@ -99,6 +103,11 @@ interface GetImageUrlOptions {
99
103
  * Use baseUrl for CDN: e.g. "https://cdn.jsdelivr.net/npm/unite-lib@1.0.0"
100
104
  */
101
105
  declare function getImageUrl(pokemon: Pokemon, imageKey: keyof PokemonImages, options?: GetImageUrlOptions): string;
106
+ /**
107
+ * Returns the image URL for a map, optionally at a given resolution (1x, 2x, 4x).
108
+ * Falls back to map.image when resolution is omitted or not available.
109
+ */
110
+ declare function getMapImageUrl(map: Map, resolution?: MapResolution, options?: GetImageUrlOptions): string;
102
111
  declare function getPokemonByName(name: string): Pokemon | undefined;
103
112
  declare function getPokemonByDex(dex: number): Pokemon | undefined;
104
113
  /**
@@ -109,4 +118,4 @@ declare function getPokemonsByBattleType(battleType: BattleType): Pokemon[];
109
118
  declare function getPokemonsByTag(tag: Tag): Pokemon[];
110
119
  declare function getActivePokemons(): Pokemon[];
111
120
 
112
- export { BattleType, type GetImageUrlOptions, type Map, type Move, type MoveSlotId, type Pokemon, type PokemonImages, type PokemonStats, Tag, getActivePokemons, getImageUrl, getPokemonByDex, getPokemonByName, getPokemonBySlug, getPokemonsByBattleType, getPokemonsByTag, maps, moves, pokemons };
121
+ export { BattleType, type GetImageUrlOptions, type Map, type MapResolution, type Move, type MoveSlotId, type Pokemon, type PokemonImages, type PokemonStats, Tag, getActivePokemons, getImageUrl, getMapImageUrl, getPokemonByDex, getPokemonByName, getPokemonBySlug, getPokemonsByBattleType, getPokemonsByTag, maps, moves, pokemons };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Locale, getPokemonName } from './i18n/index.js';
1
+ export { Locale, getMapDescription, getMapName, getPokemonName } from './i18n/index.js';
2
2
 
3
3
  /**
4
4
  * Battle role in Pokémon Unite (Attacker, Defender, etc.).
@@ -74,12 +74,16 @@ interface Move {
74
74
  /** Image path (relative to package root or baseUrl). */
75
75
  image: string;
76
76
  }
77
+ /** Map image resolution (1x, 2x, 4x). */
78
+ type MapResolution = "1" | "2" | "4";
77
79
  /** Map/arena data. */
78
80
  interface Map {
79
81
  id: string;
80
82
  name: string;
81
- /** Image path (relative to package root or baseUrl). */
83
+ /** Default image path (e.g. 1x). Use getMapImageUrl for a specific resolution. */
82
84
  image: string;
85
+ /** Optional resolution variants (@1x, @2x, @4x). Keys are "1", "2", "4". */
86
+ images?: Partial<Record<MapResolution, string>>;
83
87
  /** Optional description. */
84
88
  description?: string;
85
89
  }
@@ -99,6 +103,11 @@ interface GetImageUrlOptions {
99
103
  * Use baseUrl for CDN: e.g. "https://cdn.jsdelivr.net/npm/unite-lib@1.0.0"
100
104
  */
101
105
  declare function getImageUrl(pokemon: Pokemon, imageKey: keyof PokemonImages, options?: GetImageUrlOptions): string;
106
+ /**
107
+ * Returns the image URL for a map, optionally at a given resolution (1x, 2x, 4x).
108
+ * Falls back to map.image when resolution is omitted or not available.
109
+ */
110
+ declare function getMapImageUrl(map: Map, resolution?: MapResolution, options?: GetImageUrlOptions): string;
102
111
  declare function getPokemonByName(name: string): Pokemon | undefined;
103
112
  declare function getPokemonByDex(dex: number): Pokemon | undefined;
104
113
  /**
@@ -109,4 +118,4 @@ declare function getPokemonsByBattleType(battleType: BattleType): Pokemon[];
109
118
  declare function getPokemonsByTag(tag: Tag): Pokemon[];
110
119
  declare function getActivePokemons(): Pokemon[];
111
120
 
112
- export { BattleType, type GetImageUrlOptions, type Map, type Move, type MoveSlotId, type Pokemon, type PokemonImages, type PokemonStats, Tag, getActivePokemons, getImageUrl, getPokemonByDex, getPokemonByName, getPokemonBySlug, getPokemonsByBattleType, getPokemonsByTag, maps, moves, pokemons };
121
+ export { BattleType, type GetImageUrlOptions, type Map, type MapResolution, type Move, type MoveSlotId, type Pokemon, type PokemonImages, type PokemonStats, Tag, getActivePokemons, getImageUrl, getMapImageUrl, getPokemonByDex, getPokemonByName, getPokemonBySlug, getPokemonsByBattleType, getPokemonsByTag, maps, moves, pokemons };
@@ -25,6 +25,9 @@ var UniteLib = (() => {
25
25
  Tag: () => Tag,
26
26
  getActivePokemons: () => getActivePokemons,
27
27
  getImageUrl: () => getImageUrl,
28
+ getMapDescription: () => getMapDescription,
29
+ getMapImageUrl: () => getMapImageUrl,
30
+ getMapName: () => getMapName,
28
31
  getPokemonByDex: () => getPokemonByDex,
29
32
  getPokemonByName: () => getPokemonByName,
30
33
  getPokemonBySlug: () => getPokemonBySlug,
@@ -2431,22 +2434,37 @@ var UniteLib = (() => {
2431
2434
  // src/maps.ts
2432
2435
  var maps = [
2433
2436
  {
2434
- id: "remoat-stadium",
2435
- name: "Remoat Stadium",
2436
- image: "maps/remoat-stadium.png",
2437
- description: "Standard 5v5 map."
2437
+ id: "map-groudon",
2438
+ name: "Theia Sky Ruins",
2439
+ image: "maps/map-groudon/map-groudon@4x.png",
2440
+ images: {
2441
+ "1": "maps/map-groudon/map-groudon@1x.png",
2442
+ "2": "maps/map-groudon/map-groudon@2x.png",
2443
+ "4": "maps/map-groudon/map-groudon@4x.png"
2444
+ },
2445
+ description: "Map with Groudon."
2438
2446
  },
2439
2447
  {
2440
- id: "theia-sky-ruins",
2448
+ id: "map-kyogre",
2441
2449
  name: "Theia Sky Ruins",
2442
- image: "maps/theia-sky-ruins.png",
2443
- description: "5v5 map with Rayquaza."
2450
+ image: "maps/map-kyogre/map-kyogre@4x.png",
2451
+ images: {
2452
+ "1": "maps/map-kyogre/map-kyogre@1x.png",
2453
+ "2": "maps/map-kyogre/map-kyogre@2x.png",
2454
+ "4": "maps/map-kyogre/map-kyogre@4x.png"
2455
+ },
2456
+ description: "Map with Kyogre."
2444
2457
  },
2445
2458
  {
2446
- id: "mer-stadium",
2447
- name: "Mer Stadium",
2448
- image: "maps/mer-stadium.png",
2449
- description: "Quick battle map."
2459
+ id: "map-rayquaza",
2460
+ name: "Theia Sky Ruins",
2461
+ image: "maps/map-rayquaza/map-rayquaza@4x.png",
2462
+ images: {
2463
+ "1": "maps/map-rayquaza/map-rayquaza@1x.png",
2464
+ "2": "maps/map-rayquaza/map-rayquaza@2x.png",
2465
+ "4": "maps/map-rayquaza/map-rayquaza@4x.png"
2466
+ },
2467
+ description: "Map with Rayquaza."
2450
2468
  }
2451
2469
  ];
2452
2470
  var maps_default = maps;
@@ -2458,6 +2476,12 @@ var UniteLib = (() => {
2458
2476
  const base = options?.baseUrl?.replace(/\/$/, "");
2459
2477
  return base ? `${base}/${path}` : path;
2460
2478
  }
2479
+ function getMapImageUrl(map, resolution, options) {
2480
+ const path = resolution && map.images?.[resolution] != null ? map.images[resolution] : map.image;
2481
+ if (path == null || path === "") return "";
2482
+ const base = options?.baseUrl?.replace(/\/$/, "");
2483
+ return base ? `${base}/${path}` : path;
2484
+ }
2461
2485
  function getPokemonByName(name) {
2462
2486
  return pokemons_default.find((p) => p.name === name);
2463
2487
  }
@@ -2488,10 +2512,23 @@ var UniteLib = (() => {
2488
2512
  for (const p of pokemons_default) {
2489
2513
  names[slugFromMain(p.images.main)] = p.name;
2490
2514
  }
2515
+ for (const m of maps_default) {
2516
+ names[m.id] = m.name;
2517
+ if (m.description) names[`${m.id}.description`] = m.description;
2518
+ }
2491
2519
  var en_default = names;
2492
2520
 
2493
2521
  // src/i18n/pt-BR.ts
2494
- var ptBR = { ...en_default };
2522
+ var ptBR = {
2523
+ ...en_default,
2524
+ // Maps — names and descriptions
2525
+ "map-groudon": "Ru\xEDnas Celestes de Theia",
2526
+ "map-groudon.description": "Mapa 5v5 com Groudon.",
2527
+ "map-kyogre": "Ru\xEDnas Celestes de Theia",
2528
+ "map-kyogre.description": "Mapa 5v5 com Kyogre.",
2529
+ "map-rayquaza": "Ru\xEDnas Celestes de Theia",
2530
+ "map-rayquaza.description": "Mapa 5v5 com Rayquaza."
2531
+ };
2495
2532
  var pt_BR_default = ptBR;
2496
2533
 
2497
2534
  // src/i18n/ja-JP.ts
@@ -2582,7 +2619,14 @@ var UniteLib = (() => {
2582
2619
  armarouge: "\u30B0\u30EC\u30F3\u30A2\u30EB\u30DE",
2583
2620
  ceruledge: "\u30BD\u30A6\u30D6\u30EC\u30A4\u30BA",
2584
2621
  tinkaton: "\u30C7\u30AB\u30CC\u30C1\u30E3\u30F3",
2585
- miraidon: "\u30DF\u30E9\u30A4\u30C9\u30F3"
2622
+ miraidon: "\u30DF\u30E9\u30A4\u30C9\u30F3",
2623
+ // Maps — names and descriptions
2624
+ "map-groudon": "\u30C6\u30A4\u30A2\u306E\u5929\u7A7A\u907A\u8DE1",
2625
+ "map-groudon.description": "\u30B0\u30E9\u30FC\u30C9\u30F3\u304C\u767B\u5834\u3059\u308B5v5\u30DE\u30C3\u30D7\u3002",
2626
+ "map-kyogre": "\u30C6\u30A4\u30A2\u306E\u5929\u7A7A\u907A\u8DE1",
2627
+ "map-kyogre.description": "\u30AB\u30A4\u30AA\u30FC\u30AC\u304C\u767B\u5834\u3059\u308B5v5\u30DE\u30C3\u30D7\u3002",
2628
+ "map-rayquaza": "\u30C6\u30A4\u30A2\u306E\u5929\u7A7A\u907A\u8DE1",
2629
+ "map-rayquaza.description": "\u30EC\u30C3\u30AF\u30A6\u30B6\u304C\u767B\u5834\u3059\u308B5v5\u30DE\u30C3\u30D7\u3002"
2586
2630
  };
2587
2631
  var ja_JP_default = jaJP;
2588
2632
 
@@ -2674,7 +2718,14 @@ var UniteLib = (() => {
2674
2718
  armarouge: "Carmadura",
2675
2719
  ceruledge: "Malvalame",
2676
2720
  tinkaton: "Forgerette",
2677
- miraidon: "Miraidon"
2721
+ miraidon: "Miraidon",
2722
+ // Maps — names and descriptions
2723
+ "map-groudon": "Ruines C\xE9lestes de Theia",
2724
+ "map-groudon.description": "Carte 5v5 avec Groudon.",
2725
+ "map-kyogre": "Ruines C\xE9lestes de Theia",
2726
+ "map-kyogre.description": "Carte 5v5 avec Kyogre.",
2727
+ "map-rayquaza": "Ruines C\xE9lestes de Theia",
2728
+ "map-rayquaza.description": "Carte 5v5 avec Rayquaza."
2678
2729
  };
2679
2730
  var fr_default = fr;
2680
2731
 
@@ -2766,7 +2817,14 @@ var UniteLib = (() => {
2766
2817
  armarouge: "Armarouge",
2767
2818
  ceruledge: "Ceruledge",
2768
2819
  tinkaton: "Tinkaton",
2769
- miraidon: "Miraidon"
2820
+ miraidon: "Miraidon",
2821
+ // Maps — names and descriptions
2822
+ "map-groudon": "Ruinas Celestiales de Theia",
2823
+ "map-groudon.description": "Mapa 5v5 con Groudon.",
2824
+ "map-kyogre": "Ruinas Celestiales de Theia",
2825
+ "map-kyogre.description": "Mapa 5v5 con Kyogre.",
2826
+ "map-rayquaza": "Ruinas Celestiales de Theia",
2827
+ "map-rayquaza.description": "Mapa 5v5 con Rayquaza."
2770
2828
  };
2771
2829
  var es_default = es;
2772
2830
 
@@ -2782,6 +2840,15 @@ var UniteLib = (() => {
2782
2840
  const map = locales[locale] ?? en_default;
2783
2841
  return map[id] ?? en_default[id] ?? id;
2784
2842
  }
2843
+ function getMapName(mapId, locale = "en") {
2844
+ const map = locales[locale] ?? en_default;
2845
+ return map[mapId] ?? en_default[mapId] ?? mapId;
2846
+ }
2847
+ function getMapDescription(mapId, locale = "en") {
2848
+ const key = `${mapId}.description`;
2849
+ const map = locales[locale] ?? en_default;
2850
+ return map[key] ?? en_default[key] ?? "";
2851
+ }
2785
2852
  return __toCommonJS(src_exports);
2786
2853
  })();
2787
2854
  //# sourceMappingURL=index.global.js.map