0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 08:22:42 +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> initialContent : `<!DOCTYPE html><html><head>
<link href="//use.fontawesome.com/releases/v5.15.1/css/all.css" rel="stylesheet" /> <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="//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> <base target=_blank>
</head><body style='overflow: hidden'><div></div></body></html>` </head><body style='overflow: hidden'><div></div></body></html>`
}; };
@@ -134,7 +134,7 @@ const BrewRenderer = createClass({
renderStyle : function() { renderStyle : function() {
if(!this.props.style) return; 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){ renderPage : function(pageText, index){

File diff suppressed because it is too large Load Diff

View File

@@ -1,276 +1,279 @@
@import (less) './themes/fonts/5e/fonts.less'; @layer V3_Blank {
@import (less) './themes/assets/assets.less';
:root { @import (less) './themes/fonts/5e/fonts.less';
//Colors @import (less) './themes/assets/assets.less';
--HB_Color_Background : #FFFFFF; // White
--HB_Color_WatercolorStain : #000000; // Black
}
@page { margin: 0; } :root {
body { //Colors
counter-reset : phb-page-numbers; --HB_Color_Background : #FFFFFF; // White
} --HB_Color_WatercolorStain : #000000; // Black
*{
-webkit-print-color-adjust : exact;
}
.useColumns(@multiplier : 1, @fillMode: balance){
column-fill : @fillMode;
column-count : 2;
}
.columnWrapper{
max-height : 100%;
column-span : all;
columns : inherit;
column-gap : inherit;
}
.page{
.useColumns();
height : 279.4mm;
width : 215.9mm;
padding : 1.4cm 1.9cm 1.7cm;
counter-increment : phb-page-numbers;
background-color : var(--HB_Color_Background);
position : relative;
z-index : 15;
box-sizing : border-box;
overflow : hidden;
text-rendering : optimizeLegibility;
page-break-before : always;
page-break-after : always;
contain : size;
}
//*****************************
// * BASE
// *****************************/
.page{
p{
overflow-wrap : break-word;
display : block;
}
strong{
font-weight : bold;
}
em{
font-style : italic;
}
sup{
vertical-align : super;
font-size : smaller;
line-height : 0;
}
sub{
vertical-align : sub;
font-size : smaller;
line-height : 0;
}
ul {
list-style-position : outside; //Needed for multiline list items
list-style-type : disc;
padding-left : 1.4em;
}
ol {
list-style-position : outside;
list-style-type : decimal;
padding-left : 1.4em;
}
img{
z-index : -1;
} }
//***************************** @page { margin: 0; }
// * HEADERS body {
// *****************************/ counter-reset : phb-page-numbers;
h1,h2,h3,h4,h5,h6{
font-weight : bold;
line-height : 1.2em;
} }
h1{ *{
font-size : 2em; -webkit-print-color-adjust : exact;
} }
h2{
font-size : 1.5em; .useColumns(@multiplier : 1, @fillMode: balance){
column-fill : @fillMode;
column-count : 2;
} }
h3{ .columnWrapper{
font-size : 1.17em; max-height : 100%;
column-span : all;
columns : inherit;
column-gap : inherit;
} }
h4{ .page{
font-size : 1em; .useColumns();
height : 279.4mm;
width : 215.9mm;
padding : 1.4cm 1.9cm 1.7cm;
counter-increment : phb-page-numbers;
background-color : var(--HB_Color_Background);
position : relative;
z-index : 15;
box-sizing : border-box;
overflow : hidden;
text-rendering : optimizeLegibility;
page-break-before : always;
page-break-after : always;
contain : size;
} }
h5{ //*****************************
font-size : 0.83em; // * BASE
} // *****************************/
//***************************** .page{
// * TABLE p{
// *****************************/ overflow-wrap : break-word;
table{ display : block;
width : 100%; }
thead{ strong{
display : table-row-group;
font-weight : bold; font-weight : bold;
} }
} em{
div:not(.columnWrapper) > table + table { // Side-by-side tables should not font-style : italic;
margin-top : 0; // have vertical spacing. }
} sup{
vertical-align : super;
font-size : smaller;
line-height : 0;
}
sub{
vertical-align : sub;
font-size : smaller;
line-height : 0;
}
ul {
list-style-position : outside; //Needed for multiline list items
list-style-type : disc;
padding-left : 1.4em;
}
ol {
list-style-position : outside;
list-style-type : decimal;
padding-left : 1.4em;
}
img{
z-index : -1;
}
/* Watermark */ //*****************************
.watermark { // * HEADERS
display : grid !important; // *****************************/
place-items : center; h1,h2,h3,h4,h5,h6{
justify-content : center; font-weight : bold;
position : absolute; line-height : 1.2em;
margin : 0; }
top : 0; h1{
left : 0; font-size : 2em;
width : 100%; }
height : 100%; h2{
font-size : 120px; font-size : 1.5em;
text-transform : uppercase; }
color : black; h3{
mix-blend-mode : overlay; font-size : 1.17em;
opacity : 30%; }
transform : rotate(-45deg); h4{
z-index : 500; font-size : 1em;
p { }
margin-bottom : none; h5{
font-size : 0.83em;
}
//*****************************
// * TABLE
// *****************************/
table{
width : 100%;
thead{
display : table-row-group;
font-weight : bold;
}
}
div:not(.columnWrapper) > table + table { // Side-by-side tables should not
margin-top : 0; // have vertical spacing.
}
/* Watermark */
.watermark {
display : grid !important;
place-items : center;
justify-content : center;
position : absolute;
margin : 0;
top : 0;
left : 0;
width : 100%;
height : 100%;
font-size : 120px;
text-transform : uppercase;
color : black;
mix-blend-mode : overlay;
opacity : 30%;
transform : rotate(-45deg);
z-index : 500;
p {
margin-bottom : none;
}
}
/* Watercolor */
[class*="watercolor"] {
position : absolute;
width : 2000px; /* dimensions need to be real big so the user can set */
height : 2000px; /* height or width and the image will maintain aspect ratio */
-webkit-mask-image : var(--wc);
-webkit-mask-size : contain;
-webkit-mask-repeat : no-repeat;
mask-image : var(--wc);
mask-size : contain;
mask-repeat : no-repeat;
background-size : cover;
background-color : var(--HB_Color_WatercolorStain); /*default color*/
--wc : @watercolor1; /*default image*/
z-index : -2;
}
.watercolor1 { --wc : @watercolor1; }
.watercolor2 { --wc : @watercolor2; }
.watercolor3 { --wc : @watercolor3; }
.watercolor4 { --wc : @watercolor4; }
.watercolor5 { --wc : @watercolor5; }
.watercolor6 { --wc : @watercolor6; }
.watercolor7 { --wc : @watercolor7; }
.watercolor8 { --wc : @watercolor8; }
.watercolor9 { --wc : @watercolor9; }
.watercolor10 { --wc : @watercolor10; }
.watercolor11 { --wc : @watercolor11; }
.watercolor12 { --wc : @watercolor12; }
//************************************
// * CODE BLOCKS
// ************************************/
code{
font-family : "Courier New", Courier, monospace;
white-space : pre-wrap;
overflow-wrap : break-word;
}
pre code{
width : 100%;
display : inline-block;
}
//*****************************
// * EXTRAS
// *****************************/
.columnSplit {
visibility : hidden;
-webkit-column-break-after : always;
break-after : always;
-moz-column-break-after : always;
margin-top : 0;
& + * {
margin-top : 0;
}
}
//Avoid breaking up
blockquote,table{
z-index : 15;
-webkit-column-break-inside : avoid;
page-break-inside : avoid;
break-inside : avoid;
}
// Nested lists
ul ul,ol ol,ul ol,ol ul{
margin-bottom : 0px;
margin-left : 1.5em;
}
li{
-webkit-column-break-inside : avoid;
page-break-inside : avoid;
break-inside : avoid;
} }
} }
/* Watercolor */
[class*="watercolor"] {
position : absolute;
width : 2000px; /* dimensions need to be real big so the user can set */
height : 2000px; /* height or width and the image will maintain aspect ratio */
-webkit-mask-image : var(--wc);
-webkit-mask-size : contain;
-webkit-mask-repeat : no-repeat;
mask-image : var(--wc);
mask-size : contain;
mask-repeat : no-repeat;
background-size : cover;
background-color : var(--HB_Color_WatercolorStain); /*default color*/
--wc : @watercolor1; /*default image*/
z-index : -2;
}
.watercolor1 { --wc : @watercolor1; }
.watercolor2 { --wc : @watercolor2; }
.watercolor3 { --wc : @watercolor3; }
.watercolor4 { --wc : @watercolor4; }
.watercolor5 { --wc : @watercolor5; }
.watercolor6 { --wc : @watercolor6; }
.watercolor7 { --wc : @watercolor7; }
.watercolor8 { --wc : @watercolor8; }
.watercolor9 { --wc : @watercolor9; }
.watercolor10 { --wc : @watercolor10; }
.watercolor11 { --wc : @watercolor11; }
.watercolor12 { --wc : @watercolor12; }
//************************************
// * CODE BLOCKS
// ************************************/
code{
font-family : "Courier New", Courier, monospace;
white-space : pre-wrap;
overflow-wrap : break-word;
}
pre code{
width : 100%;
display : inline-block;
}
//***************************** //*****************************
// * EXTRAS // * MUSTACHE DIVS/SPANS
// *****************************/ // *****************************/
.columnSplit { .page {
visibility : hidden; .block {
-webkit-column-break-after : always; break-inside : avoid;
break-after : always; display : inline-block;
-moz-column-break-after : always; width : 100%;
margin-top : 0; }
& + * { .inline-block {
margin-top : 0; display : inline-block;
text-indent : initial;
} }
} }
//Avoid breaking up
blockquote,table{
z-index : 15;
-webkit-column-break-inside : avoid;
page-break-inside : avoid;
break-inside : avoid;
}
// Nested lists
ul ul,ol ol,ul ol,ol ul{
margin-bottom : 0px;
margin-left : 1.5em;
}
li{
-webkit-column-break-inside : avoid;
page-break-inside : avoid;
break-inside : avoid;
}
}
//***************************** //*****************************
// * MUSTACHE DIVS/SPANS // * DEFINITION LISTS
// *****************************/ // *****************************/
.page { .page {
.block { dl {
break-inside : avoid; padding-left : 1em;
display : inline-block; white-space : pre-line;
width : 100%; }
dt {
display : inline;
margin-right : 0.5ch;
margin-left : -1em;
}
dd {
display : inline;
margin-left : 0;
text-indent : 0;
}
} }
.inline-block {
display : inline-block;
text-indent : initial;
}
}
//***************************** //*****************************
// * DEFINITION LISTS // * BLANK LINE
// *****************************/ // *****************************/
.page { .page {
dl { .blank {
padding-left : 1em; height : 1em;
white-space : pre-line;
}
dt {
display : inline;
margin-right : 0.5ch;
margin-left : -1em;
}
dd {
display : inline;
margin-left : 0;
text-indent : 0;
}
}
//*****************************
// * BLANK LINE
// *****************************/
.page {
.blank {
height : 1em;
margin-top : 0;
& + * {
margin-top : 0;
}
}
}
//*****************************
// * WIDE
// *****************************/
.page {
.wide{
column-span : all;
display : block;
margin-bottom : 1em;
&+* {
margin-top : 0; margin-top : 0;
& + * {
margin-top : 0;
}
}
}
//*****************************
// * WIDE
// *****************************/
.page {
.wide{
column-span : all;
display : block;
margin-bottom : 1em;
&+* {
margin-top : 0;
}
} }
} }
} }