0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 09:33:08 +00:00

add more image snippets and other snippets

This commit is contained in:
Charlie Humphreys
2023-07-16 12:35:08 -05:00
parent 1b2d8d46a6
commit 77b0e93dd3
4 changed files with 78 additions and 12 deletions

View File

@@ -1,6 +1,11 @@
const _ = require('lodash');
const { SNIPPET_TYPE, FIELD_TYPE } = require('../../../shared/naturalcrit/codeEditor/helpers/widget-elements/constants');
const fourDigitNumberFromValue = (value)=>typeof value === 'number' ? (()=>{
const str = String(value);
return _.range(0, 4 - str.length).map(()=>'0').join('') + str;
})() : value;
module.exports = [{
name : 'monster',
type : SNIPPET_TYPE.BLOCK,
@@ -24,6 +29,30 @@ module.exports = [{
name : 'wide',
type : FIELD_TYPE.CHECKBOX
}]
}, {
name : 'runeTable',
type : SNIPPET_TYPE.BLOCK,
fields : [{
name : 'frame',
type : FIELD_TYPE.CHECKBOX
}, {
name : 'wide',
type : FIELD_TYPE.CHECKBOX
}, {
name : 'font-family',
type : FIELD_TYPE.TEXT
}]
}, {
name : 'index',
type : SNIPPET_TYPE.BLOCK,
fields : [{
name : 'wide',
type : FIELD_TYPE.CHECKBOX
}, {
name : 'columns',
type : FIELD_TYPE.TEXT,
increment : 1
}]
}, {
name : 'image',
type : SNIPPET_TYPE.INJECTOR,
@@ -71,11 +100,46 @@ module.exports = [{
fields : [{
name : 'imageMaskCenter',
type : FIELD_TYPE.IMAGE_SELECTOR,
preview : (value)=>`/assets/waterColorMasks/center/${typeof value === 'number' ? (()=>{
const str = String(value);
return _.range(0, 4 - str.length).map(()=>'0').join('') + str;
})() : value}.webp`,
values : _.range(1, 17)
preview : (value)=>`/assets/waterColorMasks/center/${fourDigitNumberFromValue(value)}.webp`,
values : _.range(1, 17)
}, {
name : '--offsetX',
type : FIELD_TYPE.TEXT,
increment : 5,
}, {
name : '--offsetY',
type : FIELD_TYPE.TEXT,
increment : 5,
}, {
name : '--rotation',
type : FIELD_TYPE.TEXT,
increment : 5,
}]
}, {
name : 'imageMaskEdge',
type : SNIPPET_TYPE.INLINE,
fields : [{
name : 'imageMaskEdge',
type : FIELD_TYPE.IMAGE_SELECTOR,
preview : (value)=>`/assets/waterColorMasks/edge/${fourDigitNumberFromValue(value)}.webp`,
values : _.range(1, 9)
}, {
name : '--offset',
type : FIELD_TYPE.TEXT,
increment : 5,
}, {
name : '--rotation',
type : FIELD_TYPE.TEXT,
increment : 5,
}]
}, {
name : 'imageMaskCorner',
type : SNIPPET_TYPE.INLINE,
fields : [{
name : 'imageMaskCorner',
type : FIELD_TYPE.IMAGE_SELECTOR,
preview : (value)=>`/assets/waterColorMasks/corner/${fourDigitNumberFromValue(value)}.webp`,
values : _.range(1, 38)
}, {
name : '--offsetX',
type : FIELD_TYPE.TEXT,