From b18017d7533ec0b5af50666bd98140a4863a05ef Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Mon, 20 Mar 2023 11:59:50 -0400 Subject: [PATCH] story for ShipItem --- histoire.config.js | 6 + package.json | 3 + ...story.svelte => Carrier.story.svelte.todo} | 0 .../Carrier/{stories.js => stories.js.todo} | 0 ...s.svelte => Changelog.stories.svelte.todo} | 0 ...st.story.svelte => Cost.story.svelte.todo} | 0 .../components/CostMass/index.story.svelte | 9 ++ .../index.svelte} | 4 +- .../Field/{stories.js => stories.js.todo} | 0 .../Ftl/{stories.js => stories.js.todo} | 0 ...ries.svelte => Armour.stories.svelte.todo} | 0 ...s.svelte => Integrity.stories.svelte.todo} | 0 .../Integrity/{stories.js => stories.js.todo} | 0 .../{stories.js => stories.js.todo} | 0 ...ories.svelte => Print.stories.svelte.todo} | 0 ...es.svelte => Firecons.stories.svelte.todo} | 0 ...ies.svelte => Screens.stories.svelte.todo} | 0 .../Weapons/{stories.js => stories.js.todo} | 0 ...ies.svelte => Carrier.stories.svelte.todo} | 0 ...lte => Identification.stories.svelte.todo} | 0 .../ShipEdit/Identification/index.svelte | 4 +- ...ries.svelte => Engine.stories.svelte.todo} | 0 .../ShipEdit/Propulsion/Drive/index.svelte | 11 +- src/lib/components/ShipEdit/ShipCost.svelte | 130 +++++++++--------- ...es.svelte => ShipEdit.stories.svelte.todo} | 0 ...es.svelte => Weaponry.stories.svelte.todo} | 0 src/lib/components/ShipItem.story.svelte | 14 ++ .../index.svelte => ShipItem.svelte} | 7 +- .../Armour/{stories.js => stories.js.todo} | 0 .../Weapons/{stories.js => stories.js.todo} | 0 src/lib/shipDux/engine.ts | 48 +++---- src/lib/shipDux/identification.ts | 48 ++++--- src/lib/shipDux/index.ts | 14 +- src/lib/shipDux/propulsion/index.ts | 5 + src/lib/shipDux/shipReqs.ts | 2 + src/lib/store/ship.js | 43 +++--- vite.config.js | 8 +- 37 files changed, 209 insertions(+), 147 deletions(-) create mode 100644 histoire.config.js rename src/lib/components/Carrier/{Carrier.story.svelte => Carrier.story.svelte.todo} (100%) rename src/lib/components/Carrier/{stories.js => stories.js.todo} (100%) rename src/lib/components/{Changelog.stories.svelte => Changelog.stories.svelte.todo} (100%) rename src/lib/components/{Cost.story.svelte => Cost.story.svelte.todo} (100%) create mode 100644 src/lib/components/CostMass/index.story.svelte rename src/lib/components/{CostMass.svelte => CostMass/index.svelte} (76%) rename src/lib/components/Field/{stories.js => stories.js.todo} (100%) rename src/lib/components/Ftl/{stories.js => stories.js.todo} (100%) rename src/lib/components/Output/Print/Hull/{Armour.stories.svelte => Armour.stories.svelte.todo} (100%) rename src/lib/components/Output/Print/Hull/Integrity/{Integrity.stories.svelte => Integrity.stories.svelte.todo} (100%) rename src/lib/components/Output/Print/Hull/Integrity/{stories.js => stories.js.todo} (100%) rename src/lib/components/Output/Print/MainSystems/{stories.js => stories.js.todo} (100%) rename src/lib/components/Output/Print/{Print.stories.svelte => Print.stories.svelte.todo} (100%) rename src/lib/components/Output/Print/Systems/Firecons/{Firecons.stories.svelte => Firecons.stories.svelte.todo} (100%) rename src/lib/components/Output/Print/Systems/Screens/{Screens.stories.svelte => Screens.stories.svelte.todo} (100%) rename src/lib/components/Output/Print/Weapons/{stories.js => stories.js.todo} (100%) rename src/lib/components/ShipEdit/Carrier/{Carrier.stories.svelte => Carrier.stories.svelte.todo} (100%) rename src/lib/components/ShipEdit/Identification/{Identification.stories.svelte => Identification.stories.svelte.todo} (100%) rename src/lib/components/ShipEdit/Propulsion/Drive/{Engine.stories.svelte => Engine.stories.svelte.todo} (100%) rename src/lib/components/ShipEdit/{ShipEdit.stories.svelte => ShipEdit.stories.svelte.todo} (100%) rename src/lib/components/ShipEdit/Weaponry/{Weaponry.stories.svelte => Weaponry.stories.svelte.todo} (100%) create mode 100644 src/lib/components/ShipItem.story.svelte rename src/lib/components/{ShipItem/index.svelte => ShipItem.svelte} (90%) rename src/lib/components/Structure/Armour/{stories.js => stories.js.todo} (100%) rename src/lib/components/Weapons/{stories.js => stories.js.todo} (100%) diff --git a/histoire.config.js b/histoire.config.js new file mode 100644 index 0000000..0427fca --- /dev/null +++ b/histoire.config.js @@ -0,0 +1,6 @@ +import { defineConfig } from "histoire"; +import { HstSvelte } from "@histoire/plugin-svelte"; + +export default defineConfig({ + plugins: [HstSvelte()], +}); diff --git a/package.json b/package.json index ea1eb2c..28c710f 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "format": "prettier --write ." }, "devDependencies": { + "@histoire/plugin-svelte": "^0.15.9", "@sveltejs/adapter-static": "^1.0.0-next.28", "@sveltejs/kit": "^1.10.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.38", @@ -28,11 +29,13 @@ "vitest-svelte-kit": "^0.0.6" }, "dependencies": { + "@picocss/pico": "^1.5.7", "@reduxjs/toolkit": "^1.9.3", "@sveltejs/adapter-node": "^1.0.0-next.0", "@yanick/updeep-remeda": "^2.1.0", "chota": "^0.8.0", "effector": "^22.5.2", + "histoire": "^0.15.9", "lodash": "^4.17.21", "redux": "^4.1.2", "remeda": "^1.1.0", diff --git a/src/lib/components/Carrier/Carrier.story.svelte b/src/lib/components/Carrier/Carrier.story.svelte.todo similarity index 100% rename from src/lib/components/Carrier/Carrier.story.svelte rename to src/lib/components/Carrier/Carrier.story.svelte.todo diff --git a/src/lib/components/Carrier/stories.js b/src/lib/components/Carrier/stories.js.todo similarity index 100% rename from src/lib/components/Carrier/stories.js rename to src/lib/components/Carrier/stories.js.todo diff --git a/src/lib/components/Changelog.stories.svelte b/src/lib/components/Changelog.stories.svelte.todo similarity index 100% rename from src/lib/components/Changelog.stories.svelte rename to src/lib/components/Changelog.stories.svelte.todo diff --git a/src/lib/components/Cost.story.svelte b/src/lib/components/Cost.story.svelte.todo similarity index 100% rename from src/lib/components/Cost.story.svelte rename to src/lib/components/Cost.story.svelte.todo diff --git a/src/lib/components/CostMass/index.story.svelte b/src/lib/components/CostMass/index.story.svelte new file mode 100644 index 0000000..a8ed7e8 --- /dev/null +++ b/src/lib/components/CostMass/index.story.svelte @@ -0,0 +1,9 @@ + + + + + diff --git a/src/lib/components/CostMass.svelte b/src/lib/components/CostMass/index.svelte similarity index 76% rename from src/lib/components/CostMass.svelte rename to src/lib/components/CostMass/index.svelte index f00e986..024aaf6 100644 --- a/src/lib/components/CostMass.svelte +++ b/src/lib/components/CostMass/index.svelte @@ -1,8 +1,8 @@ -
{mass}mass
+
{mass}mass
{cost}
diff --git a/src/lib/components/Field/stories.js b/src/lib/components/Field/stories.js.todo similarity index 100% rename from src/lib/components/Field/stories.js rename to src/lib/components/Field/stories.js.todo diff --git a/src/lib/components/Ftl/stories.js b/src/lib/components/Ftl/stories.js.todo similarity index 100% rename from src/lib/components/Ftl/stories.js rename to src/lib/components/Ftl/stories.js.todo diff --git a/src/lib/components/Output/Print/Hull/Armour.stories.svelte b/src/lib/components/Output/Print/Hull/Armour.stories.svelte.todo similarity index 100% rename from src/lib/components/Output/Print/Hull/Armour.stories.svelte rename to src/lib/components/Output/Print/Hull/Armour.stories.svelte.todo diff --git a/src/lib/components/Output/Print/Hull/Integrity/Integrity.stories.svelte b/src/lib/components/Output/Print/Hull/Integrity/Integrity.stories.svelte.todo similarity index 100% rename from src/lib/components/Output/Print/Hull/Integrity/Integrity.stories.svelte rename to src/lib/components/Output/Print/Hull/Integrity/Integrity.stories.svelte.todo diff --git a/src/lib/components/Output/Print/Hull/Integrity/stories.js b/src/lib/components/Output/Print/Hull/Integrity/stories.js.todo similarity index 100% rename from src/lib/components/Output/Print/Hull/Integrity/stories.js rename to src/lib/components/Output/Print/Hull/Integrity/stories.js.todo diff --git a/src/lib/components/Output/Print/MainSystems/stories.js b/src/lib/components/Output/Print/MainSystems/stories.js.todo similarity index 100% rename from src/lib/components/Output/Print/MainSystems/stories.js rename to src/lib/components/Output/Print/MainSystems/stories.js.todo diff --git a/src/lib/components/Output/Print/Print.stories.svelte b/src/lib/components/Output/Print/Print.stories.svelte.todo similarity index 100% rename from src/lib/components/Output/Print/Print.stories.svelte rename to src/lib/components/Output/Print/Print.stories.svelte.todo diff --git a/src/lib/components/Output/Print/Systems/Firecons/Firecons.stories.svelte b/src/lib/components/Output/Print/Systems/Firecons/Firecons.stories.svelte.todo similarity index 100% rename from src/lib/components/Output/Print/Systems/Firecons/Firecons.stories.svelte rename to src/lib/components/Output/Print/Systems/Firecons/Firecons.stories.svelte.todo diff --git a/src/lib/components/Output/Print/Systems/Screens/Screens.stories.svelte b/src/lib/components/Output/Print/Systems/Screens/Screens.stories.svelte.todo similarity index 100% rename from src/lib/components/Output/Print/Systems/Screens/Screens.stories.svelte rename to src/lib/components/Output/Print/Systems/Screens/Screens.stories.svelte.todo diff --git a/src/lib/components/Output/Print/Weapons/stories.js b/src/lib/components/Output/Print/Weapons/stories.js.todo similarity index 100% rename from src/lib/components/Output/Print/Weapons/stories.js rename to src/lib/components/Output/Print/Weapons/stories.js.todo diff --git a/src/lib/components/ShipEdit/Carrier/Carrier.stories.svelte b/src/lib/components/ShipEdit/Carrier/Carrier.stories.svelte.todo similarity index 100% rename from src/lib/components/ShipEdit/Carrier/Carrier.stories.svelte rename to src/lib/components/ShipEdit/Carrier/Carrier.stories.svelte.todo diff --git a/src/lib/components/ShipEdit/Identification/Identification.stories.svelte b/src/lib/components/ShipEdit/Identification/Identification.stories.svelte.todo similarity index 100% rename from src/lib/components/ShipEdit/Identification/Identification.stories.svelte rename to src/lib/components/ShipEdit/Identification/Identification.stories.svelte.todo diff --git a/src/lib/components/ShipEdit/Identification/index.svelte b/src/lib/components/ShipEdit/Identification/index.svelte index 6d79133..d9abc10 100644 --- a/src/lib/components/ShipEdit/Identification/index.svelte +++ b/src/lib/components/ShipEdit/Identification/index.svelte @@ -27,8 +27,8 @@ $: if (shipTypes.length > 0 && !shipTypes.includes(shipType)) shipType = shipTypes[0]; - $: ship.dispatch.setShipType(shipType); - $: ship.dispatch.setShipClass(shipClass); + $: ship.dispatch(ship.actions.setShipType(shipType)); + $: ship.dispatch(ship.actions.setShipClass(shipClass)); diff --git a/src/lib/components/ShipEdit/ShipEdit.stories.svelte b/src/lib/components/ShipEdit/ShipEdit.stories.svelte.todo similarity index 100% rename from src/lib/components/ShipEdit/ShipEdit.stories.svelte rename to src/lib/components/ShipEdit/ShipEdit.stories.svelte.todo diff --git a/src/lib/components/ShipEdit/Weaponry/Weaponry.stories.svelte b/src/lib/components/ShipEdit/Weaponry/Weaponry.stories.svelte.todo similarity index 100% rename from src/lib/components/ShipEdit/Weaponry/Weaponry.stories.svelte rename to src/lib/components/ShipEdit/Weaponry/Weaponry.stories.svelte.todo diff --git a/src/lib/components/ShipItem.story.svelte b/src/lib/components/ShipItem.story.svelte new file mode 100644 index 0000000..4b18500 --- /dev/null +++ b/src/lib/components/ShipItem.story.svelte @@ -0,0 +1,14 @@ + + Thingy + + + + + + + diff --git a/src/lib/components/ShipItem/index.svelte b/src/lib/components/ShipItem.svelte similarity index 90% rename from src/lib/components/ShipItem/index.svelte rename to src/lib/components/ShipItem.svelte index f5fdce4..61a2194 100644 --- a/src/lib/components/ShipItem/index.svelte +++ b/src/lib/components/ShipItem.svelte @@ -2,14 +2,15 @@
-
{mass} mass
+
+ {mass} mass +
{cost}