Compare commits
No commits in common. "8cd26c971a49e06b982afee9631016d6d6499e29" and "bc5b6af75038bdfd2cb5626dd5ac179ae4b5169d" have entirely different histories.
8cd26c971a
...
bc5b6af750
@ -29,16 +29,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function chunk(arr) {
|
//let card_selected = 0;
|
||||||
let larr = [...arr], out = [];
|
//$: selected_card = cards[card_selected];
|
||||||
while(larr.length) {
|
|
||||||
out = [...out, (larr.splice(0,MAX_CARDS))];
|
|
||||||
};
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
$: pages = chunk(cards);
|
|
||||||
|
|
||||||
let selector = cards[0].id;
|
let selector = cards[0].id;
|
||||||
|
//$: selector = cards[card_selected].id;
|
||||||
$: selected_card = cards.filter(x => x.id === selector)[0];
|
$: selected_card = cards.filter(x => x.id === selector)[0];
|
||||||
$: selected_idx = get_idx_by_id(selector);
|
$: selected_idx = get_idx_by_id(selector);
|
||||||
|
|
||||||
@ -50,8 +45,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function add_card() {
|
function add_card() {
|
||||||
cards = [...cards, {id: cards[cards.length-1].id+1, ...mhp}];
|
if (cards.length < MAX_CARDS) {
|
||||||
selector = cards[cards.length-1].id;
|
cards = [...cards, {id: cards[cards.length-1].id+1, ...mhp}];
|
||||||
|
selector = cards[cards.length-1].id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_card() {
|
function remove_card() {
|
||||||
@ -73,22 +70,20 @@
|
|||||||
<h1>PF2e card generator</h1>
|
<h1>PF2e card generator</h1>
|
||||||
<CardInput bind:name={selected_card.name} bind:type={selected_card.type} tags={selected_card.tags} bind:attributes={selected_card.attributes} bind:description={selected_card.description} on:change_tags={change_tags} on:add_card={add_card} on:remove_card={remove_card}/>
|
<CardInput bind:name={selected_card.name} bind:type={selected_card.type} tags={selected_card.tags} bind:attributes={selected_card.attributes} bind:description={selected_card.description} on:change_tags={change_tags} on:add_card={add_card} on:remove_card={remove_card}/>
|
||||||
</section>
|
</section>
|
||||||
{#each pages as page}
|
|
||||||
<section class="cards">
|
<section class="cards">
|
||||||
{#each page as card, idx (card.id)}
|
{#each cards as card, idx (card.id)}
|
||||||
<div class="card" style="break-after:avoid;">
|
<div class="card">
|
||||||
<Card {...card}/>
|
<Card {...card}/>
|
||||||
<input class="card-selector" type="radio" bind:group={selector} value={card.id}/>
|
<input class="card-selector" type="radio" bind:group={selector} value={card.id}/>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</section>
|
</section>
|
||||||
{/each}
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@media print {
|
@media print {
|
||||||
@page {
|
@page {
|
||||||
margin: 7mm;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.controls {
|
.controls {
|
||||||
display: none;
|
display: none;
|
||||||
@ -100,7 +95,6 @@
|
|||||||
.cards {
|
.cards {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
break-after: always;
|
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
border-bottom: 2px solid black;
|
border-bottom: 2px solid black;
|
||||||
padding: 0 4pt;
|
|
||||||
}
|
}
|
||||||
.name, .type {
|
.name, .type {
|
||||||
font-family: serif;
|
font-family: serif;
|
||||||
@ -36,7 +35,8 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.tags {
|
.tags {
|
||||||
padding: 1pt 4pt;
|
margin: 1pt 1pt 0pt 1pt;
|
||||||
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
@ -59,10 +59,7 @@
|
|||||||
background-color: #54166e;
|
background-color: #54166e;
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
margin-top: 1pt;
|
margin: 1pt;
|
||||||
}
|
|
||||||
.content div {
|
|
||||||
padding: 0 4pt;
|
|
||||||
}
|
}
|
||||||
:global(section.content p) {
|
:global(section.content p) {
|
||||||
padding-bottom: 2pt;
|
padding-bottom: 2pt;
|
||||||
@ -97,12 +94,12 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</section>
|
</section>
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="attributes">
|
<p class="attributes">
|
||||||
{@html pf_filter(DOMPurify.sanitize(attributes))}
|
{@html pf_filter(DOMPurify.sanitize(attributes))}
|
||||||
</div>
|
</p>
|
||||||
<div class="description">
|
<p class="description">
|
||||||
{@html pf_filter(DOMPurify.sanitize(description))}
|
{@html pf_filter(DOMPurify.sanitize(description))}
|
||||||
</div>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user