Home / Class/ MyElement Class — vite Architecture

MyElement Class — vite Architecture

Architecture documentation for the MyElement class in my-element.js from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  701c5e84_54f7_2670_6573_11a80816c6e9["MyElement"]
  a6ae0a5a_c151_e794_c7b4_8a76c9410cbc["my-element.js"]
  701c5e84_54f7_2670_6573_11a80816c6e9 -->|defined in| a6ae0a5a_c151_e794_c7b4_8a76c9410cbc
  74672a66_2391_298b_4525_542625c1eca6["properties()"]
  701c5e84_54f7_2670_6573_11a80816c6e9 -->|method| 74672a66_2391_298b_4525_542625c1eca6
  8e98f411_57d9_4fe2_25f5_bebc2d0392f5["constructor()"]
  701c5e84_54f7_2670_6573_11a80816c6e9 -->|method| 8e98f411_57d9_4fe2_25f5_bebc2d0392f5
  5c55f53b_e8ce_8afa_58f7_66dad05342e5["render()"]
  701c5e84_54f7_2670_6573_11a80816c6e9 -->|method| 5c55f53b_e8ce_8afa_58f7_66dad05342e5
  a89b648e_9daf_4ec3_e4e7_e45c16bace0b["_onClick()"]
  701c5e84_54f7_2670_6573_11a80816c6e9 -->|method| a89b648e_9daf_4ec3_e4e7_e45c16bace0b
  875699fc_4167_37c4_0695_4c88bc562790["styles()"]
  701c5e84_54f7_2670_6573_11a80816c6e9 -->|method| 875699fc_4167_37c4_0695_4c88bc562790

Relationship Graph

Source Code

packages/create-vite/template-lit/src/my-element.js lines 12–435

export class MyElement extends LitElement {
  static get properties() {
    return {
      /**
       * The number of times the button has been clicked.
       */
      count: { type: Number },
    }
  }

  constructor() {
    super()
    this.count = 0
  }

  render() {
    return html`
      <section id="center">
        <div class="hero">
          <img src=${heroImg} class="base" width="170" height="179" alt="" />
          <img src=${litLogo} class="framework" alt="Lit logo" />
          <img src=${viteLogo} class="vite" alt="Vite logo" />
        </div>
        <div>
          <slot></slot>
          <p>
            Edit <code>src/my-element.js</code> and save to test
            <code>HMR</code>
          </p>
        </div>
        <button class="counter" @click=${this._onClick} part="button">
          Count is ${this.count}
        </button>
      </section>

      <div class="ticks"></div>

      <section id="next-steps">
        <div id="docs">
          <svg class="icon" role="presentation" aria-hidden="true">
            <use href="/icons.svg#documentation-icon"></use>
          </svg>
          <h2>Documentation</h2>
          <p>Your questions, answered</p>
          <ul>
            <li>
              <a href="https://vite.dev/" target="_blank">
                <img class="logo" src=${viteLogo} alt="" />
                Explore Vite
              </a>
            </li>
            <li>
              <a href="https://lit.dev/" target="_blank">
                <img class="button-icon" src=${litLogo} alt="" />
                Learn more
              </a>
            </li>
          </ul>
        </div>
        <div id="social">
          <svg class="icon" role="presentation" aria-hidden="true">
            <use href="/icons.svg#social-icon"></use>
          </svg>
          <h2>Connect with us</h2>
          <p>Join the Vite community</p>
          <ul>
            <li>
              <a href="https://github.com/vitejs/vite" target="_blank">
                <svg class="button-icon" role="presentation" aria-hidden="true">
                  <use href="/icons.svg#github-icon"></use>
                </svg>
                GitHub
              </a>
            </li>
            <li>
              <a href="https://chat.vite.dev/" target="_blank">
                <svg class="button-icon" role="presentation" aria-hidden="true">
                  <use href="/icons.svg#discord-icon"></use>
                </svg>
                Discord
              </a>

Frequently Asked Questions

What is the MyElement class?
MyElement is a class in the vite codebase, defined in packages/create-vite/template-lit/src/my-element.js.
Where is MyElement defined?
MyElement is defined in packages/create-vite/template-lit/src/my-element.js at line 12.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free