Merge branch 'svench'
This commit is contained in:
commit
511c93de8a
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ node_modules
|
|||||||
.svelte-kit/
|
.svelte-kit/
|
||||||
.vercel_build_output/
|
.vercel_build_output/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
.svench
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"useTabs": true,
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "none",
|
|
||||||
"printWidth": 100
|
|
||||||
}
|
|
@ -1,3 +1,4 @@
|
|||||||
## Next
|
## Next
|
||||||
|
|
||||||
|
* Add svench.
|
||||||
* Switch to Sveltekit.
|
* Switch to Sveltekit.
|
||||||
|
12
package.json
12
package.json
@ -10,13 +10,15 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/kit": "^1.0.0-next.107",
|
"@sveltejs/kit": "^1.0.0-next.107",
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.10",
|
||||||
"eslint": "^7.22.0",
|
"eslint": "^7.22.0",
|
||||||
"eslint-config-prettier": "^8.1.0",
|
"eslint-config-prettier": "^8.1.0",
|
||||||
"eslint-plugin-svelte3": "^3.2.0",
|
"eslint-plugin-svelte3": "^3.2.0",
|
||||||
"prettier": "~2.2.1",
|
"prettier": "~2.2.1",
|
||||||
"prettier-plugin-svelte": "^2.2.0",
|
"prettier-plugin-svelte": "^2.2.0",
|
||||||
"svelte": "^3.34.0",
|
"svelte": "^3.34.0",
|
||||||
"vite": "^2.2.3"
|
"svench": "^0.2.0-14",
|
||||||
|
"vite": "^2.3.2"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -29,5 +31,13 @@
|
|||||||
"reselect": "^4.0.0",
|
"reselect": "^4.0.0",
|
||||||
"ts-action": "^11.0.0",
|
"ts-action": "^11.0.0",
|
||||||
"updux": "link:/home/yanick/work/javascript/updux/"
|
"updux": "link:/home/yanick/work/javascript/updux/"
|
||||||
|
},
|
||||||
|
"prettier": {
|
||||||
|
"svelteSortOrder": "options-markup-scripts-styles",
|
||||||
|
"svelteStrictMode": false,
|
||||||
|
"svelteAllowShorthand": true,
|
||||||
|
"plugins": [
|
||||||
|
"prettier-plugin-svelte"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,10 @@ h1 {
|
|||||||
font-size: var(--font-scale-14);
|
font-size: var(--font-scale-14);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: var(--font-scale-12);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -107,3 +111,4 @@ input:focus, select:focus {
|
|||||||
input.short {
|
input.short {
|
||||||
width:5em;
|
width:5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,41 +1,44 @@
|
|||||||
|
<Ribbon />
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<input class="reset button small red" type="button" value="reset" on:click={reset} />
|
<button class="button is-danger" type="button" on:click={reset}>reset</button>
|
||||||
|
|
||||||
<div class="spacer" />
|
<div class="spacer" />
|
||||||
<input type="button" class="button small notes" value="notes" on:click={toggle_notes} />
|
|
||||||
|
|
||||||
<ul class="button-group">
|
<button class="button is-info about" on:click={toggle_notes}>about</button>
|
||||||
<input type="button" class="button small green" value="editor"
|
|
||||||
on:click={() => set_output(null)} />
|
<div class="field has-addons">
|
||||||
<input type="button" class="button small green" value="json"
|
<p class="control">
|
||||||
on:click={() => set_output('json')} />
|
<button class="button" on:click={() => set_output(null)}>editor</button>
|
||||||
<input type="button" class="button small green" value="print"
|
</p>
|
||||||
on:click={() => set_output('print')} />
|
<p class="control">
|
||||||
</ul>
|
<button class="button" on:click={() => set_output("json")}>json</button>
|
||||||
|
</p>
|
||||||
|
<p class="control">
|
||||||
|
<button class="button" on:click={() => set_output("print")}>print</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{#if show_notes}
|
{#if show_notes}
|
||||||
<Notes show={show_notes} on:close={toggle_notes} />
|
<Notes show={show_notes} on:close={toggle_notes} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if output === 'json'}
|
{#if output === "json"}
|
||||||
<OutputJson ship={$ship}
|
<OutputJson ship={$ship} on:close={() => set_output(null)} />
|
||||||
on:close={() => set_output(null)}/>
|
{:else if output === "print"}
|
||||||
{:else if output === 'print' }
|
|
||||||
<Print ship={$ship} />
|
<Print ship={$ship} />
|
||||||
{:else}
|
{:else}
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<ShipSpecs />
|
<ShipSpecs />
|
||||||
|
|
||||||
<Propulsion
|
<Propulsion
|
||||||
ftl={$ship.ftl}
|
ftl={$ship.ftl}
|
||||||
engine={$ship.engine}
|
engine={$ship.engine}
|
||||||
on:change_ftl={change_ftl}
|
on:change_ftl={change_ftl}
|
||||||
on:change_engine={change_engine} />
|
on:change_engine={change_engine}
|
||||||
|
/>
|
||||||
|
|
||||||
<Hull
|
<Hull
|
||||||
ship_mass={$ship.general.mass}
|
ship_mass={$ship.general.mass}
|
||||||
@ -47,12 +50,14 @@
|
|||||||
cargo={$ship.cargo}
|
cargo={$ship.cargo}
|
||||||
streamlining={$ship.streamlining}
|
streamlining={$ship.streamlining}
|
||||||
on:set_cargo={ship_dispatch}
|
on:set_cargo={ship_dispatch}
|
||||||
on:ship_change={ship_dispatch} />
|
on:ship_change={ship_dispatch}
|
||||||
|
/>
|
||||||
|
|
||||||
<Section label="weaponry">
|
<Section label="weaponry">
|
||||||
<Firecons
|
<Firecons
|
||||||
{...$ship.weaponry.firecons}
|
{...$ship.weaponry.firecons}
|
||||||
on:change_firecons={change_firecons} />
|
on:change_firecons={change_firecons}
|
||||||
|
/>
|
||||||
|
|
||||||
<ADFC {...$ship.weaponry.adfc} />
|
<ADFC {...$ship.weaponry.adfc} />
|
||||||
|
|
||||||
@ -61,30 +66,28 @@
|
|||||||
{#each weapons as weapon (weapon.id)}
|
{#each weapons as weapon (weapon.id)}
|
||||||
<Weapon {weapon} id={weapon.id} cost={weapon.cost} mass={weapon.mass} />
|
<Weapon {weapon} id={weapon.id} cost={weapon.cost} mass={weapon.mass} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Carrier {...$ship.carrier} />
|
<Carrier {...$ship.carrier} />
|
||||||
|
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
Written by <a href="https://twitter.com/yenzie">Yanick Champoux</a>.
|
Written by <a href="https://twitter.com/yenzie">Yanick Champoux</a>. Code
|
||||||
Code available on <a
|
available on
|
||||||
href="https://github.com/yanick/aotds-shipyard">Github</a>
|
<a href="https://github.com/yanick/aotds-shipyard">Github</a>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { setContext } from "svelte";
|
import { setContext } from "svelte";
|
||||||
|
|
||||||
import Header from './Header.svelte';
|
import Header from "./Header.svelte";
|
||||||
|
import Ribbon from "./Ribbon.svelte";
|
||||||
import shipStore from "../stores/ship";
|
import shipStore from "../stores/ship";
|
||||||
import OutputJson from './Output/Json.svelte';
|
import OutputJson from "./Output/Json.svelte";
|
||||||
import Print from './Output/Print/index.svelte';
|
import Print from "./Output/Print/index.svelte";
|
||||||
|
|
||||||
import ShipSpecs from './ShipSpecs/index.svelte';
|
import ShipSpecs from "./ShipSpecs/index.svelte";
|
||||||
import Notes from './Notes.svelte';
|
import Notes from "./Notes.svelte";
|
||||||
import ShipItem from "./ShipItem/index.svelte";
|
import ShipItem from "./ShipItem/index.svelte";
|
||||||
import Field from "./Field/index.svelte";
|
import Field from "./Field/index.svelte";
|
||||||
import Hull from "./Hull/index.svelte";
|
import Hull from "./Hull/index.svelte";
|
||||||
@ -129,11 +132,11 @@
|
|||||||
setContext("ship_change", ship.dispatch);
|
setContext("ship_change", ship.dispatch);
|
||||||
|
|
||||||
let show_notes = false;
|
let show_notes = false;
|
||||||
const toggle_notes = () => show_notes = !show_notes;
|
const toggle_notes = () => (show_notes = !show_notes);
|
||||||
|
|
||||||
let output = null;
|
let output = null;
|
||||||
|
|
||||||
const set_output = value => output = value;
|
const set_output = (value) => (output = value);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -159,7 +162,6 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
:global(main > *) {
|
:global(main > *) {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
}
|
}
|
||||||
@ -174,7 +176,8 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notes {
|
.about {
|
||||||
margin-right: 2em;
|
margin-right: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
13
src/components/Output/Json.svench
Normal file
13
src/components/Output/Json.svench
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<Json ship={{potato: 'grande'}}>
|
||||||
|
</Json>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Json from './Json.svelte';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
</style>
|
4
src/components/Ribbon.svelte
Normal file
4
src/components/Ribbon.svelte
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<!-- github ribbon from https://tholman.com/github-corners/ -->
|
||||||
|
<a href="https://github.com/yanick/aotds-shipyard"
|
||||||
|
class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>
|
||||||
|
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export let label;
|
export let label;
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -16,8 +17,12 @@
|
|||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
|
h2 {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
hr {
|
hr {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
heigth: 0px;
|
background: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="cost" bind:this={cost_el}>{cost}</div>
|
<div class="cost" bind:this={cost_el}>{cost}</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { tick } from 'svelte';
|
import { tick } from "svelte";
|
||||||
|
|
||||||
export let mass;
|
export let mass;
|
||||||
export let cost;
|
export let cost;
|
||||||
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
const update_el = async (el) => {
|
const update_el = async (el) => {
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
el.classList.remove('updated');
|
el.classList.remove("updated");
|
||||||
void el.offsetWidth;
|
void el.offsetWidth;
|
||||||
el.classList.add('updated');
|
el.classList.add("updated");
|
||||||
}
|
};
|
||||||
|
|
||||||
$: update_el(mass_el, mass);
|
$: update_el(mass_el, mass);
|
||||||
$: update_el(cost_el, cost);
|
$: update_el(cost_el, cost);
|
||||||
@ -27,11 +27,18 @@
|
|||||||
<style>
|
<style>
|
||||||
div {
|
div {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
|
||||||
}
|
}
|
||||||
.cost,.mass { padding: 0px 2em; text-align: right; }
|
.cost,
|
||||||
.cost { grid-column: 3 }
|
.mass {
|
||||||
.mass { grid-column: 2 }
|
padding: 0px 2em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.cost {
|
||||||
|
grid-column: 3;
|
||||||
|
}
|
||||||
|
.mass {
|
||||||
|
grid-column: 2;
|
||||||
|
}
|
||||||
|
|
||||||
.ship-item {
|
.ship-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -44,9 +51,16 @@
|
|||||||
img {
|
img {
|
||||||
width: 0.75em;
|
width: 0.75em;
|
||||||
}
|
}
|
||||||
.cost:after { content: '\00A4'; margin-left: 0.5em; }
|
.cost:after {
|
||||||
.mass:after { content: url(mass.svg); width: 0.75em; display:
|
content: "\00A4";
|
||||||
inline-block; margin-left: 0.5em; }
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
.mass:after {
|
||||||
|
content: url(mass.svg);
|
||||||
|
width: 0.75em;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
:global(.updated) {
|
:global(.updated) {
|
||||||
animation-name: update;
|
animation-name: update;
|
||||||
@ -55,10 +69,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes update {
|
@keyframes update {
|
||||||
0% {color:inherit; font-weight: inherit;}
|
0% {
|
||||||
20% {color:red; font-weight: bold;}
|
color: inherit;
|
||||||
80% {color:red; font-weight: bold;}
|
font-weight: inherit;
|
||||||
100% {color:inherit; font-weight: inherit; }
|
}
|
||||||
|
20% {
|
||||||
|
color: red;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
80% {
|
||||||
|
color: red;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
color: inherit;
|
||||||
|
font-weight: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user