Grabbed dndbeyond's source code

```
~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js
```
This commit is contained in:
2025-05-28 11:50:03 -07:00
commit 8df9031d27
3592 changed files with 319051 additions and 0 deletions
@@ -0,0 +1,124 @@
import { orderBy } from "lodash";
import React from "react";
import {
AbilityLookup,
BaseSpell,
CharacterTheme,
DataOriginRefData,
RuleData,
SpellUtils,
} from "@dndbeyond/character-rules-engine/es";
import { SpellName } from "~/components/SpellName";
import { FeatureSnippetLimitedUse } from "../FeatureSnippetLimitedUse";
interface Props {
spells?: Array<BaseSpell>;
layoutType: "list" | "compact";
onSpellUseSet?: (spell: BaseSpell, uses: number) => void;
onSpellClick?: (spell: BaseSpell) => void;
dataOriginRefData: DataOriginRefData;
ruleData: RuleData;
abilityLookup: AbilityLookup;
isInteractive: boolean;
proficiencyBonus: number;
theme: CharacterTheme;
}
export default class FeatureSnippetSpells extends React.PureComponent<Props> {
static defaultProps = {
layoutType: "list",
};
handleSpellUseSet = (spell: BaseSpell, uses: number): void => {
const { onSpellUseSet } = this.props;
if (onSpellUseSet) {
onSpellUseSet(spell, uses);
}
};
handleSpellClick = (spell: BaseSpell, evt: React.MouseEvent): void => {
const { onSpellClick } = this.props;
if (onSpellClick) {
evt.stopPropagation();
evt.nativeEvent.stopImmediatePropagation();
onSpellClick(spell);
}
};
render() {
const {
spells,
ruleData,
abilityLookup,
layoutType,
isInteractive,
dataOriginRefData,
proficiencyBonus,
theme,
} = this.props;
if (!spells || !spells.length) {
return null;
}
let orderedSpells = orderBy(
spells,
[
(spell) => SpellUtils.getLevel(spell),
(spell) => SpellUtils.getName(spell),
],
["asc", "asc"]
);
let classNames: Array<string> = [
"ct-feature-snippet__spells",
`ct-feature-snippet__spells--layout-${layoutType}`,
];
if (theme?.isDarkMode) {
classNames.push(`ct-feature-snippet__spells--dark-mode`);
}
return (
<div className={classNames.join(" ")}>
{orderedSpells.map((spell, idx) => (
<div
className="ct-feature-snippet__spell"
key={SpellUtils.getUniqueKey(spell)}
>
<div
className="ct-feature-snippet__spell-summary"
onClick={this.handleSpellClick.bind(this, spell)}
>
<SpellName
spell={spell}
showLegacy={true}
dataOriginRefData={dataOriginRefData}
/>
</div>
{layoutType !== "compact" && !SpellUtils.isCantrip(spell) && (
<FeatureSnippetLimitedUse
component={spell}
theme={theme}
limitedUse={SpellUtils.getLimitedUse(spell)}
onUseSet={this.handleSpellUseSet}
abilityLookup={abilityLookup}
ruleData={ruleData}
isInteractive={isInteractive}
proficiencyBonus={proficiencyBonus}
/>
)}
{layoutType === "compact" && idx + 1 < orderedSpells.length && (
<span className="ct-feature-snippet__spell-sep">,</span>
)}
</div>
))}
</div>
);
}
}
@@ -0,0 +1,4 @@
import FeatureSnippetSpells from "./FeatureSnippetSpells";
export default FeatureSnippetSpells;
export { FeatureSnippetSpells };