Rename bubbles => cards

This commit is contained in:
Jorge Manrubia
2025-04-09 14:50:49 +02:00
parent e86b266f4c
commit 723e6d94f5
333 changed files with 3012 additions and 2820 deletions
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
const SIZES = [ "one", "two", "three", "four", "five" ]
export default class extends Controller {
static targets = [ "bubble" ]
static targets = [ "card" ]
connect() {
this.resize()
@@ -12,19 +12,19 @@ export default class extends Controller {
resize() {
const [ min, max ] = this.#getScoreRange()
this.bubbleTargets.forEach(bubble => {
const score = this.#currentBubbleScore(bubble)
this.cardTargets.forEach(card => {
const score = this.#currentBubbleScore(card)
const idx = Math.round((score - min) / (max - min) * (SIZES.length - 1))
bubble.style.setProperty("--bubble-size", `var(--bubble-size-${SIZES[idx]})`)
card.style.setProperty("--card-size", `var(--card-size-${SIZES[idx]})`)
})
}
#getScoreRange() {
var min = 0, max = 1;
this.bubbleTargets.forEach(bubble => {
const score = this.#currentBubbleScore(bubble)
this.cardTargets.forEach(card => {
const score = this.#currentBubbleScore(card)
min = Math.min(min, score)
max = Math.max(max, score)
@@ -47,7 +47,7 @@ export default class extends Controller {
#triggerChangeEvent(newValue) {
if (this.inputTarget.tagName === "HOUSE-MD") {
this.inputTarget.dispatchEvent(new CustomEvent('house-md:change', {
bubbles: true,
cards: true,
detail: {
previousContent: '',
newContent: newValue
@@ -12,7 +12,7 @@ export default class extends Controller {
for (const file of files) {
const uploadEvent = new CustomEvent("house-md:before-upload", {
bubbles: true,
cards: true,
detail: { file },
cancelable: true
})