@crockery/fellowship-components 0.1.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/LICENSE +21 -0
- package/README.md +126 -0
- package/RELEASING.md +75 -0
- package/THIRD_PARTY_LICENSES.md +79 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-condensed-latin-400-normal-DKyD6XsY.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-condensed-latin-500-normal-BqaLkUoX.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-condensed-latin-600-normal-CRd5VyFf.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-condensed-latin-700-normal-D8r4s4aS.woff2 +0 -0
- package/dist/chunks/data-source-CoIFvV72.js +10 -0
- package/dist/chunks/data-source-CoIFvV72.js.map +1 -0
- package/dist/chunks/decorate-B_ZTN9li.js +92 -0
- package/dist/chunks/decorate-B_ZTN9li.js.map +1 -0
- package/dist/chunks/dungeon-map-IPN6sEDj.js +1144 -0
- package/dist/chunks/dungeon-map-IPN6sEDj.js.map +1 -0
- package/dist/chunks/talent-calculator-Ch1Pbbba.js +1086 -0
- package/dist/chunks/talent-calculator-Ch1Pbbba.js.map +1 -0
- package/dist/chunks/tooltip-DoQVSnOn.js +412 -0
- package/dist/chunks/tooltip-DoQVSnOn.js.map +1 -0
- package/dist/data/data-source.d.ts +17 -0
- package/dist/data/data-source.d.ts.map +1 -0
- package/dist/data/package-data-source.d.ts +6 -0
- package/dist/data/package-data-source.d.ts.map +1 -0
- package/dist/data/package-talent-data-source.d.ts +6 -0
- package/dist/data/package-talent-data-source.d.ts.map +1 -0
- package/dist/data/talent-data-source.d.ts +11 -0
- package/dist/data/talent-data-source.d.ts.map +1 -0
- package/dist/dungeon-map/dungeon-map.d.ts +56 -0
- package/dist/dungeon-map/dungeon-map.d.ts.map +1 -0
- package/dist/dungeon-map/dungeon-map.styles.d.ts +2 -0
- package/dist/dungeon-map/dungeon-map.styles.d.ts.map +1 -0
- package/dist/dungeon-map/index.d.ts +5 -0
- package/dist/dungeon-map/index.d.ts.map +1 -0
- package/dist/dungeon-map/layout.d.ts +3 -0
- package/dist/dungeon-map/layout.d.ts.map +1 -0
- package/dist/dungeon-map/render-model.d.ts +7 -0
- package/dist/dungeon-map/render-model.d.ts.map +1 -0
- package/dist/dungeon-map/types.d.ts +107 -0
- package/dist/dungeon-map/types.d.ts.map +1 -0
- package/dist/dungeon-map/viewport-controller.d.ts +13 -0
- package/dist/dungeon-map/viewport-controller.d.ts.map +1 -0
- package/dist/dungeon-map.js +7 -0
- package/dist/dungeon-map.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/react/dungeon-map.d.ts +22 -0
- package/dist/react/dungeon-map.d.ts.map +1 -0
- package/dist/react/dungeon-map.js +180 -0
- package/dist/react/dungeon-map.js.map +1 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/talent-calculator.d.ts +22 -0
- package/dist/react/talent-calculator.d.ts.map +1 -0
- package/dist/react/talent-calculator.js +71 -0
- package/dist/react/talent-calculator.js.map +1 -0
- package/dist/react/tooltip.d.ts +15 -0
- package/dist/react/tooltip.d.ts.map +1 -0
- package/dist/react/tooltip.js +26 -0
- package/dist/react/tooltip.js.map +1 -0
- package/dist/react.js +4 -0
- package/dist/styles/field-manual-fonts.d.ts +3 -0
- package/dist/styles/field-manual-fonts.d.ts.map +1 -0
- package/dist/styles/field-manual.styles.d.ts +3 -0
- package/dist/styles/field-manual.styles.d.ts.map +1 -0
- package/dist/talent-calculator/index.d.ts +5 -0
- package/dist/talent-calculator/index.d.ts.map +1 -0
- package/dist/talent-calculator/render-model.d.ts +5 -0
- package/dist/talent-calculator/render-model.d.ts.map +1 -0
- package/dist/talent-calculator/selection-state.d.ts +10 -0
- package/dist/talent-calculator/selection-state.d.ts.map +1 -0
- package/dist/talent-calculator/talent-calculator.d.ts +51 -0
- package/dist/talent-calculator/talent-calculator.d.ts.map +1 -0
- package/dist/talent-calculator/talent-calculator.styles.d.ts +2 -0
- package/dist/talent-calculator/talent-calculator.styles.d.ts.map +1 -0
- package/dist/talent-calculator/types.d.ts +92 -0
- package/dist/talent-calculator/types.d.ts.map +1 -0
- package/dist/talent-calculator.js +7 -0
- package/dist/talent-calculator.js.map +1 -0
- package/dist/tooltip/index.d.ts +6 -0
- package/dist/tooltip/index.d.ts.map +1 -0
- package/dist/tooltip/positioning.d.ts +23 -0
- package/dist/tooltip/positioning.d.ts.map +1 -0
- package/dist/tooltip/rich-text.d.ts +4 -0
- package/dist/tooltip/rich-text.d.ts.map +1 -0
- package/dist/tooltip/tooltip.d.ts +33 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.styles.d.ts +2 -0
- package/dist/tooltip/tooltip.styles.d.ts.map +1 -0
- package/dist/tooltip/types.d.ts +19 -0
- package/dist/tooltip/types.d.ts.map +1 -0
- package/dist/tooltip.js +7 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +149 -0
- package/src/dungeon-map/README.md +168 -0
- package/src/talent-calculator/README.md +190 -0
- package/src/tooltip/README.md +113 -0
|
@@ -0,0 +1,1086 @@
|
|
|
1
|
+
import { t as e } from "./data-source-CoIFvV72.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "./decorate-B_ZTN9li.js";
|
|
3
|
+
import { a as i, n as a } from "./tooltip-DoQVSnOn.js";
|
|
4
|
+
import { findImage as o, getAssetUrl as s } from "@crockery/fellowship-data";
|
|
5
|
+
import { LitElement as c, css as l, html as u, nothing as d } from "lit";
|
|
6
|
+
import { customElement as f, property as p, state as m } from "lit/decorators.js";
|
|
7
|
+
import { repeat as h } from "lit/directives/repeat.js";
|
|
8
|
+
//#region src/data/package-talent-data-source.ts
|
|
9
|
+
var g, _ = (t) => {
|
|
10
|
+
if (t?.aborted) throw new e("aborted", "The hero talent data request was aborted.", t.reason);
|
|
11
|
+
}, v = () => (g ??= Promise.all([
|
|
12
|
+
import("@crockery/fellowship-data/heroes"),
|
|
13
|
+
import("@crockery/fellowship-data/talents"),
|
|
14
|
+
import("@crockery/fellowship-data/manifest")
|
|
15
|
+
]).then(([t, n, r]) => {
|
|
16
|
+
let i = r.default;
|
|
17
|
+
if (i.schemaVersion !== 1) throw new e("unsupported-schema", `Unsupported fellowship-data schema version: ${String(i.schemaVersion)}.`);
|
|
18
|
+
let a = /* @__PURE__ */ new Map();
|
|
19
|
+
for (let e of n.default) {
|
|
20
|
+
let t = a.get(e.parentId) ?? [];
|
|
21
|
+
t.push(e), a.set(e.parentId, t);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
manifest: i,
|
|
25
|
+
heroes: new Map(t.default.map((e) => [e.id, e])),
|
|
26
|
+
talentsByHero: new Map([...a].map(([e, t]) => [e, t]))
|
|
27
|
+
};
|
|
28
|
+
}).catch((t) => {
|
|
29
|
+
throw g = void 0, t instanceof e ? t : new e("data-load-failed", "Unable to load hero talents from @crockery/fellowship-data.", t);
|
|
30
|
+
}), g), y = (t = {}) => ({
|
|
31
|
+
async loadHeroTalents(t, n) {
|
|
32
|
+
_(n);
|
|
33
|
+
let r = await v();
|
|
34
|
+
_(n);
|
|
35
|
+
let i = r.heroes.get(t);
|
|
36
|
+
if (!i) throw new e("hero-not-found", `No hero with ID “${t}” exists in @crockery/fellowship-data.`);
|
|
37
|
+
return {
|
|
38
|
+
manifest: r.manifest,
|
|
39
|
+
hero: i,
|
|
40
|
+
talents: r.talentsByHero.get(t) ?? []
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
resolveAssetUrl(e) {
|
|
44
|
+
return t.assetBaseUrl ? s(e, { baseUrl: t.assetBaseUrl }) : s(e);
|
|
45
|
+
}
|
|
46
|
+
}), b = [
|
|
47
|
+
"I",
|
|
48
|
+
"II",
|
|
49
|
+
"III",
|
|
50
|
+
"IV",
|
|
51
|
+
"V",
|
|
52
|
+
"VI"
|
|
53
|
+
], x = (e) => b[e - 1] ?? String(e), S = (e, t, n) => ({
|
|
54
|
+
code: e,
|
|
55
|
+
message: n,
|
|
56
|
+
talentId: t.id
|
|
57
|
+
}), C = (e, t) => {
|
|
58
|
+
let n = [], r = /* @__PURE__ */ new Set(), i = [];
|
|
59
|
+
for (let a of e.talents) {
|
|
60
|
+
if (a.row === null && a.column === null) continue;
|
|
61
|
+
if (!Number.isInteger(a.row) || !Number.isInteger(a.column) || a.row === null || a.column === null || a.row < 1 || a.row > 6 || a.column < 1 || a.column > 3) {
|
|
62
|
+
n.push(S("invalid-position", a, `Talent “${a.id}” has an invalid row or column and was skipped.`));
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let e = `${a.row}:${a.column}`;
|
|
66
|
+
if (r.has(e)) {
|
|
67
|
+
n.push(S("duplicate-position", a, `Talent “${a.id}” duplicates row ${a.row}, column ${a.column} and was skipped.`));
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
r.add(e);
|
|
71
|
+
let s = Number.isInteger(a.pointCost) && (a.pointCost ?? 0) > 0 ? a.pointCost : null;
|
|
72
|
+
s === null && n.push(S("invalid-cost", a, `Talent “${a.id}” has an invalid point cost.`)), a.name || n.push(S("missing-name", a, `Talent “${a.id}” has no display name.`)), a.description || n.push(S("missing-description", a, `Talent “${a.id}” has no description.`));
|
|
73
|
+
let c = o(a.images, {
|
|
74
|
+
type: "talent",
|
|
75
|
+
size: "200"
|
|
76
|
+
}) ?? o(a.images, {
|
|
77
|
+
type: "talent",
|
|
78
|
+
size: "full"
|
|
79
|
+
}), l = null;
|
|
80
|
+
if (!c) n.push(S("missing-image", a, `Talent “${a.id}” has no icon.`));
|
|
81
|
+
else try {
|
|
82
|
+
l = t.resolveAssetUrl(c);
|
|
83
|
+
} catch (e) {
|
|
84
|
+
n.push(S("asset-url-error", a, `The icon URL for talent “${a.id}” could not be resolved: ${String(e)}.`));
|
|
85
|
+
}
|
|
86
|
+
i.push({
|
|
87
|
+
talent: a,
|
|
88
|
+
row: a.row,
|
|
89
|
+
column: a.column,
|
|
90
|
+
pointCost: s,
|
|
91
|
+
imageUrl: l
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
i.sort((e, t) => e.row - t.row || e.column - t.column);
|
|
95
|
+
let a = new Map(i.map((e) => [e.talent.id, e])), s = [...new Set(i.map(({ row: e }) => e))].map((e) => ({
|
|
96
|
+
row: e,
|
|
97
|
+
label: x(e),
|
|
98
|
+
talents: i.filter((t) => t.row === e)
|
|
99
|
+
}));
|
|
100
|
+
return {
|
|
101
|
+
hero: e.hero,
|
|
102
|
+
rows: s,
|
|
103
|
+
talentById: a,
|
|
104
|
+
warnings: n
|
|
105
|
+
};
|
|
106
|
+
}, w = 14, T = (e) => Math.min(14, Math.max(0, Math.round(Number.isFinite(e) ? e : 14))), E = (e, t) => {
|
|
107
|
+
let n = new Set(t), r = [...e.talentById.values()].filter(({ talent: e }) => n.has(e.id)).map(({ talent: e }) => e.id), i = new Set(r);
|
|
108
|
+
return {
|
|
109
|
+
selectedTalentIds: r,
|
|
110
|
+
removedTalentIds: [...new Set(t)].filter((e) => !i.has(e))
|
|
111
|
+
};
|
|
112
|
+
}, D = (e, t, n) => {
|
|
113
|
+
let r = new Set(t), i = [...e.talentById.values()].reduce((e, t) => r.has(t.talent.id) && t.pointCost !== null ? e + t.pointCost : e, 0), a = n - i;
|
|
114
|
+
return {
|
|
115
|
+
selectedTalentIds: [...e.talentById.values()].filter(({ talent: e }) => r.has(e.id)).map(({ talent: e }) => e.id),
|
|
116
|
+
spentPoints: i,
|
|
117
|
+
remainingPoints: a,
|
|
118
|
+
overBudget: a < 0
|
|
119
|
+
};
|
|
120
|
+
}, O = (e, t) => e !== null && !t.overBudget && e <= t.remainingPoints, k = l`
|
|
121
|
+
:host {
|
|
122
|
+
--fellowship-talent-background: var(--_fellowship-field-canvas);
|
|
123
|
+
--fellowship-talent-surface: var(--_fellowship-field-surface);
|
|
124
|
+
--fellowship-talent-card-background: var(--_fellowship-field-surface);
|
|
125
|
+
--fellowship-talent-card-selected-background: color-mix(
|
|
126
|
+
in srgb,
|
|
127
|
+
var(--_fellowship-field-surface-raised) 88%,
|
|
128
|
+
var(--_fellowship-field-accent)
|
|
129
|
+
);
|
|
130
|
+
--fellowship-talent-foreground: var(--_fellowship-field-ink);
|
|
131
|
+
--fellowship-talent-muted: var(--_fellowship-field-muted);
|
|
132
|
+
--fellowship-talent-disabled: var(--_fellowship-field-tertiary);
|
|
133
|
+
--fellowship-talent-border: var(--_fellowship-field-border);
|
|
134
|
+
--fellowship-talent-selection: var(--_fellowship-field-accent);
|
|
135
|
+
--fellowship-talent-focus: var(--_fellowship-field-focus);
|
|
136
|
+
--fellowship-talent-points: var(--_fellowship-field-brass);
|
|
137
|
+
--fellowship-talent-danger: var(--_fellowship-field-ember);
|
|
138
|
+
--fellowship-talent-control-surface: var(--_fellowship-field-inset);
|
|
139
|
+
--fellowship-talent-icon-size: 56px;
|
|
140
|
+
--fellowship-talent-font-family: var(--_fellowship-field-font-family);
|
|
141
|
+
--fellowship-talent-tactical-font-family: var(--_fellowship-field-mono-font-family);
|
|
142
|
+
--fellowship-talent-radius: var(--_fellowship-field-radius);
|
|
143
|
+
|
|
144
|
+
display: block;
|
|
145
|
+
min-width: 0;
|
|
146
|
+
container-type: inline-size;
|
|
147
|
+
color: var(--fellowship-talent-foreground);
|
|
148
|
+
font-family: var(--fellowship-talent-font-family);
|
|
149
|
+
-webkit-font-smoothing: antialiased;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:host([hidden]) {
|
|
153
|
+
display: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
*,
|
|
157
|
+
*::before,
|
|
158
|
+
*::after {
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
button {
|
|
163
|
+
font: inherit;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.container {
|
|
167
|
+
min-width: 0;
|
|
168
|
+
padding: 16px;
|
|
169
|
+
border-radius: calc(var(--fellowship-talent-radius) + 2px);
|
|
170
|
+
background: var(--fellowship-talent-background);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.header {
|
|
174
|
+
min-height: 72px;
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
justify-content: space-between;
|
|
178
|
+
gap: 24px;
|
|
179
|
+
padding: 8px 8px 24px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.heading {
|
|
183
|
+
margin: 0;
|
|
184
|
+
color: var(--fellowship-talent-muted);
|
|
185
|
+
font-size: 12px;
|
|
186
|
+
font-weight: 600;
|
|
187
|
+
line-height: 16px;
|
|
188
|
+
letter-spacing: 0.12em;
|
|
189
|
+
text-transform: uppercase;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.points-cluster,
|
|
193
|
+
.point-controls {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.points-cluster {
|
|
199
|
+
gap: 16px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.points {
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: baseline;
|
|
205
|
+
gap: 4px;
|
|
206
|
+
color: var(--fellowship-talent-foreground);
|
|
207
|
+
font-family: var(--fellowship-talent-tactical-font-family);
|
|
208
|
+
font-size: 32px;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
line-height: 40px;
|
|
211
|
+
letter-spacing: -0.04em;
|
|
212
|
+
font-variant-numeric: tabular-nums;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.points-spent {
|
|
216
|
+
color: var(--fellowship-talent-points);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.points-separator,
|
|
220
|
+
.points-total {
|
|
221
|
+
color: var(--_fellowship-field-tertiary);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.points-separator {
|
|
225
|
+
font-size: 18px;
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.points[data-invalid="true"],
|
|
230
|
+
.points[data-invalid="true"] .points-spent {
|
|
231
|
+
color: var(--fellowship-talent-danger);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.point-controls {
|
|
235
|
+
gap: 4px;
|
|
236
|
+
padding: 2px;
|
|
237
|
+
border-radius: calc(var(--fellowship-talent-radius) + 2px);
|
|
238
|
+
background: var(--fellowship-talent-control-surface);
|
|
239
|
+
box-shadow: inset 0 0 0 1px var(--fellowship-talent-border);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.point-control {
|
|
243
|
+
width: 40px;
|
|
244
|
+
height: 40px;
|
|
245
|
+
display: inline-grid;
|
|
246
|
+
place-items: center;
|
|
247
|
+
padding: 0;
|
|
248
|
+
border: 0;
|
|
249
|
+
border-radius: 4px;
|
|
250
|
+
background: transparent;
|
|
251
|
+
color: var(--fellowship-talent-muted);
|
|
252
|
+
font-family: var(--fellowship-talent-tactical-font-family);
|
|
253
|
+
font-size: 18px;
|
|
254
|
+
font-weight: 500;
|
|
255
|
+
line-height: 1;
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
transition:
|
|
258
|
+
background-color 120ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
259
|
+
color 120ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
260
|
+
transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.point-control:active:not(:disabled) {
|
|
264
|
+
transform: scale(0.97);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.point-control:focus-visible,
|
|
268
|
+
.clear-all:focus-visible,
|
|
269
|
+
.talent:focus-visible,
|
|
270
|
+
.retry-button:focus-visible {
|
|
271
|
+
outline: 2px solid var(--fellowship-talent-focus);
|
|
272
|
+
outline-offset: 2px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.point-control:disabled {
|
|
276
|
+
color: var(--fellowship-talent-disabled);
|
|
277
|
+
cursor: not-allowed;
|
|
278
|
+
opacity: 0.48;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.clear-all {
|
|
282
|
+
min-height: 44px;
|
|
283
|
+
padding: 0 8px;
|
|
284
|
+
border: 0;
|
|
285
|
+
border-radius: 4px;
|
|
286
|
+
background: transparent;
|
|
287
|
+
color: var(--fellowship-talent-muted);
|
|
288
|
+
font-size: 12px;
|
|
289
|
+
font-weight: 600;
|
|
290
|
+
line-height: 1;
|
|
291
|
+
letter-spacing: 0.04em;
|
|
292
|
+
white-space: nowrap;
|
|
293
|
+
cursor: pointer;
|
|
294
|
+
transition:
|
|
295
|
+
background-color 120ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
296
|
+
color 120ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
297
|
+
transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.clear-all:active:not(:disabled) {
|
|
301
|
+
transform: scale(0.97);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.clear-all:disabled {
|
|
305
|
+
color: var(--fellowship-talent-disabled);
|
|
306
|
+
cursor: not-allowed;
|
|
307
|
+
opacity: 0.42;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.grid {
|
|
311
|
+
display: grid;
|
|
312
|
+
gap: 16px;
|
|
313
|
+
padding: 8px 0 0;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.row {
|
|
317
|
+
min-width: 0;
|
|
318
|
+
min-inline-size: 0;
|
|
319
|
+
width: 100%;
|
|
320
|
+
display: grid;
|
|
321
|
+
grid-template-columns: 48px minmax(0, 1fr);
|
|
322
|
+
align-items: stretch;
|
|
323
|
+
gap: 8px;
|
|
324
|
+
margin: 0;
|
|
325
|
+
padding: 0;
|
|
326
|
+
border: 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.row-label {
|
|
330
|
+
position: relative;
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: flex-start;
|
|
333
|
+
justify-content: center;
|
|
334
|
+
padding-top: 16px;
|
|
335
|
+
color: var(--fellowship-talent-disabled);
|
|
336
|
+
font-family: var(--fellowship-talent-tactical-font-family);
|
|
337
|
+
font-size: 11px;
|
|
338
|
+
font-weight: 600;
|
|
339
|
+
line-height: 16px;
|
|
340
|
+
text-align: center;
|
|
341
|
+
letter-spacing: 0.08em;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.row-label::before {
|
|
345
|
+
position: absolute;
|
|
346
|
+
inset: 0 0 0 auto;
|
|
347
|
+
width: 1px;
|
|
348
|
+
background: var(--fellowship-talent-border);
|
|
349
|
+
content: "";
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.row-label::after {
|
|
353
|
+
position: absolute;
|
|
354
|
+
top: 23px;
|
|
355
|
+
right: -3px;
|
|
356
|
+
width: 7px;
|
|
357
|
+
height: 1px;
|
|
358
|
+
background: var(--fellowship-talent-selection);
|
|
359
|
+
content: "";
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.row-talents {
|
|
363
|
+
min-width: 0;
|
|
364
|
+
display: grid;
|
|
365
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
366
|
+
gap: 8px;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
fellowship-tooltip {
|
|
370
|
+
display: block;
|
|
371
|
+
min-width: 0;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.talent {
|
|
375
|
+
position: relative;
|
|
376
|
+
width: 100%;
|
|
377
|
+
min-width: 0;
|
|
378
|
+
min-height: 88px;
|
|
379
|
+
display: grid;
|
|
380
|
+
grid-template-columns: var(--fellowship-talent-icon-size) minmax(0, 1fr);
|
|
381
|
+
align-items: center;
|
|
382
|
+
gap: 16px;
|
|
383
|
+
padding: 16px 36px 16px 16px;
|
|
384
|
+
overflow: hidden;
|
|
385
|
+
border: 1px solid transparent;
|
|
386
|
+
border-radius: var(--fellowship-talent-radius);
|
|
387
|
+
background: var(--fellowship-talent-card-background);
|
|
388
|
+
color: var(--fellowship-talent-foreground);
|
|
389
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fellowship-talent-border) 64%, transparent);
|
|
390
|
+
text-align: left;
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
transition:
|
|
393
|
+
background-color 140ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
394
|
+
box-shadow 140ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
395
|
+
transform 120ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
396
|
+
opacity 140ms linear;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.talent::before {
|
|
400
|
+
position: absolute;
|
|
401
|
+
top: 16px;
|
|
402
|
+
left: 0;
|
|
403
|
+
width: 2px;
|
|
404
|
+
height: 24px;
|
|
405
|
+
background: transparent;
|
|
406
|
+
content: "";
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.talent:active:not([aria-disabled="true"]) {
|
|
410
|
+
transform: scale(0.99);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.talent[aria-pressed="true"] {
|
|
414
|
+
background: var(--fellowship-talent-card-selected-background);
|
|
415
|
+
box-shadow: inset 0 0 0 1px
|
|
416
|
+
color-mix(in srgb, var(--fellowship-talent-selection) 32%, transparent);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.talent[aria-pressed="true"]::before {
|
|
420
|
+
background: var(--fellowship-talent-selection);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.talent[aria-disabled="true"] {
|
|
424
|
+
color: var(--fellowship-talent-disabled);
|
|
425
|
+
cursor: not-allowed;
|
|
426
|
+
opacity: 0.46;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.talent-icon,
|
|
430
|
+
.talent-icon-fallback {
|
|
431
|
+
width: var(--fellowship-talent-icon-size);
|
|
432
|
+
height: var(--fellowship-talent-icon-size);
|
|
433
|
+
border-radius: calc(var(--fellowship-talent-radius) - 2px);
|
|
434
|
+
box-shadow: inset 0 0 0 1px var(--fellowship-talent-border);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.talent-icon {
|
|
438
|
+
display: block;
|
|
439
|
+
object-fit: cover;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.talent-icon-fallback {
|
|
443
|
+
display: grid;
|
|
444
|
+
place-items: center;
|
|
445
|
+
background: var(--fellowship-talent-control-surface);
|
|
446
|
+
color: var(--fellowship-talent-muted);
|
|
447
|
+
font-family: var(--fellowship-talent-tactical-font-family);
|
|
448
|
+
font-size: 13px;
|
|
449
|
+
font-weight: 600;
|
|
450
|
+
letter-spacing: 0.08em;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.talent[aria-pressed="true"] .talent-icon,
|
|
454
|
+
.talent[aria-pressed="true"] .talent-icon-fallback {
|
|
455
|
+
box-shadow:
|
|
456
|
+
inset 0 0 0 1px var(--fellowship-talent-border),
|
|
457
|
+
0 0 0 1px color-mix(in srgb, var(--fellowship-talent-selection) 60%, transparent);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.talent-name {
|
|
461
|
+
min-width: 0;
|
|
462
|
+
overflow: hidden;
|
|
463
|
+
color: currentColor;
|
|
464
|
+
font-size: 16px;
|
|
465
|
+
font-weight: 600;
|
|
466
|
+
line-height: 24px;
|
|
467
|
+
text-overflow: ellipsis;
|
|
468
|
+
text-wrap: balance;
|
|
469
|
+
white-space: nowrap;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.talent-cost {
|
|
473
|
+
position: absolute;
|
|
474
|
+
top: 12px;
|
|
475
|
+
right: 12px;
|
|
476
|
+
color: var(--fellowship-talent-muted);
|
|
477
|
+
font-family: var(--fellowship-talent-tactical-font-family);
|
|
478
|
+
font-size: 11px;
|
|
479
|
+
font-weight: 600;
|
|
480
|
+
line-height: 16px;
|
|
481
|
+
font-variant-numeric: tabular-nums;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.talent[aria-pressed="true"] .talent-cost {
|
|
485
|
+
color: var(--fellowship-talent-focus);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.status {
|
|
489
|
+
min-height: 256px;
|
|
490
|
+
display: grid;
|
|
491
|
+
place-items: center;
|
|
492
|
+
padding: 32px;
|
|
493
|
+
color: var(--fellowship-talent-muted);
|
|
494
|
+
text-align: center;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.status-card {
|
|
498
|
+
max-width: 480px;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.status-mark {
|
|
502
|
+
display: flex;
|
|
503
|
+
width: 40px;
|
|
504
|
+
height: 24px;
|
|
505
|
+
align-items: center;
|
|
506
|
+
justify-content: space-between;
|
|
507
|
+
margin: 0 auto 16px;
|
|
508
|
+
color: var(--fellowship-talent-points);
|
|
509
|
+
font-family: var(--fellowship-talent-tactical-font-family);
|
|
510
|
+
font-size: 16px;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.status-mark::before,
|
|
514
|
+
.status-mark::after {
|
|
515
|
+
width: 8px;
|
|
516
|
+
height: 1px;
|
|
517
|
+
background: var(--fellowship-talent-border);
|
|
518
|
+
content: "";
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.status-title {
|
|
522
|
+
margin: 0;
|
|
523
|
+
color: var(--fellowship-talent-foreground);
|
|
524
|
+
font-size: 18px;
|
|
525
|
+
font-weight: 600;
|
|
526
|
+
line-height: 24px;
|
|
527
|
+
text-wrap: balance;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.status-copy {
|
|
531
|
+
margin: 8px 0 0;
|
|
532
|
+
font-size: 14px;
|
|
533
|
+
line-height: 24px;
|
|
534
|
+
text-wrap: pretty;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.retry-button {
|
|
538
|
+
min-height: 44px;
|
|
539
|
+
margin-top: 24px;
|
|
540
|
+
padding: 0 16px;
|
|
541
|
+
border: 1px solid var(--fellowship-talent-border);
|
|
542
|
+
border-radius: 4px;
|
|
543
|
+
background: var(--fellowship-talent-control-surface);
|
|
544
|
+
color: var(--fellowship-talent-foreground);
|
|
545
|
+
font-weight: 600;
|
|
546
|
+
cursor: pointer;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.visually-hidden {
|
|
550
|
+
position: absolute;
|
|
551
|
+
width: 1px;
|
|
552
|
+
height: 1px;
|
|
553
|
+
padding: 0;
|
|
554
|
+
margin: -1px;
|
|
555
|
+
overflow: hidden;
|
|
556
|
+
clip: rect(0, 0, 0, 0);
|
|
557
|
+
white-space: nowrap;
|
|
558
|
+
border: 0;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
@media (hover: hover) {
|
|
562
|
+
.point-control:hover:not(:disabled) {
|
|
563
|
+
background: var(--fellowship-talent-surface);
|
|
564
|
+
color: var(--fellowship-talent-foreground);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.clear-all:hover:not(:disabled) {
|
|
568
|
+
background: color-mix(in srgb, var(--fellowship-talent-danger) 8%, transparent);
|
|
569
|
+
color: var(--fellowship-talent-danger);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.talent:hover:not([aria-disabled="true"]) {
|
|
573
|
+
background: var(--_fellowship-field-surface-raised);
|
|
574
|
+
box-shadow: inset 0 0 0 1px var(--fellowship-talent-border);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
@container (max-width: 719px) {
|
|
579
|
+
.container {
|
|
580
|
+
padding: 16px 12px;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.header {
|
|
584
|
+
min-height: 80px;
|
|
585
|
+
grid-template-columns: 1fr;
|
|
586
|
+
display: grid;
|
|
587
|
+
gap: 8px;
|
|
588
|
+
padding: 4px 4px 20px;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.heading {
|
|
592
|
+
font-size: 11px;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.points-cluster {
|
|
596
|
+
width: 100%;
|
|
597
|
+
flex-wrap: wrap;
|
|
598
|
+
justify-content: flex-start;
|
|
599
|
+
gap: 8px;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.points {
|
|
603
|
+
font-size: 28px;
|
|
604
|
+
line-height: 36px;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.grid {
|
|
608
|
+
gap: 24px;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.row {
|
|
612
|
+
grid-template-columns: 1fr;
|
|
613
|
+
gap: 8px;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.row-label {
|
|
617
|
+
min-height: 24px;
|
|
618
|
+
align-items: center;
|
|
619
|
+
justify-content: flex-start;
|
|
620
|
+
padding: 0 0 0 16px;
|
|
621
|
+
text-align: left;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.row-label::before {
|
|
625
|
+
inset: 12px auto auto 0;
|
|
626
|
+
width: 8px;
|
|
627
|
+
height: 1px;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.row-label::after {
|
|
631
|
+
top: 9px;
|
|
632
|
+
right: auto;
|
|
633
|
+
left: 0;
|
|
634
|
+
width: 1px;
|
|
635
|
+
height: 7px;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.row-talents {
|
|
639
|
+
grid-template-columns: 1fr;
|
|
640
|
+
gap: 8px;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.talent {
|
|
644
|
+
--fellowship-talent-icon-size: 52px;
|
|
645
|
+
|
|
646
|
+
min-height: 80px;
|
|
647
|
+
padding-block: 12px;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
@media (prefers-reduced-motion: reduce) {
|
|
652
|
+
.point-control,
|
|
653
|
+
.clear-all,
|
|
654
|
+
.talent {
|
|
655
|
+
transition:
|
|
656
|
+
background-color 100ms linear,
|
|
657
|
+
box-shadow 100ms linear,
|
|
658
|
+
color 100ms linear,
|
|
659
|
+
opacity 100ms linear;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.point-control:active:not(:disabled),
|
|
663
|
+
.clear-all:active:not(:disabled),
|
|
664
|
+
.talent:active:not([aria-disabled="true"]) {
|
|
665
|
+
transform: none;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
`, A = {
|
|
669
|
+
bubbles: !0,
|
|
670
|
+
composed: !0
|
|
671
|
+
}, j = (e, t) => e.length !== t?.length || e.some((e, n) => e !== t[n]), M = (e) => `talent:${e}`, N = (e) => ({
|
|
672
|
+
selectedTalentIds: [],
|
|
673
|
+
spentPoints: 0,
|
|
674
|
+
remainingPoints: e,
|
|
675
|
+
overBudget: !1
|
|
676
|
+
}), P = class extends c {
|
|
677
|
+
constructor(...e) {
|
|
678
|
+
super(...e), this.heroId = "", this.talentPoints = 14, this.selectedTalentIds = [], this.assetBaseUrl = null, this.dataSource = null, this.renderTalent = null, this.showPointControls = !0, this.showTooltips = !0, this._status = "empty", this._error = null, this._model = null, this._failedImages = /* @__PURE__ */ new Set(), this._announcement = "", this._renderSelectionState = N(14), this._talentPresentation = /* @__PURE__ */ new Map(), this._talentRenderContent = /* @__PURE__ */ new Map(), this.#e = null, this.#t = 0, this.#n = null, this.#r = !1, this.#i = /* @__PURE__ */ new Set(), this.#a = [];
|
|
679
|
+
}
|
|
680
|
+
static {
|
|
681
|
+
this.styles = [n, k];
|
|
682
|
+
}
|
|
683
|
+
#e;
|
|
684
|
+
#t;
|
|
685
|
+
#n;
|
|
686
|
+
#r;
|
|
687
|
+
#i;
|
|
688
|
+
#a;
|
|
689
|
+
connectedCallback() {
|
|
690
|
+
super.connectedCallback(), t(this.ownerDocument);
|
|
691
|
+
}
|
|
692
|
+
disconnectedCallback() {
|
|
693
|
+
this.#e?.abort(), super.disconnectedCallback();
|
|
694
|
+
}
|
|
695
|
+
updated(e) {
|
|
696
|
+
if (super.updated(e), this.#S(), e.has("heroId") || e.has("dataSource") || e.has("assetBaseUrl")) {
|
|
697
|
+
queueMicrotask(() => {
|
|
698
|
+
this.isConnected && this.#p();
|
|
699
|
+
});
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
if (e.has("talentPoints")) {
|
|
703
|
+
let t = T(this.talentPoints);
|
|
704
|
+
if (t !== this.talentPoints) {
|
|
705
|
+
this.#r = !0, this.talentPoints = t, this.#v("normalization");
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
this.#r ? this.#r = !1 : e.get("talentPoints") !== void 0 && this.#v("property");
|
|
709
|
+
}
|
|
710
|
+
e.has("selectedTalentIds") && this._model && this.#m(!0), this.#y();
|
|
711
|
+
}
|
|
712
|
+
willUpdate(e) {
|
|
713
|
+
super.willUpdate(e);
|
|
714
|
+
let t = e.has("_model") || e.has("selectedTalentIds") || e.has("talentPoints");
|
|
715
|
+
t && (this._renderSelectionState = this._model ? D(this._model, this.selectedTalentIds, this.talentPoints) : N(this.talentPoints)), e.has("renderTalent") && this.#i.clear(), (t || e.has("renderTalent")) && this.#l(this._renderSelectionState);
|
|
716
|
+
}
|
|
717
|
+
get renderModel() {
|
|
718
|
+
return this._model;
|
|
719
|
+
}
|
|
720
|
+
get selectionState() {
|
|
721
|
+
return this._model ? D(this._model, this.selectedTalentIds, this.talentPoints) : N(this.talentPoints);
|
|
722
|
+
}
|
|
723
|
+
reset() {
|
|
724
|
+
this.selectedTalentIds.length !== 0 && (this.selectedTalentIds = [], this.#_("reset"));
|
|
725
|
+
}
|
|
726
|
+
selectTalent(e) {
|
|
727
|
+
let t = this._model?.talentById.get(e), n = this.selectionState;
|
|
728
|
+
return !t || n.selectedTalentIds.includes(e) || !O(t.pointCost, n) ? !1 : (this.selectedTalentIds = [...n.selectedTalentIds, e], this.#_("api"), !0);
|
|
729
|
+
}
|
|
730
|
+
deselectTalent(e) {
|
|
731
|
+
return this.selectionState.selectedTalentIds.includes(e) ? (this.selectedTalentIds = this.selectionState.selectedTalentIds.filter((t) => t !== e), this.#_("api"), !0) : !1;
|
|
732
|
+
}
|
|
733
|
+
retry() {
|
|
734
|
+
this.#p();
|
|
735
|
+
}
|
|
736
|
+
render() {
|
|
737
|
+
let e = this._renderSelectionState;
|
|
738
|
+
return u`
|
|
739
|
+
<section
|
|
740
|
+
class="container"
|
|
741
|
+
part="container"
|
|
742
|
+
aria-label=${`${this._model?.hero.name ?? this._model?.hero.id ?? "Fellowship hero"} talent calculator`}
|
|
743
|
+
aria-invalid=${String(e.overBudget)}
|
|
744
|
+
>
|
|
745
|
+
${this.#o(e)}
|
|
746
|
+
${this._status === "ready" && this._model ? this.#s(this._model) : this.#f()}
|
|
747
|
+
<p class="visually-hidden" role="status" aria-live="polite">${this._announcement}</p>
|
|
748
|
+
</section>
|
|
749
|
+
`;
|
|
750
|
+
}
|
|
751
|
+
#o(e) {
|
|
752
|
+
return u`
|
|
753
|
+
<header class="header" part="header">
|
|
754
|
+
<h2 class="heading" part="heading">Talent points</h2>
|
|
755
|
+
<div class="points-cluster">
|
|
756
|
+
<div
|
|
757
|
+
class="points"
|
|
758
|
+
part="points"
|
|
759
|
+
data-invalid=${String(e.overBudget)}
|
|
760
|
+
aria-label=${`${e.spentPoints} of ${this.talentPoints} talent points spent`}
|
|
761
|
+
aria-live="polite"
|
|
762
|
+
>
|
|
763
|
+
<span class="points-spent" part="points-spent">${e.spentPoints}</span>
|
|
764
|
+
<span class="points-separator" aria-hidden="true">/</span>
|
|
765
|
+
<span class="points-total" part="points-total">${this.talentPoints}</span>
|
|
766
|
+
</div>
|
|
767
|
+
${this.showPointControls ? u`
|
|
768
|
+
<div
|
|
769
|
+
class="point-controls"
|
|
770
|
+
part="point-controls"
|
|
771
|
+
role="group"
|
|
772
|
+
aria-label="Talent points"
|
|
773
|
+
>
|
|
774
|
+
<button
|
|
775
|
+
class="point-control"
|
|
776
|
+
part="point-control"
|
|
777
|
+
type="button"
|
|
778
|
+
aria-label="Decrease available talent points"
|
|
779
|
+
title="Decrease available talent points"
|
|
780
|
+
?disabled=${this.talentPoints <= e.spentPoints}
|
|
781
|
+
@click=${() => this.#g(this.talentPoints - 1, "decrement")}
|
|
782
|
+
>
|
|
783
|
+
−
|
|
784
|
+
</button>
|
|
785
|
+
<button
|
|
786
|
+
class="point-control"
|
|
787
|
+
part="point-control"
|
|
788
|
+
type="button"
|
|
789
|
+
aria-label="Increase available talent points"
|
|
790
|
+
title="Increase available talent points"
|
|
791
|
+
?disabled=${this.talentPoints >= 14}
|
|
792
|
+
@click=${() => this.#g(this.talentPoints + 1, "increment")}
|
|
793
|
+
>
|
|
794
|
+
+
|
|
795
|
+
</button>
|
|
796
|
+
</div>
|
|
797
|
+
` : d}
|
|
798
|
+
<button
|
|
799
|
+
class="clear-all"
|
|
800
|
+
part="clear-all"
|
|
801
|
+
type="button"
|
|
802
|
+
?disabled=${e.selectedTalentIds.length === 0}
|
|
803
|
+
@click=${this.reset}
|
|
804
|
+
>
|
|
805
|
+
Clear All
|
|
806
|
+
</button>
|
|
807
|
+
</div>
|
|
808
|
+
</header>
|
|
809
|
+
`;
|
|
810
|
+
}
|
|
811
|
+
#s(e) {
|
|
812
|
+
return e.rows.length === 0 ? u`
|
|
813
|
+
<div class="status" part="empty-state" role="status">
|
|
814
|
+
<div class="status-card">
|
|
815
|
+
<div class="status-mark" aria-hidden="true">◇</div>
|
|
816
|
+
<p class="status-title">No active talents</p>
|
|
817
|
+
<p class="status-copy">
|
|
818
|
+
${e.hero.name ?? e.hero.id} has no positioned talents.
|
|
819
|
+
</p>
|
|
820
|
+
</div>
|
|
821
|
+
</div>
|
|
822
|
+
` : u`
|
|
823
|
+
<div class="grid" part="grid" role="group" aria-label="Talent tiers">
|
|
824
|
+
${h(e.rows, (e) => e.row, (e) => u`
|
|
825
|
+
<fieldset class="row" part="row">
|
|
826
|
+
<legend class="visually-hidden">Talent tier ${e.label}</legend>
|
|
827
|
+
<span class="row-label" part="row-label" aria-hidden="true">${e.label}</span>
|
|
828
|
+
<div class="row-talents">
|
|
829
|
+
${h(e.talents, (e) => e.talent.id, (e) => this.#c(e))}
|
|
830
|
+
</div>
|
|
831
|
+
</fieldset>
|
|
832
|
+
`)}
|
|
833
|
+
</div>
|
|
834
|
+
`;
|
|
835
|
+
}
|
|
836
|
+
#c(e) {
|
|
837
|
+
let t = this._talentPresentation.get(e.talent.id);
|
|
838
|
+
if (!t) return d;
|
|
839
|
+
let { context: n, name: r, descriptionId: i, affordability: a, description: o } = t, { selected: s, disabled: c } = n, l = u`
|
|
840
|
+
<button
|
|
841
|
+
class="talent"
|
|
842
|
+
part="talent"
|
|
843
|
+
type="button"
|
|
844
|
+
aria-label=${`${r}, ${a}`}
|
|
845
|
+
aria-describedby=${i}
|
|
846
|
+
aria-pressed=${String(s)}
|
|
847
|
+
aria-disabled=${String(c)}
|
|
848
|
+
@click=${() => this.#h(e, s, c)}
|
|
849
|
+
>
|
|
850
|
+
${this.#u(n)}
|
|
851
|
+
<span class="talent-cost" part="talent-cost">${e.pointCost ?? "–"}</span>
|
|
852
|
+
</button>
|
|
853
|
+
`;
|
|
854
|
+
return u`
|
|
855
|
+
${this.showTooltips && (e.talent.description || c) ? u`
|
|
856
|
+
<fellowship-tooltip
|
|
857
|
+
.heading=${r}
|
|
858
|
+
.text=${e.talent.description ?? a}
|
|
859
|
+
>
|
|
860
|
+
${l}
|
|
861
|
+
</fellowship-tooltip>
|
|
862
|
+
` : l}
|
|
863
|
+
<span class="visually-hidden" id=${i}>${o}</span>
|
|
864
|
+
`;
|
|
865
|
+
}
|
|
866
|
+
#l(e) {
|
|
867
|
+
let t = this.renderTalent, n = this._model, r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
868
|
+
if (n) for (let o of n.talentById.values()) {
|
|
869
|
+
let s = e.selectedTalentIds.includes(o.talent.id), c = O(o.pointCost, e), l = !s && !c, u = o.talent.name ?? o.talent.id, d = o.pointCost === null ? "This talent has no valid point cost." : l ? `Requires ${o.pointCost} talent points; ${Math.max(0, e.remainingPoints)} remaining.` : `${o.pointCost} talent ${o.pointCost === 1 ? "point" : "points"}.`, f = {
|
|
870
|
+
talent: o,
|
|
871
|
+
hero: n.hero,
|
|
872
|
+
selected: s,
|
|
873
|
+
affordable: c,
|
|
874
|
+
disabled: l,
|
|
875
|
+
spentPoints: e.spentPoints,
|
|
876
|
+
remainingPoints: e.remainingPoints,
|
|
877
|
+
talentPoints: this.talentPoints
|
|
878
|
+
};
|
|
879
|
+
if (a.set(o.talent.id, {
|
|
880
|
+
context: f,
|
|
881
|
+
name: u,
|
|
882
|
+
descriptionId: `talent-description-${o.row}-${o.column}`,
|
|
883
|
+
affordability: d,
|
|
884
|
+
description: [i(o.talent.description ?? ""), d].filter(Boolean).join(" ")
|
|
885
|
+
}), t) try {
|
|
886
|
+
r.set(o.talent.id, t(f));
|
|
887
|
+
} catch (e) {
|
|
888
|
+
this.#i.has(o.talent.id) || (this.#i.add(o.talent.id), this.#a.push({
|
|
889
|
+
code: "renderer-error",
|
|
890
|
+
message: `The talent renderer failed for “${o.talent.id}”: ${String(e)}.`,
|
|
891
|
+
talentId: o.talent.id
|
|
892
|
+
}));
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
this._talentPresentation = a, this._talentRenderContent = r;
|
|
896
|
+
}
|
|
897
|
+
#u(e) {
|
|
898
|
+
let t = e.talent, n = t.talent.name ?? t.talent.id, r = this.renderTalent && this._talentRenderContent.has(t.talent.id) ? this._talentRenderContent.get(t.talent.id) : u`
|
|
899
|
+
<slot name=${M(t.talent.id)}>
|
|
900
|
+
<span class="talent-name" part="talent-name" title=${n}>${n}</span>
|
|
901
|
+
</slot>
|
|
902
|
+
`;
|
|
903
|
+
return u`
|
|
904
|
+
${this.#d(t, n)} ${r}
|
|
905
|
+
`;
|
|
906
|
+
}
|
|
907
|
+
#d(e, t) {
|
|
908
|
+
return e.imageUrl && !this._failedImages.has(e.talent.id) ? u`
|
|
909
|
+
<img
|
|
910
|
+
class="talent-icon"
|
|
911
|
+
part="talent-icon"
|
|
912
|
+
src=${e.imageUrl}
|
|
913
|
+
alt=""
|
|
914
|
+
draggable="false"
|
|
915
|
+
@error=${() => this.#b(e)}
|
|
916
|
+
/>
|
|
917
|
+
` : u`<span class="talent-icon-fallback" part="talent-icon-fallback">${t.split(/\s+/).map((e) => e[0]).join("").slice(0, 2).toUpperCase()}</span>`;
|
|
918
|
+
}
|
|
919
|
+
#f() {
|
|
920
|
+
let e = this._status === "loading", t = this._status === "empty", n = e ? "Reading talent codex" : t ? "Choose a hero" : "Talents unavailable", r = e ? "Loading the hero and their available talents." : t ? "Set the hero-id attribute or heroId property to build a talent loadout." : this._error?.message ?? "An unexpected talent data error occurred.";
|
|
921
|
+
return u`
|
|
922
|
+
<div
|
|
923
|
+
class="status"
|
|
924
|
+
part=${this._status === "error" ? "error-state" : "status"}
|
|
925
|
+
role=${this._status === "error" ? "alert" : "status"}
|
|
926
|
+
>
|
|
927
|
+
<div class="status-card">
|
|
928
|
+
<div class="status-mark" aria-hidden="true">${e ? "…" : "✦"}</div>
|
|
929
|
+
<p class="status-title">${n}</p>
|
|
930
|
+
<p class="status-copy">${r}</p>
|
|
931
|
+
${this._status === "error" ? u`<button class="retry-button" type="button" @click=${this.retry}>Retry</button>` : d}
|
|
932
|
+
</div>
|
|
933
|
+
</div>
|
|
934
|
+
`;
|
|
935
|
+
}
|
|
936
|
+
async #p() {
|
|
937
|
+
let t = this.heroId.trim(), n = ++this.#t;
|
|
938
|
+
if (this.#e?.abort(), this.#e = new AbortController(), this._model = null, this._error = null, this._failedImages = /* @__PURE__ */ new Set(), this.#i.clear(), this.#n = null, !t) {
|
|
939
|
+
this._status = "empty";
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
this._status = "loading";
|
|
943
|
+
let r = this.dataSource ?? y(this.assetBaseUrl ? { assetBaseUrl: this.assetBaseUrl } : {});
|
|
944
|
+
try {
|
|
945
|
+
let i = await r.loadHeroTalents(t, this.#e.signal);
|
|
946
|
+
if (n !== this.#t || this.#e.signal.aborted) return;
|
|
947
|
+
if (i.manifest.schemaVersion !== 1) throw new e("unsupported-schema", `Unsupported fellowship-data schema version: ${String(i.manifest.schemaVersion)}.`);
|
|
948
|
+
let a = C(i, r);
|
|
949
|
+
this._model = a, this._status = "ready";
|
|
950
|
+
let o = this.#m(!1);
|
|
951
|
+
await this.updateComplete;
|
|
952
|
+
let s = this.selectionState;
|
|
953
|
+
this.dispatchEvent(new CustomEvent("fellowship-talents-ready", {
|
|
954
|
+
...A,
|
|
955
|
+
detail: {
|
|
956
|
+
data: i,
|
|
957
|
+
model: a,
|
|
958
|
+
selection: s
|
|
959
|
+
}
|
|
960
|
+
})), a.warnings.length > 0 && this.#x(a.warnings), o && this.#_("normalization"), this.#y();
|
|
961
|
+
} catch (e) {
|
|
962
|
+
if (n !== this.#t || this.#e.signal.aborted) return;
|
|
963
|
+
this.#C(e);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
#m(e) {
|
|
967
|
+
if (!this._model) return !1;
|
|
968
|
+
let t = E(this._model, this.selectedTalentIds);
|
|
969
|
+
return t.selectedTalentIds.length !== this.selectedTalentIds.length || t.selectedTalentIds.some((e, t) => e !== this.selectedTalentIds[t]) ? (this.selectedTalentIds = t.selectedTalentIds, t.removedTalentIds.length > 0 && this.#x([{
|
|
970
|
+
code: "invalid-selection",
|
|
971
|
+
message: `Removed unavailable talent selections: ${t.removedTalentIds.join(", ")}.`,
|
|
972
|
+
talentId: null
|
|
973
|
+
}]), e && this.#_("normalization"), !0) : !1;
|
|
974
|
+
}
|
|
975
|
+
#h(e, t, n) {
|
|
976
|
+
if (t) {
|
|
977
|
+
this.selectedTalentIds = this.selectionState.selectedTalentIds.filter((t) => t !== e.talent.id), this.#_("user");
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
if (n) {
|
|
981
|
+
this._announcement = this.selectionState.overBudget ? "The current build exceeds the available talent points. Deselect a talent first." : `Not enough points for ${e.talent.name ?? e.talent.id}.`;
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
this.selectedTalentIds = [...this.selectionState.selectedTalentIds, e.talent.id], this.#_("user");
|
|
985
|
+
}
|
|
986
|
+
#g(e, t) {
|
|
987
|
+
let n = T(e), r = this.selectionState;
|
|
988
|
+
n === this.talentPoints || n < r.spentPoints || (this.talentPoints = n, this.#r = !0, this.#v(t));
|
|
989
|
+
}
|
|
990
|
+
#_(e) {
|
|
991
|
+
let t = this._model ? D(this._model, this.selectedTalentIds, this.talentPoints) : N(this.talentPoints);
|
|
992
|
+
this.dispatchEvent(new CustomEvent("fellowship-talent-selection-change", {
|
|
993
|
+
...A,
|
|
994
|
+
detail: {
|
|
995
|
+
...t,
|
|
996
|
+
source: e
|
|
997
|
+
}
|
|
998
|
+
}));
|
|
999
|
+
}
|
|
1000
|
+
#v(e) {
|
|
1001
|
+
let t = this.selectionState;
|
|
1002
|
+
this.dispatchEvent(new CustomEvent("fellowship-talent-points-change", {
|
|
1003
|
+
...A,
|
|
1004
|
+
detail: {
|
|
1005
|
+
...t,
|
|
1006
|
+
talentPoints: this.talentPoints,
|
|
1007
|
+
source: e
|
|
1008
|
+
}
|
|
1009
|
+
}));
|
|
1010
|
+
}
|
|
1011
|
+
#y() {
|
|
1012
|
+
let e = this.selectionState;
|
|
1013
|
+
if (!e.overBudget) {
|
|
1014
|
+
this.#n = null, this.removeAttribute("aria-invalid");
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
this.setAttribute("aria-invalid", "true");
|
|
1018
|
+
let t = `${this.talentPoints}:${e.selectedTalentIds.join(",")}`;
|
|
1019
|
+
t !== this.#n && (this.#n = t, this.#x([{
|
|
1020
|
+
code: "over-budget",
|
|
1021
|
+
message: `The selected talents cost ${e.spentPoints} points, exceeding the ${this.talentPoints}-point budget.`,
|
|
1022
|
+
talentId: null
|
|
1023
|
+
}]));
|
|
1024
|
+
}
|
|
1025
|
+
#b(e) {
|
|
1026
|
+
this._failedImages.has(e.talent.id) || (this._failedImages = new Set(this._failedImages).add(e.talent.id), this.#x([{
|
|
1027
|
+
code: "asset-image-error",
|
|
1028
|
+
message: `The icon for talent “${e.talent.id}” could not be loaded.`,
|
|
1029
|
+
talentId: e.talent.id
|
|
1030
|
+
}]));
|
|
1031
|
+
}
|
|
1032
|
+
#x(e) {
|
|
1033
|
+
this.dispatchEvent(new CustomEvent("fellowship-talents-warning", {
|
|
1034
|
+
...A,
|
|
1035
|
+
detail: {
|
|
1036
|
+
warnings: e,
|
|
1037
|
+
model: this._model
|
|
1038
|
+
}
|
|
1039
|
+
}));
|
|
1040
|
+
}
|
|
1041
|
+
#S() {
|
|
1042
|
+
if (this.#a.length === 0) return;
|
|
1043
|
+
let e = this.#a;
|
|
1044
|
+
this.#a = [], this.#x(e);
|
|
1045
|
+
}
|
|
1046
|
+
#C(t) {
|
|
1047
|
+
let n = typeof t == "object" && t && "code" in t && "message" in t ? {
|
|
1048
|
+
code: String(t.code),
|
|
1049
|
+
message: String(t.message),
|
|
1050
|
+
...t instanceof e && t.cause !== void 0 ? { cause: t.cause } : {}
|
|
1051
|
+
} : {
|
|
1052
|
+
code: "unknown",
|
|
1053
|
+
message: t instanceof Error ? t.message : String(t)
|
|
1054
|
+
};
|
|
1055
|
+
this._error = n, this._status = "error", this.dispatchEvent(new CustomEvent("fellowship-talents-error", {
|
|
1056
|
+
...A,
|
|
1057
|
+
detail: n
|
|
1058
|
+
}));
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
r([p({
|
|
1062
|
+
type: String,
|
|
1063
|
+
attribute: "hero-id"
|
|
1064
|
+
})], P.prototype, "heroId", void 0), r([p({
|
|
1065
|
+
type: Number,
|
|
1066
|
+
attribute: "talent-points"
|
|
1067
|
+
})], P.prototype, "talentPoints", void 0), r([p({
|
|
1068
|
+
attribute: !1,
|
|
1069
|
+
hasChanged: j
|
|
1070
|
+
})], P.prototype, "selectedTalentIds", void 0), r([p({
|
|
1071
|
+
type: String,
|
|
1072
|
+
attribute: "asset-base-url"
|
|
1073
|
+
})], P.prototype, "assetBaseUrl", void 0), r([p({ attribute: !1 })], P.prototype, "dataSource", void 0), r([p({ attribute: !1 })], P.prototype, "renderTalent", void 0), r([p({
|
|
1074
|
+
type: Boolean,
|
|
1075
|
+
attribute: "show-point-controls"
|
|
1076
|
+
})], P.prototype, "showPointControls", void 0), r([p({
|
|
1077
|
+
type: Boolean,
|
|
1078
|
+
attribute: "show-tooltips"
|
|
1079
|
+
})], P.prototype, "showTooltips", void 0), r([m()], P.prototype, "_status", void 0), r([m()], P.prototype, "_error", void 0), r([m()], P.prototype, "_model", void 0), r([m()], P.prototype, "_failedImages", void 0), r([m()], P.prototype, "_announcement", void 0), r([m()], P.prototype, "_renderSelectionState", void 0), r([m()], P.prototype, "_talentPresentation", void 0), r([m()], P.prototype, "_talentRenderContent", void 0), P = r([f("fellowship-talent-calculator")], P);
|
|
1080
|
+
var F = () => {
|
|
1081
|
+
a(), customElements.get("fellowship-talent-calculator") || customElements.define("fellowship-talent-calculator", P);
|
|
1082
|
+
};
|
|
1083
|
+
//#endregion
|
|
1084
|
+
export { O as a, T as c, y as d, w as i, C as l, F as n, D as o, M as r, E as s, P as t, x as u };
|
|
1085
|
+
|
|
1086
|
+
//# sourceMappingURL=talent-calculator-Ch1Pbbba.js.map
|