<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Kevin Hoyt</title>
  <subtitle>The intersection of development and design.</subtitle>
  <link href="https://kevinhoyt.com/feed.xml" rel="self"/>
  <link href="https://kevinhoyt.com/"/>
  <updated>2026-03-23T00:00:00Z</updated>
  <id>https://kevinhoyt.com/</id>
  <author>
    <name>Kevin Hoyt</name>
    <email>kevin@ketnerlake.com</email>
  </author>
    
    <entry>
      <title>Managing Tech: 1:1</title>
      <link href="https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/"/>
      <updated>2026-03-23T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/</id>
      <summary>This is part of a series: Managing Tech: People Managing Tech: Heroes Managing Tech: Professionals Managing Tech: Time Managing Tech: Cadence Managing Tech: 1:1 (you are here) If you read the post in this series about meeting cadence and felt overwhelmed, I get it—it is a lot. In this post, I will...</summary>
      <content type="html">&lt;p&gt;This is part of a series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;People&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/14/managing-heroes/&quot;&gt;Heroes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/16/managing-professionals/&quot;&gt;Professionals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/26/managing-time/&quot;&gt;Time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/02/02/managing-cadence/&quot;&gt;Cadence&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: 1:1 (you are here)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you read the post in this series about meeting &lt;a href=&quot;https://kevinhoyt.com/blog/2026/02/02/managing-cadence/&quot;&gt;cadence&lt;/a&gt; and felt overwhelmed, I get it—it is a lot. In this post, I will dial it back and return focus to the people. As I have said before, without people, there is no manager. Making people heroes should be a primary goal of your leadership style. Let us focus on the people, and how to make them heroes. It starts with the 1:1.&lt;/p&gt;
&lt;h2&gt;What Is a 1:1?&lt;/h2&gt;
&lt;p&gt;The 1:1 meeting is exactly what it sounds like—a one-on-one meeting between you and one of your direct reports. On the surface, this sounds easy. You set up a meeting, show up, and talk about what is going on at work. Congratulations—you are halfway there. You are also halfway off the rails.&lt;/p&gt;
&lt;p&gt;If you show up just to talk about the business, then you are missing the point of the meeting in the first place: the person.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;One-on-one meetings should be people-focused, not operationally focused.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;The First 1:1&lt;/h2&gt;
&lt;p&gt;When I get a new team or a new team member, my first one-on-one meeting is a little different from the ones that follow. At this point, we do not know one another yet. It would be presumptuous to launch into operational behavior.&lt;/p&gt;
&lt;p&gt;You only get one chance to make that first impression. You can never have your first one-on-one again.&lt;/p&gt;
&lt;p&gt;I may have handoff notes from a previous manager, but those come with bias. The direct report may have heard about me from others, but again, bias and hearsay shape that perception. The place to start, then, is to get to know one another.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When scheduling the first one-on-one meeting, include a general outline of what you will cover. As a rule, never send a blank meeting invite. In this case: introductions, what is working, what is not working, what they want from their employment, and their contact preferences.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Introductions&lt;/h3&gt;
&lt;p&gt;I generally start my first one-on-one meeting with introductions. To remove social pressure and give the person time to consider how they want to introduce themselves, I begin. It gives the direct report a pattern to follow.&lt;/p&gt;
&lt;p&gt;I start with my broader industry experience—how I got here. Then I move to my experience within the company (if any). From there, I talk about my leadership style and expectations. I close with a few personal notes—where I live, why I chose to live there, my family, a book I am reading, or a movie I recently saw.&lt;/p&gt;
&lt;p&gt;Then it is their turn.&lt;/p&gt;
&lt;p&gt;This differs from a casual conversation in one key way: you should take notes. The facts the individual chooses to share are important to them, and therefore should be important to you. When ideas matter, you write them down. This is how they present themselves—the narrative of their work life. The only bias here is their own, and that is the bias you want to understand.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Let us say you hear that a direct report is into Star Trek. Capturing that detail may help you form analogies later. Imagine saying, “You know when Captain Picard did…”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;What Is Working?&lt;/h3&gt;
&lt;p&gt;Now that you know a bit about each other, you can start building a broader narrative. I like to be direct here and ask what they think is working in the business today.&lt;/p&gt;
&lt;p&gt;This gives the direct report space to express positive thoughts and emotions, and it helps establish an authentic relationship. Again, take notes. These are cues for what not to disrupt in your first 30 days.&lt;/p&gt;
&lt;p&gt;If this is a new employee, you can still ask this question. You might focus on the hiring or onboarding process—useful input for improving how you build your team. You can also ask what they liked at previous employers. If something worked well before, it may be worth exploring.&lt;/p&gt;
&lt;h3&gt;What Is Not Working?&lt;/h3&gt;
&lt;p&gt;Now comes the harder pivot—what is not working.&lt;/p&gt;
&lt;p&gt;Depending on the seniority of the direct report, you will get different levels of depth. Again, take notes. These are potential action items.&lt;/p&gt;
&lt;p&gt;If a direct report is frustrated day after day but does not tell you, you miss your first opportunity to help them succeed. Some processes exist for good reason, in which case it is your job to investigate and report back. If they are broken, you can begin charting a path toward improvement and communicate that plan.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To be clear, what you are hearing is: “This is how you can make me a hero.” Do not squander that opportunity.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If this is a new employee, you can still ask this question. They likely left their previous role for a reason. Understanding those reasons can help you avoid repeating them. What brought them to your team?&lt;/p&gt;
&lt;h3&gt;Contact Preferences&lt;/h3&gt;
&lt;p&gt;Not everyone prefers the same communication style. Some want meetings. Others prefer email or chat.&lt;/p&gt;
&lt;p&gt;Take time to understand their preferences, and share your own. For example, I let employees know that regardless of how they contact me, they can expect a response within 24 hours. It may not be a full answer, but it will be a response. I also expect the same in return.&lt;/p&gt;
&lt;p&gt;This shared understanding is critical.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Your direct reports know how they work best—when they are most productive and under what conditions. Respect that. Interrupting deep work with urgent messages can break that productivity.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Since this is your first one-on-one, you likely scheduled the meeting based on what worked best for you. That is fine. Close by asking what time they would prefer going forward, and schedule the recurring meeting together.&lt;/p&gt;
&lt;h2&gt;A Word on Notes&lt;/h2&gt;
&lt;p&gt;You should always take notes in your one-on-one meetings, and those notes should be shared with the direct report.&lt;/p&gt;
&lt;p&gt;This allows the employee to see how you interpret their communication. The shared document should be linked in the recurring meeting invite. As topics arise throughout the week, add them to the document so both of you can prepare in advance.&lt;/p&gt;
&lt;p&gt;This approach creates a clear history and progression. Nothing is left to guesswork. Transparency builds trust.&lt;/p&gt;
&lt;p&gt;When performance reviews come around, you both have a record to reference. In cases where performance coaching is needed, that history becomes even more valuable.&lt;/p&gt;
&lt;p&gt;These notes should remain confidential between you and the employee. You can summarize themes when needed, but the document itself should remain private.&lt;/p&gt;
&lt;h2&gt;The Heart of the 1:1&lt;/h2&gt;
&lt;p&gt;Before going deeper, it is important to have the right mindset: 1:1 time is employee time.&lt;/p&gt;
&lt;p&gt;While you may have updates, this time should be focused on the individual. Team meetings are for broader communication.&lt;/p&gt;
&lt;p&gt;The structure of your 1:1 may evolve, but a useful starting point includes wellness, readiness, obstacles, recognition, and feedback.&lt;/p&gt;
&lt;h3&gt;Wellness&lt;/h3&gt;
&lt;p&gt;Think of this as work-life balance.&lt;/p&gt;
&lt;p&gt;There is no need for employees to share personal details, but giving them the option matters. In some cases, serious issues may surface. You are not HR, and you are not expected to solve everything, but you are there to listen and guide them toward appropriate resources if needed.&lt;/p&gt;
&lt;p&gt;You also need to ensure psychological safety. Not everyone participates in meetings the same way. Some may want space to speak, while others may prefer not to be put on the spot. There are no bad questions, and no one should feel humiliated or ignored for speaking up.&lt;/p&gt;
&lt;p&gt;Watch for signs of burnout. If someone is consistently overextended, the 1:1 is where you catch it and correct course.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;There will be times when extra effort is required. Make sure balance returns when those periods pass.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Readiness&lt;/h3&gt;
&lt;p&gt;I like each direct report to have one to three personal goals. These should be reviewed regularly.&lt;/p&gt;
&lt;p&gt;Sometimes goals need to be adjusted. Sometimes they are not the right fit. That is fine.&lt;/p&gt;
&lt;p&gt;These goals should align with where the employee wants to go and what the business needs. Finding that balance takes time.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Consider the SMART framework: specific, measurable, actionable, relevant, and time-bound.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Once goals are defined, make sure the employee has what they need to succeed. This may include training, mentorship, tools, or additional support. Your role is to identify gaps and help close them.&lt;/p&gt;
&lt;h3&gt;Obstacles&lt;/h3&gt;
&lt;p&gt;Where readiness is broad, obstacles focus on the present.&lt;/p&gt;
&lt;p&gt;What is slowing them down right now?&lt;/p&gt;
&lt;p&gt;If they are blocked by another team or process, step in. Your role is to bridge those gaps. These become your action items to track and resolve.&lt;/p&gt;
&lt;p&gt;The outcome may not always be what you expect, but addressing obstacles improves the system for everyone.&lt;/p&gt;
&lt;h3&gt;Recognition&lt;/h3&gt;
&lt;p&gt;After the heavier topics, this is my favorite part of the conversation.&lt;/p&gt;
&lt;p&gt;What has your direct report accomplished that they feel good about?&lt;/p&gt;
&lt;p&gt;Celebrate those wins. If they do not have one, share what you see.&lt;/p&gt;
&lt;p&gt;Recognition does not have to be limited to work. Personal achievements matter as well. There is far too little praise in the world—take the opportunity to add some.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Keep recognition shared in 1:1s confidential unless given permission to share more broadly.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Feedback&lt;/h3&gt;
&lt;p&gt;This is uncomfortable, but necessary.&lt;/p&gt;
&lt;p&gt;How are you doing as a manager?&lt;/p&gt;
&lt;p&gt;Feedback should go both ways and should happen regularly. When performance reviews arrive, there should be no surprises.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Taking feedback well takes practice. Avoiding it only creates problems later.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Tuning the 1:1&lt;/h2&gt;
&lt;p&gt;Over time, you may adapt your approach.&lt;/p&gt;
&lt;p&gt;During my time at Amazon, these principles evolved into a more structured format aligned with broader business conversations and expectations.&lt;/p&gt;
&lt;h2&gt;Improving the 1:1&lt;/h2&gt;
&lt;p&gt;The 1:1 belongs to the employee. They should feel comfortable rescheduling when needed.&lt;/p&gt;
&lt;p&gt;Preparation matters. Review your notes before the meeting. Form a point of view. Update the document in advance when appropriate.&lt;/p&gt;
&lt;p&gt;Know the details. Be aware of time-off balance, training requirements, and upcoming milestones.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I typically schedule 30-minute 1:1s, but I leave buffer time afterward. Nothing signals that someone is unimportant like rushing out of their meeting.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Next Steps&lt;/h2&gt;
&lt;p&gt;The one-on-one meeting is likely your most important meeting of the week.&lt;/p&gt;
&lt;p&gt;These conversations will generate action items beyond your day-to-day work—and that is the point. This is how you help people become heroes in their careers.&lt;/p&gt;
&lt;p&gt;Take the time. Make the time. Be prepared. Keep shared notes. Build trust. Make heroes.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Quilt GPT</title>
      <link href="https://kevinhoyt.com/blog/2026/03/21/quilt-gpt/"/>
      <updated>2026-03-21T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/03/21/quilt-gpt/</id>
      <summary>My wife, Marna, has always been into arts and crafts. Her mainstay is crochet - which I got her &amp;quot;hooked&amp;quot; on shortly after we were married. Hats, mittens, scarfs, and sweaters. Afgans/blankets. She has shelves of amigurumi plushes that she has made. The list goes on and on. Marna is also...</summary>
      <content type="html">&lt;p&gt;My wife, Marna, has always been into arts and crafts. Her mainstay is crochet - which I got her &amp;quot;hooked&amp;quot; on shortly after we were married. Hats, mittens, scarfs, and sweaters. Afgans/blankets. She has shelves of &lt;a href=&quot;https://www.google.com/search?q=amigurumi&quot;&gt;amigurumi&lt;/a&gt; plushes that she has made. The list goes on and on.&lt;/p&gt;
&lt;p&gt;Marna is also very capable with a sewing machine. While she will be the mom to sew on club patches for everbody, she can also make full costumes. We once went on a Disney Cruise that sailed during Halloween. Passengers were encouraged ahead of time to bring costumes. Marna turned us all into authentic pirates.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://kevinhoyt.com/img/assets/pirate-paige.jpg&quot; alt=&quot;Pirate Paige&quot; /&gt;&lt;/p&gt;
&lt;p&gt;And then there is quilting. Quilts are emormous projects. They require numerous squares to be made - this can be a project unto itself depending on the complexity of the squares. The squares get sewn together. Then there is the padding. Then the backing. Then the edges. Then the quilting itself. Because of the effort, quilting projects happen far less frequently than other types of projects.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you get a Marna quilt, you know you are loved.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Recently, Marna set out to make a quilt for her mother. The dimensions of this quilt are 8 squares by 9 squares, with each square measuring about 10 inches square. There were seven types of squares - squares with different patterns. Once she had all the squares created, it came time to figure out how to lay them out in a pleasing manner. With 72 squares, across 7 different square types, in an 8 (even) by 9 (odd) rectangle, this became quite the challenge.&lt;/p&gt;
&lt;h2&gt;The Challenge&lt;/h2&gt;
&lt;p&gt;Marna arranged the squares out in a random 8x9 grid on the floor of our living room. Then she asked for input. First from my daughter, whose brain attempted to make a pattern out of the chaos. Patterns are pleasing, right? Then came my turn, and my initial instinct was to do the same thing - force a pattern out of the noise.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://kevinhoyt.com/img/assets/quilt-pattern.jpg&quot; alt=&quot;Quilt Pattern&quot; /&gt;&lt;/p&gt;
&lt;p&gt;After moving squares around for a while, we could not arrive at a pattern that was pleasing to the eye. Every way we looked at it, our brains would latch on to the partial patterns that were there, and expect them to continue, only to be jolted by the pattern ending abruptly. Then Marna mentioed that she was originally going for a random pattern, and my brain immediately jumped to the probability machines that are LLMs.&lt;/p&gt;
&lt;h2&gt;The Prompt&lt;/h2&gt;
&lt;p&gt;Trying to come up with a random pattern where none of the squares of the same type were touching would have taken us ages. Chat GPT however, could iterate extensively and find a pattern for us.&lt;/p&gt;
&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;I am making a quilt. 
My quilt is 8 x 9 squares. 
For the individual squares, I have the following count of each. 
Make an 8x9 array in which none (or as few as possible) of the same squares touch. 
=== 
Flowers: 12 
Plaid: 12 
Squares: 12 
Spades: 12 
Dark Green: 11 
Mixed: 11 
Light Green: 2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The prompt starts with basic context. Dimension are added in, and then a reference to the types of squares. After that the specific task/outcome is specified. Finally, the actual square labels and counts for each. The squares are labeled using words that we as humans understood referenced the patterns on each of the squares.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The first prompt for this task described one of the square types as &amp;quot;Two by Two&amp;quot; which Chat GPT seemed to read as a number of squares, not as a label. It then proceeded to drop other square types entirely to make the count fit the dimensions.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The steps Chat GPT went through to come to a successful conclusion are as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Exploring grid arrangement:&lt;/strong&gt; Reviewing the count, dimensions, and labels.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pattern arrangement:&lt;/strong&gt; Pattern based on a Latin rectangle - then deciding to use Python.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python:&lt;/strong&gt; It then proceeded to write a Python script - and run it - to achieve the results.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Checking work:&lt;/strong&gt; Chat GPT then checked the work/output, and found it lacking.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Update the code:&lt;/strong&gt; Try again with some Python for edge cases of touching diagonals.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Verify the output:&lt;/strong&gt; Successful outcome.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Present the results:&lt;/strong&gt; In an inline table format for humans to follow.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;In case you are interested, here is the 175 line Pyton program it used.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;language-python&quot;&gt;&lt;code class=&quot;language-python&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;from&lt;/span&gt; collections &lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; Counter
&lt;span class=&quot;token keyword&quot;&gt;import&lt;/span&gt; random&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; math&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; itertools&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; time

rows&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; cols &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;9&lt;/span&gt;
counts &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Flowers&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Plaid&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Squares&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Spades&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Dark Green&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Mixed&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;Light Green&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
labels&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token builtin&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;counts&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
cells&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;r&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; r &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rows&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; c &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;# initial fill random&lt;/span&gt;
arr&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; k&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;v &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; counts&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;items&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    arr &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;k&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;v
random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shuffle&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;arr&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
grid&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;i&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rows&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;

orth_dirs&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
diag_dirs&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;grid&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; diag&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    s&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; r &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rows&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; c &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;dc &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; diag &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;r&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dc
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nr&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;rows &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;cols &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; grid&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;grid&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                    s&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; s

&lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;optimize&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;diag&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; max_iter&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;300000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    arr&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; k&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;v &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; counts&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;items&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        arr &lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;k&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;v
    random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shuffle&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;arr&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    g&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;arr&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;i&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;i&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;*&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; i &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rows&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    best&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;row&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; row &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; g&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
    bests&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;score&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;diag&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    s&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;bests
    T&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;2.0&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; it &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;max_iter&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token comment&quot;&gt;# pick two cells swap&lt;/span&gt;
        r1&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c1&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;randrange&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rows&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;randrange&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        r2&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c2&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;randrange&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;rows&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;randrange&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;continue&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;continue&lt;/span&gt;
        old&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;s
        &lt;span class=&quot;token comment&quot;&gt;# local delta brute&lt;/span&gt;
        affected&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
        neigh&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token builtin&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; r&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token builtin&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;affected&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;dc &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; orth_dirs &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;diag_dirs &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; diag &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;r&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dc
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nr&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;rows &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;cols&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                    neigh&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;add&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        region&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;affected&lt;span class=&quot;token operator&quot;&gt;|&lt;/span&gt;neigh
        &lt;span class=&quot;token keyword&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;regscore&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            tot&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;
            dirs&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; diag &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; r&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; region&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;dc &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; dirs&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                    nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;r&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dc
                    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nr&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;rows &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;cols &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; region&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                            tot&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;token comment&quot;&gt;# edges leaving region need count only from region endpoints&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; r&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; affected&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;dc &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; dirs&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                    nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;r&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dc
                    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nr&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;rows &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;cols &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; region&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                            tot&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;dc &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; diag &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                    nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;r&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;c&lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt;dc
                    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nr&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;rows &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt;nc&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;cols &lt;span class=&quot;token keyword&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; region&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nr&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;nc&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                            tot&lt;span class=&quot;token operator&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;1&lt;/span&gt;
            &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; tot
        before&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;regscore&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
        after&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;regscore&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        ns&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;s &lt;span class=&quot;token operator&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;after&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;before&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; ns &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt; s &lt;span class=&quot;token keyword&quot;&gt;or&lt;/span&gt; random&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;random&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; math&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;exp&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;s&lt;span class=&quot;token operator&quot;&gt;-&lt;/span&gt;ns&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt;T&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            s&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;ns
            &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; s &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt; bests&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                bests&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;s
                best&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;row&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; row &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; g&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
                &lt;span class=&quot;token comment&quot;&gt;# print(&quot;best&quot;,bests,it)&lt;/span&gt;
                &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; bests&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
                    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; best&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;bests
        &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
            g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c2&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;g&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;r1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;c1&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;
        T&lt;span class=&quot;token operator&quot;&gt;*=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.99997&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; T&lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.001&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; T&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0.001&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; best&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;bests

&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; diag &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token boolean&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
    best&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;b&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;optimize&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;diag&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;diag&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; max_iter&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;100000&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;diag&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;diag&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;best&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;b&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt; b&lt;span class=&quot;token operator&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; row &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; best&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;row&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The resulting table:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;1&lt;/th&gt;
&lt;th&gt;2&lt;/th&gt;
&lt;th&gt;3&lt;/th&gt;
&lt;th&gt;4&lt;/th&gt;
&lt;th&gt;5&lt;/th&gt;
&lt;th&gt;6&lt;/th&gt;
&lt;th&gt;7&lt;/th&gt;
&lt;th&gt;8&lt;/th&gt;
&lt;th&gt;9&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Light Green&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Light Green&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Dark Green&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Squares&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Mixed&lt;/td&gt;
&lt;td&gt;Flowers&lt;/td&gt;
&lt;td&gt;Spades&lt;/td&gt;
&lt;td&gt;Plaid&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;It took Chat GPT almost 45 seconds to arrive at a solution.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://kevinhoyt.com/img/assets/quilt-gpt.jpg&quot; alt=&quot;Quilt GPT&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;The Results&lt;/h2&gt;
&lt;p&gt;Once the physical squares were laid out, it was universally agreed that this was an ideal solution. The &amp;quot;why&amp;quot; it was an ideal solution remains a bit of a mystery. I do not know if this comes across in the image, but when looking at the physical quilt, your eye seems to first look for a pattern. The eye cannot find that pattern because there is none - that was the point. Interestingly, the brain accepts this as the whole of the quilt being the pattern and is happy to let you enjoy the chaos.&lt;/p&gt;
&lt;p&gt;From here, Marna set to finalizing the squares and assembling the rows.&lt;/p&gt;
&lt;p&gt;The result is not technically random - which was how we described it amongst our human selves. The pattern is really a structured approach to not having touching squares, which then seems to come across as pleasingly random. It would have taken us countless hours to arrive at the same &amp;quot;random&amp;quot; pattern. Leveraging a probability machine, er, LLM, made quick work of the task, and is a really fun example of how the digital and physical colliding in art can result in a very pleasing outcome.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Managing Tech: Cadence</title>
      <link href="https://kevinhoyt.com/blog/2026/02/02/managing-cadence/"/>
      <updated>2026-02-02T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/02/02/managing-cadence/</id>
      <summary>This is part of a series: Managing Tech: People Managing Tech: Heroes Managing Tech: Professionals Managing Tech: Time Managing Tech: Cadence (you are here) Managing Tech: 1:1 I have mentioned before that a manager&#39;s currency is meetings. This is markedly different from the individual contributor,...</summary>
      <content type="html">&lt;p&gt;This is part of a series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;People&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/14/managing-heroes/&quot;&gt;Heroes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/16/managing-professionals/&quot;&gt;Professionals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/26/managing-time/&quot;&gt;Time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: Cadence (you are here)&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/&quot;&gt;1:1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I have mentioned before that a manager&#39;s currency is meetings. This is markedly different from the individual contributor, whose currency is focus time. As a manager at Amazon, it was not uncommon for me to sit down at my desk on Monday morning and find that I already had 20 hours of meetings scheduled for the week. How could that possibly be the case?&lt;/p&gt;
&lt;p&gt;In this post, I will walk through the meetings that should be on a manager&#39;s calendar, along with recommended timing and cadence. I will also discuss - at a high level - the purpose of each meeting and why it matters. Future posts will dive deeper into agendas and specific considerations for each meeting type.&lt;/p&gt;
&lt;h2&gt;Direct Report 1:1&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, 30 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You should have dedicated time with each of your direct reports every week. This is especially important for remote teams, but it applies just as strongly when you are co-located. This is their time to speak - to tell you how things are really going. While there should be dialogue, the primary flow of information should be from them to you. Communication flowing downward can happen in other meetings.&lt;/p&gt;
&lt;p&gt;To that end, if an employee wants to cancel their 1:1 for the week, that is their prerogative. You, however, should respect the scheduled time and avoid canceling or rescheduling unless it is absolutely necessary. Canceling sends the message that your direct report is less important than other work - when, in reality, they are the reason your role exists. Rescheduling risks disrupting the focus time they have carefully arranged for their own productivity.&lt;/p&gt;
&lt;p&gt;If you must reschedule, ask whether it works for them and what time they would prefer. Do not assume you understand their calendar well enough to make that decision unilaterally.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Remember that employees are people. Do you enjoy having your schedule changed without warning? If your mechanic needs to reschedule your car service, do you want them to simply pick a new time for you?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Preparation matters. You should never show up to a 1:1 without an agenda. By the time the meeting begins, you should already have a clear view of the employee&#39;s status. When did they last take time off? What goals have they stated? What follow-ups are pending?&lt;/p&gt;
&lt;p&gt;I personally schedule 30-minute 1:1s, but I block 30 minutes on either side of each meeting. The time before allows me to prepare; the time after gives me space to capture notes and address action items. This ensures I am fully present - and it also allows the meeting to run long if needed.&lt;/p&gt;
&lt;h2&gt;Direct Reports Team Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, 30–60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The team meeting is your opportunity to set and reinforce direction. This is where pass-down information belongs. This is manager talk time. Your goal is to ensure everyone is aligned - focused on the same point on the horizon - and that objectives are being communicated clearly.&lt;/p&gt;
&lt;p&gt;You should also leave room for questions.&lt;/p&gt;
&lt;p&gt;Remember that not everyone feels comfortable speaking up in a group setting. Avoid putting anyone on the spot. If you would like someone to share work or insights with the team, ask them privately during a 1:1. They may prefer to contribute via a written document, an email, or collaboration in team chat.&lt;/p&gt;
&lt;p&gt;As someone inclined toward Socratic questioning, I have learned that questions meant to probe deeper meaning can sometimes be misinterpreted as &amp;quot;stupid.&amp;quot; No question is stupid. Every question is valid. Psychological safety is essential - without it, valuable insights will remain unspoken.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Be careful with spillover from 1:1s. Personal information shared privately is not for team discussion unless explicitly acknowledged and agreed upon.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Office Hours&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, 60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;When can employees reach you for clarification outside of structured meetings? I do not consider office hours mandatory unless you are managing through change. During periods of uncertainty, people often have questions after talking with peers, family, or simply reflecting during their commute.&lt;/p&gt;
&lt;p&gt;Office hours create space for those questions.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In modern environments with persistent chat tools, office hours may be less necessary. Use your judgment. Your role exists because your direct reports exist. Be available to them.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Manager 1:1&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, 30–60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Just as you meet with your direct reports weekly, you should meet with your manager weekly as well. The same principles apply - you are one of their direct reports. This is your time to gain clarity on expectations, performance, and priorities.&lt;/p&gt;
&lt;p&gt;Thirty minutes is often sufficient, though some managers also use this time for pass-down communication, which may require a full hour.&lt;/p&gt;
&lt;h2&gt;Manager Team Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, 60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is the equivalent of your team meeting, but for your manager&#39;s direct reports. This is manager time - time to think about team needs and alignment with broader organizational goals. These meetings should be driven by your manager and primarily focused on pass-down information from higher-level discussions.&lt;/p&gt;
&lt;h2&gt;Peer Manager Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, rotating, 30 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I recommend meeting regularly with peer managers. I rotate through peers - one per week. With six peers, that is one meeting every six weeks with each.&lt;/p&gt;
&lt;p&gt;These meetings help you grow and help others grow. Approach them with humility. You will learn about processes that work well elsewhere - and sometimes you will be the one offering guidance.&lt;/p&gt;
&lt;p&gt;They are also a chance to build alliances. If you and your peers notice a broader issue or missed objective, this is the place to identify it and plan how to surface it constructively. This is not a gossip session. Complaining solves nothing; plotting a path forward does.&lt;/p&gt;
&lt;h2&gt;Partner Team Meetings&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Weekly, 30–60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Partners are managers of teams your direct reports collaborate with - Product Managers, program leads, or even VPs. Whenever possible, attend these meetings. Your direct reports should also attend when their work is directly involved.&lt;/p&gt;
&lt;p&gt;When a direct report is doing the hands-on work, your role is to support them - especially when priorities conflict or clarification is needed. You never want &amp;quot;because my manager said so&amp;quot; to be the explanation. Your presence allows you to explain trade-offs and course-correct in real time.&lt;/p&gt;
&lt;p&gt;These meetings may surface important signals - declining revenue, shifting priorities, or organizational changes. Being early to these signals allows you to plan and communicate proactively with your manager.&lt;/p&gt;
&lt;h2&gt;Direct Reports Fun Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Monthly, 60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;People connect over shared interests. This meeting exists to foster personal relationships. While you may lead it initially, long-term ownership should shift to the team - perhaps a senior contributor or a natural facilitator.&lt;/p&gt;
&lt;p&gt;Topics should vary widely: books, movies, hobbies, cooking. I have had team members give live cooking demos from their kitchens. These moments matter.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Your employees will talk without you present. That is healthy. Encourage it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Attendance should be encouraged but never required. No one should feel guilty for skipping due to deadlines. Participation should also be optional - lurking is fine. The goal is freeform connection, not forced engagement.&lt;/p&gt;
&lt;h2&gt;Direct Report Performance Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Quarterly, 60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is an extended 1:1 focused on performance. Annual reviews should never be the first time feedback is shared. Quarterly cadence allows for course correction.&lt;/p&gt;
&lt;p&gt;I like to work with three development goals per employee: short-, medium-, and long-term. This creates continuity and momentum.&lt;/p&gt;
&lt;p&gt;These meetings must be honest and clear. You can see performance patterns across the team and organization - use that insight to collaborate on closing gaps. You are not responsible for achieving their goals, but you are responsible for helping chart the path.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is also the right time to discuss potential moves into management and to gather materials for promotion narratives.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Feedback should flow both ways. Ask directly: &amp;quot;How am I doing as your manager?&amp;quot; and &amp;quot;What do you need from me to be successful?&amp;quot; If you have missed the mark, own it and improve.&lt;/p&gt;
&lt;h2&gt;Manager Performance Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Quarterly, 60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This mirrors the performance discussion you have with your team, but with your manager. It is also an opportunity to validate or contextualize feedback you are hearing from your team and to identify concrete actions for improvement.&lt;/p&gt;
&lt;h2&gt;Partner Owner Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Quarterly, 30 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is an executive-level 1:1 with business owners your team supports. Come prepared with accomplishments, current work, and future plans.&lt;/p&gt;
&lt;p&gt;Use this time to understand the business deeply. Partners enjoy explaining their products and strategy - and that knowledge makes you a better advocate for alignment.&lt;/p&gt;
&lt;p&gt;Always ask: &amp;quot;How are we doing?&amp;quot; If there are concerns, this is the moment to surface them.&lt;/p&gt;
&lt;h2&gt;Skip-Level Manager Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Quarterly, 30 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Encourage skip-level meetings - both for your employees and for yourself. These conversations remove narrative bias and provide fresh perspective. They help individuals understand how objectives connect across the organization and why certain decisions are being made.&lt;/p&gt;
&lt;h2&gt;In-Person Direct Report Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Quarterly, all day&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Applies mostly to remote managers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Remote management requires intentionality. If budget allows, visit each direct report quarterly. Meet for coffee or lunch. Connect as people.&lt;/p&gt;
&lt;p&gt;For co-located teams, consider a quarterly team lunch.&lt;/p&gt;
&lt;h2&gt;Annual Direct Report Performance Meeting&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Annually, 60 minutes&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you are holding quarterly performance meetings, nothing in the annual review should come as a surprise. The structure may be more formal due to corporate requirements, but the substance should already be familiar.&lt;/p&gt;
&lt;h2&gt;Closing Thoughts&lt;/h2&gt;
&lt;p&gt;Take notes - lots of them. When no process is defined, I use Obsidian because Markdown is searchable and reusable (even as input to AI systems). I follow up each meeting with written notes.&lt;/p&gt;
&lt;p&gt;When corporate tools exist, use them. Shared documents - with agendas prepared in advance - keep everyone aligned and eliminate ambiguity.&lt;/p&gt;
&lt;p&gt;This list may feel exhaustive. It may be too much - or not enough - depending on your culture. But the core truth remains: managers spend time in meetings. Done well, those meetings build cohesion, alignment, and serendipity.&lt;/p&gt;
&lt;p&gt;Did I miss a meeting? Drop me a note via the contact form below.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Managing Tech: Time</title>
      <link href="https://kevinhoyt.com/blog/2026/01/26/managing-time/"/>
      <updated>2026-01-26T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/01/26/managing-time/</id>
      <summary>This is part of a series: Managing Tech: People Managing Tech: Heroes Managing Tech: Professionals Managing Tech: Time (you are here) Managing Tech: Cadence Managing Tech: 1:1 If there is one skill I most commonly see underrepresented—among both individual contributors and managers alike - it is...</summary>
      <content type="html">&lt;p&gt;This is part of a series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;People&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/14/managing-heroes/&quot;&gt;Heroes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/16/managing-professionals/&quot;&gt;Professionals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: Time (you are here)&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/02/02/managing-cadence/&quot;&gt;Cadence&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/&quot;&gt;1:1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If there is one skill I most commonly see underrepresented—among both individual contributors and managers alike - it is time management. As an individual contributor, weak time management makes it difficult to scale across the responsibilities that your &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/16/managing-professionals/&quot;&gt;business&lt;/a&gt; requires of you. As a manager, poor time management means you will represent neither your employer nor your employees particularly well.&lt;/p&gt;
&lt;p&gt;In this post, I will review a range of time management approaches along a spectrum. You can compare these options, identify which best reflects your current approach, and explore alternatives. This post is intended for both individual contributors and managers.&lt;/p&gt;
&lt;h2&gt;Organization&lt;/h2&gt;
&lt;p&gt;The &amp;quot;why&amp;quot; of time management is straightforward: the more information you try to keep in your head, the less successful you will be at any one thing. The most basic approach to time management, then, is simply to get commitments out of your head.&lt;/p&gt;
&lt;p&gt;This might be as simple as a paper calendar where you write down a task for a given day. If you prefer a digital workflow (as I do), you can use a calendar application and create an appointment for the day you intend to work on a task.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you are going the digital route, I generally recommend placing the task at the time you usually start work or arrive at the office. That way, you are confronted with it immediately and can plan accordingly.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you have multiple tasks scheduled for the same day, you can arrange them in an order that works for the project. This is basic prioritization, which I will return to later in the post.&lt;/p&gt;
&lt;h2&gt;Time Blocking&lt;/h2&gt;
&lt;p&gt;Once you are consistently putting tasks on your calendar, the next step is to account for how long those tasks will actually take - blocking off sections of time accordingly. Early on, you will almost certainly underestimate how long tasks take. Over time, you will develop better estimation skills.&lt;/p&gt;
&lt;p&gt;A common misstep is forgetting to block time for tasks people take for granted: checking email, reviewing plans, or even eating lunch. I generally block the first 30 minutes of each day for email and planning.&lt;/p&gt;
&lt;p&gt;It is easy to become overly precise and try to block time down to the minute. Instead, I suggest choosing a minimum block - 15 or 30 minutes - and sticking with it. Even if a task only takes 10 minutes, you might still allocate a 30-minute block. This gives you time to context switch and provides some buffer for unexpected changes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Time blocking is useful not only for planning, but also for tracking past work. This can be invaluable during performance reviews when you need to recall what you’ve accomplished over the past year.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Eventually, you will find yourself with a fully blocked day - and then a new meeting request arrives. What now? This is where prioritization becomes essential.&lt;/p&gt;
&lt;h2&gt;Prioritization&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;...or learning to say “no.”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When a meeting request comes in for a day that’s already fully blocked, you need to decide what action to take. Which task takes priority?&lt;/p&gt;
&lt;p&gt;My preferred approach comes from the Getting Things Done (GTD) system, which I’ve written about in &lt;a href=&quot;https://kevinhoyt.com/blog/2022/06/15/four-d/&quot;&gt;another post&lt;/a&gt;. I will summarize it here for completeness:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Do It:&lt;/strong&gt; If you can complete the task now, do it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Defer It:&lt;/strong&gt; You cannot do the task right now, so schedule time to do it later.
&lt;strong&gt;Delegate It:&lt;/strong&gt; If someone else can move the task forward, delegate it - and block time to follow up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Drop It:&lt;/strong&gt; Some tasks do not actually need to be done. These are often informational and can be offloaded to another system (for example, a notes or knowledge base tool).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Learning to say &amp;quot;no&amp;quot; is a critical part of time management. Having a clear framework for prioritization makes this easier—and less personal.&lt;/p&gt;
&lt;h2&gt;A Word About Context Switching&lt;/h2&gt;
&lt;p&gt;For the &lt;strong&gt;individual contributor&lt;/strong&gt;, meetings are often a distraction from deep work. Keeping email and corporate chat open throughout the day introduces constant interruptions. This is why I prefer to block time specifically for these systems and keep them closed otherwise. Context switching is expensive, cognitively speaking.&lt;/p&gt;
&lt;p&gt;For the &lt;strong&gt;manager&lt;/strong&gt;, meetings are your currency. Still, if you feel the urge to email or message a direct report, pause for a moment and consider the impact of that interruption. Is this truly the best time? Is it urgent?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I try to set clear expectations with my direct reports around response times. My general rule of thumb is that they can expect a response from me within 24 hours - and I expect the same from them. I make it explicit that I do not expect anyone to be &amp;quot;on&amp;quot; all the time.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As a manager, you also need to be mindful of how you communicate. A message with the subject line &amp;quot;Can we talk?&amp;quot; can trigger unnecessary anxiety. It can sound like a termination conversation when all you wanted to ask about next week’s vacation plans. Whenever possible, be explicit about your intent and provide guidance such as &amp;quot;not urgent&amp;quot; or &amp;quot;when you have time.&amp;quot;&lt;/p&gt;
&lt;p&gt;Likewise, talk with your team about preferred communication channels. Some people favor email; others prefer chat. Knowing how your direct reports prefer to communicate reduces the chance that important messages get lost - or ignored.&lt;/p&gt;
&lt;h2&gt;A Word About Systems&lt;/h2&gt;
&lt;p&gt;There are as many time management systems as there are stars in the night sky. I have not counted, but you get the idea. Over my 25 years in technology, I have studied and used many different systems. Below are a few that have stood out to me.&lt;/p&gt;
&lt;h3&gt;Patterns vs. Systems&lt;/h3&gt;
&lt;p&gt;The key is to avoid treating any single system as the final answer. Time management is a skill. A system - understood as an explanation of an approach - can help you develop that skill. The real value lies in understanding why the system is structured the way it is.&lt;/p&gt;
&lt;p&gt;When a system is treated as the solution itself, it can box you into a rigid way of thinking and limit growth. Look for the patterns underneath.&lt;/p&gt;
&lt;h3&gt;Benjamin Franklin&lt;/h3&gt;
&lt;p&gt;Benjamin Franklin used a daily schedule with a column of numbers down the center of the page: 5 through 12, then 1 through 12, and finally 1 through 4. This represented each hour of the day. On either side of the numbers, he recorded what he planned to do and what he actually did.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://kevinhoyt.com/img/assets/franklin-schedule.jpg&quot; alt=&quot;Franklin Schedule&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Franklin started his day at 5 a.m. and went to bed at a consistent time, allowing for seven hours of sleep.&lt;/p&gt;
&lt;p&gt;That was his system. Does that mean you should start your day at 5 a.m.? Or sleep exactly seven hours? If you’re systematizing blindly, you might say yes. But the real lesson is the pattern: he started and ended his day consistently.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;There are additional lessons in Franklin’s approach that are beyond the scope of this post, but well worth exploring.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Bullet Journal&lt;/h3&gt;
&lt;p&gt;For a long time, I preferred paper to digital. There was something satisfying about opening a notebook, uncapping a quality pen, and putting ink on the page. I still have notebooks from my time as a sales engineer (2000–2007), and I occasionally enjoy flipping through them to see what I was doing on this day years ago.&lt;/p&gt;
&lt;p&gt;When I wanted more structure, I turned to the &lt;a href=&quot;https://bulletjournal.com/&quot;&gt;Bullet Journal&lt;/a&gt; system.&lt;/p&gt;
&lt;h3&gt;Getting Things Done&lt;/h3&gt;
&lt;p&gt;I have already referenced Getting Things Done. It is the system that resonated most strongly with me and the one that informs most of my current practices.&lt;/p&gt;
&lt;h3&gt;Franklin Covey&lt;/h3&gt;
&lt;p&gt;The original time management powerhouse, &lt;a href=&quot;https://www.franklincovey.com/&quot;&gt;Franklin Covey&lt;/a&gt; once had physical stores in shopping malls where you could buy planners and stationery preconfigured for their system.&lt;/p&gt;
&lt;p&gt;The key takeaway for me was simple: list the tasks you need to accomplish for the day. Cross off what you complete. Carry unfinished tasks forward to the next day.&lt;/p&gt;
&lt;h2&gt;What About Agile?&lt;/h2&gt;
&lt;p&gt;Agile approaches such as Scrum and Kanban are vast enough to warrant certifications. They are powerful tools, but in my experience, they are often overkill when mentoring or developing basic time management skills.&lt;/p&gt;
&lt;p&gt;All you really need is a notebook or the calendar application that comes with your operating system. Anything more can distract from the core objective: building good habits. The best time management system is the one that works for you - whether that is a well-known framework or a custom blend of techniques.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I have had direct reports successfully use Agile systems for personal time management. That is fine if it works for them. However, it can become a blocker when everyone - including the company - is running a different interpretation of the same system.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Closing Thoughts&lt;/h2&gt;
&lt;p&gt;Time management is not something you &amp;quot;set up&amp;quot; once and then forget. It is a skill you practice, refine, and occasionally relearn as your role, responsibilities, and life change.&lt;/p&gt;
&lt;p&gt;The mistake I see most often is treating a system as the solution. Systems are scaffolding. They help you learn the patterns - externalizing commitments, estimating time realistically, prioritizing intentionally, and protecting focus. Once you internalize those patterns, the specific tools matter far less.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;individual contributors&lt;/strong&gt;, good time management creates space for deep work, learning, and sustained delivery. It reduces stress by making trade-offs explicit rather than implicit.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;managers&lt;/strong&gt;, time management is leverage. How you manage your own time directly shapes how your team experiences work. Poor time management shows up as unnecessary interruptions, unclear priorities, and reactive leadership. Strong time management builds trust, predictability, and psychological safety.&lt;/p&gt;
&lt;p&gt;You do not need a perfect system. You need an honest one - one that reflects how you actually work, not how you wish you worked. Start simple. Observe what breaks. Adjust. Repeat.&lt;/p&gt;
&lt;p&gt;The goal is not to fill every minute of your day. The goal is to spend your time intentionally, on the work that actually matters.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Managing Tech: Professionals</title>
      <link href="https://kevinhoyt.com/blog/2026/01/16/managing-professionals/"/>
      <updated>2026-01-16T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/01/16/managing-professionals/</id>
      <summary>This is part of a series: Managing Tech: People Managing Tech: Heroes Managing Tech: Professionals (you are here) Managing Tech: Time Managing Tech: Cadence Managing Tech: 1:1 In my post, Managing Tech: People, I mentioned that the social contract between employee and employer has changed over the...</summary>
      <content type="html">&lt;p&gt;This is part of a series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;People&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/14/managing-heroes/&quot;&gt;Heroes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: Professionals (you are here)&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/26/managing-time/&quot;&gt;Time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/02/02/managing-cadence/&quot;&gt;Cadence&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/&quot;&gt;1:1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In my post, &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;Managing Tech: People&lt;/a&gt;, I mentioned that the social contract between employee and employer has changed over the past several decades. At IBM in 2016 (just one decade ago), it was common to encounter people who had been with the company for twenty years or more. I myself spent almost fifteen years at Adobe (2000–2013).&lt;/p&gt;
&lt;p&gt;By 2026, it is far more common to move between employers every few years. The reasons for this are many. The question then becomes: if the old contract is no longer relevant, what is the new contract?&lt;/p&gt;
&lt;h2&gt;Professionals&lt;/h2&gt;
&lt;p&gt;When I start working with a new direct report, I generally tell them something along the following lines:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;You are an adult. You are a professional. I expect adult, professional behavior from you. You can work whatever hours you want, in whatever manner you want, within reason. You know best how you get work done. Do that. I trust you to deliver.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is the contract I am proposing: &lt;strong&gt;you are a professional&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The Oxford Dictionary defines &amp;quot;professional&amp;quot; as &amp;quot;doing something as a paid job rather than as a hobby.&amp;quot; That definition is a baseline. What matters more to me is the implied trust, accountability, and autonomy that come with it.&lt;/p&gt;
&lt;p&gt;There are clarifications that surface along the way, of course. For example, attending meetings during normal business hours is expected. To me, that still falls under the umbrella of professional behavior.&lt;/p&gt;
&lt;h2&gt;Manage Your Business&lt;/h2&gt;
&lt;p&gt;Once this message is clear, I push the boundaries a little further with an explanation along the following lines:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Your job is your Business (capital “B”), and you are responsible for it. We all love to focus on product, but sometimes we are called into other business functions. Some days you may be in sales (communicating vertically about your performance). Some days it is marketing (communicating horizontally to ensure people know what you can do). If you don’t know how to do some of these, let me know, and I will mentor you through those skills.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For an employee, I generally think of their business functions as (in no particular order):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Product:&lt;/strong&gt; Deliverables&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sales:&lt;/strong&gt; Vertical communication (share your awesome)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Marketing:&lt;/strong&gt; Horizontal communication (find other ways to contribute)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Finance:&lt;/strong&gt; Expenses; ordering gear or equipment&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Human Resources:&lt;/strong&gt; Annual training and continuing education&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Customer Success:&lt;/strong&gt; Meetings (stakeholders, managers, etc.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IT:&lt;/strong&gt; Automating workflows and reporting&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Leadership:&lt;/strong&gt; Time management and mentoring&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You cannot come in and just write code. To be successful, you must think about your business holistically. Touching all of these functions ensures that your business - and your career - runs smoothly.&lt;/p&gt;
&lt;h2&gt;For The Manager&lt;/h2&gt;
&lt;p&gt;This contract is not just for the direct report - it applies equally to the manager. You must hold yourself to the same standard. Failing to do so erodes trust, and once trust is gone, the contract no longer works.&lt;/p&gt;
&lt;p&gt;I like to take this one step further:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Do not ask a direct report to do something that you have not done in the past, or are not willing to do in the present.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In tech, this idea can feel counterintuitive. Innovation never stops, and you may ask someone to deliver a feature you have never personally built. But this principle is not about that specific feature - it is about the nature of the work. You understand what delivery entails: the extra hours when needed, the on-call rotation, the pressure of deadlines, and the responsibility that comes with ownership. That shared understanding matters.&lt;/p&gt;
&lt;p&gt;If an employee has a family emergency, are you willing to step in, roll up your sleeves, and write some code? If someone is struggling with part of a feature, are you willing to schedule time, open the code, and work through it together - even if your role is simply to be a second set of eyes or a sounding board?&lt;/p&gt;
&lt;p&gt;If you are asking a direct report to grow, stretch, or take on responsibility, you must be willing to do that work alongside them. That means using your experience to help define manageable goals, checking in on progress, and coaching - not delegating and disappearing.&lt;/p&gt;
&lt;p&gt;A new contract with employees does not absolve you from the work. It raises the bar for how you show up as a manager.&lt;/p&gt;
&lt;h2&gt;The Professional Contract&lt;/h2&gt;
&lt;p&gt;This is often a new perspective for employees, but one that is both empowering and rooted in trust. I try to regularly schedule time to coach people through these ideas. By laying out the contract in terms of familiar business functions, we establish a shared framework - and a shared understanding - of what it truly means to be a professional in today’s world.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Managing Tech: Heroes</title>
      <link href="https://kevinhoyt.com/blog/2026/01/14/managing-heroes/"/>
      <updated>2026-01-14T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/01/14/managing-heroes/</id>
      <summary>This is part of a series: Managing Tech: People Managing Tech: Heroes (you are here) Managing Tech: Professionals Managing Tech: Time Managing Tech: Cadence Managing Tech: 1:1 Have you ever heard the term &amp;quot;elevator pitch&amp;quot;? You usually hear it in the context of pitching an idea to senior...</summary>
      <content type="html">&lt;p&gt;This is part of a series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;People&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: Heroes (you are here)&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/16/managing-professionals/&quot;&gt;Professionals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/26/managing-time/&quot;&gt;Time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/02/02/managing-cadence/&quot;&gt;Cadence&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/&quot;&gt;1:1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Have you ever heard the term &amp;quot;&lt;em&gt;elevator pitch&lt;/em&gt;&amp;quot;? You usually hear it in the context of pitching an idea to senior management or to investors. The idea is that the pitch for your idea or business should take no longer than an elevator ride - because that is all the time you might get.&lt;/p&gt;
&lt;p&gt;One morning, I happened to be sharing an elevator ride with a vice president at the company. It was just the two of us. He asked, &amp;quot;What is your team up to these days?&amp;quot; Feeling witty, I responded, &amp;quot;Making heroes.&amp;quot; A few days later, I heard the VP use that same phrase on a conference call - in a completely different way than I had intended.&lt;/p&gt;
&lt;p&gt;From that point on, I always made sure to finish the phrase.&lt;/p&gt;
&lt;h2&gt;Heroes&lt;/h2&gt;
&lt;p&gt;In my last post, &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/12/managing-people/&quot;&gt;Managing Tech: People&lt;/a&gt;, I mentioned that people bring their own desires and goals to work. As a manager, you should make it a priority to understand what those desires and goals are for your employees - &lt;strong&gt;to make people heroes for what it is that they want to achieve.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is awkward at first. You will get the standard &amp;quot;Where do you want to be in five years?&amp;quot; type of dialogue. The kind of dialogue that carries hints of fear and reservation. A dialogue that is truthful, but not honest. That is a fine place to start, but you want to go deeper.&lt;/p&gt;
&lt;p&gt;If you are treating your employees like people - and you are listening closely (not just hearing) - you will begin to pick up on more honest feedback over time. As trust builds, that dialogue can become particularly transparent. More on that in a moment.&lt;/p&gt;
&lt;p&gt;Sometimes the feedback is easy to address. Something along the lines of: &amp;quot;I want to learn a new skill.&amp;quot; Great! Now you have a place to start - from which you can work backward. If the objective is X, what are the steps needed to get there? Think those through and discuss them with your employee. Work together to design and define goals. Check in on progress. Check them off. And celebrate those completions together.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I generally like to have one to three goals like this set up for each employee at all times. Some may be achievable in the short term, while others may take longer. Pin goals to a year or less to best align with performance reviews.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Radical Transparency&lt;/h2&gt;
&lt;p&gt;Sometimes the feedback is surprising. If you have truly built trust - or if the employee is just that bold - you might hear something like: &amp;quot;I do not want to work in this department.&amp;quot; I have heard, &amp;quot;I don’t want to work for this company.&amp;quot; I have even heard, &amp;quot;I don’t want to work on your team.&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If you are making heroes, perhaps these are antiheroes - heroes all the same, just unconventional.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is actually a breakthrough win. If you reach this level of dialogue, you should feel good about what you have accomplished as a manager. If an employee does not want to be part of the team, department, or company, you want to know. You do not want that sentiment lingering in the background, quietly poisoning the team, the project, or the culture.&lt;/p&gt;
&lt;p&gt;You still want to make them heroes for what they want to achieve.&lt;/p&gt;
&lt;p&gt;The phrase &amp;quot;I do not want to work for this company&amp;quot; is really shorthand for &amp;quot;I want to work for a different company.&amp;quot; My response to that sentiment often surprises people. I will follow it with: &amp;quot;Where do you want to work?&amp;quot; and &amp;quot;What role would you like to have there?&amp;quot; Make that a goal and work backward to plan the steps to get there. I may even have contacts at that company I can introduce.&lt;/p&gt;
&lt;p&gt;&amp;quot;I do not want to work in this department&amp;quot; strikes me the same way, but it is often easier to address. You already know how to network within your own company - and that is usually far easier than doing so externally. In these situations, I have reached out to managers in other departments and set up mentoring conversations for the employee.&lt;/p&gt;
&lt;p&gt;This helps both the employee and me understand what steps need to be taken. Maybe there are skills to develop. Certifications to earn. Or maybe everything is a perfect fit and we are simply waiting for a position to open. In some cases, I have even coordinated work between the employee and the manager in their target department. The manager gets extra help, the employee sees a real path forward, and I alleviate potential toxicity on my own team.&lt;/p&gt;
&lt;h2&gt;Still People&lt;/h2&gt;
&lt;p&gt;Helping employees define goals that will make them heroes - and collaborating with them to get there - can start to feel mechanical if you are not careful. You have to remember that your employees are still people.&lt;/p&gt;
&lt;p&gt;I once had an employee tell me they wanted to swim to Alcatraz (Sharkfest). What an interesting personal goal. I did not make this a corporate objective, but I did follow up on their progress from time to time. When they fell behind in training, I encouraged them to stay the course. When they hit milestones, I congratulated them. When they signed up and were ready for the swim, I booked a flight to San Francisco to cheer them on.&lt;/p&gt;
&lt;p&gt;Careful of the &amp;quot;friend zone&amp;quot; I showed up, watched the event, took a picture with the employee when they finished, and then went on my way - letting them celebrate with their support team and friends who had helped them along the journey.&lt;/p&gt;
&lt;h2&gt;Stay on Target&lt;/h2&gt;
&lt;p&gt;You might think that helping an employee leave the company is misaligned with company goals - but it often is not. In the technology sector, it is commonly estimated that an employee departure costs a company around $100k. More importantly, disengaged employees cost far more while they stay.&lt;/p&gt;
&lt;p&gt;When you come alongside an employee - when you listen, build trust, and help them become a hero for what they want to achieve - you reduce that hidden cost. Sometimes the result is growth within the team. Sometimes it is a move to another department. And sometimes it is a well-supported exit.&lt;/p&gt;
&lt;p&gt;That is not a failure of management. It &lt;em&gt;is&lt;/em&gt; management.&lt;/p&gt;
&lt;p&gt;Managing tech is not about extracting maximum output from people. It is about creating the conditions where people can do meaningful work, grow honestly, and move forward with clarity - even when that path eventually leads away from you.&lt;/p&gt;
&lt;p&gt;If you make people heroes for what it is that they want to achieve, the business outcomes tend to take care of themselves.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Managing Tech: People</title>
      <link href="https://kevinhoyt.com/blog/2026/01/12/managing-people/"/>
      <updated>2026-01-12T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/01/12/managing-people/</id>
      <summary>This is part of a series: Managing Tech: People (you are here) Managing Tech: Heroes Managing Tech: Professionals Managing Tech: Time Managing Tech: Cadence Managing Tech: 1:1 You are good at your job. You come into work, consistently deliver results, and keep learning more about the business and...</summary>
      <content type="html">&lt;p&gt;This is part of a series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Managing Tech: People (you are here)&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/14/managing-heroes/&quot;&gt;Heroes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/16/managing-professionals/&quot;&gt;Professionals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/26/managing-time/&quot;&gt;Time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/02/26/managing-cadence/&quot;&gt;Cadence&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Managing Tech: &lt;a href=&quot;https://kevinhoyt.com/blog/2026/03/23/managing-1-on-1/&quot;&gt;1:1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You are good at your job. You come into work, consistently deliver results, and keep learning more about the business and your craft. Eventually, your abilities are noticed and you are promoted to manager. Congratulations!&lt;/p&gt;
&lt;p&gt;There is just one problem: the skills that made you successful as an individual contributor (IC) no longer serve you as a manager. You struggle for a while, then eventually decide to return to your previous role.&lt;/p&gt;
&lt;p&gt;There is no shame in that. I have seen this happen time and again.&lt;/p&gt;
&lt;p&gt;The other day, I was talking to a friend who had gone through this exact process. After years of being comfortably back in his IC role, he is once again being formally nudged toward management. Knowing that I have managed technical teams for nearly 20 years, he asked me for some advice.&lt;/p&gt;
&lt;p&gt;I took a deep breath, sat with the question for a moment, and suggested...&lt;/p&gt;
&lt;h2&gt;People&lt;/h2&gt;
&lt;p&gt;When it comes to managing people - especially in tech - my first thought is simple: remember that your employees are people.&lt;/p&gt;
&lt;p&gt;This sounds obvious, but tech cultures are often tuned to extract as much value from employees as possible. If you are not careful, those employees can start to look like cogs. Cogs are replaceable when they stop working. People are not.&lt;/p&gt;
&lt;p&gt;Every employee brings a full life with them to work every day: desires, goals, problems, stresses, emotions - everything from the journey that led them to this role. When you interact with your employees, interact with them as people.&lt;/p&gt;
&lt;p&gt;When you have a 1:1, ask, &amp;quot;How are you?&amp;quot; Mean it. Listen - not just hear - the response. Ask follow-up questions. Try to understand their perspective in that moment. What is motivating them? What is weighing on them? Is there anything you need to do?&lt;/p&gt;
&lt;p&gt;Sometimes the answer is no. Most of the time, it is. But if you listen closely enough, you will occasionally find moments where you can change the trajectory of an employee’s work—and sometimes their experience at the company.&lt;/p&gt;
&lt;h2&gt;No Free Pass&lt;/h2&gt;
&lt;p&gt;You might be thinking this is ridiculous.&lt;/p&gt;
&lt;p&gt;You pay these people to show up and do a job. What happens outside of work is n0t your concern. Just deliver. Deal with your baggage on your own time.&lt;/p&gt;
&lt;p&gt;The problem with this mindset is that humans are social animals. Even introverts - even the shy - need social interaction (just the right kind). By ignoring who your employees are as people, you are ignoring the very interactions that shape who they are at work.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The social contract between employee and employer has changed dramatically over the past several decades - especially in tech.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If there are 24 hours in a day and an employee works an eight-hour shift, that leaves 16 other hours influencing how they show up. Ignoring that reality means ignoring roughly 66% of what makes your employee your employee.&lt;/p&gt;
&lt;p&gt;Would you ignore 66% of your business?&lt;br /&gt;
Would you leave 66% of your revenue on the table?&lt;/p&gt;
&lt;p&gt;This is not a free pass. It is compassion. It is empathy for another human being. It is not a &amp;quot;get out of jail free&amp;quot; card.&lt;/p&gt;
&lt;p&gt;As a manager, you still need results. Deadlines still exist. The company is looking to you to deliver. Treating employees as people does not change that - it gives you a better way to lead through it.&lt;/p&gt;
&lt;p&gt;If an employee wakes up with a flat tire and arrives late, the key question is not &amp;quot;Why are you late?&amp;quot; It is &amp;quot;Will this impact deliverables?&amp;quot;&lt;/p&gt;
&lt;p&gt;If it will, how can you reallocate resources to keep things on track? Maybe another employee has been looking for a chance to stretch. Maybe someone else wants exposure to a different project. You can only make those decisions if you understand your people.&lt;/p&gt;
&lt;p&gt;Now think about the employee with the flat tire. It is stressful. It is frustrating. You would probably appreciate a little flexibility to fix the problem and move on. Offer that time. Let them resolve the issue quickly so they can return focused and productive.&lt;/p&gt;
&lt;p&gt;That is what you actually want: problems resolved in a way that still allows the team to deliver.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A welcome side effect of this approach is trust. Trust leads to loyalty - to you, to the team, and sometimes to the company. And the next time someone else needs help, that employee is far more likely to pay it forward.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;A Word of Caution&lt;/h2&gt;
&lt;p&gt;Treating employees as people is critical - but remember that you are still the manager.&lt;/p&gt;
&lt;p&gt;You will write performance reviews. You will adjust compensation. You may have to let someone go. There may be reorganizations that move people across teams. If you get too close, these moments can create real legal and organizational risk.&lt;/p&gt;
&lt;p&gt;You are not their friend. You are their manager.&lt;/p&gt;
&lt;p&gt;Empathy and humanity will help you lead through change, but crossing fully into the &amp;quot;friend zone&amp;quot; should be avoided. You do not need to enforce hierarchy - but you do need to maintain a healthy, professional distance.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Web Component Template</title>
      <link href="https://kevinhoyt.com/blog/2026/01/09/component-template/"/>
      <updated>2026-01-09T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/01/09/component-template/</id>
      <summary>Web Components get a bad rap. They are often described as too long, too verbose, or burdened with boilerplate. I recently had ChatGPT migrate the “label” component from the previous post to React. The result was less readable and nearly twice as long. Between recurring React security issues and the...</summary>
      <content type="html">&lt;p&gt;Web Components get a bad rap. They are often described as too long, too verbose, or burdened with boilerplate. I recently had ChatGPT migrate the “label” component from the previous &lt;a href=&quot;https://kevinhoyt.com/blog/2026/01/05/label-component/&quot;&gt;post&lt;/a&gt; to React. The result was less readable and nearly twice as long. Between recurring React security issues and the latest &amp;quot;Tailwind is dead&amp;quot; discourse, the ecosystem feels noisier than ever.&lt;/p&gt;
&lt;p&gt;While there are a number of different ways to leverage the various standards that make up Web Components, I like a Shadow DOM implementation that leans on composability wherever possible - especially via slots, parts, and predictable APIs. My component template is pretty dialed in. I have built hundreds of components this way, and it is the approach I keep coming back to.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I have implemented applications with Light DOM as well, and never quite developed a workflow I liked. Perhaps as somebody that has built applications with technologies like Java Swing and Visual Basic, the Shadow DOM approach just resonates more with me.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Top and Bottom&lt;/h2&gt;
&lt;p&gt;The opening line of the template extends the &lt;code&gt;HTMLElement&lt;/code&gt; class. This is standard for Web Components. For the name of the subclass, I like to use the prefix I intend to use for the component, followed by a name that describes the component. For example, a button component with the &lt;code&gt;kh-&lt;/code&gt; prefix would become &lt;code&gt;KhButton&lt;/code&gt;. In this post, we will use &lt;code&gt;KhTemplate&lt;/code&gt; as a generic example.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;KhTemplate&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HTMLElement&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-template&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; KhTemplate &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The last line of the template wires up the subclass to the element name. The prefix must be present. The most common prefix is generally two or three letters, but I have seen complete words, and even multiple words used as a prefix (for example &lt;code&gt;solar-system-sun&lt;/code&gt;, &lt;code&gt;solar-system-earth&lt;/code&gt;). My guidance would be to use whatever makes resulting code most readable. Consistency is key.&lt;/p&gt;
&lt;h2&gt;Constructor&lt;/h2&gt;
&lt;p&gt;The first part of the constructor defines the styles and markup that make up the component. I generally include a &lt;code&gt;:host&lt;/code&gt; CSS block that contains at least &lt;code&gt;box-sizing: border-box&lt;/code&gt;, &lt;code&gt;display: inline-block&lt;/code&gt;, and &lt;code&gt;position: relative&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;box-sizing&lt;/code&gt; model helps make the layout more predictable. The &lt;code&gt;display&lt;/code&gt; can be whatever you need, I prefer to specify it for consistency and maintainability. The relative &lt;code&gt;position&lt;/code&gt; comes in handy when you need to absolutely position something inside the component like a tooltip or &lt;code&gt;::after&lt;/code&gt; content.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; template &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;template&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* template */&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
    &amp;lt;style&gt;
      :host {
        box-sizing: border-box;
        display: inline-block;
        position: relative;
      }
    &amp;lt;/style&gt;
    &amp;lt;p part=&quot;label&quot;&gt;Hello world!&amp;lt;/p&gt;
  &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I also like to include the &lt;code&gt;part&lt;/code&gt; attribute whenever I think the element may need to be styled by the developer. I find that if I am reaching for &lt;code&gt;id&lt;/code&gt; or &lt;code&gt;class&lt;/code&gt; to be able to reference the element, then I should probably just use a &lt;code&gt;part&lt;/code&gt; name. This makes the part stylable, and easy to reference with &lt;code&gt;querySelector()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The second part of the constructor is declaring everything the component needs. I start with properties, and have specific default values I like to use. I also use the underscore (&lt;code&gt;_&lt;/code&gt;) character to denote that these are &amp;quot;private&amp;quot;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Properties&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anObject &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
&lt;span class=&quot;token comment&quot;&gt;// Events&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onComponentClick &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;onComponentClick&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Root&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attachShadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cloneNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Elements&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$label &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;p[part=label]&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Most components handle some form of events internally. Here is where we declare those events. I use &lt;code&gt;bind()&lt;/code&gt; so that they are also easily removed. Events get wired up later in the &lt;code&gt;connectedCallback()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;Next, we stamp out the template by attaching it to the component’s &lt;code&gt;shadowRoot&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally, any element references you will need during the life of the component. I like to use &lt;code&gt;$&lt;/code&gt; to indicate that this property refers to an element. This allows me to have a property &lt;code&gt;this._label&lt;/code&gt; align with an element &lt;code&gt;this.$label&lt;/code&gt; to make things more readable.&lt;/p&gt;
&lt;h2&gt;Event Handlers&lt;/h2&gt;
&lt;p&gt;After the constructor, I will define any of the events I referenced inside the constructor.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token function&quot;&gt;onComponentClick&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;evt&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dispatchEvent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CustomEvent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-event&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token literal-property property&quot;&gt;bubbles&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token literal-property property&quot;&gt;cancelable&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token literal-property property&quot;&gt;composed&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token literal-property property&quot;&gt;detail&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token string-property property&quot;&gt;&#39;abc&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;123&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I do not generally like to rely on bubbling - either of native events or events that my components dispatch. If there is a &lt;code&gt;button&lt;/code&gt; element inside my component, I will attach a click handler inside the component and in turn have the component dispatch something more relevant - even if it is just an &lt;code&gt;kh-click&lt;/code&gt;. Whenever I use my components then, I always listen for the component specific event.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I like to think that this makes the event handling easier to follow, and that it avoids any collision with other components I may be using (especially in a composable manner). In practice, I have never encountered any problems getting the right event from the right component.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Rendering Content&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;_render()&lt;/code&gt; method is where I update the elements within the component based on changes to attributes or properties. If the changes come from attribute changes, I will reference those access methods directly. If the changes are coming from property changes, then I will reference the internal property such as &lt;code&gt;this._value&lt;/code&gt; directly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Never set an attribute or property of the component itself from inside the &lt;code&gt;_render()&lt;/code&gt; method. This will result in an infinite loop.&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// When attributes change&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;_render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;aString &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;aString&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the case of something like a calendar component, where there are ~50 elements inside the component, this method definition can get pretty lengthy. Think of this as working with a scalpel, not a virtual DOM. You can set the &lt;code&gt;textContent&lt;/code&gt; of the &lt;code&gt;this.$label&lt;/code&gt; instance repeatedly without a performance impact.&lt;/p&gt;
&lt;h2&gt;The Upgrade&lt;/h2&gt;
&lt;p&gt;Depending on how your component is used, property values may be assigned before the component has had a chance to initialize. If this happens, any property values that were assigned will become &lt;code&gt;undefined&lt;/code&gt;. To get around this, as part of the initialization, I leverage a method named &lt;code&gt;_upgrade()&lt;/code&gt;. We will see this more in a moment.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Promote properties&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Values may be set before module load&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;property&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasOwnProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; property &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;delete&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;_upgrade()&lt;/code&gt; method checks for the existence of a property value. If it exists, that property is referenced to a local value. The property value itself is then deleted, and then immediately set with the local value. This ensures that any properties assigned before upgrade are properly re-applied once the component is fully initialized.&lt;/p&gt;
&lt;h2&gt;Connect and Disconnect&lt;/h2&gt;
&lt;p&gt;When a component is attached to the DOM, it calls the &lt;code&gt;connectedCallback()&lt;/code&gt; method. This is where you can wire up your events, and perform an initial render. When the component is removed from the DOM, it calls the &lt;code&gt;disconnectedCallback()&lt;/code&gt; method. This is where you want to remove any event handlers.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Setup&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;connectedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onComponentClick &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;anArray&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;      
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aBoolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aDate&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;    
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aFloat&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;      
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;anInteger&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;            
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;anObject&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;    
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aString&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; 
  
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Set down&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;disconnectedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onComponentClick &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is where the &lt;code&gt;_upgrade()&lt;/code&gt; method shows up. You should apply the upgrade to all attribute and property values that are exposed externally. Now that we are sure the state of the component is what the developer expected, we can call &lt;code&gt;_render()&lt;/code&gt; to place all the values in the component DOM.&lt;/p&gt;
&lt;h2&gt;Attributes&lt;/h2&gt;
&lt;p&gt;We are almost done implementing our web component. We have attributes and properties remaining.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;observedAttributes()&lt;/code&gt; method is part of the specification that tells the component what attributes might change at runtime. This means that if you set a &lt;code&gt;data-id&lt;/code&gt; attribute on the element at runtime, and the &lt;code&gt;data-id&lt;/code&gt; attribute is not declared in &lt;code&gt;observedAttributes()&lt;/code&gt;, then no updates will happen to the component - the attribute is not registered - and that may be what is desired.&lt;/p&gt;
&lt;p&gt;A &amp;quot;label&amp;quot; component on the other hand will likely have a &lt;code&gt;text&lt;/code&gt; attribute. We expect the internal DOM of the component to be updated when that attribute is added, changed, or removed. For this change to happen, we need to tell the component about the attribute.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We do not need to list properties here - they are handled directly via their setters.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Watched attributes&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;observedAttributes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;    
    &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;    
    &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Observed attribute has changed&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Update render&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;attributeChangedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; old&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When an attribute is changed, the &lt;code&gt;_render()&lt;/code&gt; method is called to update the DOM. This may look different than some other component implementations you may have seen. This is because in this implementation, some property changes may change the DOM as well. Rather than have that code in multiple places, it gets centralized in the &lt;code&gt;_render()&lt;/code&gt; method.&lt;/p&gt;
&lt;h2&gt;Properties&lt;/h2&gt;
&lt;p&gt;Technically attributes can only be strings. We will add some syntactic sugar in a moment to be able to handle basic types such as integers, floats, and booleans. There are times however when you really need to pass an object to the component. That is where properties come into play.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I have specific signatures I like to use for my properties. I will declare them in the constructor with a default value, and assign them there for any runtime changes.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Properties&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Not reflected&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Array, Date, Object, null&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anArray&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anArray&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anObject&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anObject &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;structuredClone&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;    &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Properties are defined using access methods. When working with them at runtime, they take on the same look at when working with attributes (&lt;code&gt;label.text = &#39;Hello world.&#39;&lt;/code&gt;). Regardless of properties or attributes, I force the default to &lt;code&gt;null&lt;/code&gt; for consistency (with the exception of boolean attributes). I also assign by value, and return by reference by convention across all of my components. These conventions keep everything consistent.&lt;/p&gt;
&lt;p&gt;In order to keep the consistency for attributes, and in order to add that syntactic sugar to handle specific data types, we also implement access methods for attributes.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Attributes&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Reflected&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;// Boolean, Float, Integer, String, null&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aBoolean&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aBoolean&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;typeof&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      value &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;false&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anInteger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anInteger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;        &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These attribute access methods handle the updates to the attributes themselves (a technique commonly called &amp;quot;attribute reflection&amp;quot;). When the attribute access methods are invoked, they will in turn trigger the &lt;code&gt;attributeChangedCallback()&lt;/code&gt; method, which will in turn call the &lt;code&gt;_render()&lt;/code&gt; function to update the internal DOM as necessary.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note that the naming convention used in these code snippets is designed to indicate a specific data type. You will want to update/use these snippets to map to your specific API surface. For example, if you have &lt;code&gt;text&lt;/code&gt; attribute, then you would implement the &lt;code&gt;aString()&lt;/code&gt; access methods, but name the methods &lt;code&gt;text()&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Next Steps&lt;/h2&gt;
&lt;p&gt;I will place the entire template below for reference. You can also find it as a &lt;a href=&quot;https://gist.github.com/krhoyt/c0fbb7ad1fbb1bdf8e808115e6d62487&quot;&gt;GitHub Gist&lt;/a&gt;. I have implemented hundreds of components using this approach, and deployed them in production applications such as &lt;a href=&quot;https://annoawesome.com/&quot;&gt;Anno Awesome&lt;/a&gt; and &lt;a href=&quot;https://flavorawesome.com/&quot;&gt;Flavor Awesome&lt;/a&gt;. If you are looking for more examples, check out my Vanilla JS implementations of &lt;a href=&quot;https://github.com/krhoyt/Rainforest&quot;&gt;Amazon Cloudscape&lt;/a&gt; and &lt;a href=&quot;https://github.com/krhoyt/Graphene&quot;&gt;IBM Carbon&lt;/a&gt; for more examples.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;KhTemplate&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HTMLElement&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; template &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;template&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* template */&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
      &amp;lt;style&gt;
        :host {
          box-sizing: border-box;
          display: inline-block;
          position: relative;
        }

        :host( [a-boolean] ) {
          display: none;
        }
        
        hoyt-component::part( inner ) {
          --component-stylet: var( --my-component-style, #123456 );
        }
      &amp;lt;/style&gt;
      &amp;lt;hoyt-component exportparts=&quot;inner: outer&quot; part=&quot;also-outer&quot;&gt;&amp;lt;/hoyt-component&gt;
    &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;// Properties&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anObject &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;// Consider for mobile&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_touch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;ontouchstart&#39;&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;documentElement &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;touchstart&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Events&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onComponentClick &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;onComponentClick&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Root&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attachShadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cloneNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token comment&quot;&gt;// Elements&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$component &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;element-name&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token function&quot;&gt;onComponentClick&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;evt&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;dispatchEvent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;CustomEvent&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-event&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token literal-property property&quot;&gt;bubbles&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;token literal-property property&quot;&gt;cancelable&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;token literal-property property&quot;&gt;composed&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;token literal-property property&quot;&gt;detail&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token string-property property&quot;&gt;&#39;abc&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;123&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

   &lt;span class=&quot;token comment&quot;&gt;// When attributes change&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;_render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$component&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;aBoolean &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;aInteger &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;// Promote properties&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Values may be set before module load&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;property&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasOwnProperty&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; property &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;delete&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;property&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;// Setup&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;connectedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$component&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onComponentClick &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;anArray&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;      
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aBoolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aDate&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;    
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aFloat&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;      
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;anInteger&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;            
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;anObject&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;    
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_upgrade&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;aString&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; 
    
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token comment&quot;&gt;// Set down&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;diconnectedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$component&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;click&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;onComponentClick &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;// Watched attributes&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;observedAttributes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
      &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;    
      &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;    
      &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token comment&quot;&gt;// Observed attribute has changed&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Update render&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;attributeChangedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; old&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;_render&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; 
  
  &lt;span class=&quot;token comment&quot;&gt;// Properties&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Not reflected&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Array, Date, Object, null&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anArray&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anArray&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anArray &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;...&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anObject&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anObject&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_anObject &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;structuredClone&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;    

  &lt;span class=&quot;token comment&quot;&gt;// Attributes&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Reflected&lt;/span&gt;
  &lt;span class=&quot;token comment&quot;&gt;// Boolean, Float, Integer, String, null&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aBoolean&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aBoolean&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;typeof&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        value &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

      &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;false&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anInteger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anInteger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  
  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-string&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;        
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-template&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; KhTemplate &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content>
    </entry>
    
    <entry>
      <title>The Unsung UI Control: Label</title>
      <link href="https://kevinhoyt.com/blog/2026/01/05/label-component/"/>
      <updated>2026-01-06T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2026/01/05/label-component/</id>
      <summary>Whenever I start designing a new UI, inevitably, one of the first components I create is a Label component. You might think that the Label is unnecessary because that is what the paragraph element (p) does. And you would be partly correct. But then you have likely seen an Input element or a Checkbox...</summary>
      <content type="html">&lt;p&gt;Whenever I start designing a new UI, inevitably, one of the first components I create is a &lt;code&gt;Label&lt;/code&gt; component. You might think that the &lt;code&gt;Label&lt;/code&gt; is unnecessary because that is what the paragraph element (&lt;code&gt;p&lt;/code&gt;) does. And you would be partly correct. But then you have likely seen an &lt;code&gt;Input&lt;/code&gt; element or a &lt;code&gt;Checkbox&lt;/code&gt; element, and those are HTML native types as well (&lt;code&gt;input type=&amp;quot;text&amp;quot;&lt;/code&gt;, &lt;code&gt;input type=&amp;quot;checkbox&amp;quot;&lt;/code&gt;). Same with &lt;code&gt;Button&lt;/code&gt;,  &lt;code&gt;TextArea&lt;/code&gt;, and others.&lt;/p&gt;
&lt;p&gt;When you think about wrapper components like &lt;code&gt;Input&lt;/code&gt;, at a minimum they are adding functionality. In many cases component wrappers around native HTML elements will also be enforcing styling to the design system itself. With that in mind, let us take a look at how I approach building a &lt;code&gt;Label&lt;/code&gt; component.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The only design system I have seen do this implicitly is &lt;a href=&quot;https://cloudscape.design/&quot;&gt;Amazon Cloudscape&lt;/a&gt; with it&#39;s &lt;a href=&quot;https://cloudscape.design/components/box/&quot;&gt;Box&lt;/a&gt; component.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Foundations&lt;/h2&gt;
&lt;p&gt;I think Web Components have gotten a bad rap for being especially verbose and/or complex. This can certainly be true when you have data binding in frameworks such as Svelte, but you still need the basics in both - the CSS and the root element. From there it is a matter of extending the &lt;code&gt;HTMLElement&lt;/code&gt; class, and attaching the template to the DOM of the element.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This is the Shadow DOM approach. The alternative Light DOM approach also needs the root element and the CSS, though they will appear in different places. This is not an article about which is better. Context is key. For this example however, I will be focused on the Shadow DOM approach.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HoytLabel&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HTMLElement&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; template &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;template&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* template */&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
      &amp;lt;style&gt;
        :host {
          box-sizing: border-box;
          display: inline-block;
          position: relative;
        }

        p {
          color: var( --label-color, #161616 );
          font-family: &#39;Open Sans&#39;, sans-serif;
          font-size: var( --label-font-size, 16px );
          font-weight: var( --label-font-weight, 400 );
          letter-spacing: var( --label-letter-spacing, 0.10px );
          line-height: var( --label-line-height, 24px );
          margin: var( --label-margin, 0 );
          padding: var( --label-padding, 0 );
          width: var( --label-width, 100% );
        }
      &amp;lt;/style&gt;
      &amp;lt;p part=&quot;label&quot;&gt;
        &amp;lt;slot&gt;&amp;lt;/slot&gt;
      &amp;lt;/p&gt;
    &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;// Root&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attachShadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cloneNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-label&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; HoytLabel &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have included CSS variables for the paragraph element. Each of these set a default value for their respective style property. This is my approach. You might alternatively be inclined to use CSS &lt;code&gt;:root&lt;/code&gt; in your main CSS file, and define these variables there.&lt;/p&gt;
&lt;p&gt;When I think of a Svelte component, as an example, the styles are included in the same &lt;code&gt;*.svelte&lt;/code&gt; file. I like that the element and the styles are together, so I keep that approach in my components. I also like my styles to be closer to the component so that I do not have to go looking around to other files. I have also found that when using components, I want to nudge them slightly here or there. I like to do that nudging closer to the declaration to avoid inadvertant cascading.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Some design systems lock down the styles that can be used to force consistency across a large organization (again, see Amazon Cloudscape).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The component implementation here includes a &lt;code&gt;slot&lt;/code&gt; element. Anything placed inside the component declaration will show up there - between the &lt;code&gt;p&lt;/code&gt; tags. The component is used (at this point) as follows.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world!&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Adding Functionality&lt;/h2&gt;
&lt;p&gt;For almost every component I implement, I include a &lt;code&gt;hidden&lt;/code&gt; attribute. The &lt;code&gt;hidden&lt;/code&gt; attribute already exists in HTML, but when you are building custom elements, you need to decide how (or if) it should be implemented. When I use &lt;code&gt;hidden&lt;/code&gt;, I want the element to be removed from the DOM. In CSS terms, that is the &lt;code&gt;display: none&lt;/code&gt; property.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HoytLabel&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HTMLElement&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; template &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;template&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* template */&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
      &amp;lt;style&gt;
        :host {
          box-sizing: border-box;
          display: inline-block;
          position: relative;
        }

        :host( [hidden] ) {
          display: none;
        }

        p {
          color: var( --label-color, #161616 );
          font-family: &#39;Open Sans&#39;, sans-serif;
          font-size: var( --label-font-size, 16px );
          font-weight: var( --label-font-weight, 400 );
          letter-spacing: var( --label-letter-spacing, 0.10px );
          line-height: var( --label-line-height, 24px );
          margin: var( --label-margin, 0 );
          padding: var( --label-padding, 0 );
        }
      &amp;lt;/style&gt;
      &amp;lt;p part=&quot;label&quot;&gt;
        &amp;lt;slot&gt;&amp;lt;/slot&gt;
      &amp;lt;/p&gt;
    &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;// Root&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attachShadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cloneNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-label&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; HoytLabel &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the style block of the component, we use the &lt;code&gt;:host()&lt;/code&gt; selector to apply styling when a &lt;code&gt;hidden&lt;/code&gt; attribute is present in the component instance. We can then make the component hidden using:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Easy enough. Another attribute I like to add is &lt;code&gt;concealed&lt;/code&gt; which toggles the CSS &lt;code&gt;visibility&lt;/code&gt; property for the times I do not want to remove the element from the DOM, but just make it invisible.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:host( [concealed] )&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;visibility&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;concealed&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sometimes you want text to be truncated with an ellipsis (by default in this configuration text will wrap). For this, we can implement a &lt;code&gt;truncate&lt;/code&gt; attribute, that gets applied to the contained paragraph element.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:host( [truncate] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; hidden&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;text-overflow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; ellipsis&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;  
  &lt;span class=&quot;token property&quot;&gt;white-space&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; nowrap&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt; &lt;span class=&quot;token special-attr&quot;&gt;&lt;span class=&quot;token attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token value css language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 150px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;truncate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world, or some other really long greeting.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nice! Now we are having some fun. Let us keep going.&lt;/p&gt;
&lt;p&gt;While you can style the &lt;code&gt;Label&lt;/code&gt; component using the CSS variables, some design systems may not want to leave the options that wide open. They still recognize that there will be different style choices in different contexts, but they do not want developers departing from the system (prescribed look and feel). A happy middle ground here is to supply attributes that style the element, but do so within a range of fixed possibilities.&lt;/p&gt;
&lt;p&gt;Take the font color for example. Design systems will have already decided what the default color will be (usually slightly off-black). What if you want to use the &lt;code&gt;Label&lt;/code&gt; component in an error situation? You will most likely want to change the font color to some variation of red. In a design system, that variation of red will already have been determined for you. In this fashion, any time an error is presented, across any of the applications using the design system, will show the same color of red. This means that rather than add a &lt;code&gt;color&lt;/code&gt; attribute that takes any color value, that color reflects usage. It is that usage that is assigned to the &lt;code&gt;color&lt;/code&gt; attribute - and by extension helps to describe the usage of the component instance in the code.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:host( [disabled] ) p, :host( [color=disabled] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #656871&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [color=error] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #db0000&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [color=info] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #006ce0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [color=success] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #00802f&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [color=warning] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #855900&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same approach is often used for font sizing and font-weight.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:host( [size=&#39;body-xs&#39;] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 12px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 16px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [size=&#39;body-sm&#39;] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 14px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [size=&#39;heading-xs&#39;] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 16px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [size=&#39;heading-sm&#39;] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 18px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token property&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 22px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token selector&quot;&gt;:host( [weight=light] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token selector&quot;&gt;:host( [weight=bold] ) p&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 700&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;error&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;body-xs&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;weight&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;bold&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is where having a &lt;code&gt;Label&lt;/code&gt; component in your design system really starts to shine as compared to using a paragraph element. The API of the component can inform developers of the expected usage, while at the same time ensuring consistency. Think of the 200+ products offerred by Amazon Web Services. Each has it&#39;s own team of developers. Each has it&#39;s own UX/UI needs. Yet (like them or not) they all look the same.&lt;/p&gt;
&lt;h2&gt;Extending Functionality&lt;/h2&gt;
&lt;p&gt;Up to this point we have been adding attributes and applying corresponding styles all with CSS - no additional JavaScript code needed. With this approach, if you want an attribute to be updated dynamically, you would have to use the &lt;code&gt;setAttribute()&lt;/code&gt; method.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; label &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-label&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;weight&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;bold&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Or to remove&lt;/span&gt;
label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;weight&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you directly set &lt;code&gt;label.weight = &#39;bold&#39;&lt;/code&gt;, then no changes to the label will appear to take place. There is work being done - a property called &lt;code&gt;weight&lt;/code&gt; is being set on the &lt;code&gt;Label&lt;/code&gt; instance. Just like any JavaScript object, you can apply random properties all you want. They will not do anything, but you can apply them.&lt;/p&gt;
&lt;p&gt;To get at the root cause of this behavior, we have to think a little more critically about what it is that we are trying to accomplish with the use of &lt;code&gt;label.weight = &#39;bold&#39;&lt;/code&gt;. What we really want to happen is for the attribute &lt;code&gt;weight&lt;/code&gt; to be added to the component instance, and the value of &lt;code&gt;bold&lt;/code&gt; to be assigned to that attribute. This will in turn trigger the CSS styles.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note the distinction here between setting a property and setting an attribute.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When we want a Web Component property and attribute to have the same behavior, that is called reflection. To get basic reflection, we add access methods (get/set) to the component, and have those methods update the attributes accordingly.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HoytLabel&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HTMLElement&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token function&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; template &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;template&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;innerHTML &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token comment&quot;&gt;/* template */&lt;/span&gt; &lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;
      &amp;lt;style&gt;
        :host {
          box-sizing: border-box;
          display: inline-block;
          position: relative;
        }

        :host( [concealed] ) {
          visibility: hidden;
        }

        :host( [hidden] ) {
          display: none;
        }

        :host( [truncate] ) p {
          overflow: hidden;
          text-overflow: ellipsis;          
          white-space: nowrap;
        }

        p {
          color: var( --label-color, #161616 );
          font-family: &#39;Open Sans&#39;, sans-serif;
          font-size: var( --label-font-size, 16px );
          font-weight: var( --label-font-weight, 400 );
          letter-spacing: var( --label-letter-spacing, 0.10px );
          line-height: var( --label-line-height, 24px );
          margin: var( --label-margin, 0 );
          padding: var( --label-padding, 0 );
        }

        :host( [disabled] ) p, :host( [color=disabled] ) p {color: #656871;}
        :host( [color=error] ) p {color: #db0000;}
        :host( [color=info] ) p {color: #006ce0;}
        :host( [color=success] ) p {color: #00802f;}
        :host( [color=warning] ) p {color: #855900;}
        
        :host( [size=&#39;body-xs&#39;] ) p {font-size: 12px; line-height: 16px;}
        :host( [size=&#39;body-sm&#39;] ) p {font-size: 14px; line-height: 20px;}
        :host( [size=&#39;heading-xs&#39;] ) p {font-size: 16px; line-height: 20px;}
        :host( [size=&#39;heading-sm&#39;] ) p {font-size: 18px; line-height: 22px;}

        :host( [weight=light] ) p {font-weight: 300;}
        :host( [weight=bold] ) p {font-weight: 600;}        
        :host( [weight=heavy] ) p {font-weight: 700;}        
      &amp;lt;/style&gt;
      &amp;lt;p part=&quot;label&quot;&gt;
        &amp;lt;slot&gt;&amp;lt;/slot&gt;
      &amp;lt;/p&gt;
    &lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;token comment&quot;&gt;// Root&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;attachShadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token literal-property property&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;open&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; template&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;content&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;cloneNode&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;weight&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;weight&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;weight&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;weight&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;weight&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;  
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

window&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-label&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; HoytLabel &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is not as slick as data binding with a Svelte rune, but it also does not add much complexity. One set of access methods per reflected property. You can also add a bit of syntactic sugar in these accessors to handle primitive types more gracefully.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;// Boolean&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aBoolean&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aBoolean&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;typeof&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      value &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;false&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-boolean&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Float&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aFloat&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;a-float&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;// Integer&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anInteger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;hasAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;parseInt&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;anInteger&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;removeAttribute&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;an-integer&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These also have the nice side effect of presenting a &lt;code&gt;null&lt;/code&gt; value when the attribute/property is not set.&lt;/p&gt;
&lt;p&gt;Web Component attributes cannot be complex objects, but that does not mean that properties cannot. If you want to handle a &lt;code&gt;Date&lt;/code&gt; object for example, you can add access methods. The implementation of those methods will change the internal state, and update the component.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token keyword&quot;&gt;set&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;aDate&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;_aDate &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For now though, let us get back to our label.&lt;/p&gt;
&lt;p&gt;Web Components having slots is important for composition of content - just as most HTML elements can contain other markup. In the case of a &lt;code&gt;Label&lt;/code&gt; the content might be a long form description. An actual paragraph would be hard to read as an attribute. There are times however when the content you want the label to display is relatively short - most application labels come to mind.&lt;/p&gt;
&lt;p&gt;If you are inclined to add an access method for a &lt;code&gt;text&lt;/code&gt; attribute, then you are on the right path.&lt;/p&gt;
&lt;p&gt;We also need to observe the changes to that attribute using the Web Components API, and apply changes where we want. In the case of the paragraph element, that looks something like:&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;observedAttributes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;token string&quot;&gt;&#39;text&#39;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;token function&quot;&gt;attributeChangedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token parameter&quot;&gt;name&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; old&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; value&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token keyword&quot;&gt;switch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; name &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;token keyword&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;text&#39;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt;
      &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;$label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;textContent &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; value &lt;span class=&quot;token operator&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;        
      &lt;span class=&quot;token keyword&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You have to be careful here, though. If &lt;code&gt;this.$label&lt;/code&gt; points to the &lt;code&gt;p&lt;/code&gt; element, setting the &lt;code&gt;textContent&lt;/code&gt; will remove the &lt;code&gt;slot&lt;/code&gt; element. While that works, it is not particularly friendly. We want to allow developers to use &lt;code&gt;text&lt;/code&gt; as an attribute and a property, but also compose the content should they so desire.&lt;/p&gt;
&lt;p&gt;What I like to do here is put a &lt;code&gt;span&lt;/code&gt; inside the &lt;code&gt;p&lt;/code&gt;, and have &lt;code&gt;this.$label&lt;/code&gt; point to the &lt;code&gt;span&lt;/code&gt;. If you want things really tidy, you can even add a splash more CSS to hide the &lt;code&gt;span&lt;/code&gt; if there is no &lt;code&gt;text&lt;/code&gt; property.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;:host( :not( [text] ) ) span&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Okay, but what does all of this have to do with a &lt;code&gt;Label&lt;/code&gt; component in a design system?&lt;/p&gt;
&lt;p&gt;If I set the &lt;code&gt;text&lt;/code&gt; property, I treat that as a signal that the component will be updated dynamically at runtime. If the text content is composed (inside the component markup), then that is a signal that the content will not change at runtime.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Will not change --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Hello world.&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;token comment&quot;&gt;&amp;lt;!-- Will change at runtime --&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;kh-label&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Hello world.&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;kh-label&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This becomes manifest in the code as well. I am never thinking &amp;quot;Should I be using &lt;code&gt;textContent&lt;/code&gt; here?&amp;quot; Programmatically, it is always &lt;code&gt;label.text&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; label &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; document&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;kh-label&#39;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
label&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;text &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token string&quot;&gt;&#39;Hello, Kevin.&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I use this pattern throughout my components. I lean on composability where possible, but if an element is going to change at runtime, I provide a means to use a property (without damaging slotted content if I can help it). With a &lt;code&gt;Button&lt;/code&gt; component as an example, I provide a &lt;code&gt;label&lt;/code&gt; property that can be set dynamically at runtime. If I am reading the markup, and the &lt;code&gt;Button&lt;/code&gt; component has text content between the opening and closing tags, then the label of that button will not be changing at runtime. When I am updating the label of a button at runtime, I always use &lt;code&gt;Button.label&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Next Steps&lt;/h2&gt;
&lt;p&gt;Where this really starts to get interesting is in more complex controls such as a list. Differentiating a &lt;code&gt;Button&lt;/code&gt; from a &lt;code&gt;Link&lt;/code&gt; and presenting an anchor element in place of the button element when an &lt;code&gt;href&lt;/code&gt; attribute is present is another fun example. I will cover these in future posts. Until then, feel free to check out my complete Web Component template on &lt;a href=&quot;https://gist.github.com/krhoyt/c0fbb7ad1fbb1bdf8e808115e6d62487&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
    </entry>
    
    <entry>
      <title>Warp Test Drive</title>
      <link href="https://kevinhoyt.com/blog/2025/10/21/warp-test-drive/"/>
      <updated>2025-10-21T00:00:00Z</updated>
      <id>https://kevinhoyt.com/blog/2025/10/21/warp-test-drive/</id>
      <summary>Is it vibe coding or vibe debugging? Is AI assisting you or making you lazy? Is the industry shutting out junior developers or making them more productive more quickly? These are hard, often philosophical questions. Once thing is sure however - AI is here to stay. Refusing to acknowledge AI, and to...</summary>
      <content type="html">&lt;p&gt;Is it vibe coding or vibe debugging? Is AI assisting you or making you lazy? Is the industry shutting out junior developers or making them more productive more quickly? These are hard, often philosophical questions. Once thing is sure however - AI is here to stay. Refusing to acknowledge AI, and to learn how to use it for your workflow(s), is putting your head in the sand and ignoring the inevitable.&lt;/p&gt;
&lt;p&gt;That is where my experiment with Warp began - somewhere between curiosity and skepticism.&lt;/p&gt;
&lt;h2&gt;Some Background&lt;/h2&gt;
&lt;p&gt;I first got to work with AI back in 2017 while at IBM. Back then we did not really refer to it as AI as much as machine learning (ML, or AI/ML at best). IBM Watson provided various ML-oriented services, and we developer advocates were first on the ground to teach other developers how to use those services. This included everything from transcription and sentiment analysis to image recognition, and even building custom models.&lt;/p&gt;
&lt;p&gt;Fast forward to 2022 while at Amazon where I managed the documentation team focused on &lt;a href=&quot;https://aws.amazon.com/sagemaker/&quot;&gt;SageMaker&lt;/a&gt; (custom ML models). Of course ChatGPT launched in 2022 as well, and generative AI in general began its explosive adoption rate. Technical writers generate text, too, so we were very interested in what these new tools could do for us. We were not about to send documentation for unreleased product to a public API, but when &lt;a href=&quot;https://aws.amazon.com/bedrock&quot;&gt;Amazon Bedrock&lt;/a&gt; was released, providing data protections, we jumped at the opportunity.&lt;/p&gt;
&lt;p&gt;With collaboration and input from a team of technical writers, I built tooling that leveraged generative AI from the ground up to see what we could do. Ownership was eventually handed off to an engineering team who scaled the project across the 200+ organization of writers.&lt;/p&gt;
&lt;p&gt;More recently, in a freelance capacity, I have gone deeper into generative AI for my customers. This work has included vector and graph databases against custom datasets, as well as agentic tooling such as &lt;a href=&quot;https://n8n.io/&quot;&gt;n8n&lt;/a&gt;. Along the way, I have used ChatGPT and Claude Code extensively to help me with complex algorithms, and even to scaffold projects and features.&lt;/p&gt;
&lt;p&gt;I have a lot of opinions on my exposure to all these technologies, but that is not the point of all this background. The point is that I have a broad experience with both generative AI as well as ML, both from a user and implementation perspective. I recently had the opportunity to bring that significant practical experience to kick the tires on &lt;a href=&quot;https://www.warp.dev/&quot;&gt;Warp’s Agentic Development Environment&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Full disclosure, I am actively seeking new work. If you find any of this background inline with what you need for your organization, then feel free to reach out on &lt;a href=&quot;https://www.linkedin.com/in/parkerkrhoyt/&quot;&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Moving at Warp Speed&lt;/h2&gt;
&lt;p&gt;Warp calls itself an ‘agentic development environment’ - which means it does not just execute your commands, it helps you decide what to do next.&lt;/p&gt;
&lt;p&gt;Warp surfaces as a replacement for your terminal. Warp allows you to interact with the command line like you would with any other terminal. When Warp detects natural language it switches out to a generative mode. The default settings choose a model and approach that is most efficient, but you can choose your own adventure as well for those times you need more reasoning from the model. Features and settings abound to let you customize how Warp interacts with both you the developer, and the underpinning models.&lt;/p&gt;
&lt;h2&gt;Hiring Challenge&lt;/h2&gt;
&lt;p&gt;To get started, I used the Warp &amp;quot;&lt;a href=&quot;https://github.com/warpdotdev/hiring-challenge&quot;&gt;hiring challenge&lt;/a&gt;&amp;quot;. The hiring challenge presents you with a data file of space missions. The data file weighs in at over 9 Mb, and contains over 100,000 missions. The columns for each data row are separated by a pipe &lt;code&gt;|&lt;/code&gt; symbol, but there are comments and other labels in there to keep things interesting. The objective, as outlined in the &lt;a href=&quot;https://github.com/warpdotdev/hiring-challenge/blob/main/mission_challenge.md&quot;&gt;challenge description&lt;/a&gt; is to use Warp to generate an AWK command to parse the data file and determine the security code of the longest successful Mars mission.&lt;/p&gt;
&lt;p&gt;Here is the thing though... The description reads like a product requirements document (PRD). My first instinct then was to clone the repository and tell Warp to deliver on the PRD. This worked out well because when you first install and run Warp, and head off to start a new project, you will be given the opportunity to do just that - import a repository. Warp automatically read the PRD, and got to work on generating the AWK command. Along the way, it checked itself too, which is reassuring. A few minutes later, I had the command and the desired output.&lt;/p&gt;
&lt;p&gt;Well, um, that was easy. Suspiciously easy.&lt;/p&gt;
&lt;h2&gt;Going Deeper&lt;/h2&gt;
&lt;p&gt;While I have run across AWK before, I would never claim to be an expert in its syntax, so I asked Warp to generate a Node.js file that would complete the challenge. Again, a few minutes later, I had what I wanted in a language/syntax with which I was familiar.&lt;/p&gt;
&lt;p&gt;In reviewing the code, I found it to be complete and comprehensive. It was not quite what I would have written myself, but I appreciated the nod to async/callback processing given the size of the data file. I ran the script and was presented with the same answer as the AWK command.&lt;/p&gt;
&lt;p&gt;At this point, I had clicked a few buttons, and run a few commands - easily toggling between natural language and classic CLI along the way. I had spent about thirty minutes (including the install and sign up), and had set aside an afternoon. Time to ratchet things up a notch.&lt;/p&gt;
&lt;h2&gt;More Complexity&lt;/h2&gt;
&lt;p&gt;If I really wanted the answer presented by the PRD, then I would import the data file into a database, and use the magic of SQL to dial in an answer. Okay, Warp, generate a Node.js file to put the missions into a SQLite database. And it did. It even installed a modern library to work with SQLite. I ran the script, and moments later had myself a nice little SQLite file. I opened up &lt;a href=&quot;https://tableplus.com/&quot;&gt;TablePlus&lt;/a&gt;, and ran some SQL. Yup, same answer. All systems go.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I do not know why, but I chose to write the SQL by hand myself. Old habits die hard? Scared of being confronted with the reality that the tool was killing what took me decades of experience to learn? Denial?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had not hit a roadblock yet with Warp. It had even gone above and beyond in some cases. It is not a real test until you have broken something, so time to get back at it. If I had a database, I figured I might as well take the next step and turn it into an REST API. I wanted to dial up the specificity a bit so I asked Warp to generate a serverless function to be deployed on &lt;a href=&quot;https://www.netlify.com/&quot;&gt;Netlify&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Warp did deliver a serverless function, and that function worked, but it was an older, non-ESM, implementation. It also did not take into consideration any CORS and/or bot handling. I did not ask Warp to do that, so not really a big miss, but it opened the door to push the edge a bit more. Rather than iterate through these changes, I pointed Warp to an example Netlify serverless function I had from another project. Warp adapted seamlessly.&lt;/p&gt;
&lt;p&gt;Okay. This is just too fun.&lt;/p&gt;
&lt;p&gt;Since I am ultimately looking for a specific answer, not just a data dump, we are going to need some sorting and filtering URL parameters. What say you, Warp? Yeah, no problem. I deployed and hit the API through the browser, added my sort and filter requirements, and just like that I had the same answer staring at me from the first row of the JSON results. Well, I guess the only thing left is a UI.&lt;/p&gt;
&lt;h2&gt;Home Sweet UI&lt;/h2&gt;
&lt;p&gt;Having spent 15 years at Adobe, most of that time spent teaching developers to implement cutting edge user interfaces (with Flash, Flex, and ultimately web standards across devices), user interface development and design is a bit of a sweet spot for me. It feels comfortable. It is the basis of what enabled me to build the generative AI tooling at Amazon. My first role at IBM was actually testing developer SDKs for completeness and idiomatic usage across Android (Java) and iOS (Swift).&lt;/p&gt;
&lt;p&gt;Svelte 5 makes for an interesting test for generative AI solutions. Svelte 5 was released just around the time of some of the major cut lines LLMs. Features have been added since then some LLMs simply do not know about. Also, I wanted to play with some of those new features myself, so I headed down the Svelte 5 path for this project.&lt;/p&gt;
&lt;p&gt;I implemented the UI myself, again wanting to experience these new features first hand, but I now found myself confidently asking Warp for code snippets whenever needed. Warp had become an ally. The assistance I asked Warp for ranged from building the REST URL dynamically from user interactions, to one-liners around media queries and other markup that I was too lazy to research myself.&lt;/p&gt;
&lt;p&gt;When I went to build the Svelte project, I needed to change the adapter for my static SPA approach. Warp handled that for me without a problem. &lt;a href=&quot;https://hire-me-warp.netlify.app/&quot;&gt;Check out&lt;/a&gt; the final results. The application is responsive, supports mobile, and includes sorting on columns, as well as status filtering.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://hire-me-warp.netlify.app/&quot;&gt;&lt;img src=&quot;https://kevinhoyt.com/img/assets/warp.test.drive.png&quot; alt=&quot;Space Missions&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;What Was Missing&lt;/h2&gt;
&lt;p&gt;I know that I barely touched the full capabilities of Warp. I will be honest, I was expecting it to bomb. It just kept getting better. Hindsight, if I had expected Warp to be this good, I probably would have just written PRDs for the various features I ended up building, and then had it generate the implementation. My experience with other generative AI tooling for developers had taught me that was a bad idea, so I went at the challenge piecemeal. I still got across the finish line, and in record time with a code base I trusted, but it would be an interesting experiment to try PRD-driven development.&lt;/p&gt;
&lt;p&gt;The feature I found that I wanted but that was not there is the ability to use local LLMs. There is a lot of really innovative work going on outside the big players. There are features provided by open source LLMs, such as image generation, that I think would really round out the experience. For enterprise or privacy-conscious workflows, such as the generative tooling I made at Amazon, local LLM support would be a game changer.&lt;/p&gt;
&lt;h2&gt;Final Thoughts&lt;/h2&gt;
&lt;p&gt;In the end, I did not really use the &amp;quot;agentic&amp;quot; aspect of Warp. Warp was fast enough, and complete enough, and accurate enough, and this project was small enough that it never really surfaced as a need. That being said, when I think of agentic workflows as presented by tooling such as n8n, I think there is a lot of room for Warp to expand. Warp sees the input to an agentic workflow as a prompt. There is no reason it could not watch files, directories, support tickets, etc. and get to work without me needing to prompt. Put together with local LLMs and I could see tasks like product image resizing, icon generation, etc. without additional token costs.&lt;/p&gt;
&lt;p&gt;All in all, Warp is a fantastic improvement to my experience with other generative AI tooling. If you are looking to pull your head out of the sand and get acclimated to this new AI-powered future of development, you do not need to look any further than Warp. Personally, I came expecting a terminal replacement with some AI bells and whistles. I left convinced that the future of development is not about AI replacing us - it is about AI working &lt;em&gt;with&lt;/em&gt; us. Warp gets that balance right.&lt;/p&gt;
</content>
    </entry>
</feed>
