@joist/element 4.0.0-next.51 → 4.0.0-next.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +33 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -45,7 +45,8 @@ export class MyElement extends HTMLElement {
45
45
  ## HTML and CSS
46
46
 
47
47
  HTML templates can be applied by passing the result of the `html` tag to the shaodw list.
48
- CSS can be applied by passing the result of the `css` tag to the shadow list.
48
+ CSS can be applied by passing the result of the `css` tag to the shadow list.
49
+ Any new tagged template literal that returns a `ShadowResult` can be used.
49
50
 
50
51
  ```ts
51
52
  @element({
@@ -94,7 +95,7 @@ export class MyElement extends HTMLElement {
94
95
  }
95
96
  ```
96
97
 
97
- ## Queries
98
+ ## Query
98
99
 
99
100
  The `query` function will query for a particular element and allow you to easily patch that element with new properties.
100
101
 
@@ -119,8 +120,36 @@ export class MyElement extends HTMLElement {
119
120
 
120
121
  @effect()
121
122
  onChange() {
122
- const input = this.#input();
123
- input.value = this.value;
123
+ const input = this.#input({ value: this.value});
124
+ }
125
+ }
126
+ ```
127
+
128
+ ## QueryAll
129
+
130
+ The `queryAll` function will get all elements that match the given query. A patching function can be passed to update any or all items in the list
131
+
132
+ ```ts
133
+ @element({
134
+ tagName: 'my-element',
135
+ shadowDom: [
136
+ html`
137
+ <input id="first" />
138
+ <input id="second" />
139
+ `
140
+ ]
141
+ })
142
+ export class MyElement extends HTMLElement {
143
+ @observe()
144
+ value: string;
145
+
146
+ #inputs = queryAll('input');
147
+
148
+ @effect()
149
+ onChange() {
150
+ this.#input(() => {
151
+ return { value: this.value }
152
+ })
124
153
  }
125
154
  }
126
155
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joist/element",
3
- "version": "4.0.0-next.51",
3
+ "version": "4.0.0-next.52",
4
4
  "type": "module",
5
5
  "main": "./target/lib.js",
6
6
  "module": "./target/lib.js",