Merge branch 'sveltekit'
This commit is contained in:
commit
f8242ac84a
15
.eslintrc.cjs
Normal file
15
.eslintrc.cjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: ['eslint:recommended', 'prettier'],
|
||||||
|
plugins: ['svelte3'],
|
||||||
|
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaVersion: 2019
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es2017: true,
|
||||||
|
node: true
|
||||||
|
}
|
||||||
|
};
|
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,5 +1,8 @@
|
|||||||
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
.nyc_output
|
/.svelte
|
||||||
pnpm-lock.yaml
|
/build
|
||||||
public/build
|
/functions
|
||||||
public/bundle.*
|
.svelte-kit/
|
||||||
|
.vercel_build_output/
|
||||||
|
package-lock.json
|
||||||
|
1
.node-version
Normal file
1
.node-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
15.14.0
|
4
.prettierignore
Normal file
4
.prettierignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.svelte/**
|
||||||
|
static/**
|
||||||
|
build/**
|
||||||
|
node_modules/**
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"useTabs": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## Next
|
||||||
|
|
||||||
|
* Switch to Sveltekit.
|
@ -1,44 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
|
|
||||||
<base href="./" >
|
|
||||||
|
|
||||||
<meta charset='utf-8'>
|
|
||||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
||||||
|
|
||||||
<title>Svelte app</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
|
|
||||||
|
|
||||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
|
||||||
<link rel='stylesheet' href='./global.css'>
|
|
||||||
<link rel='stylesheet' href='./bundle.css'>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<link rel='stylesheet' href='/materialize/materialize.css'>
|
|
||||||
<script src="/materialize/materialize.js"></script>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script>
|
|
||||||
process = { env: { NODE_ENV: 'production' } };
|
|
||||||
</script>
|
|
||||||
<script defer src='./bundle.js'></script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}
|
|
||||||
@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<!-- 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>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
9
jsconfig.json
Normal file
9
jsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"$lib/*": ["src/lib/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||||
|
}
|
162
package.json
162
package.json
@ -1,139 +1,33 @@
|
|||||||
{
|
{
|
||||||
"author": "Yanick Champoux <yanick@babyl.ca>",
|
"name": "~TODO~",
|
||||||
"dependencies": {
|
"version": "0.0.1",
|
||||||
"@babel/cli": "^7.10.1",
|
|
||||||
"@babel/core": "^7.10.2",
|
|
||||||
"@babel/node": "^7.10.1",
|
|
||||||
"@material/animation": "^7.0.0",
|
|
||||||
"@material/base": "^7.0.0",
|
|
||||||
"@material/density": "^7.0.0",
|
|
||||||
"@material/feature-targeting": "^7.0.0",
|
|
||||||
"@material/floating-label": "^7.0.0",
|
|
||||||
"@material/line-ripple": "^7.0.0",
|
|
||||||
"@material/notched-outline": "^7.0.0",
|
|
||||||
"@material/ripple": "^7.0.0",
|
|
||||||
"@material/rtl": "^7.0.0",
|
|
||||||
"@material/shape": "^7.0.0",
|
|
||||||
"@material/textfield": "^6.0.0",
|
|
||||||
"@material/theme": "^7.0.0",
|
|
||||||
"@material/typography": "^7.0.0",
|
|
||||||
"@smui/floating-label": "^1.0.0-beta.21",
|
|
||||||
"@smui/line-ripple": "^1.0.0-beta.21",
|
|
||||||
"@smui/notched-outline": "^1.0.0-beta.21",
|
|
||||||
"@smui/textfield": "^1.0.0-beta.21",
|
|
||||||
"@storybook/svelte": "^5.3.19",
|
|
||||||
"babel-loader": "^8.1.0",
|
|
||||||
"css-loader": "^3.6.0",
|
|
||||||
"dart-sass": "^1.25.0",
|
|
||||||
"lodash": "^4.17.15",
|
|
||||||
"mini-css-extract-plugin": "^0.9.0",
|
|
||||||
"node-sass": "^4.14.1",
|
|
||||||
"prettier": "2.0.5",
|
|
||||||
"prettier-plugin-svelte": "1.1.0",
|
|
||||||
"redux": "^4.0.5",
|
|
||||||
"reselect": "^4.0.0",
|
|
||||||
"rollup-plugin-css-only": "^2.1.0",
|
|
||||||
"rollup-plugin-postcss": "^3.1.2",
|
|
||||||
"rollup-plugin-scss": "^2.5.0",
|
|
||||||
"sass": "^1.26.9",
|
|
||||||
"sass-loader": "^8.0.2",
|
|
||||||
"sirv-cli": "^0.4.4",
|
|
||||||
"style-loader": "^1.2.1",
|
|
||||||
"svelte-loader": "^2.13.6",
|
|
||||||
"svelte3-redux": "^0.3.0",
|
|
||||||
"ts-action": "^11.0.0",
|
|
||||||
"updeep": "^1.2.0",
|
|
||||||
"updux": "^2.1.0",
|
|
||||||
"webpack": "^4.43.0",
|
|
||||||
"webpack-cli": "^3.3.12",
|
|
||||||
"webpack-dev-server": "^3.11.0"
|
|
||||||
},
|
|
||||||
"description": "Full Thrust ship builder",
|
|
||||||
"devDependencies": {
|
|
||||||
"@rollup/plugin-alias": "^3.1.1",
|
|
||||||
"@rollup/plugin-commonjs": "^12.0.0",
|
|
||||||
"@rollup/plugin-node-resolve": "^8.0.0",
|
|
||||||
"@storybook/addon-actions": "^5.3.19",
|
|
||||||
"eslint": "7.4.0",
|
|
||||||
"eslint-config-prettier": "6.11.0",
|
|
||||||
"eslint-plugin-babel": "5.3.1",
|
|
||||||
"eslint-plugin-lodash": "^7.1.0",
|
|
||||||
"eslint-plugin-prettier": "3.1.4",
|
|
||||||
"eslint-plugin-svelte3": "2.7.3",
|
|
||||||
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
|
|
||||||
"file-loader": "^6.0.0",
|
|
||||||
"npm-run-all": "^4.1.5",
|
|
||||||
"rollup": "^2.3.4",
|
|
||||||
"rollup-plugin-livereload": "^1.0.0",
|
|
||||||
"rollup-plugin-svelte": "^5.0.3",
|
|
||||||
"rollup-plugin-terser": "^5.1.2",
|
|
||||||
"svelte": "^3.0.0",
|
|
||||||
"svelte-material-ui": "^1.0.0-beta.21",
|
|
||||||
"svg-inline-loader": "^0.8.2",
|
|
||||||
"tap": "^14.10.7"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"env": {
|
|
||||||
"amd": true,
|
|
||||||
"browser": true,
|
|
||||||
"es6": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"prettier",
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:you-dont-need-lodash-underscore/compatible",
|
|
||||||
"plugin:lodash/recommended"
|
|
||||||
],
|
|
||||||
"ignorePatterns": [
|
|
||||||
"src/node_modules"
|
|
||||||
],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"*.svelte"
|
|
||||||
],
|
|
||||||
"processor": "svelte3/svelte3"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"modules": true
|
|
||||||
},
|
|
||||||
"ecmaVersion": "2020",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"svelte3"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"lodash/prefer-lodash-method": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"game"
|
|
||||||
],
|
|
||||||
"license": "ISC",
|
|
||||||
"main": "index.js",
|
|
||||||
"name": "aotds-docks",
|
|
||||||
"prettier": {
|
|
||||||
"svelteSortOrder": "markup-scripts-styles",
|
|
||||||
"svelteStrictMode": false
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "NODE_ENV=production webpack",
|
"dev": "svelte-kit dev",
|
||||||
"lint": "npm-run-all --parallel \"lint:prettier -- {@}\" \"lint:eslint -- {@}\" --",
|
"build": "svelte-kit build",
|
||||||
"lint:eslint": "./scripts/eslint",
|
"preview": "svelte-kit preview",
|
||||||
"lint:eslint:fix": "npm run lint:eslint -- --fix",
|
"lint": "prettier --check . && eslint --ignore-path .gitignore .",
|
||||||
"lint:fix": "npm-run-all \"lint:eslint:fix -- {@}\" \"lint:prettier:fix -- {@}\" --",
|
"format": "prettier --write ."
|
||||||
"lint:prettier": "./scripts/prettier",
|
|
||||||
"lint:prettier:fix": "npm run lint:prettier -- --fix",
|
|
||||||
"package": "./scripts/merge_package.pl",
|
|
||||||
"start": "webpack-dev-server --open --content-base public",
|
|
||||||
"test": "tap 'src/**test.js' --no-coverage"
|
|
||||||
},
|
},
|
||||||
"tap": {
|
"devDependencies": {
|
||||||
"coverage": false
|
"@sveltejs/kit": "^1.0.0-next.107",
|
||||||
|
"eslint": "^7.22.0",
|
||||||
|
"eslint-config-prettier": "^8.1.0",
|
||||||
|
"eslint-plugin-svelte3": "^3.2.0",
|
||||||
|
"prettier": "~2.2.1",
|
||||||
|
"prettier-plugin-svelte": "^2.2.0",
|
||||||
|
"svelte": "^3.34.0",
|
||||||
|
"vite": "^2.2.3"
|
||||||
},
|
},
|
||||||
"version": "0.0.1"
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"@sveltejs/adapter-node": "^1.0.0-next.18",
|
||||||
|
"@sveltejs/adapter-static": "^1.0.0-next.9",
|
||||||
|
"@yanick/updeep": "link:/home/yanick/work/javascript/updeep",
|
||||||
|
"bulma": "^0.9.2",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"redux": "^4.1.0",
|
||||||
|
"reselect": "^4.0.0",
|
||||||
|
"ts-action": "^11.0.0",
|
||||||
|
"updux": "link:/home/yanick/work/javascript/updux/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
63
package.yml
63
package.yml
@ -1,63 +0,0 @@
|
|||||||
---
|
|
||||||
_merge:
|
|
||||||
- version
|
|
||||||
- dependencies
|
|
||||||
- devDependencies
|
|
||||||
|
|
||||||
name: aotds-docks
|
|
||||||
description: Full Thrust ship builder
|
|
||||||
|
|
||||||
author: 'Yanick Champoux <yanick@babyl.ca>'
|
|
||||||
|
|
||||||
scripts:
|
|
||||||
build: NODE_ENV=production webpack
|
|
||||||
start: webpack-dev-server --open --content-base public
|
|
||||||
|
|
||||||
package: ./scripts/merge_package.pl
|
|
||||||
|
|
||||||
test: tap 'src/**test.js' --no-coverage
|
|
||||||
|
|
||||||
"lint:prettier": ./scripts/prettier
|
|
||||||
"lint:eslint": ./scripts/eslint
|
|
||||||
lint: npm-run-all --parallel "lint:prettier -- {@}" "lint:eslint -- {@}" --
|
|
||||||
|
|
||||||
"lint:prettier:fix": npm run lint:prettier -- --fix
|
|
||||||
"lint:eslint:fix": npm run lint:eslint -- --fix
|
|
||||||
"lint:fix": npm-run-all "lint:eslint:fix -- {@}" "lint:prettier:fix -- {@}" --
|
|
||||||
|
|
||||||
eslintConfig:
|
|
||||||
env:
|
|
||||||
amd: true
|
|
||||||
browser: true
|
|
||||||
es6: true
|
|
||||||
node: true
|
|
||||||
extends:
|
|
||||||
- prettier
|
|
||||||
- eslint:recommended
|
|
||||||
- plugin:you-dont-need-lodash-underscore/compatible
|
|
||||||
- plugin:lodash/recommended
|
|
||||||
ignorePatterns:
|
|
||||||
- src/node_modules
|
|
||||||
overrides:
|
|
||||||
- files:
|
|
||||||
- '*.svelte'
|
|
||||||
processor: svelte3/svelte3
|
|
||||||
parserOptions:
|
|
||||||
ecmaFeatures:
|
|
||||||
modules: true
|
|
||||||
ecmaVersion: '2020'
|
|
||||||
sourceType: module
|
|
||||||
plugins:
|
|
||||||
- svelte3
|
|
||||||
rules:
|
|
||||||
lodash/prefer-lodash-method: off
|
|
||||||
keywords: [ game ]
|
|
||||||
license: ISC
|
|
||||||
main: index.js
|
|
||||||
|
|
||||||
prettier:
|
|
||||||
svelteSortOrder: markup-scripts-styles
|
|
||||||
svelteStrictMode: false
|
|
||||||
|
|
||||||
tap:
|
|
||||||
coverage: false
|
|
11705
public/bulma/bulma-rtl.css
Normal file
11705
public/bulma/bulma-rtl.css
Normal file
File diff suppressed because it is too large
Load Diff
1
public/bulma/bulma-rtl.css.map
Normal file
1
public/bulma/bulma-rtl.css.map
Normal file
File diff suppressed because one or more lines are too long
1
public/bulma/bulma-rtl.min.css
vendored
Normal file
1
public/bulma/bulma-rtl.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
11705
public/bulma/bulma.css
vendored
Normal file
11705
public/bulma/bulma.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
public/bulma/bulma.css.map
Normal file
1
public/bulma/bulma.css.map
Normal file
File diff suppressed because one or more lines are too long
1
public/bulma/bulma.min.css
vendored
Normal file
1
public/bulma/bulma.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -1,36 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset='utf-8'>
|
|
||||||
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
||||||
|
|
||||||
<title>The Docks</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700">
|
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="./fonts/faktos.css">
|
|
||||||
<link rel="stylesheet" href="./fonts/dosis/dosis.css">
|
|
||||||
|
|
||||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
|
||||||
<link rel='stylesheet' href='./global.css'>
|
|
||||||
<link rel='stylesheet' href='./css/buttons.css'>
|
|
||||||
<link rel='stylesheet' href='./bundle.css'>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="print.css">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<link rel='stylesheet' href='/materialize/materialize.css'>
|
|
||||||
<script src="/materialize/materialize.js"></script>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script>
|
|
||||||
process = { env: { NODE_ENV: 'production' } };
|
|
||||||
</script>
|
|
||||||
<script defer src='./bundle.js'></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
102
rollup.config.js
102
rollup.config.js
@ -1,102 +0,0 @@
|
|||||||
import svelte from 'rollup-plugin-svelte';
|
|
||||||
import resolve from '@rollup/plugin-node-resolve';
|
|
||||||
import commonjs from '@rollup/plugin-commonjs';
|
|
||||||
import alias from '@rollup/plugin-alias';
|
|
||||||
import livereload from 'rollup-plugin-livereload';
|
|
||||||
import { terser } from 'rollup-plugin-terser';
|
|
||||||
import css from 'rollup-plugin-css-only';
|
|
||||||
import postcss from 'rollup-plugin-postcss';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const postcssOptions = () => ({
|
|
||||||
extensions: ['.scss', '.sass'],
|
|
||||||
extract: false,
|
|
||||||
minimize: true,
|
|
||||||
use: [
|
|
||||||
['sass', {
|
|
||||||
includePaths: [
|
|
||||||
'./sass',
|
|
||||||
'./node_modules',
|
|
||||||
// This is only needed because we're using a local module. :-/
|
|
||||||
// Normally, you would not need this line.
|
|
||||||
path.resolve(__dirname, '..', 'node_modules')
|
|
||||||
]
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const production = !process.env.ROLLUP_WATCH;
|
|
||||||
|
|
||||||
export default {
|
|
||||||
input: 'src/main.js',
|
|
||||||
output: {
|
|
||||||
sourcemap: true,
|
|
||||||
format: 'iife',
|
|
||||||
name: 'app',
|
|
||||||
file: 'public/build/bundle.js'
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
alias({
|
|
||||||
entries: [
|
|
||||||
{ find: '~', replacement: './src' },
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
// scss(),
|
|
||||||
css({ output: 'public/build/import-bundle.css' }),
|
|
||||||
svelte({
|
|
||||||
// enable run-time checks when not in production
|
|
||||||
dev: !production,
|
|
||||||
// we'll extract any component CSS out into
|
|
||||||
// a separate file - better for performance
|
|
||||||
css: css => {
|
|
||||||
css.write('public/build/bundle.css');
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
postcss(postcssOptions()),
|
|
||||||
// If you have external dependencies installed from
|
|
||||||
// npm, you'll most likely need these plugins. In
|
|
||||||
// some cases you'll need additional configuration -
|
|
||||||
// consult the documentation for details:
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
|
||||||
resolve({
|
|
||||||
browser: true,
|
|
||||||
dedupe: ['svelte']
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
|
|
||||||
// In dev mode, call `npm run start` once
|
|
||||||
// the bundle has been generated
|
|
||||||
!production && serve(),
|
|
||||||
|
|
||||||
// Watch the `public` directory and refresh the
|
|
||||||
// browser on changes when not in production
|
|
||||||
!production && livereload('public'),
|
|
||||||
|
|
||||||
// If we're building for production (npm run build
|
|
||||||
// instead of npm run dev), minify
|
|
||||||
production && terser()
|
|
||||||
],
|
|
||||||
watch: {
|
|
||||||
clearScreen: false,
|
|
||||||
chokidar: {
|
|
||||||
usePolling: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function serve() {
|
|
||||||
let started = false;
|
|
||||||
|
|
||||||
return {
|
|
||||||
writeBundle() {
|
|
||||||
if (!started) {
|
|
||||||
started = true;
|
|
||||||
|
|
||||||
require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
|
|
||||||
stdio: ['ignore', 'inherit', 'inherit'],
|
|
||||||
shell: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
16
src/app.html
Normal file
16
src/app.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link rel="stylesheet" href="/bulma/bulma.css" />
|
||||||
|
<link rel="stylesheet" href="/fonts/faktos.css">
|
||||||
|
<link rel="stylesheet" href="/fonts/dosis/dosis.css">
|
||||||
|
<link rel='stylesheet' href='/global.css'>
|
||||||
|
%svelte.head%
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="svelte">%svelte.body%</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -78,23 +78,23 @@
|
|||||||
<script>
|
<script>
|
||||||
import { setContext } from "svelte";
|
import { setContext } from "svelte";
|
||||||
|
|
||||||
import Header from './Header';
|
import Header from './Header.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';
|
import Print from './Output/Print/index.svelte';
|
||||||
|
|
||||||
import ShipSpecs from './ShipSpecs/index.svelte';
|
import ShipSpecs from './ShipSpecs/index.svelte';
|
||||||
import Notes from './Notes';
|
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";
|
import Hull from "./Hull/index.svelte";
|
||||||
import Firecons from "./Firecons.svelte";
|
import Firecons from "./Firecons.svelte";
|
||||||
import Propulsion from "./Propulsion/index.svelte";
|
import Propulsion from "./Propulsion/index.svelte";
|
||||||
import Section from "~C/Section";
|
import Section from "./Section/index.svelte";
|
||||||
import Weapon from "~C/Weapon";
|
import Weapon from "./Weapon/index.svelte";
|
||||||
import Carrier from "~C/Carrier";
|
import Carrier from "./Carrier/index.svelte";
|
||||||
import ADFC from "~C/Weaponry/ADFC";
|
import ADFC from "./Weaponry/ADFC/index.svelte";
|
||||||
import AddWeapon from "~C/Weaponry/AddWeapon";
|
import AddWeapon from "./Weaponry/AddWeapon/index.svelte";
|
||||||
|
|
||||||
const ship = shipStore();
|
const ship = shipStore();
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
|
|
||||||
import Section from "~C/Section/index.svelte";
|
import Section from "$lib/components/Section/index.svelte";
|
||||||
import Field from "~C/Field/index.svelte";
|
import Field from "$lib/components/Field/index.svelte";
|
||||||
import ShipItem from "~C/ShipItem/index.svelte";
|
import ShipItem from "$lib/components/ShipItem/index.svelte";
|
||||||
import dux from '~/dux/carrier';
|
import dux from '$lib/dux/carrier';
|
||||||
import squadron_types from '~/dux/carrier/squadron_types';
|
import squadron_types from '$lib/dux/carrier/squadron_types';
|
||||||
|
|
||||||
const types = squadron_types.map( ({type}) => type );
|
const types = squadron_types.map( ({type}) => type );
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
|
|
||||||
import Section from "~C/Section/index.svelte";
|
import Section from "../Section/index.svelte";
|
||||||
import Field from "~C/Field/index.svelte";
|
import Field from "../Field/index.svelte";
|
||||||
import ShipItem from "~C/ShipItem/index.svelte";
|
import ShipItem from "../ShipItem/index.svelte";
|
||||||
import Squadron from './Squadron';
|
import Squadron from './Squadron/index.svelte';
|
||||||
import dux from '~/dux/carrier';
|
import dux from '../../dux/carrier';
|
||||||
|
|
||||||
export let bays = 0;
|
export let bays = 0;
|
||||||
export let squadrons = [];
|
export let squadrons = [];
|
||||||
|
@ -13,10 +13,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Field from '~C/Field';
|
|
||||||
import ShipItem from '~C/ShipItem';
|
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
|
import ShipItem from '$lib/components/ShipItem/index.svelte';
|
||||||
|
|
||||||
export let cost;
|
export let cost;
|
||||||
export let mass;
|
export let mass;
|
||||||
export let advanced = false;
|
export let advanced = false;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import ShipItem from '~C/ShipItem';
|
import ShipItem from './ShipItem/index.svelte';
|
||||||
import Field from '~C/Field';
|
import Field from './Field/index.svelte';
|
||||||
|
|
||||||
export let nbr, cost, mass = (0,0,0);
|
export let nbr, cost, mass = (0,0,0);
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher} from 'svelte';
|
import { createEventDispatcher} from 'svelte';
|
||||||
|
|
||||||
import dux from '~/dux/structure/armour';
|
import dux from '$lib/dux/structure/armour';
|
||||||
|
|
||||||
import ShipItem from '~C/ShipItem/index.svelte';
|
import ShipItem from '$lib/components/ShipItem/index.svelte';
|
||||||
import Field from '~C/Field/index.svelte';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
|
|
||||||
export let layer = 1;
|
export let layer = 1;
|
||||||
export let rating = 0;
|
export let rating = 0;
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher} from 'svelte';
|
import { createEventDispatcher} from 'svelte';
|
||||||
|
|
||||||
import ShipItem from '~C/ShipItem/index.svelte';
|
import ShipItem from '$lib/components/ShipItem/index.svelte';
|
||||||
import Field from '~C/Field/index.svelte';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
import Layer from './Layer/index.svelte';
|
import Layer from './Layer/index.svelte';
|
||||||
import dux from '~/dux/structure/armour';
|
import dux from '$lib/dux/structure/armour';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
export let armour = [];
|
export let armour = [];
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
</ShipItem>
|
</ShipItem>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get.js';
|
||||||
import ShipItem from '~C/ShipItem/index.svelte';
|
import ShipItem from '$lib/components/ShipItem/index.svelte';
|
||||||
import Field from '~C/Field/index.svelte';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
import dux from '~/dux/cargo';
|
import dux from '$lib/dux/cargo';
|
||||||
|
|
||||||
import {getContext, createEventDispatcher} from 'svelte';
|
import {getContext, createEventDispatcher} from 'svelte';
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
import Section from '~C/Section';
|
import Section from '$lib/components/Section/index.svelte';
|
||||||
import Field from '~C/Field';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
import ShipItem from '~C/ShipItem';
|
import ShipItem from '../../ShipItem/index.svelte';
|
||||||
|
|
||||||
export let cost = 0;
|
export let cost = 0;
|
||||||
export let mass = 0;
|
export let mass = 0;
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
</ShipItem>
|
</ShipItem>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get.js';
|
||||||
import ShipItem from '~C/ShipItem/index.svelte';
|
import ShipItem from '$lib/components/ShipItem/index.svelte';
|
||||||
import Field from '~C/Field/index.svelte';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
import dux from '~/dux/streamlining';
|
import dux from '$lib/dux/streamlining';
|
||||||
|
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
import Section from '~C/Section';
|
import Section from '../Section/index.svelte';
|
||||||
import Field from '~C/Field';
|
import Field from '../Field/index.svelte';
|
||||||
import ShipItem from '~C/ShipItem';
|
import ShipItem from '../ShipItem/index.svelte';
|
||||||
import Screens from './Screens';
|
import Screens from './Screens/index.svelte';
|
||||||
import Armour from './Armour';
|
import Armour from './Armour/index.svelte';
|
||||||
import Cargo from './Cargo';
|
import Cargo from './Cargo/index.svelte';
|
||||||
import Streamlining from './Streamlining';
|
import Streamlining from './Streamlining/index.svelte';
|
||||||
|
|
||||||
export let cost, mass, ship_mass, rating, screens, armour = (
|
export let cost, mass, ship_mass, rating, screens, armour = (
|
||||||
0, 0, 10, 1, [], []
|
0, 0, 10, 1, [], []
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ceil } from '~/dux/utils';
|
import { ceil } from '$lib/dux/utils';
|
||||||
|
|
||||||
export let ship_mass = 0;
|
export let ship_mass = 0;
|
||||||
export let rating = 0;
|
export let rating = 0;
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Integrity from './Integrity';
|
import Integrity from './Integrity/index.svelte';
|
||||||
import Armour from './Armour';
|
import Armour from './Armour/index.svelte';
|
||||||
|
|
||||||
export let structure = {};
|
export let structure = {};
|
||||||
export let ship_mass = 0;
|
export let ship_mass = 0;
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Cost from '~C/Cost';
|
import Cost from '../../../Cost.svelte';
|
||||||
import Mass from '~C/Mass';
|
import Mass from '$lib/components/Mass.svelte';
|
||||||
|
|
||||||
export let ship_class;
|
export let ship_class;
|
||||||
export let ship_type;
|
export let ship_type;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Firecons from './Firecons';
|
import Firecons from './Firecons/index.svelte';
|
||||||
import Screens from './Screens';
|
import Screens from './Screens/index.svelte';
|
||||||
|
|
||||||
export let firecons = 0;
|
export let firecons = 0;
|
||||||
export let screens = {};
|
export let screens = {};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Arcs from '~C/Weapon/Arcs';
|
import Arcs from '$lib/components/Weapon/Arcs/index.svelte';
|
||||||
export let weapon_class = 1;
|
export let weapon_class = 1;
|
||||||
export let arcs = [];
|
export let arcs = [];
|
||||||
</script>
|
</script>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Beam from './Beam';
|
import Beam from './Beam/index.svelte';
|
||||||
export let weapons = [];
|
export let weapons = [];
|
||||||
|
|
||||||
let beams = [];
|
let beams = [];
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import Identification from './Identification';
|
import Identification from './Identification/index.svelte';
|
||||||
import MainSystems from './MainSystems';
|
import MainSystems from './MainSystems/index.svelte';
|
||||||
import Hull from './Hull';
|
import Hull from './Hull/index.svelte';
|
||||||
import Weapons from './Weapons';
|
import Weapons from './Weapons/index.svelte';
|
||||||
import Systems from './Systems';
|
import Systems from './Systems/index.svelte';
|
||||||
|
|
||||||
export let ship;
|
export let ship;
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
|
|
||||||
import Field from '~C/Field';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
import { candidate_ship_types } from '~/dux/ship_types';
|
import { candidate_ship_types } from '../../dux/ship_types';
|
||||||
|
|
||||||
export let ship = getContext('ship');
|
export let ship = getContext('ship');
|
||||||
let general;
|
let general;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import Field from "~C/Field";
|
import Field from "$lib/components/Field/index.svelte";
|
||||||
|
|
||||||
export let ship = getContext("ship");
|
export let ship = getContext("ship");
|
||||||
|
|
||||||
|
@ -22,13 +22,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
import Arc from '../../Weapons/Arc.svelte';
|
import Arc from '../../Weapons/Arc.svelte';
|
||||||
import Arcs from '../Arcs';
|
import Arcs from '../Arcs/index.svelte';
|
||||||
import { weapon_cost_mass } from '~/dux/weapons/rules';
|
import { weapon_cost_mass } from '$lib/dux/weapons/rules';
|
||||||
import fp from 'lodash/fp';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import ShipItem from '~C/ShipItem';
|
import ShipItem from '$lib/components/ShipItem/index.svelte';
|
||||||
import Field from '~C/Field';
|
import Field from '$lib/components/Field/index.svelte';
|
||||||
import dux from '~/dux';
|
import dux from '$lib/dux';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
|
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
import Arcs from '../Arcs';
|
import Arcs from '../Arcs/index.svelte';
|
||||||
import dux from '~/dux';
|
import dux from '$lib/dux';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
|
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
import Arcs from '../Arcs';
|
import Arcs from '../Arcs/index.svelte';
|
||||||
import dux from '~/dux';
|
import dux from '$lib/dux';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
|
const all_arcs = [ 'FS', 'F', 'FP', 'AP', 'A', 'AS' ];
|
||||||
|
@ -16,17 +16,16 @@
|
|||||||
|
|
||||||
import Arc from '../Weapons/Arc.svelte';
|
import Arc from '../Weapons/Arc.svelte';
|
||||||
import { weapon_cost_mass } from '../../dux/weapons/rules.js';
|
import { weapon_cost_mass } from '../../dux/weapons/rules.js';
|
||||||
import fp from 'lodash/fp';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import ShipItem from '~C/ShipItem';
|
import ShipItem from '../ShipItem/index.svelte';
|
||||||
import Field from '~C/Field';
|
import Field from '../Field/index.svelte';
|
||||||
import Beam from './Beam';
|
import Beam from './Beam/index.svelte';
|
||||||
import Submunition from './Submunition';
|
import Submunition from './Submunition/index.svelte';
|
||||||
import PointDefenceSystem from './PointDefenceSystem';
|
import PointDefenceSystem from './PointDefenceSystem/index.svelte';
|
||||||
import Scattergun from './Scattergun';
|
import Scattergun from './Scattergun/index.svelte';
|
||||||
import Needle from './Needle';
|
import Needle from './Needle/index.svelte';
|
||||||
import dux from '~/dux';
|
import dux from '../../dux';
|
||||||
|
|
||||||
const weapon_component = {
|
const weapon_component = {
|
||||||
beam: Beam,
|
beam: Beam,
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import get from "lodash/get";
|
import get from "lodash/get.js";
|
||||||
import ShipItem from "~C/ShipItem/index.svelte";
|
import ShipItem from "../../ShipItem/index.svelte";
|
||||||
import Field from "~C/Field/index.svelte";
|
import Field from "../../Field/index.svelte";
|
||||||
import dux from "~/dux";
|
import dux from "../../../dux";
|
||||||
|
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Field from '~C/Field';
|
import Field from '../../Field/index.svelte';
|
||||||
import {getContext } from 'svelte';
|
import {getContext } from 'svelte';
|
||||||
import dux from '~/dux';
|
import dux from '../../../dux';
|
||||||
|
|
||||||
export let weapon_type = "beam";
|
export let weapon_type = "beam";
|
||||||
export let ship_change = getContext('ship_change') || ( () => {} );
|
export let ship_change = getContext('ship_change') || ( () => {} );
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
'FS', 'F', 'FP', 'AP', 'A', 'AS'
|
'FS', 'F', 'FP', 'AP', 'A', 'AS'
|
||||||
];
|
];
|
||||||
|
|
||||||
import fp from 'lodash/fp';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
@ -19,27 +19,27 @@ const dux = new Updux({
|
|||||||
|
|
||||||
const set_squadron = action('set_squadron',payload());
|
const set_squadron = action('set_squadron',payload());
|
||||||
|
|
||||||
dux.addMutation(set_squadron, ({id,type}) => u({ squadrons: u.map(
|
dux.addMutation(set_squadron, ({id,type}) => u.update({ squadrons: u.map(
|
||||||
u.if(_.matches({id}), u({type, cost: 6 * _.find(squadron_types,{type}).cost, mass: 6 }))
|
u.if(_.matches({id}), u({type, cost: 6 * _.find(squadron_types,{type}).cost, mass: 6 }))
|
||||||
)}));
|
)}));
|
||||||
|
|
||||||
const set_carrier_bays = action('set_carrier_bays', payload() );
|
const set_carrier_bays = action('set_carrier_bays', payload() );
|
||||||
|
|
||||||
dux.addMutation( set_carrier_bays, bays => state => {
|
dux.addMutation( set_carrier_bays, bays => state => {
|
||||||
state = u({
|
state = u.update({
|
||||||
bays,
|
bays,
|
||||||
mass: 1.5*6*bays,
|
mass: 1.5*6*bays,
|
||||||
cost: 3 * 1.5 * 6 * bays,
|
cost: 3 * 1.5 * 6 * bays,
|
||||||
})(state);
|
})(state);
|
||||||
|
|
||||||
if( state.squadrons.length > bays ) {
|
if( state.squadrons.length > bays ) {
|
||||||
state = u({
|
state = u.update({
|
||||||
squadrons: squadrons => squadrons.slice(0,bays)
|
squadrons: squadrons => squadrons.slice(0,bays)
|
||||||
}, state)
|
}, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
if( state.squadrons.length < bays ) {
|
if( state.squadrons.length < bays ) {
|
||||||
state = u({
|
state = u.update({
|
||||||
squadrons: squadrons => [ ...squadrons, ..._.times(
|
squadrons: squadrons => [ ...squadrons, ..._.times(
|
||||||
bays - state.squadrons.length, i => ({
|
bays - state.squadrons.length, i => ({
|
||||||
id: 1 + i + state.squadrons.length,
|
id: 1 + i + state.squadrons.length,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from 'updux';
|
import Updux from 'updux';
|
||||||
import { action, payload } from 'ts-action';
|
import { action, payload } from 'ts-action';
|
||||||
import u from 'updeep';
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
|
||||||
const set_engine = action('set_engine',payload());
|
const set_engine = action('set_engine',payload());
|
||||||
@ -14,8 +14,8 @@ const dux = new Updux({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dux.addMutation(set_engine, engine => u(engine));
|
dux.addMutation(set_engine, engine => u.update(engine));
|
||||||
dux.addMutation(set_drive_reqs, rate => u(rate));
|
dux.addMutation(set_drive_reqs, rate => u.update(rate));
|
||||||
|
|
||||||
export function calc_drive_reqs(ship_mass,rating,advanced=false) {
|
export function calc_drive_reqs(ship_mass,rating,advanced=false) {
|
||||||
const mass = Math.ceil(rating * 0.05 * ship_mass);
|
const mass = Math.ceil(rating * 0.05 * ship_mass);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from 'updux';
|
import Updux from "updux";
|
||||||
import { action, payload } from 'ts-action';
|
import { action, payload } from 'ts-action';
|
||||||
import u from 'updeep';
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { calc_ftl_reqs } from './rules';
|
import { calc_ftl_reqs } from './rules';
|
||||||
|
|
||||||
@ -9,6 +9,7 @@ const set_ftl = action('set_ftl',payload());
|
|||||||
|
|
||||||
const set_ftl_reqs = action('set_ftl_reqs', payload() );
|
const set_ftl_reqs = action('set_ftl_reqs', payload() );
|
||||||
|
|
||||||
|
console.log(Updux);
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
initial: {
|
initial: {
|
||||||
mass: 0,
|
mass: 0,
|
||||||
@ -17,7 +18,8 @@ const dux = new Updux({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dux.addMutation(set_ftl, type => u({type}));
|
dux.addMutation(set_ftl, type => u.update({type}));
|
||||||
dux.addMutation(set_ftl_reqs, reqs => u(reqs) );
|
dux.addMutation(set_ftl_reqs, reqs => u.update(reqs) );
|
||||||
|
|
||||||
export default dux.asDux;
|
export default dux.asDux;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
import ftl from "./ftl";
|
import ftl from "./ftl";
|
||||||
@ -13,7 +13,7 @@ import structure from './structure';
|
|||||||
import cargo from './cargo';
|
import cargo from './cargo';
|
||||||
import streamlining from './streamlining';
|
import streamlining from './streamlining';
|
||||||
import carrier from './carrier';
|
import carrier from './carrier';
|
||||||
import { ceil } from '~/dux/utils';
|
import { ceil } from './utils';
|
||||||
|
|
||||||
const set_ship_mass = action("set_ship_mass", payload());
|
const set_ship_mass = action("set_ship_mass", payload());
|
||||||
const set_name = action("set_name", payload());
|
const set_name = action("set_name", payload());
|
||||||
@ -36,6 +36,8 @@ const initial = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(Updux);
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
subduxes: { ftl, engine, weaponry, structure, cargo, streamlining, carrier },
|
subduxes: { ftl, engine, weaponry, structure, cargo, streamlining, carrier },
|
||||||
initial
|
initial
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
@ -13,10 +13,10 @@ const dux = new Updux({
|
|||||||
|
|
||||||
const set_streamlining = action('set_streamlining',payload());
|
const set_streamlining = action('set_streamlining',payload());
|
||||||
|
|
||||||
dux.addMutation(set_streamlining, type => u({type}) );
|
dux.addMutation(set_streamlining, type => u.update({type}) );
|
||||||
|
|
||||||
const set_streamlining_cost_mass = action('set_streamlining_cost_mass',payload());
|
const set_streamlining_cost_mass = action('set_streamlining_cost_mass',payload());
|
||||||
|
|
||||||
dux.addMutation( set_streamlining_cost_mass, reqs => u(reqs) );
|
dux.addMutation( set_streamlining_cost_mass, reqs => u.update(reqs) );
|
||||||
|
|
||||||
export default dux.asDux;
|
export default dux.asDux;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
import screens from './screens';
|
import screens from './screens';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
@ -10,9 +10,9 @@ const dux = new Updux({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const set_screens = action('set_screens', payload() );
|
const set_screens = action('set_screens', payload() );
|
||||||
dux.addMutation(set_screens, payload => u(payload) );
|
dux.addMutation(set_screens, payload => u.update(payload) );
|
||||||
|
|
||||||
const set_screens_reqs = action('set_screens_reqs', payload() );
|
const set_screens_reqs = action('set_screens_reqs', payload() );
|
||||||
dux.addMutation(set_screens_reqs, payload => u(payload) );
|
dux.addMutation(set_screens_reqs, payload => u.update(payload) );
|
||||||
|
|
||||||
export default dux.asDux;
|
export default dux.asDux;
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
import fp from 'lodash/fp';
|
import flow from 'lodash/fp/flow.js';
|
||||||
|
import sumBy from 'lodash/fp/sumBy.js';
|
||||||
|
import pick from 'lodash/fp/pick.js';
|
||||||
|
import filter from 'lodash/fp/filter.js';
|
||||||
|
import flattenDeep from 'lodash/fp/flattenDeep.js';
|
||||||
|
import has from 'lodash/fp/has.js';
|
||||||
|
|
||||||
const expand_cost_mass = (obj={}) => ([
|
const expand_cost_mass = (obj={}) => ([
|
||||||
fp.pick(['cost','mass'],obj),
|
pick(['cost','mass'],obj),
|
||||||
...Object.values(obj || {}).filter( val => typeof val === 'object' ).map(
|
...Object.values(obj || {}).filter( val => typeof val === 'object' ).map(
|
||||||
val => expand_cost_mass(val)
|
val => expand_cost_mass(val)
|
||||||
)
|
)
|
||||||
@ -14,18 +19,18 @@ export function calc_ship_req(ship) {
|
|||||||
|
|
||||||
//if(!general) general = {};
|
//if(!general) general = {};
|
||||||
|
|
||||||
const items = fp.flow(
|
const items = flow(
|
||||||
expand_cost_mass,
|
expand_cost_mass,
|
||||||
fp.flattenDeep,
|
flattenDeep,
|
||||||
fp.filter(fp.has('cost'))
|
filter(has('cost'))
|
||||||
)({
|
)({
|
||||||
...rest,
|
...rest,
|
||||||
cost: general.mass, mass: 0
|
cost: general.mass, mass: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mass: fp.sumBy('mass',items),
|
mass: sumBy('mass',items),
|
||||||
cost: fp.sumBy('cost',items),
|
cost: sumBy('cost',items),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
|
|
||||||
const dux = new Updux({
|
const dux = new Updux({
|
||||||
initial: {
|
initial: {
|
||||||
@ -11,7 +11,7 @@ const dux = new Updux({
|
|||||||
})
|
})
|
||||||
|
|
||||||
dux.addMutation( action( 'set_adfc', payload() ), rating =>
|
dux.addMutation( action( 'set_adfc', payload() ), rating =>
|
||||||
u({ rating, mass: 2 * rating, cost: 8 * rating })
|
u.update({ rating, mass: 2 * rating, cost: 8 * rating })
|
||||||
);
|
);
|
||||||
|
|
||||||
export default dux.asDux;
|
export default dux.asDux;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
|
|
||||||
import weapons from './weapons';
|
import weapons from './weapons';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Updux from "updux";
|
import Updux from "updux";
|
||||||
import { action, payload } from "ts-action";
|
import { action, payload } from "ts-action";
|
||||||
import u from "updeep";
|
import u from "@yanick/updeep";
|
||||||
import { createSelector } from "reselect";
|
import { createSelector } from "reselect";
|
||||||
import { weapon_cost_mass } from "../../weapons/rules";
|
import { weapon_cost_mass } from "../../weapons/rules";
|
||||||
|
|
||||||
|
3
src/global.d.ts
vendored
Normal file
3
src/global.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/// <reference types="@sveltejs/kit" />
|
||||||
|
/// <reference types="svelte" />
|
||||||
|
/// <reference types="vite/client" />
|
6
src/routes/index.svelte
Normal file
6
src/routes/index.svelte
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<App />
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import App from '../components/App.svelte';
|
||||||
|
</script>
|
||||||
|
|
@ -1,15 +1,22 @@
|
|||||||
|
import { browser } from '$app/env';
|
||||||
import { readable } from "svelte/store";
|
import { readable } from "svelte/store";
|
||||||
import { compose, applyMiddleware } from "redux";
|
import { compose, applyMiddleware } from "redux";
|
||||||
|
|
||||||
import { calc_ship_req } from "../dux/utils";
|
import { calc_ship_req } from "../dux/utils";
|
||||||
|
|
||||||
const composeEnhancers =
|
let composeEnhancers = compose;
|
||||||
(window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;
|
|
||||||
|
if(browser) {
|
||||||
|
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
||||||
|
}
|
||||||
|
|
||||||
import shipDux from "../dux";
|
import shipDux from "../dux";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
let saved = window && window.localStorage.getItem('aotds-shipyard');
|
let saved;
|
||||||
|
|
||||||
|
if(browser) saved = window.localStorage.getItem('aotds-shipyard');
|
||||||
|
|
||||||
if( saved ) {
|
if( saved ) {
|
||||||
saved = JSON.parse(saved);
|
saved = JSON.parse(saved);
|
||||||
}
|
}
|
||||||
@ -38,7 +45,7 @@ export default () => {
|
|||||||
previous = current;
|
previous = current;
|
||||||
console.log(current);
|
console.log(current);
|
||||||
|
|
||||||
window && window.localStorage.setItem(
|
if(browser)window.localStorage.setItem(
|
||||||
'aotds-shipyard', JSON.stringify(current)
|
'aotds-shipyard', JSON.stringify(current)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
20
svelte.config.js
Normal file
20
svelte.config.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import adapter from '@sveltejs/adapter-static';
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
export default {
|
||||||
|
kit: {
|
||||||
|
// hydrate the <div id="svelte"> element in src/app.html
|
||||||
|
target: '#svelte',
|
||||||
|
adapter: adapter(),
|
||||||
|
files: {
|
||||||
|
lib: './src',
|
||||||
|
assets: './public',
|
||||||
|
},
|
||||||
|
vite: {
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
// external: ['updux','@yanick/updeep']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
};
|
@ -1,86 +0,0 @@
|
|||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
const mode = process.env.NODE_ENV || "development";
|
|
||||||
const prod = mode === "production";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: {
|
|
||||||
bundle: ["./src/main.js"],
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
svelte: path.resolve("node_modules", "svelte"),
|
|
||||||
'~': path.resolve(__dirname, 'src/'),
|
|
||||||
'~C': path.resolve(__dirname, 'src/components/'),
|
|
||||||
},
|
|
||||||
extensions: [".mjs", ".js", ".svelte"],
|
|
||||||
mainFields: ["svelte", "browser", "module", "main"],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: __dirname + "/public",
|
|
||||||
filename: "[name].js",
|
|
||||||
chunkFilename: "[name].[id].js",
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.svelte$/,
|
|
||||||
use: {
|
|
||||||
loader: "svelte-loader",
|
|
||||||
options: {
|
|
||||||
emitCss: true,
|
|
||||||
hotReload: true,
|
|
||||||
dev: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
use: [
|
|
||||||
/**
|
|
||||||
* MiniCssExtractPlugin doesn't support HMR.
|
|
||||||
* For developing, use 'style-loader' instead.
|
|
||||||
* */
|
|
||||||
prod ? MiniCssExtractPlugin.loader : "style-loader",
|
|
||||||
{ loader: "css-loader",
|
|
||||||
options: {url: false}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.svg$/,
|
|
||||||
loader: 'file-loader'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s[ac]ss$/i,
|
|
||||||
use: [
|
|
||||||
// Creates `style` nodes from JS strings
|
|
||||||
"style-loader",
|
|
||||||
// Translates CSS into CommonJS
|
|
||||||
"css-loader",
|
|
||||||
// Compiles Sass to CSS
|
|
||||||
{
|
|
||||||
loader: "sass-loader",
|
|
||||||
options: {
|
|
||||||
webpackImporter: false,
|
|
||||||
//implementation: require("node-sass"),
|
|
||||||
implementation: require("sass"),
|
|
||||||
sassOptions: {
|
|
||||||
indentWidth: 4,
|
|
||||||
includePaths: ["sass", "node_modules"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
mode,
|
|
||||||
plugins: [
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: "[name].css",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
devtool: prod ? false : "source-map",
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user