@crockery/fellowship-components 0.3.0 → 0.4.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 +12 -10
- package/RELEASING.md +15 -14
- package/dist/chunks/data-source-XbksqUrw.js +7 -0
- package/dist/chunks/decorate-B_ZTN9li.js +0 -2
- package/dist/chunks/{dungeon-cast-browser-Cyh519NI.js → dungeon-cast-browser-CSnu3gC5.js} +54 -56
- package/dist/chunks/{dungeon-map-xFaPasVr.js → dungeon-map-CutIcCVP.js} +89 -92
- package/dist/chunks/{talent-calculator-CIPNbqK5.js → talent-calculator-Dxuc2dZ8.js} +88 -90
- package/dist/chunks/tooltip-DoQVSnOn.js +0 -2
- package/dist/data/cast-data-source.d.ts +0 -1
- package/dist/data/data-source.d.ts +3 -2
- package/dist/data/package-cast-data-source.d.ts +0 -1
- package/dist/data/package-data-source.d.ts +0 -1
- package/dist/data/package-talent-data-source.d.ts +0 -1
- package/dist/data/talent-data-source.d.ts +0 -1
- package/dist/dungeon-cast-browser/dungeon-cast-browser.d.ts +0 -1
- package/dist/dungeon-cast-browser/dungeon-cast-browser.styles.d.ts +0 -1
- package/dist/dungeon-cast-browser/index.d.ts +0 -1
- package/dist/dungeon-cast-browser/render-model.d.ts +0 -1
- package/dist/dungeon-cast-browser/types.d.ts +0 -1
- package/dist/dungeon-cast-browser.js +1 -3
- package/dist/dungeon-map/dungeon-map.d.ts +0 -1
- package/dist/dungeon-map/dungeon-map.styles.d.ts +0 -1
- package/dist/dungeon-map/index.d.ts +0 -1
- package/dist/dungeon-map/layout.d.ts +0 -1
- package/dist/dungeon-map/render-model.d.ts +0 -1
- package/dist/dungeon-map/types.d.ts +0 -1
- package/dist/dungeon-map/viewport-controller.d.ts +0 -1
- package/dist/dungeon-map.js +1 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -4
- package/dist/react/dungeon-cast-browser.d.ts +0 -1
- package/dist/react/dungeon-cast-browser.js +1 -3
- package/dist/react/dungeon-map.d.ts +0 -1
- package/dist/react/dungeon-map.js +1 -3
- package/dist/react/index.d.ts +0 -1
- package/dist/react/talent-calculator.d.ts +0 -1
- package/dist/react/talent-calculator.js +1 -3
- package/dist/react/tooltip.d.ts +0 -1
- package/dist/react/tooltip.js +0 -2
- package/dist/styles/field-manual-fonts.d.ts +0 -1
- package/dist/styles/field-manual.styles.d.ts +0 -1
- package/dist/talent-calculator/index.d.ts +0 -1
- package/dist/talent-calculator/render-model.d.ts +0 -1
- package/dist/talent-calculator/selection-state.d.ts +0 -1
- package/dist/talent-calculator/talent-calculator.d.ts +0 -1
- package/dist/talent-calculator/talent-calculator.styles.d.ts +0 -1
- package/dist/talent-calculator/types.d.ts +0 -1
- package/dist/talent-calculator.js +1 -3
- package/dist/tooltip/index.d.ts +0 -1
- package/dist/tooltip/positioning.d.ts +0 -1
- package/dist/tooltip/rich-text.d.ts +0 -1
- package/dist/tooltip/tooltip.d.ts +0 -1
- package/dist/tooltip/tooltip.styles.d.ts +0 -1
- package/dist/tooltip/types.d.ts +0 -1
- package/dist/tooltip.js +0 -2
- package/package.json +8 -15
- package/dist/chunks/data-source-C-Gs7kRl.js +0 -2
- package/dist/chunks/decorate-B_ZTN9li.js.map +0 -1
- package/dist/chunks/dungeon-cast-browser-Cyh519NI.js.map +0 -1
- package/dist/chunks/dungeon-map-xFaPasVr.js.map +0 -1
- package/dist/chunks/talent-calculator-CIPNbqK5.js.map +0 -1
- package/dist/chunks/tooltip-DoQVSnOn.js.map +0 -1
- package/dist/data/cast-data-source.d.ts.map +0 -1
- package/dist/data/data-source.d.ts.map +0 -1
- package/dist/data/package-cast-data-source.d.ts.map +0 -1
- package/dist/data/package-data-source.d.ts.map +0 -1
- package/dist/data/package-talent-data-source.d.ts.map +0 -1
- package/dist/data/talent-data-source.d.ts.map +0 -1
- package/dist/dungeon-cast-browser/dungeon-cast-browser.d.ts.map +0 -1
- package/dist/dungeon-cast-browser/dungeon-cast-browser.styles.d.ts.map +0 -1
- package/dist/dungeon-cast-browser/index.d.ts.map +0 -1
- package/dist/dungeon-cast-browser/render-model.d.ts.map +0 -1
- package/dist/dungeon-cast-browser/types.d.ts.map +0 -1
- package/dist/dungeon-cast-browser.js.map +0 -1
- package/dist/dungeon-map/dungeon-map.d.ts.map +0 -1
- package/dist/dungeon-map/dungeon-map.styles.d.ts.map +0 -1
- package/dist/dungeon-map/index.d.ts.map +0 -1
- package/dist/dungeon-map/layout.d.ts.map +0 -1
- package/dist/dungeon-map/render-model.d.ts.map +0 -1
- package/dist/dungeon-map/types.d.ts.map +0 -1
- package/dist/dungeon-map/viewport-controller.d.ts.map +0 -1
- package/dist/dungeon-map.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/react/dungeon-cast-browser.d.ts.map +0 -1
- package/dist/react/dungeon-cast-browser.js.map +0 -1
- package/dist/react/dungeon-map.d.ts.map +0 -1
- package/dist/react/dungeon-map.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/talent-calculator.d.ts.map +0 -1
- package/dist/react/talent-calculator.js.map +0 -1
- package/dist/react/tooltip.d.ts.map +0 -1
- package/dist/react/tooltip.js.map +0 -1
- package/dist/styles/field-manual-fonts.d.ts.map +0 -1
- package/dist/styles/field-manual.styles.d.ts.map +0 -1
- package/dist/talent-calculator/index.d.ts.map +0 -1
- package/dist/talent-calculator/render-model.d.ts.map +0 -1
- package/dist/talent-calculator/selection-state.d.ts.map +0 -1
- package/dist/talent-calculator/talent-calculator.d.ts.map +0 -1
- package/dist/talent-calculator/talent-calculator.styles.d.ts.map +0 -1
- package/dist/talent-calculator/types.d.ts.map +0 -1
- package/dist/talent-calculator.js.map +0 -1
- package/dist/tooltip/index.d.ts.map +0 -1
- package/dist/tooltip/positioning.d.ts.map +0 -1
- package/dist/tooltip/rich-text.d.ts.map +0 -1
- package/dist/tooltip/tooltip.d.ts.map +0 -1
- package/dist/tooltip/tooltip.styles.d.ts.map +0 -1
- package/dist/tooltip/types.d.ts.map +0 -1
- package/dist/tooltip.js.map +0 -1
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n
|
|
3
|
-
import { a
|
|
4
|
-
import { createPackageFellowshipDataClient as
|
|
5
|
-
import { LitElement as
|
|
6
|
-
import { customElement as
|
|
7
|
-
import { repeat as
|
|
8
|
-
import { findImage as
|
|
1
|
+
import { n as e, t } from "./data-source-XbksqUrw.js";
|
|
2
|
+
import { n, r, t as i } from "./decorate-B_ZTN9li.js";
|
|
3
|
+
import { a, n as o } from "./tooltip-DoQVSnOn.js";
|
|
4
|
+
import { createPackageFellowshipDataClient as s } from "@crockery/fellowship-data/client";
|
|
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
|
+
import { findImage as g } from "@crockery/fellowship-data";
|
|
9
9
|
//#region src/data/package-talent-data-source.ts
|
|
10
|
-
var
|
|
11
|
-
let t =
|
|
10
|
+
var _ = (e = {}) => {
|
|
11
|
+
let t = s(e);
|
|
12
12
|
return {
|
|
13
13
|
loadHeroTalents: (e, n) => t.loadHeroTalents(e, n),
|
|
14
14
|
resolveAssetUrl: (e) => t.resolveAssetUrl(e)
|
|
15
15
|
};
|
|
16
|
-
},
|
|
16
|
+
}, v = [
|
|
17
17
|
"I",
|
|
18
18
|
"II",
|
|
19
19
|
"III",
|
|
20
20
|
"IV",
|
|
21
21
|
"V",
|
|
22
22
|
"VI"
|
|
23
|
-
],
|
|
23
|
+
], y = (e) => v[e - 1] ?? String(e), b = (e, t, n) => ({
|
|
24
24
|
code: e,
|
|
25
25
|
message: n,
|
|
26
26
|
talentId: t.id
|
|
27
|
-
}),
|
|
27
|
+
}), x = (e, t) => {
|
|
28
28
|
let n = [], r = /* @__PURE__ */ new Set(), i = [];
|
|
29
29
|
for (let a of e.talents) {
|
|
30
30
|
if (a.row === null && a.column === null) continue;
|
|
31
31
|
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) {
|
|
32
|
-
n.push(
|
|
32
|
+
n.push(b("invalid-position", a, `Talent “${a.id}” has an invalid row or column and was skipped.`));
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
35
|
let e = `${a.row}:${a.column}`;
|
|
36
36
|
if (r.has(e)) {
|
|
37
|
-
n.push(
|
|
37
|
+
n.push(b("duplicate-position", a, `Talent “${a.id}” duplicates row ${a.row}, column ${a.column} and was skipped.`));
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
r.add(e);
|
|
41
41
|
let o = Number.isInteger(a.pointCost) && (a.pointCost ?? 0) > 0 ? a.pointCost : null;
|
|
42
|
-
o === null && n.push(
|
|
43
|
-
let s =
|
|
42
|
+
o === null && n.push(b("invalid-cost", a, `Talent “${a.id}” has an invalid point cost.`)), a.name || n.push(b("missing-name", a, `Talent “${a.id}” has no display name.`)), a.description || n.push(b("missing-description", a, `Talent “${a.id}” has no description.`));
|
|
43
|
+
let s = g(a.images, {
|
|
44
44
|
type: "talent",
|
|
45
45
|
size: "200"
|
|
46
|
-
}) ??
|
|
46
|
+
}) ?? g(a.images, {
|
|
47
47
|
type: "talent",
|
|
48
48
|
size: "full"
|
|
49
49
|
}), c = null;
|
|
50
|
-
if (!s) n.push(
|
|
50
|
+
if (!s) n.push(b("missing-image", a, `Talent “${a.id}” has no icon.`));
|
|
51
51
|
else try {
|
|
52
52
|
c = t.resolveAssetUrl(s);
|
|
53
53
|
} catch (e) {
|
|
54
|
-
n.push(
|
|
54
|
+
n.push(b("asset-url-error", a, `The icon URL for talent “${a.id}” could not be resolved: ${String(e)}.`));
|
|
55
55
|
}
|
|
56
56
|
i.push({
|
|
57
57
|
talent: a,
|
|
@@ -64,7 +64,7 @@ var g = (e = {}) => {
|
|
|
64
64
|
i.sort((e, t) => e.row - t.row || e.column - t.column);
|
|
65
65
|
let a = new Map(i.map((e) => [e.talent.id, e])), o = [...new Set(i.map(({ row: e }) => e))].map((e) => ({
|
|
66
66
|
row: e,
|
|
67
|
-
label:
|
|
67
|
+
label: y(e),
|
|
68
68
|
talents: i.filter((t) => t.row === e)
|
|
69
69
|
}));
|
|
70
70
|
return {
|
|
@@ -73,13 +73,13 @@ var g = (e = {}) => {
|
|
|
73
73
|
talentById: a,
|
|
74
74
|
warnings: n
|
|
75
75
|
};
|
|
76
|
-
},
|
|
76
|
+
}, S = 14, C = (e) => Math.min(14, Math.max(0, Math.round(Number.isFinite(e) ? e : 14))), w = (e, t) => {
|
|
77
77
|
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);
|
|
78
78
|
return {
|
|
79
79
|
selectedTalentIds: r,
|
|
80
80
|
removedTalentIds: [...new Set(t)].filter((e) => !i.has(e))
|
|
81
81
|
};
|
|
82
|
-
},
|
|
82
|
+
}, T = (e, t, n) => {
|
|
83
83
|
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;
|
|
84
84
|
return {
|
|
85
85
|
selectedTalentIds: [...e.talentById.values()].filter(({ talent: e }) => r.has(e.id)).map(({ talent: e }) => e.id),
|
|
@@ -87,7 +87,7 @@ var g = (e = {}) => {
|
|
|
87
87
|
remainingPoints: a,
|
|
88
88
|
overBudget: a < 0
|
|
89
89
|
};
|
|
90
|
-
},
|
|
90
|
+
}, E = (e, t) => e !== null && !t.overBudget && e <= t.remainingPoints, D = l`
|
|
91
91
|
:host {
|
|
92
92
|
--fellowship-talent-background: var(--_fellowship-field-canvas);
|
|
93
93
|
--fellowship-talent-surface: var(--_fellowship-field-surface);
|
|
@@ -635,20 +635,20 @@ var g = (e = {}) => {
|
|
|
635
635
|
transform: none;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
`,
|
|
638
|
+
`, O = {
|
|
639
639
|
bubbles: !0,
|
|
640
640
|
composed: !0
|
|
641
|
-
},
|
|
641
|
+
}, k = (e, t) => e.length !== t?.length || e.some((e, n) => e !== t[n]), A = (e) => `talent:${e}`, j = (e) => ({
|
|
642
642
|
selectedTalentIds: [],
|
|
643
643
|
spentPoints: 0,
|
|
644
644
|
remainingPoints: e,
|
|
645
645
|
overBudget: !1
|
|
646
|
-
}),
|
|
646
|
+
}), M = class extends c {
|
|
647
647
|
constructor(...e) {
|
|
648
|
-
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 =
|
|
648
|
+
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 = j(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 = [];
|
|
649
649
|
}
|
|
650
650
|
static {
|
|
651
|
-
this.styles = [
|
|
651
|
+
this.styles = [r, D];
|
|
652
652
|
}
|
|
653
653
|
#e;
|
|
654
654
|
#t;
|
|
@@ -657,7 +657,7 @@ var g = (e = {}) => {
|
|
|
657
657
|
#i;
|
|
658
658
|
#a;
|
|
659
659
|
connectedCallback() {
|
|
660
|
-
super.connectedCallback(),
|
|
660
|
+
super.connectedCallback(), n(this.ownerDocument);
|
|
661
661
|
}
|
|
662
662
|
disconnectedCallback() {
|
|
663
663
|
this.#e?.abort(), super.disconnectedCallback();
|
|
@@ -670,7 +670,7 @@ var g = (e = {}) => {
|
|
|
670
670
|
return;
|
|
671
671
|
}
|
|
672
672
|
if (e.has("talentPoints")) {
|
|
673
|
-
let t =
|
|
673
|
+
let t = C(this.talentPoints);
|
|
674
674
|
if (t !== this.talentPoints) {
|
|
675
675
|
this.#r = !0, this.talentPoints = t, this.#v("normalization");
|
|
676
676
|
return;
|
|
@@ -682,20 +682,20 @@ var g = (e = {}) => {
|
|
|
682
682
|
willUpdate(e) {
|
|
683
683
|
super.willUpdate(e);
|
|
684
684
|
let t = e.has("_model") || e.has("selectedTalentIds") || e.has("talentPoints");
|
|
685
|
-
t && (this._renderSelectionState = this._model ?
|
|
685
|
+
t && (this._renderSelectionState = this._model ? T(this._model, this.selectedTalentIds, this.talentPoints) : j(this.talentPoints)), e.has("renderTalent") && this.#i.clear(), (t || e.has("renderTalent")) && this.#l(this._renderSelectionState);
|
|
686
686
|
}
|
|
687
687
|
get renderModel() {
|
|
688
688
|
return this._model;
|
|
689
689
|
}
|
|
690
690
|
get selectionState() {
|
|
691
|
-
return this._model ?
|
|
691
|
+
return this._model ? T(this._model, this.selectedTalentIds, this.talentPoints) : j(this.talentPoints);
|
|
692
692
|
}
|
|
693
693
|
reset() {
|
|
694
694
|
this.selectedTalentIds.length !== 0 && (this.selectedTalentIds = [], this.#_("reset"));
|
|
695
695
|
}
|
|
696
696
|
selectTalent(e) {
|
|
697
697
|
let t = this._model?.talentById.get(e), n = this.selectionState;
|
|
698
|
-
return !t || n.selectedTalentIds.includes(e) || !
|
|
698
|
+
return !t || n.selectedTalentIds.includes(e) || !E(t.pointCost, n) ? !1 : (this.selectedTalentIds = [...n.selectedTalentIds, e], this.#_("api"), !0);
|
|
699
699
|
}
|
|
700
700
|
deselectTalent(e) {
|
|
701
701
|
return this.selectionState.selectedTalentIds.includes(e) ? (this.selectedTalentIds = this.selectionState.selectedTalentIds.filter((t) => t !== e), this.#_("api"), !0) : !1;
|
|
@@ -705,7 +705,7 @@ var g = (e = {}) => {
|
|
|
705
705
|
}
|
|
706
706
|
render() {
|
|
707
707
|
let e = this._renderSelectionState;
|
|
708
|
-
return
|
|
708
|
+
return u`
|
|
709
709
|
<section
|
|
710
710
|
class="container"
|
|
711
711
|
part="container"
|
|
@@ -719,7 +719,7 @@ var g = (e = {}) => {
|
|
|
719
719
|
`;
|
|
720
720
|
}
|
|
721
721
|
#o(e) {
|
|
722
|
-
return
|
|
722
|
+
return u`
|
|
723
723
|
<header class="header" part="header">
|
|
724
724
|
<h2 class="heading" part="heading">Talent points</h2>
|
|
725
725
|
<div class="points-cluster">
|
|
@@ -734,7 +734,7 @@ var g = (e = {}) => {
|
|
|
734
734
|
<span class="points-separator" aria-hidden="true">/</span>
|
|
735
735
|
<span class="points-total" part="points-total">${this.talentPoints}</span>
|
|
736
736
|
</div>
|
|
737
|
-
${this.showPointControls ?
|
|
737
|
+
${this.showPointControls ? u`
|
|
738
738
|
<div
|
|
739
739
|
class="point-controls"
|
|
740
740
|
part="point-controls"
|
|
@@ -764,7 +764,7 @@ var g = (e = {}) => {
|
|
|
764
764
|
+
|
|
765
765
|
</button>
|
|
766
766
|
</div>
|
|
767
|
-
` :
|
|
767
|
+
` : d}
|
|
768
768
|
<button
|
|
769
769
|
class="clear-all"
|
|
770
770
|
part="clear-all"
|
|
@@ -779,7 +779,7 @@ var g = (e = {}) => {
|
|
|
779
779
|
`;
|
|
780
780
|
}
|
|
781
781
|
#s(e) {
|
|
782
|
-
return e.rows.length === 0 ?
|
|
782
|
+
return e.rows.length === 0 ? u`
|
|
783
783
|
<div class="status" part="empty-state" role="status">
|
|
784
784
|
<div class="status-card">
|
|
785
785
|
<div class="status-mark" aria-hidden="true">◇</div>
|
|
@@ -789,14 +789,14 @@ var g = (e = {}) => {
|
|
|
789
789
|
</p>
|
|
790
790
|
</div>
|
|
791
791
|
</div>
|
|
792
|
-
` :
|
|
792
|
+
` : u`
|
|
793
793
|
<div class="grid" part="grid" role="group" aria-label="Talent tiers">
|
|
794
|
-
${
|
|
794
|
+
${h(e.rows, (e) => e.row, (e) => u`
|
|
795
795
|
<fieldset class="row" part="row">
|
|
796
796
|
<legend class="visually-hidden">Talent tier ${e.label}</legend>
|
|
797
797
|
<span class="row-label" part="row-label" aria-hidden="true">${e.label}</span>
|
|
798
798
|
<div class="row-talents">
|
|
799
|
-
${
|
|
799
|
+
${h(e.talents, (e) => e.talent.id, (e) => this.#c(e))}
|
|
800
800
|
</div>
|
|
801
801
|
</fieldset>
|
|
802
802
|
`)}
|
|
@@ -805,8 +805,8 @@ var g = (e = {}) => {
|
|
|
805
805
|
}
|
|
806
806
|
#c(e) {
|
|
807
807
|
let t = this._talentPresentation.get(e.talent.id);
|
|
808
|
-
if (!t) return
|
|
809
|
-
let { context: n, name: r, descriptionId: i, affordability: a, description: o } = t, { selected: s, disabled: c } = n,
|
|
808
|
+
if (!t) return d;
|
|
809
|
+
let { context: n, name: r, descriptionId: i, affordability: a, description: o } = t, { selected: s, disabled: c } = n, l = u`
|
|
810
810
|
<button
|
|
811
811
|
class="talent"
|
|
812
812
|
part="talent"
|
|
@@ -821,22 +821,22 @@ var g = (e = {}) => {
|
|
|
821
821
|
<span class="talent-cost" part="talent-cost">${e.pointCost ?? "–"}</span>
|
|
822
822
|
</button>
|
|
823
823
|
`;
|
|
824
|
-
return
|
|
825
|
-
${this.showTooltips && (e.talent.description || c) ?
|
|
824
|
+
return u`
|
|
825
|
+
${this.showTooltips && (e.talent.description || c) ? u`
|
|
826
826
|
<fellowship-tooltip
|
|
827
827
|
.heading=${r}
|
|
828
828
|
.text=${e.talent.description ?? a}
|
|
829
829
|
>
|
|
830
|
-
${
|
|
830
|
+
${l}
|
|
831
831
|
</fellowship-tooltip>
|
|
832
|
-
` :
|
|
832
|
+
` : l}
|
|
833
833
|
<span class="visually-hidden" id=${i}>${o}</span>
|
|
834
834
|
`;
|
|
835
835
|
}
|
|
836
836
|
#l(e) {
|
|
837
|
-
let t = this.renderTalent, n = this._model, r = /* @__PURE__ */ new Map(),
|
|
837
|
+
let t = this.renderTalent, n = this._model, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
838
838
|
if (n) for (let o of n.talentById.values()) {
|
|
839
|
-
let s = e.selectedTalentIds.includes(o.talent.id), c =
|
|
839
|
+
let s = e.selectedTalentIds.includes(o.talent.id), c = E(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 = {
|
|
840
840
|
talent: o,
|
|
841
841
|
hero: n.hero,
|
|
842
842
|
selected: s,
|
|
@@ -846,12 +846,12 @@ var g = (e = {}) => {
|
|
|
846
846
|
remainingPoints: e.remainingPoints,
|
|
847
847
|
talentPoints: this.talentPoints
|
|
848
848
|
};
|
|
849
|
-
if (
|
|
849
|
+
if (i.set(o.talent.id, {
|
|
850
850
|
context: f,
|
|
851
851
|
name: u,
|
|
852
852
|
descriptionId: `talent-description-${o.row}-${o.column}`,
|
|
853
853
|
affordability: d,
|
|
854
|
-
description: [
|
|
854
|
+
description: [a(o.talent.description ?? ""), d].filter(Boolean).join(" ")
|
|
855
855
|
}), t) try {
|
|
856
856
|
r.set(o.talent.id, t(f));
|
|
857
857
|
} catch (e) {
|
|
@@ -862,20 +862,20 @@ var g = (e = {}) => {
|
|
|
862
862
|
}));
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
-
this._talentPresentation =
|
|
865
|
+
this._talentPresentation = i, this._talentRenderContent = r;
|
|
866
866
|
}
|
|
867
867
|
#u(e) {
|
|
868
|
-
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) :
|
|
869
|
-
<slot name=${
|
|
868
|
+
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`
|
|
869
|
+
<slot name=${A(t.talent.id)}>
|
|
870
870
|
<span class="talent-name" part="talent-name" title=${n}>${n}</span>
|
|
871
871
|
</slot>
|
|
872
872
|
`;
|
|
873
|
-
return
|
|
873
|
+
return u`
|
|
874
874
|
${this.#d(t, n)} ${r}
|
|
875
875
|
`;
|
|
876
876
|
}
|
|
877
877
|
#d(e, t) {
|
|
878
|
-
return e.imageUrl && !this._failedImages.has(e.talent.id) ?
|
|
878
|
+
return e.imageUrl && !this._failedImages.has(e.talent.id) ? u`
|
|
879
879
|
<img
|
|
880
880
|
class="talent-icon"
|
|
881
881
|
part="talent-icon"
|
|
@@ -884,11 +884,11 @@ var g = (e = {}) => {
|
|
|
884
884
|
draggable="false"
|
|
885
885
|
@error=${() => this.#b(e)}
|
|
886
886
|
/>
|
|
887
|
-
` :
|
|
887
|
+
` : u`<span class="talent-icon-fallback" part="talent-icon-fallback">${t.split(/\s+/).map((e) => e[0]).join("").slice(0, 2).toUpperCase()}</span>`;
|
|
888
888
|
}
|
|
889
889
|
#f() {
|
|
890
890
|
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.";
|
|
891
|
-
return
|
|
891
|
+
return u`
|
|
892
892
|
<div
|
|
893
893
|
class="status"
|
|
894
894
|
part=${this._status === "error" ? "error-state" : "status"}
|
|
@@ -898,7 +898,7 @@ var g = (e = {}) => {
|
|
|
898
898
|
<div class="status-mark" aria-hidden="true">${e ? "…" : "✦"}</div>
|
|
899
899
|
<p class="status-title">${n}</p>
|
|
900
900
|
<p class="status-copy">${r}</p>
|
|
901
|
-
${this._status === "error" ?
|
|
901
|
+
${this._status === "error" ? u`<button class="retry-button" type="button" @click=${this.retry}>Retry</button>` : d}
|
|
902
902
|
</div>
|
|
903
903
|
</div>
|
|
904
904
|
`;
|
|
@@ -910,18 +910,18 @@ var g = (e = {}) => {
|
|
|
910
910
|
return;
|
|
911
911
|
}
|
|
912
912
|
this._status = "loading";
|
|
913
|
-
let r = this.dataSource ??
|
|
913
|
+
let r = this.dataSource ?? _(this.assetBaseUrl ? { assetBaseUrl: this.assetBaseUrl } : {});
|
|
914
914
|
try {
|
|
915
915
|
let i = await r.loadHeroTalents(t, this.#e.signal);
|
|
916
916
|
if (n !== this.#t || this.#e.signal.aborted) return;
|
|
917
|
-
|
|
918
|
-
let a =
|
|
917
|
+
e(i.manifest.schemaVersion);
|
|
918
|
+
let a = x(i, r);
|
|
919
919
|
this._model = a, this._status = "ready";
|
|
920
920
|
let o = this.#m(!1);
|
|
921
921
|
await this.updateComplete;
|
|
922
922
|
let s = this.selectionState;
|
|
923
923
|
this.dispatchEvent(new CustomEvent("fellowship-talents-ready", {
|
|
924
|
-
...
|
|
924
|
+
...O,
|
|
925
925
|
detail: {
|
|
926
926
|
data: i,
|
|
927
927
|
model: a,
|
|
@@ -935,7 +935,7 @@ var g = (e = {}) => {
|
|
|
935
935
|
}
|
|
936
936
|
#m(e) {
|
|
937
937
|
if (!this._model) return !1;
|
|
938
|
-
let t =
|
|
938
|
+
let t = w(this._model, this.selectedTalentIds);
|
|
939
939
|
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([{
|
|
940
940
|
code: "invalid-selection",
|
|
941
941
|
message: `Removed unavailable talent selections: ${t.removedTalentIds.join(", ")}.`,
|
|
@@ -954,13 +954,13 @@ var g = (e = {}) => {
|
|
|
954
954
|
this.selectedTalentIds = [...this.selectionState.selectedTalentIds, e.talent.id], this.#_("user");
|
|
955
955
|
}
|
|
956
956
|
#g(e, t) {
|
|
957
|
-
let n =
|
|
957
|
+
let n = C(e), r = this.selectionState;
|
|
958
958
|
n === this.talentPoints || n < r.spentPoints || (this.talentPoints = n, this.#r = !0, this.#v(t));
|
|
959
959
|
}
|
|
960
960
|
#_(e) {
|
|
961
|
-
let t = this._model ?
|
|
961
|
+
let t = this._model ? T(this._model, this.selectedTalentIds, this.talentPoints) : j(this.talentPoints);
|
|
962
962
|
this.dispatchEvent(new CustomEvent("fellowship-talent-selection-change", {
|
|
963
|
-
...
|
|
963
|
+
...O,
|
|
964
964
|
detail: {
|
|
965
965
|
...t,
|
|
966
966
|
source: e
|
|
@@ -970,7 +970,7 @@ var g = (e = {}) => {
|
|
|
970
970
|
#v(e) {
|
|
971
971
|
let t = this.selectionState;
|
|
972
972
|
this.dispatchEvent(new CustomEvent("fellowship-talent-points-change", {
|
|
973
|
-
...
|
|
973
|
+
...O,
|
|
974
974
|
detail: {
|
|
975
975
|
...t,
|
|
976
976
|
talentPoints: this.talentPoints,
|
|
@@ -1001,7 +1001,7 @@ var g = (e = {}) => {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
#x(e) {
|
|
1003
1003
|
this.dispatchEvent(new CustomEvent("fellowship-talents-warning", {
|
|
1004
|
-
...
|
|
1004
|
+
...O,
|
|
1005
1005
|
detail: {
|
|
1006
1006
|
warnings: e,
|
|
1007
1007
|
model: this._model
|
|
@@ -1013,44 +1013,42 @@ var g = (e = {}) => {
|
|
|
1013
1013
|
let e = this.#a;
|
|
1014
1014
|
this.#a = [], this.#x(e);
|
|
1015
1015
|
}
|
|
1016
|
-
#C(
|
|
1017
|
-
let n = typeof
|
|
1018
|
-
code: String(
|
|
1019
|
-
message: String(
|
|
1020
|
-
...
|
|
1016
|
+
#C(e) {
|
|
1017
|
+
let n = typeof e == "object" && e && "code" in e && "message" in e ? {
|
|
1018
|
+
code: String(e.code),
|
|
1019
|
+
message: String(e.message),
|
|
1020
|
+
...e instanceof t && e.cause !== void 0 ? { cause: e.cause } : {}
|
|
1021
1021
|
} : {
|
|
1022
1022
|
code: "unknown",
|
|
1023
|
-
message:
|
|
1023
|
+
message: e instanceof Error ? e.message : String(e)
|
|
1024
1024
|
};
|
|
1025
1025
|
this._error = n, this._status = "error", this.dispatchEvent(new CustomEvent("fellowship-talents-error", {
|
|
1026
|
-
...
|
|
1026
|
+
...O,
|
|
1027
1027
|
detail: n
|
|
1028
1028
|
}));
|
|
1029
1029
|
}
|
|
1030
1030
|
};
|
|
1031
|
-
|
|
1031
|
+
i([p({
|
|
1032
1032
|
type: String,
|
|
1033
1033
|
attribute: "hero-id"
|
|
1034
|
-
})],
|
|
1034
|
+
})], M.prototype, "heroId", void 0), i([p({
|
|
1035
1035
|
type: Number,
|
|
1036
1036
|
attribute: "talent-points"
|
|
1037
|
-
})],
|
|
1037
|
+
})], M.prototype, "talentPoints", void 0), i([p({
|
|
1038
1038
|
attribute: !1,
|
|
1039
|
-
hasChanged:
|
|
1040
|
-
})],
|
|
1039
|
+
hasChanged: k
|
|
1040
|
+
})], M.prototype, "selectedTalentIds", void 0), i([p({
|
|
1041
1041
|
type: String,
|
|
1042
1042
|
attribute: "asset-base-url"
|
|
1043
|
-
})],
|
|
1043
|
+
})], M.prototype, "assetBaseUrl", void 0), i([p({ attribute: !1 })], M.prototype, "dataSource", void 0), i([p({ attribute: !1 })], M.prototype, "renderTalent", void 0), i([p({
|
|
1044
1044
|
type: Boolean,
|
|
1045
1045
|
attribute: "show-point-controls"
|
|
1046
|
-
})],
|
|
1046
|
+
})], M.prototype, "showPointControls", void 0), i([p({
|
|
1047
1047
|
type: Boolean,
|
|
1048
1048
|
attribute: "show-tooltips"
|
|
1049
|
-
})],
|
|
1050
|
-
var
|
|
1051
|
-
|
|
1049
|
+
})], M.prototype, "showTooltips", void 0), i([m()], M.prototype, "_status", void 0), i([m()], M.prototype, "_error", void 0), i([m()], M.prototype, "_model", void 0), i([m()], M.prototype, "_failedImages", void 0), i([m()], M.prototype, "_announcement", void 0), i([m()], M.prototype, "_renderSelectionState", void 0), i([m()], M.prototype, "_talentPresentation", void 0), i([m()], M.prototype, "_talentRenderContent", void 0), M = i([f("fellowship-talent-calculator")], M);
|
|
1050
|
+
var N = () => {
|
|
1051
|
+
o(), customElements.get("fellowship-talent-calculator") || customElements.define("fellowship-talent-calculator", M);
|
|
1052
1052
|
};
|
|
1053
1053
|
//#endregion
|
|
1054
|
-
export {
|
|
1055
|
-
|
|
1056
|
-
//# sourceMappingURL=talent-calculator-CIPNbqK5.js.map
|
|
1054
|
+
export { E as a, C as c, _ as d, S as i, x as l, N as n, T as o, A as r, w as s, M as t, y as u };
|
|
@@ -2,4 +2,3 @@ export type { DungeonCastData } from "@crockery/fellowship-data/client";
|
|
|
2
2
|
import type { FellowshipDataClient } from "@crockery/fellowship-data/client";
|
|
3
3
|
/** @deprecated Use the corresponding `FellowshipDataClient` methods. */
|
|
4
4
|
export type FellowshipCastDataSource = Pick<FellowshipDataClient, "loadDungeonCasts" | "resolveAssetUrl">;
|
|
5
|
-
//# sourceMappingURL=cast-data-source.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { FellowshipDataError } from "@crockery/fellowship-data/client";
|
|
2
|
+
export { FellowshipDataError };
|
|
2
3
|
export type { DungeonMapData, FellowshipDataErrorCode, } from "@crockery/fellowship-data/client";
|
|
3
4
|
import type { FellowshipDataClient } from "@crockery/fellowship-data/client";
|
|
5
|
+
export declare const assertSupportedFellowshipDataSchema: (schemaVersion: number) => void;
|
|
4
6
|
/** @deprecated Use the corresponding `FellowshipDataClient` methods. */
|
|
5
7
|
export type FellowshipDataSource = Pick<FellowshipDataClient, "loadDungeon" | "resolveAssetUrl">;
|
|
6
|
-
//# sourceMappingURL=data-source.d.ts.map
|
|
@@ -5,4 +5,3 @@ export interface PackageFellowshipCastDataSourceOptions {
|
|
|
5
5
|
}
|
|
6
6
|
/** @deprecated Use `createPackageFellowshipDataClient` from `@crockery/fellowship-data/client`. */
|
|
7
7
|
export declare const createPackageFellowshipCastDataSource: (options?: PackageFellowshipCastDataSourceOptions) => FellowshipCastDataSource;
|
|
8
|
-
//# sourceMappingURL=package-cast-data-source.d.ts.map
|
|
@@ -5,4 +5,3 @@ export interface PackageFellowshipDataSourceOptions {
|
|
|
5
5
|
}
|
|
6
6
|
/** @deprecated Use `createPackageFellowshipDataClient` from `@crockery/fellowship-data/client`. */
|
|
7
7
|
export declare const createPackageFellowshipDataSource: (options?: PackageFellowshipDataSourceOptions) => FellowshipDataSource;
|
|
8
|
-
//# sourceMappingURL=package-data-source.d.ts.map
|
|
@@ -5,4 +5,3 @@ export interface PackageFellowshipTalentDataSourceOptions {
|
|
|
5
5
|
}
|
|
6
6
|
/** @deprecated Use `createPackageFellowshipDataClient` from `@crockery/fellowship-data/client`. */
|
|
7
7
|
export declare const createPackageFellowshipTalentDataSource: (options?: PackageFellowshipTalentDataSourceOptions) => FellowshipTalentDataSource;
|
|
8
|
-
//# sourceMappingURL=package-talent-data-source.d.ts.map
|
|
@@ -2,4 +2,3 @@ export type { TalentCalculatorData } from "@crockery/fellowship-data/client";
|
|
|
2
2
|
import type { FellowshipDataClient } from "@crockery/fellowship-data/client";
|
|
3
3
|
/** @deprecated Use the corresponding `FellowshipDataClient` methods. */
|
|
4
4
|
export type FellowshipTalentDataSource = Pick<FellowshipDataClient, "loadHeroTalents" | "resolveAssetUrl">;
|
|
5
|
-
//# sourceMappingURL=talent-data-source.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { defineFellowshipDungeonCastBrowser, FellowshipDungeonCastBrowserElement, } from "./dungeon-cast-browser.js";
|
|
2
2
|
export { castIdentityKey, createDungeonCastBrowserModel } from "./render-model.js";
|
|
3
3
|
export type { CastCapabilityLabel, ConfiguredCastFilter, DungeonCastBrowserModel, DungeonCastEnemyModel, DungeonCastModel, FellowshipCastBrowserErrorDetail, FellowshipCastBrowserErrorEvent, FellowshipCastBrowserReadyDetail, FellowshipCastBrowserReadyEvent, FellowshipCastIdentity, FellowshipCastSelectedDetail, FellowshipCastSelectedEvent, FellowshipDungeonCastBrowserProperties, } from "./types.js";
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,4 +2,3 @@ import type { DungeonCastData, FellowshipCastDataSource } from "../data/cast-dat
|
|
|
2
2
|
import type { DungeonCastBrowserModel, FellowshipCastIdentity } from "./types.js";
|
|
3
3
|
export declare const castIdentityKey: ({ enemyId, abilityId }: FellowshipCastIdentity) => string;
|
|
4
4
|
export declare const createDungeonCastBrowserModel: (data: DungeonCastData, source: FellowshipCastDataSource) => DungeonCastBrowserModel;
|
|
5
|
-
//# sourceMappingURL=render-model.d.ts.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./chunks/dungeon-cast-browser-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./chunks/dungeon-cast-browser-CSnu3gC5.js";
|
|
2
2
|
//#region src/dungeon-cast-browser/index.ts
|
|
3
3
|
t();
|
|
4
4
|
//#endregion
|
|
5
5
|
export { r as FellowshipDungeonCastBrowserElement, n as castIdentityKey, e as createDungeonCastBrowserModel, t as defineFellowshipDungeonCastBrowser };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=dungeon-cast-browser.js.map
|
|
@@ -2,4 +2,3 @@ export { FellowshipDungeonMapElement, defineFellowshipDungeonMap } from "./dunge
|
|
|
2
2
|
export { createDungeonMapRenderModel, humanizeMapLabel } from "./render-model.js";
|
|
3
3
|
export { ViewportController } from "./viewport-controller.js";
|
|
4
4
|
export type { DungeonMapEnemyModel, DungeonMapEnemyRenderContext, DungeonMapGroupModel, DungeonMapGroupRenderContext, DungeonMapRenderModel, DungeonMapWarning, FellowshipDungeonMapProperties, FellowshipMapErrorDetail, FellowshipMapImageChangeDetail, FellowshipMapReadyDetail, FellowshipMapViewportChangeDetail, FellowshipMapWarningDetail, LitEnemyRenderer, LitGroupRenderer, MapLabelFormatter, NormalizedRect, ViewportState, } from "./types.js";
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,4 +4,3 @@ import type { DungeonMapRenderModel } from "./types.js";
|
|
|
4
4
|
export declare const isValidMapPosition: (position: Position2D | null) => position is Position2D;
|
|
5
5
|
export declare const createDungeonMapRenderModel: (data: DungeonMapData, mapImage: ImageAssetRef, source: FellowshipDataSource) => DungeonMapRenderModel;
|
|
6
6
|
export declare const humanizeMapLabel: (mapImage: ImageAssetRef, dungeon: Dungeon) => string;
|
|
7
|
-
//# sourceMappingURL=render-model.d.ts.map
|
package/dist/dungeon-map.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./chunks/dungeon-map-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./chunks/dungeon-map-CutIcCVP.js";
|
|
2
2
|
//#region src/dungeon-map/index.ts
|
|
3
3
|
n();
|
|
4
4
|
//#endregion
|
|
5
5
|
export { i as FellowshipDungeonMapElement, r as ViewportController, t as createDungeonMapRenderModel, n as defineFellowshipDungeonMap, e as humanizeMapLabel };
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=dungeon-map.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as e } from "./chunks/data-source-
|
|
2
|
-
import { a as t, i as n, n as r, o as i, r as a, t as o } from "./chunks/dungeon-map-
|
|
3
|
-
import { a as s, i as c, n as l, r as u, t as d } from "./chunks/dungeon-cast-browser-
|
|
4
|
-
import { a as f, c as p, d as m, i as h, l as g, n as _, o as v, r as y, s as b, t as x, u as S } from "./chunks/talent-calculator-
|
|
1
|
+
import { t as e } from "./chunks/data-source-XbksqUrw.js";
|
|
2
|
+
import { a as t, i as n, n as r, o as i, r as a, t as o } from "./chunks/dungeon-map-CutIcCVP.js";
|
|
3
|
+
import { a as s, i as c, n as l, r as u, t as d } from "./chunks/dungeon-cast-browser-CSnu3gC5.js";
|
|
4
|
+
import { a as f, c as p, d as m, i as h, l as g, n as _, o as v, r as y, s as b, t as x, u as S } from "./chunks/talent-calculator-Dxuc2dZ8.js";
|
|
5
5
|
import "./dungeon-map.js";
|
|
6
6
|
import "./dungeon-cast-browser.js";
|
|
7
7
|
import { a as C, i as w, n as T, r as E, t as D } from "./chunks/tooltip-DoQVSnOn.js";
|