mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Styling improvements
This commit is contained in:
parent
ad9a72d494
commit
52f62014f9
3 changed files with 35 additions and 58 deletions
|
|
@ -1115,7 +1115,7 @@
|
||||||
},
|
},
|
||||||
"Rules": {
|
"Rules": {
|
||||||
"damageReduction": {
|
"damageReduction": {
|
||||||
"increasePerArmorMark": "Armor Block Per Mark",
|
"increasePerArmorMark": "Damage Reduction per Armor Slot",
|
||||||
"maxArmorMarkedBonus": "Max Armor Used",
|
"maxArmorMarkedBonus": "Max Armor Used",
|
||||||
"maxArmorMarkedStress": "Max Armor Used With Stress",
|
"maxArmorMarkedStress": "Max Armor Used With Stress",
|
||||||
"stress": {
|
"stress": {
|
||||||
|
|
|
||||||
|
|
@ -5,38 +5,18 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
const ignoredActorKeys = ['config', 'DhEnvironment'];
|
const ignoredActorKeys = ['config', 'DhEnvironment'];
|
||||||
const actorAttributes = Object.keys(game.system.api.models.actors).reduce((acc, key) => {
|
this.changeChoices = Object.keys(game.system.api.models.actors).reduce((acc, key) => {
|
||||||
if (!ignoredActorKeys.includes(key)) {
|
if (!ignoredActorKeys.includes(key)) {
|
||||||
const model = game.system.api.models.actors[key];
|
const model = game.system.api.models.actors[key];
|
||||||
const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model);
|
const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model);
|
||||||
acc[game.i18n.localize(model.metadata.label)] = CONFIG.Token.documentClass.getTrackedAttributeChoices(
|
const group = game.i18n.localize(model.metadata.label);
|
||||||
attributes,
|
const choices = CONFIG.Token.documentClass
|
||||||
model
|
.getTrackedAttributeChoices(attributes, model)
|
||||||
);
|
.map(x => ({ ...x, group: group }));
|
||||||
|
acc.push(...choices);
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, []);
|
||||||
console.log(actorAttributes);
|
|
||||||
|
|
||||||
// const allowedItemKeys = ['DHArmor'];
|
|
||||||
// const itemAttributes = Object.keys(game.system.api.models.items).reduce((acc, key) => {
|
|
||||||
// if(allowedItemKeys.includes(key)) {
|
|
||||||
// const model = game.system.api.models.items[key];
|
|
||||||
// acc[game.i18n.localize(model.metadata.label)] = CONFIG.Token.documentClass.getTrackedAttributes(model);
|
|
||||||
// }
|
|
||||||
// return acc;
|
|
||||||
// }, {});
|
|
||||||
|
|
||||||
// this.selectChoices = [
|
|
||||||
// ...Object.keys(actorAttributes).flatMap(name => {
|
|
||||||
// const attribute = actorAttributes[name];
|
|
||||||
// return { group: name, label: attribute, value: attribute };
|
|
||||||
// }),
|
|
||||||
// ...Object.keys(itemAttributes).flatMap(name => {
|
|
||||||
// const attribute = itemAttributes[name];
|
|
||||||
// return { group: name, label: attribute, value: attribute };
|
|
||||||
// })
|
|
||||||
// ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
|
|
@ -69,17 +49,17 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
||||||
|
|
||||||
_attachPartListeners(partId, htmlElement, options) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
const selectChoices = this.selectChoices;
|
const changeChoices = this.changeChoices;
|
||||||
|
|
||||||
htmlElement.querySelectorAll('.effect-change-input').forEach(element => {
|
htmlElement.querySelectorAll('.effect-change-input').forEach(element => {
|
||||||
autocomplete({
|
autocomplete({
|
||||||
input: element,
|
input: element,
|
||||||
fetch: function (text, update) {
|
fetch: function (text, update) {
|
||||||
if (!text) {
|
if (!text) {
|
||||||
update(selectChoices);
|
update(changeChoices);
|
||||||
} else {
|
} else {
|
||||||
text = text.toLowerCase();
|
text = text.toLowerCase();
|
||||||
var suggestions = selectChoices.filter(n => n.label.toLowerCase().includes(text));
|
var suggestions = changeChoices.filter(n => n.label.toLowerCase().includes(text));
|
||||||
update(suggestions);
|
update(suggestions);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -87,19 +67,14 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
||||||
const label = game.i18n.localize(item.label);
|
const label = game.i18n.localize(item.label);
|
||||||
const matchIndex = label.toLowerCase().indexOf(search);
|
const matchIndex = label.toLowerCase().indexOf(search);
|
||||||
|
|
||||||
const base = document.createElement('div');
|
const beforeText = label.slice(0, matchIndex);
|
||||||
base.textContent = label.slice(0, matchIndex);
|
const matchText = label.slice(matchIndex, matchIndex + search.length);
|
||||||
|
const after = label.slice(matchIndex + search.length, label.length);
|
||||||
|
|
||||||
const matchText = document.createElement('div');
|
const element = document.createElement('li');
|
||||||
matchText.textContent = label.slice(matchIndex, matchIndex + search.length);
|
element.innerHTML = `${beforeText}${matchText ? `<strong>${matchText}</strong>` : ''}${after}`;
|
||||||
matchText.classList.add('matched');
|
|
||||||
|
|
||||||
const after = document.createElement('div');
|
return element;
|
||||||
after.textContent = label.slice(matchIndex + search.length, label.length);
|
|
||||||
|
|
||||||
base.insertAdjacentElement('beforeend', matchText);
|
|
||||||
base.insertAdjacentElement('beforeend', after);
|
|
||||||
return base;
|
|
||||||
},
|
},
|
||||||
renderGroup: function (label) {
|
renderGroup: function (label) {
|
||||||
const itemElement = document.createElement('div');
|
const itemElement = document.createElement('div');
|
||||||
|
|
@ -107,7 +82,7 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
||||||
return itemElement;
|
return itemElement;
|
||||||
},
|
},
|
||||||
onSelect: function (item) {
|
onSelect: function (item) {
|
||||||
element.value = item.value;
|
element.value = `system.${item.value}`;
|
||||||
},
|
},
|
||||||
click: e => e.fetch(),
|
click: e => e.fetch(),
|
||||||
minLength: 0
|
minLength: 0
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,22 @@
|
||||||
.theme-light .autocomplete {
|
.theme-light .autocomplete {
|
||||||
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
background-image: url('../assets/parchments/dh-parchment-light.png');
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.autocomplete {
|
.autocomplete {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
border-width: 0 1px 1px 1px;
|
border-width: 0 1px 1px 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: light-dark(@dark-blue, @beige);
|
border-color: light-dark(@dark, @beige);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
color: light-dark(@beige, @dark);
|
background-image: url('../assets/parchments/dh-parchment-dark.png');
|
||||||
background-image: url('../assets/parchments/dh-parchment-light.png');
|
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
|
max-height: 400px !important;
|
||||||
|
overflow-y: auto;
|
||||||
|
font-style: @font-body;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
|
||||||
.group {
|
.group {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
@ -18,22 +24,18 @@
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div[role='option'] {
|
li[role='option'] {
|
||||||
font-size: 14;
|
font-size: 14px;
|
||||||
padding-left: 16px;
|
padding-left: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: light-dark(@beige-50, @dark-blue);
|
background-color: light-dark(@dark, @beige);
|
||||||
color: light-dark(@dark, @beige);
|
color: light-dark(@beige, var(--color-dark-3));
|
||||||
}
|
}
|
||||||
|
|
||||||
.matched {
|
> div {
|
||||||
font-weight: bold;
|
white-space: nowrap;
|
||||||
}
|
|
||||||
|
|
||||||
&.selected {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue