unite-lib 1.0.3 → 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,
@@ -741,6 +744,31 @@ var UniteLib = (() => {
741
744
  ],
742
745
  "difficulty": 1
743
746
  },
747
+ {
748
+ "name": "Moltres",
749
+ "dex": 146,
750
+ "images": {
751
+ "main": "pokemons/roster-moltres.png",
752
+ "big": "pokemons/roster-moltres-2x.png",
753
+ "complete": "pokemons/stat-moltres.png",
754
+ "move_s11": "moves/moltres_s11.png",
755
+ "move_s21": "moves/moltres_s21.png"
756
+ },
757
+ "active": true,
758
+ "battleType": BattleType.ALLROUNDER,
759
+ "stats": {
760
+ "offense": 4,
761
+ "endurance": 2.5,
762
+ "mobility": 2,
763
+ "scoring": 2,
764
+ "support": 2
765
+ },
766
+ "tags": [
767
+ Tag.ALLROUNDER,
768
+ Tag.MELEE
769
+ ],
770
+ "difficulty": 2
771
+ },
744
772
  {
745
773
  "name": "Dragonite",
746
774
  "dex": 149,
@@ -769,7 +797,7 @@ var UniteLib = (() => {
769
797
  "difficulty": 1
770
798
  },
771
799
  {
772
- "name": "Mewtwo X",
800
+ "name": "Mega Mewtwo X",
773
801
  "dex": 150,
774
802
  "images": {
775
803
  "main": "pokemons/roster-mewtwox.png",
@@ -796,7 +824,7 @@ var UniteLib = (() => {
796
824
  "difficulty": 1
797
825
  },
798
826
  {
799
- "name": "Mewtwo Y",
827
+ "name": "Mega Mewtwo Y",
800
828
  "dex": 150,
801
829
  "images": {
802
830
  "main": "pokemons/roster-mewtwoy.png",
@@ -2406,22 +2434,37 @@ var UniteLib = (() => {
2406
2434
  // src/maps.ts
2407
2435
  var maps = [
2408
2436
  {
2409
- id: "remoat-stadium",
2410
- name: "Remoat Stadium",
2411
- image: "maps/remoat-stadium.png",
2412
- 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."
2413
2446
  },
2414
2447
  {
2415
- id: "theia-sky-ruins",
2448
+ id: "map-kyogre",
2416
2449
  name: "Theia Sky Ruins",
2417
- image: "maps/theia-sky-ruins.png",
2418
- 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."
2419
2457
  },
2420
2458
  {
2421
- id: "mer-stadium",
2422
- name: "Mer Stadium",
2423
- image: "maps/mer-stadium.png",
2424
- 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."
2425
2468
  }
2426
2469
  ];
2427
2470
  var maps_default = maps;
@@ -2433,6 +2476,12 @@ var UniteLib = (() => {
2433
2476
  const base = options?.baseUrl?.replace(/\/$/, "");
2434
2477
  return base ? `${base}/${path}` : path;
2435
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
+ }
2436
2485
  function getPokemonByName(name) {
2437
2486
  return pokemons_default.find((p) => p.name === name);
2438
2487
  }
@@ -2463,10 +2512,23 @@ var UniteLib = (() => {
2463
2512
  for (const p of pokemons_default) {
2464
2513
  names[slugFromMain(p.images.main)] = p.name;
2465
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
+ }
2466
2519
  var en_default = names;
2467
2520
 
2468
2521
  // src/i18n/pt-BR.ts
2469
- var ptBR = { ...en_default, zapdos: "Zapdos" };
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
+ };
2470
2532
  var pt_BR_default = ptBR;
2471
2533
 
2472
2534
  // src/i18n/ja-JP.ts
@@ -2557,7 +2619,14 @@ var UniteLib = (() => {
2557
2619
  armarouge: "\u30B0\u30EC\u30F3\u30A2\u30EB\u30DE",
2558
2620
  ceruledge: "\u30BD\u30A6\u30D6\u30EC\u30A4\u30BA",
2559
2621
  tinkaton: "\u30C7\u30AB\u30CC\u30C1\u30E3\u30F3",
2560
- 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"
2561
2630
  };
2562
2631
  var ja_JP_default = jaJP;
2563
2632
 
@@ -2649,7 +2718,14 @@ var UniteLib = (() => {
2649
2718
  armarouge: "Carmadura",
2650
2719
  ceruledge: "Malvalame",
2651
2720
  tinkaton: "Forgerette",
2652
- 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."
2653
2729
  };
2654
2730
  var fr_default = fr;
2655
2731
 
@@ -2741,7 +2817,14 @@ var UniteLib = (() => {
2741
2817
  armarouge: "Armarouge",
2742
2818
  ceruledge: "Ceruledge",
2743
2819
  tinkaton: "Tinkaton",
2744
- 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."
2745
2828
  };
2746
2829
  var es_default = es;
2747
2830
 
@@ -2757,6 +2840,15 @@ var UniteLib = (() => {
2757
2840
  const map = locales[locale] ?? en_default;
2758
2841
  return map[id] ?? en_default[id] ?? id;
2759
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
+ }
2760
2852
  return __toCommonJS(src_exports);
2761
2853
  })();
2762
2854
  //# sourceMappingURL=index.global.js.map