Skip to content

Commit

Permalink
feat(sheets): implement ancestry item sheet #12
Browse files Browse the repository at this point in the history
* chore: Fixed custom fonts

* feat(ancestry sheets): Aded basic Ancestry sheets and advancement data model. Swapped to built-in prosemirror custom element. Updated Item styling to use vertical tabs.

* feat(culture sheet): updated culture sheets to use prosemirror editor and placeholder decsriptions

* chore: minor item header style update

* chore: post merge alignment. Updated Connection, injury, loot, path & specialty items to use the prosemirror element correctly and have initial placeholder values.
Updated cultre and ancestry sheets to make use of base item's form actions.
Fixed specialty item initialisation issues.

* chore: item sheets tab styling alignment

* feat(item sheets): refactored description enrichment to base item sheets

* feat(ancestry sheets): removed custom prose-mirror component

* chore: updated armor and trait items to use description placeholders

* feat(item sheets): ancestry details tab added, with some placeholder content.

* chore: updated missed label localisation

* feat(item sheets): updated new sheet types to include description placeholders & details icons

* feat(item sheets): Ancestry details tab placeholders replaced with valid controls.

* css tweaks

* feat(item sheets): made item sheet tab display into a world setting

* feat(item sheets): style tweaks

* feat: add document ref input component

* feat(ancestry sheet): improve usability of advancement extra talents list

* feat(ancestry sheet): replace talent picks list with bonus talents rules list

* feat(ancestry-sheets): PR comments addressed:
- removed orphaned & redundant code
- small caps applied to headers
- font changes restricted to document sheets for now
- hid the item titles when sheets not minimised
- description tab only shows editor if the sheet is editable for the user

* feat(item sheets): updated description tab to display read-only elements in a column

---------

Co-authored-by: stanavdb <[email protected]>
  • Loading branch information
zithith and stanavdb authored Oct 19, 2024
1 parent 6abdd7b commit 79eb5ea
Show file tree
Hide file tree
Showing 76 changed files with 1,730 additions and 264 deletions.
File renamed without changes.
12 changes: 10 additions & 2 deletions src/declarations/foundry/client/data/abstract/client-document.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ declare function _ClientDocumentMixin<
Schema extends foundry.abstract.DataModel = foundry.abstract.DataModel,
Parent extends foundry.abstract.Document | null = null,
BaseClass extends typeof foundry.abstract.Document<Schema, Parent>,
>(base: BaseClass): Mixin<BaseClass, typeof _ClientDocument>;
>(base: BaseClass): Mixin<BaseClass, typeof ClientDocument>;

declare class _ClientDocument {
declare class ClientDocument {
/**
* A collection of Application instances which should be re-rendered whenever this document is updated.
* The keys of this object are the application ids and the values are Application instances. Each
Expand Down Expand Up @@ -40,4 +40,12 @@ declare class _ClientDocument {
* Called before {@link ClientDocument#prepareDerivedData} in {@link ClientDocument#prepareData}.
*/
public prepareDerivedData();

/**
* Create a content link for this Document.
* @param options Additional options to configure how the link is constructed.
*/
public toAnchor(
options?: Partial<TextEditor.EnrichmentAnchorOptions>,
): HTMLAnchorElement;
}
63 changes: 63 additions & 0 deletions src/declarations/foundry/common/abstract/fields.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,69 @@ declare namespace foundry {
class SetField extends ArrayField {}

class HTMLField extends StringField {}

/**
* A subclass of {@link ObjectField} which embeds some other DataModel definition as an inner object.
*/
class EmbeddedDataField extends SchemaField {
constructor(
model: typeof foundry.data.DataModel,
options?: DataFieldOptions,
context?: DataFieldContext,
);
}

/**
* A subclass of {@link ArrayField} which supports an embedded Document collection.
* Invalid elements will be dropped from the collection during validation rather than failing for the field entirely.
*/
class EmbeddedCollectionField extends ArrayField {
constructor(
element: typeof foundry.abstract.Document,
options?: DataFieldOptions,
context?: DataFieldContext,
);
}

/**
* A subclass of {@link EmbeddedDataField} which supports a single embedded Document.
*/
class EmbeddedDocumentField extends EmbeddedDataField {
constructor(
model: typeof foundry.abstract.Document,
options?: DataFieldOptions,
context?: DataFieldContext,
);
}

/**
* A subclass of {@link StringField} which provides the primary _id for a Document.
* The field may be initially null, but it must be non-null when it is saved to the database.
*/
class DocumentIdField extends StringField {}

interface DocumentUUIDFieldOptions extends StringFieldOptions {
/**
* A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field
*/
type?: string;

/**
* Does this field require (or prohibit) embedded documents?
*/
embedded?: boolean;
}

/**
* A subclass of {@link StringField} which supports referencing some other Document by its UUID.
* This field may not be blank, but may be null to indicate that no UUID is referenced.
*/
class DocumentUUIDField extends StringField {
constructor(
options?: DocumentUUIDFieldOptions,
context?: DataFieldContext,
);
}
}
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Hooks.once('init', async () => {

Items.unregisterSheet('core', ItemSheet);
registerItemSheet(ItemType.Culture, applications.item.CultureItemSheet);
registerItemSheet(ItemType.Ancestry, applications.item.AncestrySheet);
registerItemSheet(ItemType.Path, applications.item.PathItemSheet);
registerItemSheet(
ItemType.Connection,
Expand Down
97 changes: 84 additions & 13 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,55 +267,68 @@
"Type": {
"Weapon": {
"label": "Weapon",
"label_plural": "Weapons"
"label_plural": "Weapons",
"desc_placeholder": "Edit this to describe what this weapon is & how it looks."
},
"Armor": {
"label": "Armor",
"label_plural": "Armor"
"label_plural": "Armor",
"desc_placeholder": "Edit this to describe what this armor is & how it looks."
},
"Equipment": {
"label": "Equipment",
"label_plural": "Equipment"
"label_plural": "Equipment",
"desc_placeholder": "Edit this to describe what this piece of equipment is & how it looks."
},
"Loot": {
"label": "Loot",
"label_plural": "Loot"
"label_plural": "Loot",
"desc_placeholder": "Edit this to describe the item."
},
"Ancestry": {
"label": "Ancestry",
"label_plural": "Ancestries"
"label_plural": "Ancestries",
"desc_placeholder": "Edit this to define a potential heritage for a character. Also include any special rules text for players to read."
},
"Culture": {
"label": "Culture",
"label_plural": "Cultures"
"label_plural": "Cultures",
"desc_placeholder": "Edit this to define one of the many cultures in the setting. Also include any special rules text for players to read."
},
"Path": {
"label": "Path",
"label_plural": "Paths"
"label_plural": "Paths",
"desc_placeholder": "Edit this to describe this the sorts of characters this progression path represents."
},
"Specialty": {
"label": "Specialty",
"label_plural": "Specialties"
"label_plural": "Specialties",
"desc_placeholder": "Edit this to describe the unique subset of characters this specialty represents."
},
"Talent": {
"label": "Talent",
"label_plural": "Talents"
"label_plural": "Talents",
"desc_placeholder": "Edit this to describe what this Talent does."
},
"Action": {
"label": "Action",
"label_plural": "Actions"
"label_plural": "Actions",
"desc_placeholder": "Edit this to describe what this action is and does."
},
"Trait": {
"label": "Trait",
"label_plural": "Traits"
"label_plural": "Traits",
"desc_placeholder": "Edit this to describe this trait."
},
"Injury": {
"label": "Injury",
"label_plural": "Injuries"
"label_plural": "Injuries",
"desc_placeholder": "Edit this to describe how this injury affects a character."
},
"Connection": {
"label": "Connection",
"label_plural": "Connections"
"label_plural": "Connections",
"desc_placeholder": "Edit this to create a description of the NPC and how they are connected to the character."
}
},
"Weapon": {
Expand Down Expand Up @@ -454,6 +467,7 @@
},
"AttackFlavor": "[actor] attacks with their [item].",
"Sheet": {
"Basics": "Basics",
"Tabs": {
"Description": "Description",
"Effects": "Effects",
Expand All @@ -469,6 +483,27 @@
"InitialDuration": "Initial",
"RemainingDuration": "Remaining"
},
"Ancestry": {
"Size": "Size",
"Advancement": "Advancement",
"FreePath": "Free Path",
"FreeTalents": "Free Talents",
"BonusTalents": "Bonus Talents",
"Restrictions": "Restrictions",
"PathReferencePlaceholder": "Drop a Path here to set a free path",
"TalentIdDescription": "The identifier column should hold the identifier of the talent item you want characters with this Ancestry to have access to. The path identifier can only contain letters (a-z), numbers (0-9), dashes (-), and underscores (_).",
"Component": {
"AdvancementTalentList": {
"DropTalent": "Drop a Talent here to add it to the list",
"Warning": {
"WrongType": "The dropped Document must be of type Talent"
}
},
"BonusTalents": {
"Add": "New Rule"
}
}
},
"Specialty": {
"PathId": "Path Identifier",
"PathIdDescription": "The identifier of the path this specialty belongs to. The path identifier can only contain letters (a-z), numbers (0-9), dashes (-), and underscores (_)."
Expand Down Expand Up @@ -627,6 +662,21 @@
"Edit": "Edit Effect",
"Delete": "Remove Effect",
"ToggleActive": "Toggle Active"
},
"Talents": {
"Label": "Talents",
"AcquiredAtLevel": "Acquired at Level",
"Add": "New Talent",
"Edit": "Edit Talent",
"Delete": "Remove Talent",
"Cancel": "Discard Changes",
"Submit": "Finish Editing"
},
"TalentPicks": {
"Edit": "Edit",
"Delete": "Remove",
"Cancel": "Discard Changes",
"Submit": "Finish Editing"
}
},
"Attribute": {
Expand Down Expand Up @@ -738,12 +788,29 @@
"Dice": "Dice"
}
}
},
"EditBonusTalentsRule": {
"Title": "Edit Bonus Talents Rule",
"Quantity": "Amount",
"Warning": {
"DuplicateLevel": "A rule for level {level} already exists"
}
}
},
"COMPONENT": {
"DocumentReferenceInput": {
"Placeholder": "Drop a {type} here to create a reference",
"Warning": {
"WrongType": "The dropped Document must be of type {type}",
"WrongSubtype": "The dropped {type} must be of type {subtype}"
}
}
},
"GENERIC": {
"Unknown": "Unknown",
"None": "None",
"Default": "Default",
"Document": "Document",
"Formula": "Formula",
"Value": "Value",
"Skill": "Skill",
Expand All @@ -760,6 +827,9 @@
"Mode": "Mode",
"Turns": "Turns",
"Rounds": "Rounds",
"Clear": "Clear",
"Name": "Name",
"Level": "Level",
"Button": {
"Roll": "Roll",
"Continue": "Continue",
Expand Down Expand Up @@ -800,6 +870,7 @@
},
"Item": {
"culture": "Culture",
"ancestry": "Ancestry",
"path": "Path",
"connection": "Connection",
"injury": "Injury",
Expand Down
39 changes: 28 additions & 11 deletions src/style.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
@import './style/sheets/module.scss';
@import './style/chat/module.scss';
@import './style/sidebar/combat.scss';
@import './style/dialog.scss';
@import './style/components.scss';
@import './style/module.scss';

// @import './style/chat/module.scss';
/* ----------------------------------------- */
/* Globals */
/* ----------------------------------------- */
Expand All @@ -25,6 +20,9 @@
--plotweaver-color-invest-front: #3e6abb;
--plotweaver-color-invest-back: #182845;

// --font-primary: 'Laski Sans';
// --font-h5: 'Laski-Sans';

/* ----------------------------------------- */
/* Default Generic Theme */
/* ----------------------------------------- */
Expand Down Expand Up @@ -67,36 +65,55 @@
font-family: 'Penumbra Web Pro';
font-style: normal;
font-weight: 400;
src: url('../../fonts/penumbra-web-pro/PenumbraWebPro-Serif.woff2')
format('woff2');
src: url('assets/fonts/penumbra-web-pro/PenumbraWebPro-Serif.woff')
format('woff');
}

@font-face {
font-family: 'Laski Sans';
font-style: normal;
font-weight: 400;
src: url('../../fonts/laski-sans/Laski-Sans-Regular.woff2') format('woff2');
src: url('assets/fonts/laski-sans/Laski-Sans-Regular.woff2') format('woff2');
}

@font-face {
font-family: 'Laski Sans';
font-style: normal;
font-weight: 600;
src: url('../../fonts/laski-sans/Laski-Sans-SemiBold.woff2') format('woff2');
src: url('assets/fonts/laski-sans/Laski-Sans-SemiBold.woff2')
format('woff2');
}

@font-face {
font-family: 'Laski Sans';
font-style: normal;
font-weight: 700;
src: url('../../fonts/laski-sans/Laski-Sans-Bold.woff2') format('woff2');
src: url('assets/fonts/laski-sans/Laski-Sans-Bold.woff2') format('woff2');
}

@font-face {
font-family: 'cosmere-dingbats';
src: url('https://dl.dropboxusercontent.com/scl/fi/9909gen4fd0oveyzfposx/CosmereDingbats-Regular.otf?rlkey=ig6odq9hxyo1st8kt3ujp1czz&st=72qrads3&raw=1');
}

.application h1,
span.document-name {
font-family: 'Penumbra Web Pro';
font-variant: small-caps;
}

.application h4 {
font-variant: small-caps;
}

.application h5 {
font-family: 'Laski Sans';
}

.application {
font-family: 'Laski Sans';
}

em.cosmere-icon,
i.cosmere-icon {
font-family: 'cosmere-dingbats';
Expand Down
Loading

0 comments on commit 79eb5ea

Please sign in to comment.