thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.04k stars 169 forks source link

3.4.0: outdated signature for <code>applyElement</code> #338

Closed Mariusthvdb closed 6 months ago

Mariusthvdb commented 6 months ago

My Home Assistant version: 2024.1.0b02

My lovelace configuration method (GUI or yaml):Yaml

What I am doing:

using custom:fold-entity-row

What I expected to happen: no error What happened instead: see screen below

Minimal steps to reproduce:

# The least amount of code possible to reproduce my error
      card_mod:
        style: |
          .label {
            margin-left: 0px !important;
          }

# End of code

Error messages from the browser console:

Scherm­afbeelding 2023-12-30 om 22 38 14

By putting an X in the boxes ([]) below, I indicate that I:

ildar170975 commented 6 months ago

see screen below

And where is the error?

thomasloven commented 6 months ago

Excellent! This is an issue with fold-entity-row. The log message is a warning about the card-mod intereface available to card authors is changed, but should be backwards compatible for a while. I actually forgot that fold-entity-row used this...

Did you add card-mod styles to anything in the fold-entity-row, and did they apply as expected?

Mariusthvdb commented 6 months ago

right, should have issued at f-e-r....

yes, the mod is above and was applied correctly:

      card_mod:
        style: |
          .label {
            margin-left: 0px !important;
          }

you need it at f-e-r?

thomasloven commented 6 months ago

Nah. I'll take care of it. Glad to hear it worked as intended.

Mariusthvdb commented 6 months ago

this should be fixed in fold-entity-row shouldnt it? just asking to be sure, because card-mod 3.4.1 did not prevent this card-mod warning

Scherm­afbeelding 2024-01-02 om 14 58 56
Mariusthvdb commented 6 months ago

just discovered this one too on picture-entity:

Scherm­afbeelding 2024-01-02 om 21 46 33

its not a custom card, unless it now is referring to the hui-element in:

      - type: custom:hui-element
        card_type: picture-entity
        entity: camera.weerkaart_nl
        show_name: false
        show_state: false
        <<: &style
          card_mod:
            style: |
              ha-card {
                box-shadow: none;
                margin: 8px -16px -16px -16px;
              }

again, the mod still works, the warning seems beyond the user to fix.

thomasloven commented 6 months ago

Yes. It has to be fixed by the card developer. Things will still work for at least six months, and I've added a limit so you should only ever see this warning once at a time.

Mariusthvdb commented 6 months ago

cool, btw there's a tiny typo in the warning, should be 'relies'

nima-1102 commented 5 months ago

Yes. It has to be fixed by the card developer. Things will still work for at least six months, and I've added a limit so you should only ever see this warning once at a time.

I get the same warning for Browser Mod (2.3.0), using the example at the bottom of this Page.

Card-mod warning
card-mod.js?hacstag=190927524342:1 You are using a custom card which relies on card-mod, and uses an outdated signature for applyToElement.
card-mod.js?hacstag=190927524342:1 The outdated signature will be removed at some point in the future. Hopefully the developer of your card will have updated their card by then.
card-mod.js?hacstag=190927524342:1 The card used card-mod to apply styles here: <browser-mod-popup class=​"undefined">​…​</browser-mod-popup>​
type: button
show_name: true
show_icon: true
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: Teal background
      content: Where did the dashboard go?
      card_mod:
        style:
          ha-dialog$: |
            div.mdc-dialog div.mdc-dialog__scrim {
              background: rgba(0, 128, 128, 0.9);
            }