From 87bd19290948dc9b46e8e03695fa7da225db0a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ovidiu=20D=2E=20Ni=C8=9Ban?= Date: Thu, 3 Nov 2022 08:15:17 +0200 Subject: [PATCH 1/5] Home Assistant 2022.11 compatibility --- src/stack-in-card.ts | 2 ++ src/types.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/stack-in-card.ts b/src/stack-in-card.ts index 2308c58..2769bf2 100644 --- a/src/stack-in-card.ts +++ b/src/stack-in-card.ts @@ -51,6 +51,7 @@ class StackInCard extends LitElement implements LovelaceCard { margin: false, box_shadow: false, border_radius: false, + border: false, ...config.keep, }, }; @@ -96,6 +97,7 @@ class StackInCard extends LitElement implements LovelaceCard { private _updateStyle(e: LovelaceCard | null, withBg: boolean): void { if (!e) return; if (!this._config?.keep?.box_shadow) e.style.boxShadow = 'none'; + if (!this._config?.keep?.border) e.style.border = 'none'; if ( !this._config?.keep?.background && withBg && diff --git a/src/types.ts b/src/types.ts index 096ba88..5154a52 100644 --- a/src/types.ts +++ b/src/types.ts @@ -12,6 +12,7 @@ export interface KeepConfig { margin?: boolean; background?: boolean; box_shadow?: boolean; + border?: boolean; border_radius?: boolean; outer_padding?: boolean; } From 7221ff23e485c4209352f44a85d9090152a4d36b Mon Sep 17 00:00:00 2001 From: Ovidiu Nitan Date: Thu, 3 Nov 2022 12:09:41 +0200 Subject: [PATCH 2/5] Add border option to the relevant documentation for the keep object --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3f0c024..adda121 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ If a card inside the stack has the `--keep-background` CSS style defined, it wil | `box_shadow` | boolean | **Optional** | Will keep the `box-shadow` on **all** the child cards | `false` | | `margin` | boolean | **Optional** | Will keep the `margin` between **all** the child cards | `false` | | `outer_padding` | boolean | **Optional** | Will add a `padding` of `8px` to the card if `margin` is `true` | `true` if `margin` is `true`, else false | +| `border` | boolean | **Optional** | Will keep the `border` on **all** the child cards | `false` | | `border_radius` | boolean | **Optional** | Will keep the `border-radius` on **all** the child cards | `false` | ## Example From e0b2a19439b626b9b00749ac9f08cded0eb79734 Mon Sep 17 00:00:00 2001 From: Ovidiu Nitan Date: Tue, 15 Nov 2022 12:10:40 +0200 Subject: [PATCH 3/5] Respect --keep-border css variable when added to custom button card styles --- src/stack-in-card.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stack-in-card.ts b/src/stack-in-card.ts index 2769bf2..20d634b 100644 --- a/src/stack-in-card.ts +++ b/src/stack-in-card.ts @@ -97,7 +97,9 @@ class StackInCard extends LitElement implements LovelaceCard { private _updateStyle(e: LovelaceCard | null, withBg: boolean): void { if (!e) return; if (!this._config?.keep?.box_shadow) e.style.boxShadow = 'none'; - if (!this._config?.keep?.border) e.style.border = 'none'; + if (!this._config?.keep?.border && getComputedStyle(e).getPropertyValue('--keep-border').trim() !== 'true') { + e.style.border = 'none'; + } if ( !this._config?.keep?.background && withBg && From 26972f8981ccdbba4104a746102f55a4b160430a Mon Sep 17 00:00:00 2001 From: Ovidiu Nitan Date: Tue, 15 Nov 2022 12:25:38 +0200 Subject: [PATCH 4/5] Update README.md to add an example with using the keep object --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index adda121..23891e0 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,28 @@ If a card inside the stack has the `--keep-background` CSS style defined, it wil - sun.sun ``` +### Example with `keep` object + +```yaml +type: custom:stack-in-card +title: My Stack In Card +mode: vertical +keep: + background: true +cards: + - type: horizontal-stack + cards: + - type: button + entity: sun.sun + - type: button + entity: sun.sun + - type: vertical-stack + cards: + - type: entities + entities: + - sun.sun +``` + ### Example with button-card to keep the background This will keep the background of the button even if stacked: From bd126ee4a931b1dcd3315fafe0db25b961de8ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ovidiu=20D=2E=20Ni=C8=9Ban?= Date: Tue, 2 Apr 2024 23:01:24 +0300 Subject: [PATCH 5/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 23891e0..6ae5aac 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +## Note: outdated, use https://github.com/stickpin/stack-in-card instead + # Stack In Card by [@RomRider](https://www.github.com/RomRider) A replacement for [vertical-stack-in-card](https://github.com/ofekashery/vertical-stack-in-card) and `horizontal-stack-in-card`