From ac598fa3a7bb95149a7498a6b2628d6c95b1c86f Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 12 Mar 2022 15:00:11 -0600 Subject: [PATCH 01/11] Added support for resources of non-persistent refs --- src/features/resources/resource.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/resources/resource.ts b/src/features/resources/resource.ts index 8f44c31..2946047 100644 --- a/src/features/resources/resource.ts +++ b/src/features/resources/resource.ts @@ -1,5 +1,5 @@ import Decimal, { DecimalSource, format, formatWhole } from "util/bignum"; -import { computed, ComputedRef, ref, Ref, watch } from "vue"; +import { computed, ComputedRef, isRef, ref, Ref, watch } from "vue"; import { globalBus } from "game/events"; import { State, persistent } from "game/persistence"; @@ -15,7 +15,9 @@ export function createResource( precision = 0, small = undefined ): Resource { - const resource: Partial> = persistent(defaultValue); + const resource: Partial> = isRef(defaultValue) + ? defaultValue + : persistent(defaultValue); resource.displayName = displayName; resource.precision = precision; resource.small = small; From 56d3a214407bbedf2f95710d01606bb7b262a1f9 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 12 Mar 2022 18:21:18 -0600 Subject: [PATCH 02/11] Add dontMerge class to allow features to disable mergeAdjacent --- src/components/common/table.css | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/common/table.css b/src/components/common/table.css index 1971fb2..56d4929 100644 --- a/src/components/common/table.css +++ b/src/components/common/table.css @@ -34,57 +34,57 @@ margin: 10px 0; } -.row.mergeAdjacent > .feature, -.row.mergeAdjacent > .tooltip-container > .feature { +.row.mergeAdjacent > .feature:not(.dontMerge), +.row.mergeAdjacent > .tooltip-container > .feature:not(.dontMerge) { margin-left: 0; margin-right: 0; border-radius: 0; } -.row.mergeAdjacent > .feature:first-child, -.row.mergeAdjacent > .tooltip-container:first-child > .feature { +.row.mergeAdjacent > .feature:not(.dontMerge):first-child, +.row.mergeAdjacent > .tooltip-container:first-child > .feature:not(.dontMerge) { border-radius: var(--border-radius) 0 0 var(--border-radius); } -.row.mergeAdjacent > .feature:last-child, -.row.mergeAdjacent > .tooltip-container:last-child > .feature { +.row.mergeAdjacent > .feature:not(.dontMerge):last-child, +.row.mergeAdjacent > .tooltip-container:last-child > .feature:not(.dontMerge) { border-radius: 0 var(--border-radius) var(--border-radius) 0; } -.row.mergeAdjacent > .feature:first-child:last-child, -.row.mergeAdjacent > .tooltip-container:first-child:last-child > .feature { +.row.mergeAdjacent > .feature:not(.dontMerge):first-child:last-child, +.row.mergeAdjacent > .tooltip-container:first-child:last-child > .feature:not(.dontMerge) { border-radius: var(--border-radius); } /* TODO how to implement mergeAdjacent for grids? -.row.mergeAdjacent + .row.mergeAdjacent > .feature { +.row.mergeAdjacent + .row.mergeAdjacent > .feature:not(.dontMerge) { border-top-left-radius: 0; border-top-right-radius: 0; } */ -.col.mergeAdjacent .feature { +.col.mergeAdjacent .feature:not(.dontMerge) { margin-top: 0; margin-bottom: 0; border-radius: 0; } -.col.mergeAdjacent .feature:first-child { +.col.mergeAdjacent .feature:not(.dontMerge):first-child { border-radius: var(--border-radius) var(--border-radius) 0 0; } -.col.mergeAdjacent .feature:last-child { +.col.mergeAdjacent .feature:not(.dontMerge):last-child { border-radius: 0 0 var(--border-radius) var(--border-radius); } -.col.mergeAdjacent .feature:first-child:last-child { +.col.mergeAdjacent .feature:not(.dontMerge):first-child:last-child { border-radius: var(--border-radius); } /* TODO how to implement mergeAdjacent for grids? -.col.mergeAdjacent + .col.mergeAdjacent > .feature { +.col.mergeAdjacent + .col.mergeAdjacent > .feature:not(.dontMerge) { border-top-left-radius: 0; border-bottom-left-radius: 0; } From 8170f240c8e4fdf41729de59490fe08b854378a0 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 13 Mar 2022 11:00:44 -0500 Subject: [PATCH 03/11] Fix clickables not obeying mergeAdjacent --- src/features/clickables/Clickable.vue | 49 +++++++++++++-------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/features/clickables/Clickable.vue b/src/features/clickables/Clickable.vue index 18976a0..0581e96 100644 --- a/src/features/clickables/Clickable.vue +++ b/src/features/clickables/Clickable.vue @@ -1,31 +1,30 @@