@hexah/skin-sdk 0.2.1 → 0.9.1

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
@@ -27,12 +27,32 @@ import { SCREEN_KEYS, SLOT_KEYS, DEFAULT_TEMPLATE, SKIN_API_VERSION } from '@hex
27
27
  - `SKIN_API_VERSION` — wersja kontraktu, którą deklaruje skórka (host odrzuca niezgodny major).
28
28
  - Typy JSDoc: `ReportListItem`, `ReportListView`, `ReportListResult`, `Pagination`, `SkinScreenProps`.
29
29
 
30
- Read-modele/usługi (`useReports`, `useSnackbar`, `useDialog`, `useShard`…), prymitywy UI
31
- (`PageBox`, `HexahChip`, `DataList`…) i `useSlots()` paczka udostępnia jako **typowane atrapy**
32
- dają podpowiedzi w edytorze, a realne implementacje dostarcza host w runtime (Module
33
- Federation, shareScope). Atrapa wywołana poza hostem rzuca jasny błąd: skórka działa wyłącznie
34
- wewnątrz aplikacji Hexah. Bundler skórki dzieli te paczki z `import: false`, więc atrapy nigdy
35
- nie trafiają do bundla.
30
+ ### Hooki danych (per strona gry)
31
+
32
+ | Strona | Hook |
33
+ | --- | --- |
34
+ | Aktualności / Kurier | `useArticles` |
35
+ | Harold (GPT) | `useGptThreads` |
36
+ | Operacje | `useTales` |
37
+ | Metropolia | `useTown` |
38
+ | Frakcje | `useGuild` |
39
+ | Kolonie | `useVillages` |
40
+ | Zgłoszenia | `useReports` |
41
+ | Konfiguracja | `useSettings` |
42
+ | Zaopatrzenie | `useShop` |
43
+ | Profil | `useAccountProfile` |
44
+
45
+ ### Stan i usługi
46
+
47
+ Read-modele stanu: `useShard`, `useShardUser`, `useCharacter`, `useAccount`, `usePageData`,
48
+ `useOnlineCharacters`. Usługi: `useSnackbar`, `useDialog`, `useGamePageShell`. Sloty hosta:
49
+ `useSlots()` + `SLOT_KEYS`. Prymitywy UI: `PageBox`, `HexahChip`, `DataList`, `HexahPagination`,
50
+ `AngularPanel`, `StandardButton`, `RoundAvatar`, `HexahCharacterSection`.
51
+
52
+ Wszystko paczka udostępnia jako **typowane atrapy** — dają podpowiedzi w edytorze, a realne
53
+ implementacje dostarcza host w runtime (Module Federation, shareScope). Atrapa wywołana poza
54
+ hostem rzuca jasny błąd: skórka działa wyłącznie wewnątrz aplikacji Hexah. Bundler skórki dzieli
55
+ te paczki z `import: false`, więc atrapy nigdy nie trafiają do bundla.
36
56
 
37
57
  ## Tworzenie skórki
38
58
 
package/index.js CHANGED
@@ -19,7 +19,7 @@
19
19
  * major. Bump: major = zmiana łamiąca powierzchnię, minor = dodanie zgodne wstecz,
20
20
  * patch = bez zmiany powierzchni.
21
21
  */
22
- const SKIN_API_VERSION = "0.2.0";
22
+ const SKIN_API_VERSION = "0.9.0";
23
23
 
24
24
  /** Domyślny szablon, gdy motyw nie ma własnego wariantu wizualnego. */
25
25
  const DEFAULT_TEMPLATE = "medieval";
@@ -98,6 +98,31 @@ const SLOT_KEYS = Object.freeze({
98
98
  * @property {Pagination} pagination
99
99
  */
100
100
 
101
+ /**
102
+ * @typedef {object} ArticleListView — paginacja listy artykułów (Aktualności/Kurier).
103
+ * @property {number} [page]
104
+ * @property {number} [pageSize]
105
+ */
106
+
107
+ /**
108
+ * @typedef {object} Article — artykuł (read-model); pola dodatkowe z `getBySlug`.
109
+ * @property {number} id
110
+ * @property {string} title
111
+ * @property {string} slug
112
+ * @property {boolean} [pinned]
113
+ * @property {{ url?: string, name?: string }} [cover]
114
+ * @property {string} [createdAt]
115
+ * @property {number} [heartCount]
116
+ * @property {number} [uniqueViewCount]
117
+ * @property {boolean} [userHasHeart]
118
+ */
119
+
120
+ /**
121
+ * @typedef {object} ArticleListResult
122
+ * @property {Article[]} results
123
+ * @property {Pagination} pagination
124
+ */
125
+
101
126
  /**
102
127
  * Kontrakt propsów ekranu skórki (komponent zarejestrowany pod `SCREEN_KEYS`).
103
128
  * Sloty (gotowe komponenty hosta) przychodzą w `slots`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexah/skin-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.9.1",
4
4
  "description": "Publiczny, wersjonowany kontrakt SDK skórek Hexah (stałe + typy). Implementacje dostarcza host w runtime.",
5
5
  "main": "index.js",
6
6
  "types": "index.js",
package/runtime-stubs.js CHANGED
@@ -58,6 +58,86 @@ const useDialog = hostProvided("useDialog");
58
58
  const useReports = hostProvided("useReports");
59
59
  /** @param {{ title?: string }} shell Ustawia tytuł/powłokę strony. @returns {void} */
60
60
  const useGamePageShell = hostProvided("useGamePageShell");
61
+ /**
62
+ * API artykułów (Aktualności/Kurier).
63
+ * @returns {{
64
+ * list: (data: import('./index').ArticleListView & { callback: (r:any)=>void }) => void,
65
+ * getBySlug: (data: { slug: string, callback: (r:any)=>void }) => void,
66
+ * recordView: (data: { slug: string, callback?: (r:any)=>void }) => void,
67
+ * markKurierRead: (data: { slug: string, callback?: (r:any)=>void }) => void,
68
+ * listComments: (data: { slug: string, page?: number, pageSize?: number, callback: (r:any)=>void }) => void,
69
+ * createComment: (data: { slug: string, body: string, callback: (r:any)=>void }) => void,
70
+ * toggleReaction: (data: { slug: string, callback: (r:any)=>void }) => void,
71
+ * }}
72
+ */
73
+ const useArticles = hostProvided("useArticles");
74
+ /**
75
+ * API wątków GPT (Harold).
76
+ * @returns {{
77
+ * list: (data: { page?: number, pageSize?: number, callback: (r:any)=>void }) => void,
78
+ * get: (data: { threadId: number, callback: (r:any)=>void }) => void,
79
+ * create: (data: { message: string, callback: (r:any)=>void }) => void,
80
+ * remove: (data: { threadId: number, callback: (r:any)=>void }) => void,
81
+ * sendMessage: (data: { threadId: number, message: string, callback: (r:any)=>void }) => void,
82
+ * }}
83
+ */
84
+ const useGptThreads = hostProvided("useGptThreads");
85
+ /**
86
+ * API opowieści/operacji (lista, wyszukiwanie, podgląd, ulubione/preferencje, dołącz/opuść,
87
+ * subskrypcja). Rozgrywka w pokoju sesji jest po stronie hosta (poza tą powierzchnią).
88
+ * @returns {{
89
+ * list: (data: { type?: string, filter?: string, page?: number, pageSize?: number, callback: (r:any)=>void }) => void,
90
+ * search: (data: { callback: (r:any)=>void }) => void,
91
+ * get: (data: { callback: (r:any)=>void }) => void,
92
+ * getFavorites: (data: { callback: (r:any)=>void }) => void,
93
+ * getPreferences: (data: { callback: (r:any)=>void }) => void,
94
+ * togglePreference: (data: { callback: (r:any)=>void }) => void,
95
+ * join: (data: { callback: (r:any)=>void }) => void,
96
+ * leave: (data: { callback: (r:any)=>void }) => void,
97
+ * toggleSubscribe: (data: { callback: (r:any)=>void }) => void,
98
+ * checkSubscribe: (data: { callback: (r:any)=>void }) => void,
99
+ * }}
100
+ */
101
+ const useTales = hostProvided("useTales");
102
+ /**
103
+ * API budynków Metropolii (bank, mesa, zielarz, Voltar, ratusz, warsztat, kuźnia, praca).
104
+ * Metody: bankSend, innRest, innBuyTravelerKit, healerPlantsList, healerHeal, voltarToolsList,
105
+ * voltarBuy, hallTypes, hallPriceList, hallBuy, workshopPlansList, workshopPlanGet,
106
+ * workshopCraftItem, forgePlansList, forgePlanGet, forgeCraftMaterial, workPerform.
107
+ * @returns {Record<string, (data: { callback: (r:any)=>void }) => void>}
108
+ */
109
+ const useTown = hostProvided("useTown");
110
+ /**
111
+ * API Frakcji (gildii): create, join, list, search, get, sendCrabs, headquartersRestInfo,
112
+ * headquartersRest, leave, getPermissions, specialActions, getProperties, hexmap (populacje/
113
+ * aktywność), provinceInfo, publicStats, warehouse (get/deposit/withdraw), materials
114
+ * (get/donate/distribute).
115
+ * @returns {Record<string, (data: { callback: (r:any)=>void }) => void>}
116
+ */
117
+ const useGuild = hostProvided("useGuild");
118
+ /**
119
+ * API Kolonii (osad): found, takeAbandoned, get, list, build (create/cost/upgrade/demolish/
120
+ * move/resetAll), depositCrabs, withdrawCrabs, sendResourcesToGuild, abandon, rebellionResolve,
121
+ * taxesSet, governorAssign, techniqueList, techniqueUpgrade, hexDecorationsUpdate, nameUpdate.
122
+ * @returns {Record<string, (data: { callback: (r:any)=>void }) => void>}
123
+ */
124
+ const useVillages = hostProvided("useVillages");
125
+ /**
126
+ * API Konfiguracji: updateSetting, setInvisibleOnline, updateNewsletterSubscription.
127
+ * @returns {Record<string, (data: { callback: (r:any)=>void }) => void>}
128
+ */
129
+ const useSettings = hostProvided("useSettings");
130
+ /**
131
+ * API sklepu (Zaopatrzenie): getOffers, getItems, buyItem, startPayment.
132
+ * @returns {Record<string, (data: { callback: (r:any)=>void }) => void>}
133
+ */
134
+ const useShop = hostProvided("useShop");
135
+ /**
136
+ * API Profilu/konta: getAccountInfo, getBlockedList, blockUser, unblockUser, linkDiscord,
137
+ * getGlobalStats.
138
+ * @returns {Record<string, (data: { callback: (r:any)=>void }) => void>}
139
+ */
140
+ const useAccountProfile = hostProvided("useAccountProfile");
61
141
 
62
142
  /* ---------- Sloty (host) ---------- */
63
143
  /** Provider slotów hosta (host montuje go sam; skórka go nie używa). */
@@ -118,6 +198,15 @@ module.exports = {
118
198
  useDialog,
119
199
  useReports,
120
200
  useGamePageShell,
201
+ useArticles,
202
+ useGptThreads,
203
+ useTales,
204
+ useTown,
205
+ useGuild,
206
+ useVillages,
207
+ useSettings,
208
+ useShop,
209
+ useAccountProfile,
121
210
  SlotsProvider,
122
211
  useSlots,
123
212
  PageBox,