set align(val) {
    const currentAlign = this.#align;
    let trueVal = val;
    if (typeof trueVal !== 'string' || !trueVal.length) {
      trueVal = CENTER;
    }

    // Normalize values and store the first entry as the "edge" to align against
    let vals = trueVal.split(',');
    vals = vals.map((thisVal) => thisVal.trim().toLowerCase());

    // Adust the first value and set it as the "edge"
    const edge = vals[0];
    if (ALIGNMENT_EDGES.includes(edge)) {
      this.#alignEdge = edge;
      vals[0] = this.#alignEdge;
    }

    // If there's no second value, assumxae it's 'center'
    if (!vals[1]) {
      vals.push('center');
    }

    // If the values are defined in reverse (y, x), switch them
    if (ALIGNMENTS_EDGES_Y.includes(vals[0]) || ALIGNMENTS_EDGES_X.includes(vals[1])) {
      const val1 = vals[1];
      vals[1] = vals[0];
      vals[0] = val1;
    }

    // Update each alignment value if it's valid, and render the attribute
    let attrX;
    let attrY;
    if (ALIGNMENTS_X.includes(vals[0])) {
      attrX = vals[0];
      this.#alignX = vals[0];
    } else {
      attrX = this.alignX;
    }
    if (ALIGNMENTS_Y.includes(vals[1])) {
      attrY = vals[1];
      this.#alignY = vals[1];
    } else {
      attrY = this.alignY;
    }

    const newAlign = formatAlignAttribute(attrX, attrY, this.#alignEdge);
    const needsUpdatedAlign = currentAlign !== newAlign;
    if (needsUpdatedAlign) {
      this.#align = newAlign;
      this.setAttribute(attributes.ALIGN, newAlign);
      this.place();
    } else if (!this.hasAttribute('align')) {
      this.setAttribute(attributes.ALIGN, currentAlign);
    }
  }
/**
   * @param {string} val a comma-delimited set of alignment types `direction1, direction2`
   */
@param {string} val a comma-delimited set of alignment types `direction1, direction2`
@param { string } val a comma - delimited set of alignment types ` direction1 direction2 `
set align(val) {
    const currentAlign = this.#align;
    let trueVal = val;
    if (typeof trueVal !== 'string' || !trueVal.length) {
      trueVal = CENTER;
    }
    let vals = trueVal.split(',');
    vals = vals.map((thisVal) => thisVal.trim().toLowerCase());
    const edge = vals[0];
    if (ALIGNMENT_EDGES.includes(edge)) {
      this.#alignEdge = edge;
      vals[0] = this.#alignEdge;
    }
    if (!vals[1]) {
      vals.push('center');
    }
    if (ALIGNMENTS_EDGES_Y.includes(vals[0]) || ALIGNMENTS_EDGES_X.includes(vals[1])) {
      const val1 = vals[1];
      vals[1] = vals[0];
      vals[0] = val1;
    }
    let attrX;
    let attrY;
    if (ALIGNMENTS_X.includes(vals[0])) {
      attrX = vals[0];
      this.#alignX = vals[0];
    } else {
      attrX = this.alignX;
    }
    if (ALIGNMENTS_Y.includes(vals[1])) {
      attrY = vals[1];
      this.#alignY = vals[1];
    } else {
      attrY = this.alignY;
    }
    const newAlign = formatAlignAttribute(attrX, attrY, this.#alignEdge);
    const needsUpdatedAlign = currentAlign !== newAlign;
    if (needsUpdatedAlign) {
      this.#align = newAlign;
      this.setAttribute(attributes.ALIGN, newAlign);
      this.place();
    } else if (!this.hasAttribute('align')) {
      this.setAttribute(attributes.ALIGN, currentAlign);
    }
  }
set align ( val ) { const currentAlign = this . #align ; let trueVal = val ; if ( typeof trueVal !== 'string' || ! trueVal . length ) { trueVal = CENTER ; } let vals = trueVal . split ( ',' ) ; vals = vals . map ( ( thisVal ) => thisVal . trim ( ) . toLowerCase ( ) ) ; const edge = vals [ 0 ] ; if ( ALIGNMENT_EDGES . includes ( edge ) ) { this . #alignEdge = edge ; vals [ 0 ] = this . #alignEdge ; } if ( ! vals [ 1 ] ) { vals . push ( 'center' ) ; } if ( ALIGNMENTS_EDGES_Y . includes ( vals [ 0 ] ) || ALIGNMENTS_EDGES_X . includes ( vals [ 1 ] ) ) { const val1 = vals [ 1 ] ; vals [ 1 ] = vals [ 0 ] ; vals [ 0 ] = val1 ; } let attrX ; let attrY ; if ( ALIGNMENTS_X . includes ( vals [ 0 ] ) ) { attrX = vals [ 0 ] ; this . #alignX = vals [ 0 ] ; } else { attrX = this . alignX ; } if ( ALIGNMENTS_Y . includes ( vals [ 1 ] ) ) { attrY = vals [ 1 ] ; this . #alignY = vals [ 1 ] ; } else { attrY = this . alignY ; } const newAlign = formatAlignAttribute ( attrX , attrY , this . #alignEdge ) ; const needsUpdatedAlign = currentAlign !== newAlign ; if ( needsUpdatedAlign ) { this . #align = newAlign ; this . setAttribute ( attributes . ALIGN , newAlign ) ; this . place ( ) ; } else if ( ! this . hasAttribute ( 'align' ) ) { this . setAttribute ( attributes . ALIGN , currentAlign ) ; } }
@param {string} val a comma-delimited set of alignment types `direction1, direction2`
@param { string } val a comma - delimited set of alignment types ` direction1 direction2 `
// Normalize values and store the first entry as the "edge" to align against // Adust the first value and set it as the "edge" // If there's no second value, assumxae it's 'center' // If the values are defined in reverse (y, x), switch them // Update each alignment value if it's valid, and render the attribute