Skip to content

Commit

Permalink
Update prettier (#4559)
Browse files Browse the repository at this point in the history
* Update prettier to 3.2.5 and format files.

* Library updates for prettier

* Ask 'find' not to delve into dotfiles when looking for package.json files
  • Loading branch information
rictic committed Feb 22, 2024
1 parent b779807 commit 1b00c07
Show file tree
Hide file tree
Showing 121 changed files with 2,435 additions and 1,580 deletions.
4 changes: 2 additions & 2 deletions .changeset/changelog-lit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ const changelogFunctions = {
)
.join(', ')
: containsLitTeamMemberUsername(links.user)
? null
: links.user;
? null
: links.user;

/**
* containsLitTeamMemberUsername lets us only congratulate community
Expand Down
2 changes: 2 additions & 0 deletions .emptyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# An empty ignore file, for when we want to ask prettier to format
# generated files that are .gitignore'd
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
runs-on: windows-latest
env:
WIREIT_LOGGER: quiet-ci
WIREIT_PARALLEL: 1

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"bracketSpacing": false
"bracketSpacing": false,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
- `render()` no longer clears the container it's rendered to. It now appends to the container by default.
- Expressions in comments are no longer rendered or updated. See [Valid expression locations](https://lit.dev/docs/templates/expressions/#expression-locations) for more details.
- Template caching happens per callsite, not per template-tag/callsize pair. This means some rare forms of highly dynamic template tags are no longer supported.
- Arrays and other iterables passed to attribute bindings are not specially handled. Arrays will be rendered with their default toString representation. This means that `` html`<div class=${['a', 'b']}> `` will render `<div class="a,b">` instead of `<div class="a b">`. To get the old behavior, use `array.join(' ')`.
- Arrays and other iterables passed to attribute bindings are not specially handled. Arrays will be rendered with their default toString representation. This means that ``html`<div class=${['a', 'b']}>`` will render `<div class="a,b">` instead of `<div class="a b">`. To get the old behavior, use `array.join(' ')`.
- Multiple bindings in a single attribute value don't require the attribute value is quoted, as long as there is no whitespace or other attribute-ending character in the attribute value. `` html`<div id=${a}-${b}>` ``
- The directive and part APIs are significantly different. See [Custom Directives](https://lit.dev/docs/templates/custom-directives/) and the [Upgrade Guide](https://lit.dev/docs/releases/upgrade/#update-custom-directive-implementations) for more details.
- The `Directive` base class and `directive()` factory function are
Expand Down
29 changes: 14 additions & 15 deletions dev-docs/design/how-lit-html-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ import {html, render} from 'lit';

const container = document.querySelector('#container');

const counterUi = (count) => html` <span class="${count % 2 == 1 ? 'odd' : ''}">
${count}
</span>
<button @click=${() => render(counterUi(count + 1), container)}>
Increment
</button>`;
const counterUi = (count) =>
html` <span class="${count % 2 == 1 ? 'odd' : ''}"> ${count} </span>
<button @click=${() => render(counterUi(count + 1), container)}>
Increment
</button>`;

render(counterUi(0), container);
```
Expand Down Expand Up @@ -415,16 +414,16 @@ lit-html is fast, but what if it could be faster!?

A `Part` is a lit-html concept and represents the location of an expression in the `html` tagged template literal:

| Part | Description | Authored |
| ---------------------- | ------------------------------------------------------------------ | -------------------------------------------- |
| `ChildPart` | Expressions in HTML child position | `` html`<div>${...}</div>` `` |
| `AttributePart` | Expressions in HTML attribute value position | `` html`<input id="${...}">` `` |
| `BooleanAttributePart` | Expressions in a boolean attribute value (name prefixed with `?`) | `` html`<input ?checked="${...}">` `` |
| `PropertyPart` | Expressions in property value position (name prefixed with `.`) | `` html`<input .value=${...}>` `` |
| `EventPart` | Expressions in an event listener position (name prefixed with `@`) | `` html`<button @click=${...}></button>` `` |
| `ElementPart` | Expressions on the element tag | `` html`<input ${...}>` `` |
| Part | Description | Authored |
| ---------------------- | ------------------------------------------------------------------ | ------------------------------------------ |
| `ChildPart` | Expressions in HTML child position | ``html`<div>${...}</div>` `` |
| `AttributePart` | Expressions in HTML attribute value position | ``html`<input id="${...}">` `` |
| `BooleanAttributePart` | Expressions in a boolean attribute value (name prefixed with `?`) | ``html`<input ?checked="${...}">` `` |
| `PropertyPart` | Expressions in property value position (name prefixed with `.`) | ``html`<input .value=${...}>` `` |
| `EventPart` | Expressions in an event listener position (name prefixed with `@`) | ``html`<button @click=${...}></button>` `` |
| `ElementPart` | Expressions on the element tag | ``html`<input ${...}>` `` |

In all the cases above the authored code pass an expression into `${...}` which represents a dynamic binding to the template, and the different part types implement how the value is committed to the DOM. For instance the `EventPart` in `` html`<button @click=${() => console.log('clicked')}></button>` `` will take the user provided function, and manage `addEventListener` and `removeEventListener` calls on the DOM such that the passed function is called when the click event is triggered.
In all the cases above the authored code pass an expression into `${...}` which represents a dynamic binding to the template, and the different part types implement how the value is committed to the DOM. For instance the `EventPart` in ``html`<button @click=${() => console.log('clicked')}></button>` `` will take the user provided function, and manage `addEventListener` and `removeEventListener` calls on the DOM such that the passed function is called when the click event is triggered.

Knowing about Parts is useful when [writing custom directives](https://lit.dev/docs/templates/custom-directives/#parts).

Expand Down
2 changes: 1 addition & 1 deletion examples/preact/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="light dark" />
Expand Down

0 comments on commit 1b00c07

Please sign in to comment.