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/README.md CHANGED
@@ -47,18 +47,24 @@ const cdnImg = getImageUrl(pikachu, "main", {
47
47
  ### i18n (localized names)
48
48
 
49
49
  ```js
50
- import { getPokemonName } from "unite-lib";
50
+ import { getPokemonName, getMapName, getMapDescription } from "unite-lib";
51
51
  // or
52
- import { getPokemonName } from "unite-lib/i18n";
52
+ import { getPokemonName, getMapName, getMapDescription } from "unite-lib/i18n";
53
53
 
54
+ // Pokémon names
54
55
  getPokemonName("venusaur", "en"); // "Venusaur"
55
56
  getPokemonName("venusaur", "pt-BR"); // "Venusaur"
56
57
  getPokemonName("venusaur", "ja-JP"); // "フシギバナ"
57
58
  getPokemonName("venusaur", "fr"); // "Florizarre"
58
59
  getPokemonName("venusaur", "es"); // "Venusaur"
60
+
61
+ // Map names and descriptions (optional — use when you need localized UI)
62
+ getMapName("map-groudon", "en"); // "Theia Sky Ruins"
63
+ getMapName("map-groudon", "pt-BR"); // "Ruínas Celestes de Theia"
64
+ getMapDescription("map-groudon", "es"); // "Mapa 5v5 con Groudon."
59
65
  ```
60
66
 
61
- Supported locales: `en`, `pt-BR`, `ja-JP`, `fr`, `es`.
67
+ Supported locales: `en`, `pt-BR`, `ja-JP`, `fr`, `es`. Each map in `maps` has a default `name` and `description` (English); use `getMapName(mapId, locale)` and `getMapDescription(mapId, locale)` when you want to show them in another language.
62
68
 
63
69
  ## Content
64
70
 
@@ -84,7 +90,7 @@ Move images (slot 1 and 2, variants 1 and 2) per Pokémon.
84
90
 
85
91
  ### Maps
86
92
 
87
- Game map images (Remoat Stadium, Theia Sky Ruins, Mer Stadium, etc.).
93
+ Game map images (Theia Sky Ruins variants: Groudon, Kyogre, Rayquaza). Each map has multiple resolutions (1x, 2x, 4x); use `getMapImageUrl(map, resolution?, options?)` to pick one. Names and descriptions are available in all supported locales via `getMapName(mapId, locale)` and `getMapDescription(mapId, locale)` (see [i18n](#i18n-localized-names)).
88
94
 
89
95
  ![Map](https://raw.githubusercontent.com/cesaroeduardo/unite-lib/main/maps/groudon.png)
90
96
 
@@ -173,17 +179,20 @@ Asset URLs via jsDelivr (substitua `@latest` por uma versão se quiser):
173
179
  |--------|-------------|
174
180
  | `pokemons` | Full roster (name, dex, images, battleType, stats, tags, difficulty) |
175
181
  | `moves` | Move list (pokemonId, slotId, name, image) |
176
- | `maps` | Map list (id, name, image, description) |
182
+ | `maps` | Map list (id, name, image, images by resolution, description) |
177
183
  | `BattleType` | `attacker`, `defender`, `allrounder`, `speedster`, `supporter` |
178
184
  | `Tag` | Role + style: `attacker`, `defender`, `melee`, `ranged`, … |
179
185
  | `getImageUrl(pokemon, key, options?)` | Image path or full URL with `baseUrl` |
186
+ | `getMapImageUrl(map, resolution?, options?)` | Map image URL (resolution: `"1"`, `"2"`, `"4"`) |
180
187
  | `getPokemonByName(name)` | Find by display name |
181
188
  | `getPokemonByDex(dex)` | Find by Pokédex number |
182
189
  | `getPokemonBySlug(slug)` | Find by slug (e.g. `venusaur`) |
183
190
  | `getPokemonsByBattleType(type)` | Filter by BattleType |
184
191
  | `getPokemonsByTag(tag)` | Filter by Tag |
185
192
  | `getActivePokemons()` | Only active roster entries |
186
- | `getPokemonName(slug, locale)` | Localized name (from main package or `unite-lib/i18n`) |
193
+ | `getPokemonName(slug, locale)` | Localized Pokémon name (from main package or `unite-lib/i18n`) |
194
+ | `getMapName(mapId, locale)` | Localized map name |
195
+ | `getMapDescription(mapId, locale)` | Localized map description |
187
196
 
188
197
  ## Project structure
189
198
 
@@ -23,6 +23,8 @@ __export(i18n_exports, {
23
23
  en: () => en_default,
24
24
  es: () => es_default,
25
25
  fr: () => fr_default,
26
+ getMapDescription: () => getMapDescription,
27
+ getMapName: () => getMapName,
26
28
  getPokemonName: () => getPokemonName,
27
29
  jaJP: () => ja_JP_default,
28
30
  ptBR: () => pt_BR_default
@@ -2397,6 +2399,44 @@ var pokemons = [
2397
2399
  ];
2398
2400
  var pokemons_default = pokemons;
2399
2401
 
2402
+ // src/maps.ts
2403
+ var maps = [
2404
+ {
2405
+ id: "map-groudon",
2406
+ name: "Theia Sky Ruins",
2407
+ image: "maps/map-groudon/map-groudon@4x.png",
2408
+ images: {
2409
+ "1": "maps/map-groudon/map-groudon@1x.png",
2410
+ "2": "maps/map-groudon/map-groudon@2x.png",
2411
+ "4": "maps/map-groudon/map-groudon@4x.png"
2412
+ },
2413
+ description: "Map with Groudon."
2414
+ },
2415
+ {
2416
+ id: "map-kyogre",
2417
+ name: "Theia Sky Ruins",
2418
+ image: "maps/map-kyogre/map-kyogre@4x.png",
2419
+ images: {
2420
+ "1": "maps/map-kyogre/map-kyogre@1x.png",
2421
+ "2": "maps/map-kyogre/map-kyogre@2x.png",
2422
+ "4": "maps/map-kyogre/map-kyogre@4x.png"
2423
+ },
2424
+ description: "Map with Kyogre."
2425
+ },
2426
+ {
2427
+ id: "map-rayquaza",
2428
+ name: "Theia Sky Ruins",
2429
+ image: "maps/map-rayquaza/map-rayquaza@4x.png",
2430
+ images: {
2431
+ "1": "maps/map-rayquaza/map-rayquaza@1x.png",
2432
+ "2": "maps/map-rayquaza/map-rayquaza@2x.png",
2433
+ "4": "maps/map-rayquaza/map-rayquaza@4x.png"
2434
+ },
2435
+ description: "Map with Rayquaza."
2436
+ }
2437
+ ];
2438
+ var maps_default = maps;
2439
+
2400
2440
  // src/i18n/en.ts
2401
2441
  function slugFromMain(mainPath) {
2402
2442
  return mainPath.replace(/^pokemons\/roster-/, "").replace(/\.png$/, "");
@@ -2405,10 +2445,23 @@ var names = {};
2405
2445
  for (const p of pokemons_default) {
2406
2446
  names[slugFromMain(p.images.main)] = p.name;
2407
2447
  }
2448
+ for (const m of maps_default) {
2449
+ names[m.id] = m.name;
2450
+ if (m.description) names[`${m.id}.description`] = m.description;
2451
+ }
2408
2452
  var en_default = names;
2409
2453
 
2410
2454
  // src/i18n/pt-BR.ts
2411
- var ptBR = { ...en_default };
2455
+ var ptBR = {
2456
+ ...en_default,
2457
+ // Maps — names and descriptions
2458
+ "map-groudon": "Ru\xEDnas Celestes de Theia",
2459
+ "map-groudon.description": "Mapa 5v5 com Groudon.",
2460
+ "map-kyogre": "Ru\xEDnas Celestes de Theia",
2461
+ "map-kyogre.description": "Mapa 5v5 com Kyogre.",
2462
+ "map-rayquaza": "Ru\xEDnas Celestes de Theia",
2463
+ "map-rayquaza.description": "Mapa 5v5 com Rayquaza."
2464
+ };
2412
2465
  var pt_BR_default = ptBR;
2413
2466
 
2414
2467
  // src/i18n/ja-JP.ts
@@ -2499,7 +2552,14 @@ var jaJP = {
2499
2552
  armarouge: "\u30B0\u30EC\u30F3\u30A2\u30EB\u30DE",
2500
2553
  ceruledge: "\u30BD\u30A6\u30D6\u30EC\u30A4\u30BA",
2501
2554
  tinkaton: "\u30C7\u30AB\u30CC\u30C1\u30E3\u30F3",
2502
- miraidon: "\u30DF\u30E9\u30A4\u30C9\u30F3"
2555
+ miraidon: "\u30DF\u30E9\u30A4\u30C9\u30F3",
2556
+ // Maps — names and descriptions
2557
+ "map-groudon": "\u30C6\u30A4\u30A2\u306E\u5929\u7A7A\u907A\u8DE1",
2558
+ "map-groudon.description": "\u30B0\u30E9\u30FC\u30C9\u30F3\u304C\u767B\u5834\u3059\u308B5v5\u30DE\u30C3\u30D7\u3002",
2559
+ "map-kyogre": "\u30C6\u30A4\u30A2\u306E\u5929\u7A7A\u907A\u8DE1",
2560
+ "map-kyogre.description": "\u30AB\u30A4\u30AA\u30FC\u30AC\u304C\u767B\u5834\u3059\u308B5v5\u30DE\u30C3\u30D7\u3002",
2561
+ "map-rayquaza": "\u30C6\u30A4\u30A2\u306E\u5929\u7A7A\u907A\u8DE1",
2562
+ "map-rayquaza.description": "\u30EC\u30C3\u30AF\u30A6\u30B6\u304C\u767B\u5834\u3059\u308B5v5\u30DE\u30C3\u30D7\u3002"
2503
2563
  };
2504
2564
  var ja_JP_default = jaJP;
2505
2565
 
@@ -2591,7 +2651,14 @@ var fr = {
2591
2651
  armarouge: "Carmadura",
2592
2652
  ceruledge: "Malvalame",
2593
2653
  tinkaton: "Forgerette",
2594
- miraidon: "Miraidon"
2654
+ miraidon: "Miraidon",
2655
+ // Maps — names and descriptions
2656
+ "map-groudon": "Ruines C\xE9lestes de Theia",
2657
+ "map-groudon.description": "Carte 5v5 avec Groudon.",
2658
+ "map-kyogre": "Ruines C\xE9lestes de Theia",
2659
+ "map-kyogre.description": "Carte 5v5 avec Kyogre.",
2660
+ "map-rayquaza": "Ruines C\xE9lestes de Theia",
2661
+ "map-rayquaza.description": "Carte 5v5 avec Rayquaza."
2595
2662
  };
2596
2663
  var fr_default = fr;
2597
2664
 
@@ -2683,7 +2750,14 @@ var es = {
2683
2750
  armarouge: "Armarouge",
2684
2751
  ceruledge: "Ceruledge",
2685
2752
  tinkaton: "Tinkaton",
2686
- miraidon: "Miraidon"
2753
+ miraidon: "Miraidon",
2754
+ // Maps — names and descriptions
2755
+ "map-groudon": "Ruinas Celestiales de Theia",
2756
+ "map-groudon.description": "Mapa 5v5 con Groudon.",
2757
+ "map-kyogre": "Ruinas Celestiales de Theia",
2758
+ "map-kyogre.description": "Mapa 5v5 con Kyogre.",
2759
+ "map-rayquaza": "Ruinas Celestiales de Theia",
2760
+ "map-rayquaza.description": "Mapa 5v5 con Rayquaza."
2687
2761
  };
2688
2762
  var es_default = es;
2689
2763
 
@@ -2699,11 +2773,22 @@ function getPokemonName(id, locale = "en") {
2699
2773
  const map = locales[locale] ?? en_default;
2700
2774
  return map[id] ?? en_default[id] ?? id;
2701
2775
  }
2776
+ function getMapName(mapId, locale = "en") {
2777
+ const map = locales[locale] ?? en_default;
2778
+ return map[mapId] ?? en_default[mapId] ?? mapId;
2779
+ }
2780
+ function getMapDescription(mapId, locale = "en") {
2781
+ const key = `${mapId}.description`;
2782
+ const map = locales[locale] ?? en_default;
2783
+ return map[key] ?? en_default[key] ?? "";
2784
+ }
2702
2785
  // Annotate the CommonJS export names for ESM import in node:
2703
2786
  0 && (module.exports = {
2704
2787
  en,
2705
2788
  es,
2706
2789
  fr,
2790
+ getMapDescription,
2791
+ getMapName,
2707
2792
  getPokemonName,
2708
2793
  jaJP,
2709
2794
  ptBR