format files

This commit is contained in:
Johannes Loher 2020-12-23 17:09:02 +01:00
parent bd4c5308bf
commit 4f6a9b7e73
18 changed files with 541 additions and 622 deletions

View file

@ -1,55 +1,55 @@
const gulp = require('gulp'); const gulp = require("gulp");
const fs = require('fs-extra'); const fs = require("fs-extra");
const path = require('path'); const path = require("path");
const chalk = require('chalk'); const chalk = require("chalk");
const archiver = require('archiver'); const archiver = require("archiver");
const stringify = require('json-stringify-pretty-compact'); const stringify = require("json-stringify-pretty-compact");
const typescript = require('typescript'); const typescript = require("typescript");
const ts = require('gulp-typescript'); const ts = require("gulp-typescript");
const less = require('gulp-less'); const less = require("gulp-less");
const sass = require('gulp-sass'); const sass = require("gulp-sass");
const git = require('gulp-git'); const git = require("gulp-git");
const argv = require('yargs').argv; const argv = require("yargs").argv;
sass.compiler = require('sass'); sass.compiler = require("sass");
function getConfig() { function getConfig() {
const configPath = path.resolve(process.cwd(), 'foundryconfig.json'); const configPath = path.resolve(process.cwd(), "foundryconfig.json");
let config; let config;
if (fs.existsSync(configPath)) { if (fs.existsSync(configPath)) {
config = fs.readJSONSync(configPath); config = fs.readJSONSync(configPath);
return config; return config;
} else { } else {
return; return;
} }
} }
function getManifest() { function getManifest() {
const json = {}; const json = {};
if (fs.existsSync('src')) { if (fs.existsSync("src")) {
json.root = 'src'; json.root = "src";
} else { } else {
json.root = 'dist'; json.root = "dist";
} }
const modulePath = path.join(json.root, 'module.json'); const modulePath = path.join(json.root, "module.json");
const systemPath = path.join(json.root, 'system.json'); const systemPath = path.join(json.root, "system.json");
if (fs.existsSync(modulePath)) { if (fs.existsSync(modulePath)) {
json.file = fs.readJSONSync(modulePath); json.file = fs.readJSONSync(modulePath);
json.name = 'module.json'; json.name = "module.json";
} else if (fs.existsSync(systemPath)) { } else if (fs.existsSync(systemPath)) {
json.file = fs.readJSONSync(systemPath); json.file = fs.readJSONSync(systemPath);
json.name = 'system.json'; json.name = "system.json";
} else { } else {
return; return;
} }
return json; return json;
} }
/** /**
@ -57,75 +57,63 @@ function getManifest() {
* @returns {typescript.TransformerFactory<typescript.SourceFile>} * @returns {typescript.TransformerFactory<typescript.SourceFile>}
*/ */
function createTransformer() { function createTransformer() {
/** /**
* @param {typescript.Node} node * @param {typescript.Node} node
*/ */
function shouldMutateModuleSpecifier(node) { function shouldMutateModuleSpecifier(node) {
if ( if (!typescript.isImportDeclaration(node) && !typescript.isExportDeclaration(node)) return false;
!typescript.isImportDeclaration(node) && if (node.moduleSpecifier === undefined) return false;
!typescript.isExportDeclaration(node) if (!typescript.isStringLiteral(node.moduleSpecifier)) return false;
) if (!node.moduleSpecifier.text.startsWith("./") && !node.moduleSpecifier.text.startsWith("../")) return false;
return false; if (path.extname(node.moduleSpecifier.text) !== "") return false;
if (node.moduleSpecifier === undefined) return false; return true;
if (!typescript.isStringLiteral(node.moduleSpecifier)) return false; }
if (
!node.moduleSpecifier.text.startsWith('./') &&
!node.moduleSpecifier.text.startsWith('../')
)
return false;
if (path.extname(node.moduleSpecifier.text) !== '') return false;
return true;
}
/** /**
* Transforms import/export declarations to append `.js` extension * Transforms import/export declarations to append `.js` extension
* @param {typescript.TransformationContext} context * @param {typescript.TransformationContext} context
*/ */
function importTransformer(context) { function importTransformer(context) {
return (node) => { return (node) => {
/** /**
* @param {typescript.Node} node * @param {typescript.Node} node
*/ */
function visitor(node) { function visitor(node) {
if (shouldMutateModuleSpecifier(node)) { if (shouldMutateModuleSpecifier(node)) {
if (typescript.isImportDeclaration(node)) { if (typescript.isImportDeclaration(node)) {
const newModuleSpecifier = typescript.createLiteral( const newModuleSpecifier = typescript.createLiteral(`${node.moduleSpecifier.text}.js`);
`${node.moduleSpecifier.text}.js` return typescript.updateImportDeclaration(
); node,
return typescript.updateImportDeclaration( node.decorators,
node, node.modifiers,
node.decorators, node.importClause,
node.modifiers, newModuleSpecifier
node.importClause, );
newModuleSpecifier } else if (typescript.isExportDeclaration(node)) {
); const newModuleSpecifier = typescript.createLiteral(`${node.moduleSpecifier.text}.js`);
} else if (typescript.isExportDeclaration(node)) { return typescript.updateExportDeclaration(
const newModuleSpecifier = typescript.createLiteral( node,
`${node.moduleSpecifier.text}.js` node.decorators,
); node.modifiers,
return typescript.updateExportDeclaration( node.exportClause,
node, newModuleSpecifier
node.decorators, );
node.modifiers, }
node.exportClause, }
newModuleSpecifier return typescript.visitEachChild(node, visitor, context);
); }
}
}
return typescript.visitEachChild(node, visitor, context);
}
return typescript.visitNode(node, visitor); return typescript.visitNode(node, visitor);
}; };
} }
return importTransformer; return importTransformer;
} }
const tsConfig = ts.createProject('tsconfig.json', { const tsConfig = ts.createProject("tsconfig.json", {
getCustomTransformers: (_program) => ({ getCustomTransformers: (_program) => ({
after: [createTransformer()], after: [createTransformer()],
}), }),
}); });
/********************/ /********************/
@ -136,63 +124,48 @@ const tsConfig = ts.createProject('tsconfig.json', {
* Build TypeScript * Build TypeScript
*/ */
function buildTS() { function buildTS() {
return gulp.src('src/**/*.ts').pipe(tsConfig()).pipe(gulp.dest('dist')); return gulp.src("src/**/*.ts").pipe(tsConfig()).pipe(gulp.dest("dist"));
} }
/** /**
* Build Less * Build Less
*/ */
function buildLess() { function buildLess() {
return gulp.src('src/*.less').pipe(less()).pipe(gulp.dest('dist')); return gulp.src("src/*.less").pipe(less()).pipe(gulp.dest("dist"));
} }
/** /**
* Build SASS * Build SASS
*/ */
function buildSASS() { function buildSASS() {
return gulp return gulp.src("src/*.scss").pipe(sass().on("error", sass.logError)).pipe(gulp.dest("dist"));
.src('src/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('dist'));
} }
/** /**
* Copy static files * Copy static files
*/ */
async function copyFiles() { async function copyFiles() {
const statics = [ const statics = ["lang", "fonts", "assets", "templates", "module.json", "system.json", "template.json"];
'lang', try {
'fonts', for (const file of statics) {
'assets', if (fs.existsSync(path.join("src", file))) {
'templates', await fs.copy(path.join("src", file), path.join("dist", file));
'module.json', }
'system.json', }
'template.json', return Promise.resolve();
]; } catch (err) {
try { Promise.reject(err);
for (const file of statics) { }
if (fs.existsSync(path.join('src', file))) {
await fs.copy(path.join('src', file), path.join('dist', file));
}
}
return Promise.resolve();
} catch (err) {
Promise.reject(err);
}
} }
/** /**
* Watch for changes for each build step * Watch for changes for each build step
*/ */
function buildWatch() { function buildWatch() {
gulp.watch('src/**/*.ts', { ignoreInitial: false }, buildTS); gulp.watch("src/**/*.ts", { ignoreInitial: false }, buildTS);
gulp.watch('src/**/*.less', { ignoreInitial: false }, buildLess); gulp.watch("src/**/*.less", { ignoreInitial: false }, buildLess);
gulp.watch('src/**/*.scss', { ignoreInitial: false }, buildSASS); gulp.watch("src/**/*.scss", { ignoreInitial: false }, buildSASS);
gulp.watch( gulp.watch(["src/fonts", "src/lang", "src/templates", "src/*.json"], { ignoreInitial: false }, copyFiles);
['src/fonts', 'src/lang', 'src/templates', 'src/*.json'],
{ ignoreInitial: false },
copyFiles
);
} }
/********************/ /********************/
@ -204,43 +177,40 @@ function buildWatch() {
* while ignoring source files * while ignoring source files
*/ */
async function clean() { async function clean() {
const name = path.basename(path.resolve('.')); const name = path.basename(path.resolve("."));
const files = []; const files = [];
// If the project uses TypeScript // If the project uses TypeScript
if (fs.existsSync(path.join('src', `${name}.ts`))) { if (fs.existsSync(path.join("src", `${name}.ts`))) {
files.push( files.push(
'lang', "lang",
'templates', "templates",
'assets', "assets",
'module', "module",
`${name}.js`, `${name}.js`,
'module.json', "module.json",
'system.json', "system.json",
'template.json' "template.json"
); );
} }
// If the project uses Less or SASS // If the project uses Less or SASS
if ( if (fs.existsSync(path.join("src", `${name}.less`)) || fs.existsSync(path.join("src", `${name}.scss`))) {
fs.existsSync(path.join('src', `${name}.less`)) || files.push("fonts", `${name}.css`);
fs.existsSync(path.join('src', `${name}.scss`)) }
) {
files.push('fonts', `${name}.css`);
}
console.log(' ', chalk.yellow('Files to clean:')); console.log(" ", chalk.yellow("Files to clean:"));
console.log(' ', chalk.blueBright(files.join('\n '))); console.log(" ", chalk.blueBright(files.join("\n ")));
// Attempt to remove the files // Attempt to remove the files
try { try {
for (const filePath of files) { for (const filePath of files) {
await fs.remove(path.join('dist', filePath)); await fs.remove(path.join("dist", filePath));
} }
return Promise.resolve(); return Promise.resolve();
} catch (err) { } catch (err) {
Promise.reject(err); Promise.reject(err);
} }
} }
/********************/ /********************/
@ -251,55 +221,47 @@ async function clean() {
* Link build to User Data folder * Link build to User Data folder
*/ */
async function linkUserData() { async function linkUserData() {
const name = path.basename(path.resolve('.')); const name = path.basename(path.resolve("."));
const config = fs.readJSONSync('foundryconfig.json'); const config = fs.readJSONSync("foundryconfig.json");
let destDir; let destDir;
try { try {
if ( if (
fs.existsSync(path.resolve('.', 'dist', 'module.json')) || fs.existsSync(path.resolve(".", "dist", "module.json")) ||
fs.existsSync(path.resolve('.', 'src', 'module.json')) fs.existsSync(path.resolve(".", "src", "module.json"))
) { ) {
destDir = 'modules'; destDir = "modules";
} else if ( } else if (
fs.existsSync(path.resolve('.', 'dist', 'system.json')) || fs.existsSync(path.resolve(".", "dist", "system.json")) ||
fs.existsSync(path.resolve('.', 'src', 'system.json')) fs.existsSync(path.resolve(".", "src", "system.json"))
) { ) {
destDir = 'systems'; destDir = "systems";
} else { } else {
throw Error( throw Error(`Could not find ${chalk.blueBright("module.json")} or ${chalk.blueBright("system.json")}`);
`Could not find ${chalk.blueBright( }
'module.json'
)} or ${chalk.blueBright('system.json')}`
);
}
let linkDir; let linkDir;
if (config.dataPath) { if (config.dataPath) {
if (!fs.existsSync(path.join(config.dataPath, 'Data'))) if (!fs.existsSync(path.join(config.dataPath, "Data")))
throw Error('User Data path invalid, no Data directory found'); throw Error("User Data path invalid, no Data directory found");
linkDir = path.join(config.dataPath, 'Data', destDir, name); linkDir = path.join(config.dataPath, "Data", destDir, name);
} else { } else {
throw Error('No User Data path defined in foundryconfig.json'); throw Error("No User Data path defined in foundryconfig.json");
} }
if (argv.clean || argv.c) { if (argv.clean || argv.c) {
console.log( console.log(chalk.yellow(`Removing build in ${chalk.blueBright(linkDir)}`));
chalk.yellow(`Removing build in ${chalk.blueBright(linkDir)}`)
);
await fs.remove(linkDir); await fs.remove(linkDir);
} else if (!fs.existsSync(linkDir)) { } else if (!fs.existsSync(linkDir)) {
console.log( console.log(chalk.green(`Copying build to ${chalk.blueBright(linkDir)}`));
chalk.green(`Copying build to ${chalk.blueBright(linkDir)}`) await fs.symlink(path.resolve("./dist"), linkDir);
); }
await fs.symlink(path.resolve('./dist'), linkDir); return Promise.resolve();
} } catch (err) {
return Promise.resolve(); Promise.reject(err);
} catch (err) { }
Promise.reject(err);
}
} }
/*********************/ /*********************/
@ -310,47 +272,45 @@ async function linkUserData() {
* Package build * Package build
*/ */
async function packageBuild() { async function packageBuild() {
const manifest = getManifest(); const manifest = getManifest();
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
// Remove the package dir without doing anything else // Remove the package dir without doing anything else
if (argv.clean || argv.c) { if (argv.clean || argv.c) {
console.log(chalk.yellow('Removing all packaged files')); console.log(chalk.yellow("Removing all packaged files"));
fs.removeSync('package'); fs.removeSync("package");
return; return;
} }
// Ensure there is a directory to hold all the packaged versions // Ensure there is a directory to hold all the packaged versions
fs.ensureDirSync('package'); fs.ensureDirSync("package");
// Initialize the zip file // Initialize the zip file
const zipName = `${manifest.file.name}-v${manifest.file.version}.zip`; const zipName = `${manifest.file.name}-v${manifest.file.version}.zip`;
const zipFile = fs.createWriteStream(path.join('package', zipName)); const zipFile = fs.createWriteStream(path.join("package", zipName));
const zip = archiver('zip', { zlib: { level: 9 } }); const zip = archiver("zip", { zlib: { level: 9 } });
zipFile.on('close', () => { zipFile.on("close", () => {
console.log(chalk.green(zip.pointer() + ' total bytes')); console.log(chalk.green(zip.pointer() + " total bytes"));
console.log( console.log(chalk.green(`Zip file ${zipName} has been written`));
chalk.green(`Zip file ${zipName} has been written`) return resolve();
); });
return resolve();
});
zip.on('error', (err) => { zip.on("error", (err) => {
throw err; throw err;
}); });
zip.pipe(zipFile); zip.pipe(zipFile);
// Add the directory with the final code // Add the directory with the final code
zip.directory('dist/', manifest.file.name); zip.directory("dist/", manifest.file.name);
zip.finalize(); zip.finalize();
} catch (err) { } catch (err) {
return reject(err); return reject(err);
} }
}); });
} }
/*********************/ /*********************/
@ -361,128 +321,99 @@ async function packageBuild() {
* Update version and URLs in the manifest JSON * Update version and URLs in the manifest JSON
*/ */
function updateManifest(cb) { function updateManifest(cb) {
const packageJson = fs.readJSONSync('package.json'); const packageJson = fs.readJSONSync("package.json");
const config = getConfig(), const config = getConfig(),
manifest = getManifest(), manifest = getManifest(),
rawURL = config.rawURL, rawURL = config.rawURL,
repoURL = config.repository, repoURL = config.repository,
manifestRoot = manifest.root; manifestRoot = manifest.root;
if (!config) cb(Error(chalk.red('foundryconfig.json not found'))); if (!config) cb(Error(chalk.red("foundryconfig.json not found")));
if (!manifest) cb(Error(chalk.red('Manifest JSON not found'))); if (!manifest) cb(Error(chalk.red("Manifest JSON not found")));
if (!rawURL || !repoURL) if (!rawURL || !repoURL) cb(Error(chalk.red("Repository URLs not configured in foundryconfig.json")));
cb(
Error(
chalk.red(
'Repository URLs not configured in foundryconfig.json'
)
)
);
try { try {
const version = argv.update || argv.u; const version = argv.update || argv.u;
/* Update version */ /* Update version */
const versionMatch = /^(\d{1,}).(\d{1,}).(\d{1,})$/; const versionMatch = /^(\d{1,}).(\d{1,}).(\d{1,})$/;
const currentVersion = manifest.file.version; const currentVersion = manifest.file.version;
let targetVersion = ''; let targetVersion = "";
if (!version) { if (!version) {
cb(Error('Missing version number')); cb(Error("Missing version number"));
} }
if (versionMatch.test(version)) { if (versionMatch.test(version)) {
targetVersion = version; targetVersion = version;
} else { } else {
targetVersion = currentVersion.replace( targetVersion = currentVersion.replace(versionMatch, (substring, major, minor, patch) => {
versionMatch, console.log(substring, Number(major) + 1, Number(minor) + 1, Number(patch) + 1);
(substring, major, minor, patch) => { if (version === "major") {
console.log( return `${Number(major) + 1}.0.0`;
substring, } else if (version === "minor") {
Number(major) + 1, return `${major}.${Number(minor) + 1}.0`;
Number(minor) + 1, } else if (version === "patch") {
Number(patch) + 1 return `${major}.${minor}.${Number(patch) + 1}`;
); } else {
if (version === 'major') { return "";
return `${Number(major) + 1}.0.0`; }
} else if (version === 'minor') { });
return `${major}.${Number(minor) + 1}.0`; }
} else if (version === 'patch') {
return `${major}.${minor}.${Number(patch) + 1}`;
} else {
return '';
}
}
);
}
if (targetVersion === '') { if (targetVersion === "") {
return cb(Error(chalk.red('Error: Incorrect version arguments.'))); return cb(Error(chalk.red("Error: Incorrect version arguments.")));
} }
if (targetVersion === currentVersion) { if (targetVersion === currentVersion) {
return cb( return cb(Error(chalk.red("Error: Target version is identical to current version.")));
Error( }
chalk.red( console.log(`Updating version number to '${targetVersion}'`);
'Error: Target version is identical to current version.'
)
)
);
}
console.log(`Updating version number to '${targetVersion}'`);
packageJson.version = targetVersion; packageJson.version = targetVersion;
manifest.file.version = targetVersion; manifest.file.version = targetVersion;
/* Update URLs */ /* Update URLs */
const result = `${rawURL}/v${manifest.file.version}/package/${manifest.file.name}-v${manifest.file.version}.zip`; const result = `${rawURL}/v${manifest.file.version}/package/${manifest.file.name}-v${manifest.file.version}.zip`;
manifest.file.url = repoURL; manifest.file.url = repoURL;
manifest.file.manifest = `${rawURL}/master/${manifestRoot}/${manifest.name}`; manifest.file.manifest = `${rawURL}/master/${manifestRoot}/${manifest.name}`;
manifest.file.download = result; manifest.file.download = result;
const prettyProjectJson = stringify(manifest.file, { const prettyProjectJson = stringify(manifest.file, {
maxLength: 35, maxLength: 35,
indent: '\t', indent: "\t",
}); });
fs.writeJSONSync('package.json', packageJson, { spaces: '\t' }); fs.writeJSONSync("package.json", packageJson, { spaces: "\t" });
fs.writeFileSync( fs.writeFileSync(path.join(manifest.root, manifest.name), prettyProjectJson, "utf8");
path.join(manifest.root, manifest.name),
prettyProjectJson,
'utf8'
);
return cb(); return cb();
} catch (err) { } catch (err) {
cb(err); cb(err);
} }
} }
function gitAdd() { function gitAdd() {
return gulp.src('package').pipe(git.add({ args: '--no-all' })); return gulp.src("package").pipe(git.add({ args: "--no-all" }));
} }
function gitCommit() { function gitCommit() {
return gulp.src('./*').pipe( return gulp.src("./*").pipe(
git.commit(`v${getManifest().file.version}`, { git.commit(`v${getManifest().file.version}`, {
args: '-a', args: "-a",
disableAppendPaths: true, disableAppendPaths: true,
}) })
); );
} }
function gitTag() { function gitTag() {
const manifest = getManifest(); const manifest = getManifest();
return git.tag( return git.tag(`v${manifest.file.version}`, `Updated to ${manifest.file.version}`, (err) => {
`v${manifest.file.version}`, if (err) throw err;
`Updated to ${manifest.file.version}`, });
(err) => {
if (err) throw err;
}
);
} }
const execGit = gulp.series(gitAdd, gitCommit, gitTag); const execGit = gulp.series(gitAdd, gitCommit, gitTag);
@ -495,10 +426,4 @@ exports.clean = clean;
exports.link = linkUserData; exports.link = linkUserData;
exports.package = packageBuild; exports.package = packageBuild;
exports.update = updateManifest; exports.update = updateManifest;
exports.publish = gulp.series( exports.publish = gulp.series(clean, updateManifest, execBuild, packageBuild, execGit);
clean,
updateManifest,
execBuild,
packageBuild,
execGit
);

View file

@ -1,30 +1,30 @@
{ {
"private": true, "private": true,
"name": "test", "name": "test",
"version": "0.1.0", "version": "0.1.0",
"description": "", "description": "",
"scripts": { "scripts": {
"package": "gulp package", "package": "gulp package",
"build": "gulp build && gulp link", "build": "gulp build && gulp link",
"build:watch": "gulp watch", "build:watch": "gulp watch",
"clean": "gulp clean && gulp link --clean", "clean": "gulp clean && gulp link --clean",
"update": "npm install --save-dev gitlab:foundry-projects/foundry-pc/foundry-pc-types" "update": "npm install --save-dev gitlab:foundry-projects/foundry-pc/foundry-pc-types"
}, },
"author": "", "author": "",
"license": "", "license": "",
"devDependencies": { "devDependencies": {
"archiver": "^5.1.0", "archiver": "^5.1.0",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"foundry-pc-types": "gitlab:foundry-projects/foundry-pc/foundry-pc-types", "foundry-pc-types": "gitlab:foundry-projects/foundry-pc/foundry-pc-types",
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-git": "^2.10.1", "gulp-git": "^2.10.1",
"gulp-less": "^4.0.1", "gulp-less": "^4.0.1",
"gulp-sass": "^4.1.0", "gulp-sass": "^4.1.0",
"gulp-typescript": "^6.0.0-alpha.1", "gulp-typescript": "^6.0.0-alpha.1",
"json-stringify-pretty-compact": "^2.0.0", "json-stringify-pretty-compact": "^2.0.0",
"sass": "^1.30.0", "sass": "^1.30.0",
"typescript": "^4.1.3", "typescript": "^4.1.3",
"yargs": "^16.2.0" "yargs": "^16.2.0"
} }
} }

View file

@ -23,7 +23,6 @@ export class DS4ActorSheet extends ActorSheet<{
// TODO: replace ["..."] access with . // TODO: replace ["..."] access with .
const data = super.getData(); const data = super.getData();
data["dtypes"] = ["String", "Number", "Boolean"]; data["dtypes"] = ["String", "Number", "Boolean"];
const innerData = data.data;
for (let attr of Object.values(data.data["attributes"])) { for (let attr of Object.values(data.data["attributes"])) {
attr["isCheckbox"] = attr["dtype"] === "Boolean"; attr["isCheckbox"] = attr["dtype"] === "Boolean";
} }

View file

@ -35,7 +35,7 @@ export class DS4ItemSheet extends ItemSheet {
const position = super.setPosition(options); const position = super.setPosition(options);
const sheetBody = (this.element as JQuery).find(".sheet-body"); // TODO: Why is the cast necessary? const sheetBody = (this.element as JQuery).find(".sheet-body"); // TODO: Why is the cast necessary?
const bodyHeight = position.height - 192; const bodyHeight = position.height - 192;
//sheetBody.css("height", bodyHeight); sheetBody.css("height", bodyHeight);
return position; return position;
} }

View file

@ -1,16 +1,15 @@
.window-content { .window-content {
overflow-y: hidden; overflow-y: hidden;
padding: 5px; padding: 5px;
form { form {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
.tab { .tab {
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
align-content: flex-start; align-content: flex-start;
} }
} }

View file

@ -1,13 +1,13 @@
.basic-properties { .basic-properties {
flex: 0 0 100%; flex: 0 0 100%;
.basic-property { .basic-property {
.basic-property-label { .basic-property-label {
font-weight: bold; font-weight: bold;
} }
.basic-property-select { .basic-property-select {
display: block; display: block;
width: 100%; width: 100%;
}
} }
}
} }

View file

@ -1,39 +1,39 @@
.side-properties { .side-properties {
flex: 0 0 150px; flex: 0 0 150px;
margin: 5px 5px 5px 0; margin: 5px 5px 5px 0;
padding-right: 5px; padding-right: 5px;
border-right: 2px groove $c-border-groove; border-right: 2px groove $c-border-groove;
.side-property { .side-property {
margin: 2px 0; margin: 2px 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
label { label {
flex: 2; flex: 2;
line-height: 26px; line-height: 26px;
font-weight: bold; font-weight: bold;
}
input,
select {
text-align: right;
flex: 1;
width: calc(100% - 2px);
}
} }
input,
select {
text-align: right;
flex: 1;
width: calc(100% - 2px);
}
}
} }
.sheet-body .tab .editor { .sheet-body .tab .editor {
height: 100%; height: 100%;
} }
.tox { .tox {
.tox-editor-container { .tox-editor-container {
background: $c-white; background: $c-white;
} }
.tox-edit-area { .tox-edit-area {
padding: 0 8px; padding: 0 8px;
} }
} }

View file

@ -1,62 +1,62 @@
.item-form { .item-form {
font-family: $font-primary; font-family: $font-primary;
} }
$header-top-margin: 5px; $header-top-margin: 5px;
header.sheet-header { header.sheet-header {
flex: 0 0 210px; flex: 0 0 210px;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
.profile-img { .profile-img {
flex: 0 0 100px; flex: 0 0 100px;
height: 100px; height: 100px;
margin: $header-top-margin 10px $header-top-margin 0; margin: $header-top-margin 10px $header-top-margin 0;
} }
.header-fields { .header-fields {
flex: 1; flex: 1;
} }
h1.charname { h1.charname {
height: 50px; height: 50px;
padding: 0px; padding: 0px;
margin: $header-top-margin 10px $header-top-margin 0; margin: $header-top-margin 10px $header-top-margin 0;
border-bottom: 0; border-bottom: 0;
input { input {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
border: none; border: none;
background-color: transparent; background-color: transparent;
}
font-family: $font-heading;
display: block;
}
h2.item-type {
font-family: $font-heading;
display: block;
height: 50px;
padding: 0px;
flex: 0 0 0;
color: $c-light-grey;
border: none;
line-height: 50px;
margin: $header-top-margin 0;
text-align: right;
} }
font-family: $font-heading;
display: block;
}
h2.item-type {
font-family: $font-heading;
display: block;
height: 50px;
padding: 0px;
flex: 0 0 0;
color: $c-light-grey;
border: none;
line-height: 50px;
margin: $header-top-margin 0;
text-align: right;
}
} }
.sheet-tabs { .sheet-tabs {
flex: 0; flex: 0;
} }
.sheet-body, .sheet-body,
.sheet-body .tab { .sheet-body .tab {
height: 100%; height: 100%;
} }

View file

@ -1,35 +1,35 @@
.items-list { .items-list {
list-style: none; list-style: none;
margin: 7px 0; margin: 7px 0;
padding: 0; padding: 0;
overflow-y: auto; overflow-y: auto;
.item-header { .item-header {
font-weight: bold; font-weight: bold;
}
.item {
height: 30px;
line-height: 24px;
padding: 3px 0;
border-bottom: 1px solid #BBB;
.item-image {
flex: 0 0 24px;
margin-right: 5px;
} }
img { .item {
display: block; height: 30px;
line-height: 24px;
padding: 3px 0;
border-bottom: 1px solid #bbb;
.item-image {
flex: 0 0 24px;
margin-right: 5px;
}
img {
display: block;
}
} }
}
.item-name { .item-name {
margin: 0; margin: 0;
} }
.item-controls { .item-controls {
flex: 0 0 86px; flex: 0 0 86px;
text-align: right; text-align: right;
} }
} }

View file

@ -1,14 +1,14 @@
nav.tabs { nav.tabs {
height: 40px; height: 40px;
border-top: 2px groove $c-border-groove; border-top: 2px groove $c-border-groove;
border-bottom: 2px groove $c-border-groove; border-bottom: 2px groove $c-border-groove;
.item { .item {
line-height: 40px; line-height: 40px;
font-weight: bold; font-weight: bold;
} }
.item.active { .item.active {
text-decoration: none; text-decoration: none;
} }
} }

View file

@ -3,58 +3,58 @@
/* ----------------------------------------- */ /* ----------------------------------------- */
.flexrow { .flexrow {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: flex-start; justify-content: flex-start;
> * { > * {
flex: 1; flex: 1;
} }
.flex1 { .flex1 {
flex: 1; flex: 1;
} }
.flex2 { .flex2 {
flex: 2; flex: 2;
} }
.flex3 { .flex3 {
flex: 3; flex: 3;
} }
.flex4 { .flex4 {
flex: 4; flex: 4;
} }
} }
.flexcol { .flexcol {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-wrap: nowrap; flex-wrap: nowrap;
> * { > * {
flex: 1; flex: 1;
} }
.flex1 { .flex1 {
flex: 1; flex: 1;
} }
.flex2 { .flex2 {
flex: 2; flex: 2;
} }
.flex3 { .flex3 {
flex: 3; flex: 3;
} }
.flex4 { .flex4 {
flex: 4; flex: 4;
} }
} }
.flex-center { .flex-center {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
text-align: center; text-align: center;
} }
.flex-between { .flex-between {
justify-content: space-between; justify-content: space-between;
} }

View file

@ -1,83 +1,83 @@
.grid, .grid,
.grid-2col { .grid-2col {
display: grid; display: grid;
grid-column: span 2 / span 2; grid-column: span 2 / span 2;
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px; gap: 10px;
padding: 0; padding: 0;
} }
.grid-1col { .grid-1col {
grid-column: span 1 / span 1; grid-column: span 1 / span 1;
grid-template-columns: repeat(1, minmax(0, 1fr)); grid-template-columns: repeat(1, minmax(0, 1fr));
} }
.grid-3col { .grid-3col {
grid-column: span 3 / span 3; grid-column: span 3 / span 3;
grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-columns: repeat(3, minmax(0, 1fr));
} }
.grid-4col { .grid-4col {
grid-column: span 4 / span 4; grid-column: span 4 / span 4;
grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-columns: repeat(4, minmax(0, 1fr));
} }
.grid-5col { .grid-5col {
grid-column: span 5 / span 5; grid-column: span 5 / span 5;
grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-columns: repeat(5, minmax(0, 1fr));
} }
.grid-6col { .grid-6col {
grid-column: span 5 / span 5; grid-column: span 5 / span 5;
grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-columns: repeat(5, minmax(0, 1fr));
} }
.grid-7col { .grid-7col {
grid-column: span 7 / span 7; grid-column: span 7 / span 7;
grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-columns: repeat(7, minmax(0, 1fr));
} }
.grid-8col { .grid-8col {
grid-column: span 8 / span 8; grid-column: span 8 / span 8;
grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-columns: repeat(8, minmax(0, 1fr));
} }
.grid-9col { .grid-9col {
grid-column: span 9 / span 9; grid-column: span 9 / span 9;
grid-template-columns: repeat(9, minmax(0, 1fr)); grid-template-columns: repeat(9, minmax(0, 1fr));
} }
.grid-10col { .grid-10col {
grid-column: span 10 / span 10; grid-column: span 10 / span 10;
grid-template-columns: repeat(10, minmax(0, 1fr)); grid-template-columns: repeat(10, minmax(0, 1fr));
} }
.grid-11col { .grid-11col {
grid-column: span 11 / span 11; grid-column: span 11 / span 11;
grid-template-columns: repeat(11, minmax(0, 1fr)); grid-template-columns: repeat(11, minmax(0, 1fr));
} }
.grid-12col { .grid-12col {
grid-column: span 12 / span 12; grid-column: span 12 / span 12;
grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-columns: repeat(12, minmax(0, 1fr));
} }
.flex-group-center, .flex-group-center,
.flex-group-left, .flex-group-left,
.flex-group-right { .flex-group-right {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-align: center; text-align: center;
padding: 5px; padding: 5px;
border: 1px solid #999; border: 1px solid #999;
} }
.flex-group-left { .flex-group-left {
justify-content: flex-start; justify-content: flex-start;
text-align: left; text-align: left;
} }
.flex-group-right { .flex-group-right {
justify-content: flex-end; justify-content: flex-end;
text-align: right; text-align: right;
} }

View file

@ -1,12 +1,12 @@
.window-app { .window-app {
font-family: $font-primary; font-family: $font-primary;
} }
.rollable { .rollable {
&:hover, &:hover,
&:focus { &:focus {
color: #000; color: #000;
text-shadow: 0 0 10px red; text-shadow: 0 0 10px red;
cursor: pointer; cursor: pointer;
} }
} }

View file

@ -1,4 +1,4 @@
$c-white: #fff; $c-white: #fff;
$c-black: #000; $c-black: #000;
$c-light-grey: #777; $c-light-grey: #777;
$c-border-groove: #eeede0; $c-border-groove: #eeede0;

View file

@ -1,16 +1,16 @@
@mixin element-invisible { @mixin element-invisible {
position: absolute; position: absolute;
width: 1px; width: 1px;
height: 1px; height: 1px;
margin: -1px; margin: -1px;
border: 0; border: 0;
padding: 0; padding: 0;
clip: rect(0 0 0 0); clip: rect(0 0 0 0);
overflow: hidden; overflow: hidden;
} }
@mixin hide { @mixin hide {
display: none; display: none;
} }

View file

@ -1,10 +1,10 @@
@import url("https://fonts.googleapis.com/css2?family=Lora:wght@400;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Lora:wght@400;700&display=swap");
@font-face { @font-face {
font-family: "Wood Stamp"; font-family: "Wood Stamp";
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
src: local("Wood Stamp"), url("fonts/Woodstamp.woff") format("woff"); src: local("Wood Stamp"), url("fonts/Woodstamp.woff") format("woff");
} }
$font-primary: "Lora", sans-serif; $font-primary: "Lora", sans-serif;

View file

@ -1,3 +1,3 @@
$padding-sm: 5px; $padding-sm: 5px;
$padding-md: 10px; $padding-md: 10px;
$padding-lg: 20px; $padding-lg: 20px;

View file

@ -1,11 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2017", "target": "ES2017",
"lib": [ "lib": ["DOM", "ES6", "ES2017"],
"DOM", "types": ["foundry-pc-types"]
"ES6", }
"ES2017" }
],
"types": ["foundry-pc-types"]
}
}