Skip to content

Commit

Permalink
Merge pull request #1133 from lumphammer/v12-safe
Browse files Browse the repository at this point in the history
Make the codebase safe for V12 again
  • Loading branch information
n3dst4 authored Jan 27, 2025
2 parents dce6c09 + 0295964 commit df7cb9e
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 96 deletions.
144 changes: 73 additions & 71 deletions src/investigator.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,90 +6,92 @@
// We wouldn't need to do this if we were exporting our CSS into a file and
// getting Foundry to load it, but see https://github.com/lumphammer/gumshoe-fvtt/issues/928
// for why we don't do that.
@layer system {
.window-content.non-resizable {
padding: 0;
position: relative;
}

.window-content.resizable {
position: relative;
overflow: hidden;
padding: 0;
.react-target {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
}

a.entity-link,
a.content-link,
a.inline-roll {
background: unset;
border-style: dashed;
border-width: 1px;
}
// disabling layers for now to remain v12 compatible
//@layer system {
.window-content.non-resizable {
padding: 0;
position: relative;
}

.window-content.resizable {
position: relative;
overflow: hidden;
padding: 0;
.react-target {
flex: 1;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
}

// .window-app,
// #sidebar,
// .main-controls li,
// .sub-controls li,
// #players,
// #hotbar > *,
// #navigation a,
// #navigation li {
// backdrop-filter: blur(10px);
// background-image: linear-gradient(to bottom, #000b 0%, #0006 100%);
// }

hr {
width: calc(100% - 2em);
}
a.entity-link,
a.content-link,
a.inline-roll {
background: unset;
border-style: dashed;
border-width: 1px;
}

.journal-sheet.investigator {
.journal-page-header,
.journal-header {
display: none;
}
.journal-entry-pages {
margin: 0;
}
}
.react-target {
flex: 1;
}

button.investigator-secret-hide-reveal-button {
width: fit-content;
}
// .window-app,
// #sidebar,
// .main-controls li,
// .sub-controls li,
// #players,
// #hotbar > *,
// #navigation a,
// #navigation li {
// backdrop-filter: blur(10px);
// background-image: linear-gradient(to bottom, #000b 0%, #0006 100%);
// }

// foundry v12 adds "position: relative" to .directory-item, which breaks our
// absolutely-positioned combat tracker
.investigator-combatant-list .directory-item {
position: absolute;
}
hr {
width: calc(100% - 2em);
}

// foundry's default styles mean our compendium pack names get cut off
.compendium-sidebar .directory-item.compendium[data-pack*="investigator"] h3 {
// was 16px
font-size: 1em;
// was 80%
max-width: 100%;
.journal-sheet.investigator {
.journal-page-header,
.journal-header {
display: none;
}

// we add the .investigator CSS class in our JS sheet classes so we can pick
// out "our" apps from the others. We are specifically overriding `padding`
// here rather than doing a revert-layer (as below) because we probably want
// the rest of the styles to be applied.
.application.investigator .window-content {
padding: 0;
.journal-entry-pages {
margin: 0;
}
}

button.investigator-secret-hide-reveal-button {
width: fit-content;
}

// foundry v12 adds "position: relative" to .directory-item, which breaks our
// absolutely-positioned combat tracker
.investigator-combatant-list .directory-item {
position: absolute;
}

// foundry's default styles mean our compendium pack names get cut off
.compendium-sidebar .directory-item.compendium[data-pack*="investigator"] h3 {
// was 16px
font-size: 1em;
// was 80%
max-width: 100%;
}

// we add the .investigator CSS class in our JS sheet classes so we can pick
// out "our" apps from the others. We are specifically overriding `padding`
// here rather than doing a revert-layer (as below) because we probably want
// the rest of the styles to be applied.
.application.investigator .window-content {
padding: 0;
}
// }

// the upside to taking control over layering is that we stick some
// `revert-layer`s into lower layers when we want to nullify them
@layer elements.typography {
Expand Down
2 changes: 1 addition & 1 deletion src/module/InvestigatorItemSheetV2Class.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ItemSheetV2ClassBase extends ItemSheetV2 {
}

export const ItemSheetV2Class = ReactApplicationV2Mixin(
"ItemSheetV2Class",
"ItemSheetClassV2",
ItemSheetV2ClassBase,
render,
);
7 changes: 3 additions & 4 deletions src/module/NPCSheetClassV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { ReactApplicationV2Mixin } from "@lumphammer/shared-fvtt-bits/src/ReactA
import React from "react";

import { Suspense } from "../components/Suspense";
import { InvestigatorActor } from "./InvestigatorActor";

import DocumentSheetV2 = foundry.applications.api.DocumentSheetV2;
import ActorSheetV2 = foundry.applications.sheets.ActorSheetV2;

const NPCSheet = React.lazy(() =>
import("../components/characters/NPCSheet").then(({ NPCSheet }) => ({
default: NPCSheet,
})),
);

class NPCSheetV2ClassBase extends DocumentSheetV2<InvestigatorActor> {
class NPCSheetV2ClassBase extends ActorSheetV2 {
static DEFAULT_OPTIONS = {
window: {
frame: true,
Expand All @@ -34,7 +33,7 @@ const render = () => {
};

export const NPCSheetClassV2 = ReactApplicationV2Mixin(
"NPCSheetClass",
"NPCSheetClassV2",
NPCSheetV2ClassBase,
render,
);
46 changes: 26 additions & 20 deletions src/startup/registerSheetsAndClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import { InvestigatorCombatant } from "../module/InvestigatorCombatant";
import { InvestigatorCombatTracker } from "../module/InvestigatorCombatTracker";
import { InvestigatorItem } from "../module/InvestigatorItem";
import { ItemSheetClass } from "../module/InvestigatorItemSheetClass";
// eslint-disable-next-line unused-imports/no-unused-imports
import { ItemSheetV2Class } from "../module/InvestigatorItemSheetV2Class";
import { InvestigatorJournalSheet } from "../module/InvestigatorJournalSheet";
import { JournalEditorSheetClass } from "../module/JournalEditorSheetClass";
import { NPCSheetClass } from "../module/NPCSheetClass";
// eslint-disable-next-line unused-imports/no-unused-imports
import { NPCSheetClassV2 } from "../module/NPCSheetClassV2";
import { PartySheetClass } from "../module/PartySheetClass";
import { PCSheetClass } from "../module/PCSheetClass";
// eslint-disable-next-line unused-imports/no-unused-imports
import { PCSheetClassV2 } from "../module/PCSheetClassV2";
export const registerSheetsAndClasses = () => {
CONFIG.Actor.documentClass = InvestigatorActor;
Expand All @@ -27,18 +30,10 @@ export const registerSheetsAndClasses = () => {
makeDefault: true,
types: [constants.pc],
});
Actors.registerSheet(constants.systemId, PCSheetClassV2, {
makeDefault: false,
types: [constants.pc],
});
Actors.registerSheet(constants.systemId, NPCSheetClass, {
makeDefault: true,
types: [constants.npc],
});
Actors.registerSheet(constants.systemId, NPCSheetClassV2, {
makeDefault: false,
types: [constants.npc],
});
Actors.registerSheet(constants.systemId, PartySheetClass, {
makeDefault: true,
types: [constants.party],
Expand All @@ -56,18 +51,6 @@ export const registerSheetsAndClasses = () => {
constants.card,
],
});
Items.registerSheet(constants.systemId, ItemSheetV2Class, {
makeDefault: false,
types: [
constants.weapon,
constants.equipment,
constants.investigativeAbility,
constants.generalAbility,
constants.mwItem,
constants.personalDetail,
constants.card,
],
});
Journal.registerSheet("investigator", JournalEditorSheetClass, {
types: ["base"],
makeDefault: false,
Expand All @@ -78,4 +61,27 @@ export const registerSheetsAndClasses = () => {
makeDefault: false,
label: "Investigator Journal Sheet",
});

// V2 sheets

// Items.registerSheet(constants.systemId, ItemSheetV2Class, {
// makeDefault: false,
// types: [
// constants.weapon,
// constants.equipment,
// constants.investigativeAbility,
// constants.generalAbility,
// constants.mwItem,
// constants.personalDetail,
// constants.card,
// ],
// });
// Actors.registerSheet(constants.systemId, NPCSheetClassV2, {
// makeDefault: false,
// types: [constants.npc],
// });
// Actors.registerSheet(constants.systemId, PCSheetClassV2, {
// makeDefault: false,
// types: [constants.pc],
// });
};

0 comments on commit df7cb9e

Please sign in to comment.