0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-20 05:22:47 +00:00

Try @Layers to not need .page in user style

This commit is contained in:
Trevor Buckner
2023-01-13 17:08:12 -05:00
parent da676c6ec1
commit a22d59475e
3 changed files with 1009 additions and 1003 deletions

View File

@@ -49,7 +49,7 @@ const BrewRenderer = createClass({
initialContent : `<!DOCTYPE html><html><head>
<link href="//use.fontawesome.com/releases/v5.15.1/css/all.css" rel="stylesheet" />
<link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
<link href='/homebrew/bundle.css' rel='stylesheet' />
<style>@import url("/homebrew/bundle.css") layer(bundle)</style>
<base target=_blank>
</head><body style='overflow: hidden'><div></div></body></html>`
};
@@ -134,7 +134,7 @@ const BrewRenderer = createClass({
renderStyle : function() {
if(!this.props.style) return;
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.style} </style>` }} />;
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style>@layer styleTab {\n${this.props.style}\n} </style>` }} />;
},
renderPage : function(pageText, index){

View File

@@ -1,7 +1,9 @@
@import (less) './themes/fonts/5e/fonts.less';
@import (less) './themes/assets/assets.less';
@layer V3_PHB {
:root {
@import (less) './themes/fonts/5e/fonts.less';
@import (less) './themes/assets/assets.less';
:root {
//Colors
--HB_Color_Background : #EEE5CE; // Light parchment
--HB_Color_Accent : #E0E5C1; // Pastel green
@@ -12,16 +14,16 @@
--HB_Color_CaptionText : #766649; // Brown
--HB_Color_WatercolorStain : #BBAD82; // Light brown
--HB_Color_Footnotes : #C9AD6A; // Gold
}
}
@page { margin: 0; }
body {
@page { margin: 0; }
body {
counter-reset : phb-page-numbers;
}
*{
}
*{
-webkit-print-color-adjust : exact;
}
.useSansSerif(){
}
.useSansSerif(){
font-family : ScalySansRemake;
font-size : 0.318cm;
line-height : 1.2em;
@@ -41,8 +43,8 @@ body {
h5 + * {
margin-top : 0.1cm;
}
}
.useColumns(@multiplier : 1, @fillMode: balance){
}
.useColumns(@multiplier : 1, @fillMode: balance){
column-count : 2;
column-fill : @fillMode;
column-gap : 0.9cm;
@@ -53,14 +55,14 @@ body {
-moz-column-width : 8cm * @multiplier;
-webkit-column-gap : 0.9cm;
-moz-column-gap : 0.9cm;
}
.columnWrapper{
}
.columnWrapper{
max-height : 100%;
column-span : all;
columns : inherit;
column-gap : inherit;
}
.page{
}
.page{
.useColumns();
counter-increment : phb-page-numbers;
position : relative;
@@ -77,12 +79,12 @@ body {
text-rendering : optimizeLegibility;
page-break-before : always;
page-break-after : always;
}
}
//*****************************
// * BASE
// *****************************/
.page{
.page{
p{
overflow-wrap : break-word; //TODO: MAKE ALL MARGINS TOP-ONLY. USE * + * STYLE SELECTORS
display : block;
@@ -592,11 +594,11 @@ body {
page-break-inside : avoid;
break-inside : avoid;
}
}
//*****************************
// * SPELL LIST
// *****************************/
.page .spellList{
}
//*****************************
// * SPELL LIST
// *****************************/
.page .spellList{
.useSansSerif();
column-count : 2;
ul+h5{
@@ -618,12 +620,12 @@ body {
&.wide{
column-count : 4;
}
}
}
//*****************************
// * CLASS TABLE
// *****************************/
.page .classTable{
//*****************************
// * CLASS TABLE
// *****************************/
.page .classTable{
th[colspan]:not([rowspan]) {
white-space : nowrap;
}
@@ -676,11 +678,11 @@ body {
h5 + table{
margin-top : 0.2cm;
}
}
//*****************************
// * TABLE OF CONTENTS
// *****************************/
.page {
}
//*****************************
// * TABLE OF CONTENTS
// *****************************/
.page {
&:has(.toc):after {
display: none;
}
@@ -752,12 +754,12 @@ body {
.useColumns(0.96, @fillMode: balance);
}
}
}
}
//*****************************
// * DEFINITION LISTS
// *****************************/
.page {
//*****************************
// * DEFINITION LISTS
// *****************************/
.page {
dl {
line-height : 1.25em;
padding-left : 1em;
@@ -782,15 +784,16 @@ body {
margin-left : 0px;
text-indent : 0px;
}
}
}
//*****************************
// * WIDE
// *****************************/
.page .wide{
//*****************************
// * WIDE
// *****************************/
.page .wide{
margin-bottom : 0.325cm;
}
}
.page h1 + *{
.page h1 + *{
margin-top : 0;
}
}

View File

@@ -1,31 +1,33 @@
@import (less) './themes/fonts/5e/fonts.less';
@import (less) './themes/assets/assets.less';
@layer V3_Blank {
:root {
@import (less) './themes/fonts/5e/fonts.less';
@import (less) './themes/assets/assets.less';
:root {
//Colors
--HB_Color_Background : #FFFFFF; // White
--HB_Color_WatercolorStain : #000000; // Black
}
}
@page { margin: 0; }
body {
@page { margin: 0; }
body {
counter-reset : phb-page-numbers;
}
*{
}
*{
-webkit-print-color-adjust : exact;
}
}
.useColumns(@multiplier : 1, @fillMode: balance){
.useColumns(@multiplier : 1, @fillMode: balance){
column-fill : @fillMode;
column-count : 2;
}
.columnWrapper{
}
.columnWrapper{
max-height : 100%;
column-span : all;
columns : inherit;
column-gap : inherit;
}
.page{
}
.page{
.useColumns();
height : 279.4mm;
width : 215.9mm;
@@ -40,11 +42,11 @@ body {
page-break-before : always;
page-break-after : always;
contain : size;
}
}
//*****************************
// * BASE
// *****************************/
.page{
.page{
p{
overflow-wrap : break-word;
display : block;
@@ -211,12 +213,12 @@ body {
page-break-inside : avoid;
break-inside : avoid;
}
}
}
//*****************************
// * MUSTACHE DIVS/SPANS
// *****************************/
.page {
//*****************************
// * MUSTACHE DIVS/SPANS
// *****************************/
.page {
.block {
break-inside : avoid;
display : inline-block;
@@ -226,12 +228,12 @@ body {
display : inline-block;
text-indent : initial;
}
}
}
//*****************************
// * DEFINITION LISTS
// *****************************/
.page {
//*****************************
// * DEFINITION LISTS
// *****************************/
.page {
dl {
padding-left : 1em;
white-space : pre-line;
@@ -246,12 +248,12 @@ body {
margin-left : 0;
text-indent : 0;
}
}
}
//*****************************
// * BLANK LINE
// *****************************/
.page {
//*****************************
// * BLANK LINE
// *****************************/
.page {
.blank {
height : 1em;
margin-top : 0;
@@ -259,12 +261,12 @@ body {
margin-top : 0;
}
}
}
}
//*****************************
// * WIDE
// *****************************/
.page {
//*****************************
// * WIDE
// *****************************/
.page {
.wide{
column-span : all;
display : block;
@@ -273,4 +275,5 @@ body {
margin-top : 0;
}
}
}
}