@joist/templating 4.2.3 → 4.2.4-next.0
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.
- package/README.md +172 -144
- package/package.json +1 -2
- package/src/lib/define.ts +1 -1
- package/src/lib/elements/{props.element.test.ts → bind.element.test.ts} +31 -7
- package/src/lib/elements/bind.element.ts +103 -0
- package/src/lib/elements/for.element.test.ts +8 -9
- package/src/lib/elements/scope.ts +1 -1
- package/src/lib/elements/value.element.test.ts +1 -1
- package/src/lib/elements/value.element.ts +2 -2
- package/target/lib/define.d.ts +1 -1
- package/target/lib/define.js +1 -1
- package/target/lib/define.js.map +1 -1
- package/target/lib/elements/{props.element.d.ts → bind.element.d.ts} +3 -2
- package/target/lib/elements/bind.element.js +118 -0
- package/target/lib/elements/bind.element.js.map +1 -0
- package/target/lib/elements/bind.element.test.d.ts +1 -0
- package/target/lib/elements/{props.element.test.js → bind.element.test.js} +29 -8
- package/target/lib/elements/bind.element.test.js.map +1 -0
- package/target/lib/elements/for.element.test.js +7 -8
- package/target/lib/elements/for.element.test.js.map +1 -1
- package/target/lib/elements/scope.js +1 -1
- package/target/lib/elements/scope.js.map +1 -1
- package/target/lib/elements/value.element.d.ts +1 -1
- package/target/lib/elements/value.element.js +1 -1
- package/target/lib/elements/value.element.js.map +1 -1
- package/target/lib/elements/value.element.test.js +1 -1
- package/src/lib/elements/props.element.ts +0 -76
- package/target/lib/elements/props.element.js +0 -90
- package/target/lib/elements/props.element.js.map +0 -1
- package/target/lib/elements/props.element.test.d.ts +0 -1
- package/target/lib/elements/props.element.test.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
The Joist templating system provides a powerful and flexible way to handle data binding and templating in web components. This documentation covers the core components and their usage.
|
|
4
4
|
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Core Components](#core-components)
|
|
8
|
+
- [Built-in Template Elements](#built-in-template-elements)
|
|
9
|
+
- [Complete Example](#complete-example)
|
|
10
|
+
- [Troubleshooting](#troubleshooting)
|
|
11
|
+
|
|
5
12
|
## Core Components
|
|
6
13
|
|
|
7
14
|
### Bind Decorator (`bind.ts`)
|
|
@@ -19,42 +26,71 @@ class MyElement extends HTMLElement {
|
|
|
19
26
|
|
|
20
27
|
The decorator:
|
|
21
28
|
|
|
22
|
-
- Creates a
|
|
29
|
+
- Creates a one-way binding between component properties and templates
|
|
23
30
|
- Automatically handles value propagation through the `joist::value` event
|
|
24
31
|
- Integrates with Joist's observable system for efficient change detection
|
|
32
|
+
- Supports computed properties
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
class MyElement extends HTMLElement {
|
|
36
|
+
@observe()
|
|
37
|
+
assessor value = "Hello World";
|
|
38
|
+
|
|
39
|
+
@bind((instance) => instance.value.toUpperCase())
|
|
40
|
+
accessor formattedValue = "";
|
|
41
|
+
}
|
|
42
|
+
```
|
|
25
43
|
|
|
26
44
|
### Token System (`token.ts`)
|
|
27
45
|
|
|
28
46
|
The `JToken` class handles parsing and evaluation of binding expressions. It supports:
|
|
29
47
|
|
|
48
|
+
NOTE: Most of the time you will not be using this yourself.
|
|
49
|
+
|
|
30
50
|
- Simple property bindings: `propertyName`
|
|
31
51
|
- Nested property access: `user.profile.name`
|
|
32
52
|
- Negation operator: `!isVisible`
|
|
53
|
+
- Array access: `items.0.name`
|
|
33
54
|
|
|
34
55
|
Example usage:
|
|
35
56
|
|
|
36
57
|
```typescript
|
|
37
58
|
const token = new JToken("user.name");
|
|
38
59
|
const value = token.readTokenValueFrom(context);
|
|
60
|
+
|
|
61
|
+
// With negation
|
|
62
|
+
const negatedToken = new JToken("!isVisible");
|
|
63
|
+
const isHidden = negatedToken.readTokenValueFrom(context);
|
|
39
64
|
```
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
## Built-in Template Elements
|
|
42
67
|
|
|
43
|
-
|
|
68
|
+
Joist provides several built-in template elements for common templating needs:
|
|
44
69
|
|
|
45
|
-
|
|
46
|
-
- Bubbles through the DOM tree
|
|
47
|
-
- Carries both the token and update mechanism
|
|
70
|
+
### Value Display (`j-val`)
|
|
48
71
|
|
|
49
|
-
|
|
72
|
+
Displays a bound value as text content:
|
|
50
73
|
|
|
51
|
-
|
|
74
|
+
```html
|
|
75
|
+
<!-- Basic usage -->
|
|
76
|
+
<j-val bind="user.name"></j-val>
|
|
77
|
+
|
|
78
|
+
<!-- With formatting -->
|
|
79
|
+
<j-val bind="formattedPrice"></j-val>
|
|
80
|
+
|
|
81
|
+
<!-- With nested properties -->
|
|
82
|
+
<j-val bind="user.profile.address.city"></j-val>
|
|
83
|
+
|
|
84
|
+
<!-- With array access -->
|
|
85
|
+
<j-val bind="items[0].name"></j-val>
|
|
86
|
+
```
|
|
52
87
|
|
|
53
88
|
### Conditional Rendering (`j-if`)
|
|
54
89
|
|
|
55
90
|
Conditionally renders content based on a boolean expression:
|
|
56
91
|
|
|
57
92
|
```html
|
|
93
|
+
<!-- Basic usage -->
|
|
58
94
|
<j-if bind="isVisible">
|
|
59
95
|
<template>
|
|
60
96
|
<div>This content is only shown when isVisible is true</div>
|
|
@@ -86,37 +122,64 @@ The `j-if` element supports:
|
|
|
86
122
|
- Optional `else` template for fallback content
|
|
87
123
|
- Automatic cleanup of removed content
|
|
88
124
|
|
|
89
|
-
|
|
125
|
+
### Property Binding (`j-bind`)
|
|
126
|
+
|
|
127
|
+
Binds values to element properties and attributes. By default it will bind values to the first child element of `j-bind`
|
|
90
128
|
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
- Feature flags
|
|
94
|
-
- Authentication states
|
|
95
|
-
- Loading states
|
|
129
|
+
- `props` Binds to element properties
|
|
130
|
+
- `attrs` prefix: Binds to element attributes
|
|
96
131
|
|
|
97
|
-
|
|
132
|
+
#### Binding Syntax
|
|
98
133
|
|
|
99
|
-
|
|
134
|
+
The binding syntax follows the format `target:source` where:
|
|
100
135
|
|
|
101
|
-
-
|
|
102
|
-
-
|
|
136
|
+
- `target` is the property/attribute name to bind to
|
|
137
|
+
- `source` is the value to bind from
|
|
103
138
|
|
|
104
139
|
```html
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<
|
|
140
|
+
<!-- Basic attribute binding -->
|
|
141
|
+
<j-bind attrs="href:href">
|
|
142
|
+
<a>Link</a>
|
|
143
|
+
</j-bind>
|
|
144
|
+
|
|
145
|
+
<!-- Property binding -->
|
|
146
|
+
<j-bind props="target:some.value">
|
|
147
|
+
<a>Link</a>
|
|
148
|
+
</j-bind>
|
|
149
|
+
|
|
150
|
+
<!-- Multiple bindings -->
|
|
151
|
+
<j-bind props="selectionStart:foo, selectionEnd:foo">
|
|
152
|
+
<input value="1234567890" />
|
|
153
|
+
</j-bind>
|
|
154
|
+
|
|
155
|
+
<!-- Style binding -->
|
|
156
|
+
<j-bind props="style.color:color, style.backgroundColor:bgColor">
|
|
157
|
+
<div>Styled content</div>
|
|
158
|
+
</j-bind>
|
|
159
|
+
```
|
|
108
160
|
|
|
109
|
-
|
|
110
|
-
<input type="text" $.value="userName">
|
|
161
|
+
#### Targeting Specific Elements
|
|
111
162
|
|
|
112
|
-
|
|
113
|
-
<my-element $.data="complexObject">
|
|
163
|
+
You can target a specific child element using the `target` attribute:
|
|
114
164
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
</j-
|
|
165
|
+
```html
|
|
166
|
+
<j-bind attrs="href:href" target="#test">
|
|
167
|
+
<a>Default</a>
|
|
168
|
+
<a id="test">Target</a>
|
|
169
|
+
</j-bind>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Boolean Attributes
|
|
173
|
+
|
|
174
|
+
Boolean attributes are handled specially:
|
|
175
|
+
|
|
176
|
+
- `true` values set the attribute
|
|
177
|
+
- `false` values remove the attribute
|
|
178
|
+
|
|
179
|
+
```html
|
|
180
|
+
<j-bind attrs="disabled:isDisabled">
|
|
181
|
+
<button>Click me</button>
|
|
182
|
+
</j-bind>
|
|
120
183
|
```
|
|
121
184
|
|
|
122
185
|
### List Rendering (`j-for`)
|
|
@@ -124,25 +187,26 @@ Binds values to element properties and attributes. The prefix determines the bin
|
|
|
124
187
|
Renders lists of items with support for keyed updates:
|
|
125
188
|
|
|
126
189
|
```html
|
|
190
|
+
<!-- Basic list rendering -->
|
|
127
191
|
<j-for bind="todos" key="id">
|
|
128
192
|
<template>
|
|
129
|
-
<
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</
|
|
193
|
+
<div class="todo-item">
|
|
194
|
+
<j-val bind="each.value.text"></j-val>
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|
|
197
|
+
</j-for>
|
|
198
|
+
|
|
199
|
+
<!-- With complex item structure -->
|
|
200
|
+
<j-for bind="users" key="id">
|
|
201
|
+
<template>
|
|
202
|
+
<div class="user-card">
|
|
203
|
+
<j-bind>
|
|
204
|
+
<img props="src:each.value.avatar" />
|
|
205
|
+
</j-bind>
|
|
206
|
+
|
|
207
|
+
<h3><j-val bind="each.value.name"></j-val></h3>
|
|
208
|
+
<p><j-val bind="each.value.bio"></j-val></p>
|
|
209
|
+
</div>
|
|
146
210
|
</template>
|
|
147
211
|
</j-for>
|
|
148
212
|
```
|
|
@@ -153,17 +217,9 @@ The `j-for` element provides context variables:
|
|
|
153
217
|
- `each.index`: The zero-based index of the current item
|
|
154
218
|
- `each.position`: The one-based position of the current item
|
|
155
219
|
|
|
156
|
-
### Value Display (`j-value`)
|
|
157
|
-
|
|
158
|
-
Displays a bound value as text content:
|
|
159
|
-
|
|
160
|
-
```html
|
|
161
|
-
<j-value bind="user.name"></j-value> <j-value bind="formattedPrice"></j-value>
|
|
162
|
-
```
|
|
163
|
-
|
|
164
220
|
### Async State Handling (`j-async`)
|
|
165
221
|
|
|
166
|
-
Handles asynchronous operations and state management with loading, success, and error states
|
|
222
|
+
Handles asynchronous operations and state management with loading, success, and error states:
|
|
167
223
|
|
|
168
224
|
```typescript
|
|
169
225
|
// AsyncState type
|
|
@@ -183,15 +239,16 @@ accessor userPromise = fetch('/api/user').then(r => r.json());
|
|
|
183
239
|
```
|
|
184
240
|
|
|
185
241
|
```html
|
|
242
|
+
<!-- Basic async handling -->
|
|
186
243
|
<j-async bind="userPromise">
|
|
187
244
|
<template loading>Loading...</template>
|
|
188
245
|
|
|
189
246
|
<template success>
|
|
190
|
-
<div>Welcome, <j-
|
|
247
|
+
<div>Welcome, <j-val bind="state.data.name"></j-val>!</div>
|
|
191
248
|
</template>
|
|
192
249
|
|
|
193
250
|
<template error>
|
|
194
|
-
<div>Error: <j-
|
|
251
|
+
<div>Error: <j-val bind="state.error"></j-val></div>
|
|
195
252
|
</template>
|
|
196
253
|
</j-async>
|
|
197
254
|
```
|
|
@@ -200,9 +257,53 @@ The `j-async` element supports:
|
|
|
200
257
|
|
|
201
258
|
- Promise handling with automatic state transitions
|
|
202
259
|
- Loading, success, and error templates
|
|
203
|
-
- Automatic cleanup on disconnection
|
|
204
260
|
- State object with typed data and error fields
|
|
205
261
|
|
|
262
|
+
## Troubleshooting
|
|
263
|
+
|
|
264
|
+
### Common Issues
|
|
265
|
+
|
|
266
|
+
1. **Binding Not Updating**
|
|
267
|
+
|
|
268
|
+
- Check if the property is decorated with `@bind()`
|
|
269
|
+
- Verify the binding expression is correct
|
|
270
|
+
- Ensure the property is being updated correctly
|
|
271
|
+
|
|
272
|
+
2. **List Rendering Issues**
|
|
273
|
+
|
|
274
|
+
- Verify the `key` attribute is unique and stable
|
|
275
|
+
- Check if the list items are properly structured
|
|
276
|
+
- Ensure the binding expression matches the data structure
|
|
277
|
+
|
|
278
|
+
3. **Async State Problems**
|
|
279
|
+
- Verify the Promise is properly resolved/rejected
|
|
280
|
+
- Check if all required templates are present
|
|
281
|
+
- Ensure error handling is implemented
|
|
282
|
+
|
|
283
|
+
## Manual Value Handling
|
|
284
|
+
|
|
285
|
+
You can manually handle value requests and updates by listening for the `joist::value` event. This is useful when you need more control over the binding process or want to implement custom binding logic:
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
class MyElement extends HTMLElement {
|
|
289
|
+
connectedCallback() {
|
|
290
|
+
// Listen for value requests
|
|
291
|
+
this.addEventListener("joist::value", (e) => {
|
|
292
|
+
const token = e.token;
|
|
293
|
+
|
|
294
|
+
// Handle the value request
|
|
295
|
+
if (token.bindTo === "myValue") {
|
|
296
|
+
// Update the value
|
|
297
|
+
e.update({
|
|
298
|
+
oldValue: this.myValue,
|
|
299
|
+
newValue: this.myValue,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
206
307
|
## Complete Example
|
|
207
308
|
|
|
208
309
|
Here's a complete todo application in a single component:
|
|
@@ -212,7 +313,7 @@ import { bind } from "@joist/templating";
|
|
|
212
313
|
import { element, html, css, listen, query } from "@joist/element";
|
|
213
314
|
|
|
214
315
|
interface Todo {
|
|
215
|
-
id:
|
|
316
|
+
id: string;
|
|
216
317
|
text: string;
|
|
217
318
|
}
|
|
218
319
|
|
|
@@ -230,6 +331,7 @@ interface Todo {
|
|
|
230
331
|
gap: 1rem;
|
|
231
332
|
}
|
|
232
333
|
.todo-item {
|
|
334
|
+
align-items: center;
|
|
233
335
|
display: flex;
|
|
234
336
|
gap: 0.5rem;
|
|
235
337
|
margin: 0.5rem 0;
|
|
@@ -252,14 +354,17 @@ interface Todo {
|
|
|
252
354
|
|
|
253
355
|
<j-for id="todos" bind="todos" key="id">
|
|
254
356
|
<template>
|
|
255
|
-
<
|
|
256
|
-
<j-
|
|
257
|
-
|
|
258
|
-
|
|
357
|
+
<div class="todo-item">
|
|
358
|
+
<j-val class="todo-text" bind="each.value.text"></j-val>
|
|
359
|
+
|
|
360
|
+
<j-bind attrs="data-id:each.value.id">
|
|
361
|
+
<button>×</button>
|
|
362
|
+
</j-bind>
|
|
363
|
+
</div>
|
|
259
364
|
</template>
|
|
260
365
|
</j-for>
|
|
261
366
|
|
|
262
|
-
<j-
|
|
367
|
+
<j-val bind="todos.length"></j-val> remaining
|
|
263
368
|
`,
|
|
264
369
|
],
|
|
265
370
|
})
|
|
@@ -276,7 +381,7 @@ export class TodoList extends HTMLElement {
|
|
|
276
381
|
|
|
277
382
|
const input = this.#input();
|
|
278
383
|
|
|
279
|
-
this.todos = [...this.todos, { id: this.#nextId
|
|
384
|
+
this.todos = [...this.todos, { id: String(this.#nextId++), text: input.value.trim() }];
|
|
280
385
|
|
|
281
386
|
input.value = "";
|
|
282
387
|
}
|
|
@@ -284,87 +389,10 @@ export class TodoList extends HTMLElement {
|
|
|
284
389
|
@listen("click", "#todos")
|
|
285
390
|
onDelete(e: Event) {
|
|
286
391
|
if (e.target instanceof HTMLButtonElement) {
|
|
287
|
-
const id = Number(e.target.id);
|
|
392
|
+
const id = Number(e.target.dataset.id);
|
|
288
393
|
|
|
289
394
|
this.todos = this.todos.filter((todo) => todo.id !== id);
|
|
290
395
|
}
|
|
291
396
|
}
|
|
292
397
|
}
|
|
293
398
|
```
|
|
294
|
-
|
|
295
|
-
## Usage
|
|
296
|
-
|
|
297
|
-
1. Use the `@bind()` decorator on properties you want to make bindable
|
|
298
|
-
2. Properties will automatically integrate with the templating system
|
|
299
|
-
3. Changes are propagated through the component tree using the custom event system
|
|
300
|
-
|
|
301
|
-
## Integration with Observable
|
|
302
|
-
|
|
303
|
-
The templating system is built on top of Joist's observable system (`@joist/observable`), providing:
|
|
304
|
-
|
|
305
|
-
- Automatic change detection
|
|
306
|
-
- Efficient updates
|
|
307
|
-
- Integration with the component lifecycle
|
|
308
|
-
|
|
309
|
-
## Best Practices
|
|
310
|
-
|
|
311
|
-
1. Use the `@bind()` decorator only on properties that need reactivity
|
|
312
|
-
2. Keep binding expressions simple and avoid deep nesting
|
|
313
|
-
3. Consider performance implications when binding to frequently changing values
|
|
314
|
-
4. Always use a `key` attribute with `j-for` when items can be reordered
|
|
315
|
-
5. Place template content directly inside `j-if` and `j-for` elements
|
|
316
|
-
|
|
317
|
-
## Manual Value Handling
|
|
318
|
-
|
|
319
|
-
You can manually handle value requests and updates by listening for the `joist::value` event. This is useful when you need more control over the binding process or want to implement custom binding logic:
|
|
320
|
-
|
|
321
|
-
```typescript
|
|
322
|
-
import { JoistValueEvent } from "@joist/templating";
|
|
323
|
-
|
|
324
|
-
class MyElement extends HTMLElement {
|
|
325
|
-
connectedCallback() {
|
|
326
|
-
// Listen for value requests
|
|
327
|
-
this.addEventListener("joist::value", (e: JoistValueEvent) => {
|
|
328
|
-
const token = e.token;
|
|
329
|
-
|
|
330
|
-
// Handle the value request
|
|
331
|
-
if (token.bindTo === "myValue") {
|
|
332
|
-
// Update the value
|
|
333
|
-
e.update({
|
|
334
|
-
oldValue: this.myValue,
|
|
335
|
-
newValue: this.myValue,
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
Example with async value handling:
|
|
344
|
-
|
|
345
|
-
```typescript
|
|
346
|
-
import { JoistValueEvent } from "@joist/templating";
|
|
347
|
-
|
|
348
|
-
class MyElement extends HTMLElement {
|
|
349
|
-
connectedCallback() {
|
|
350
|
-
this.addEventListener("joist::value", (e: JoistValueEvent) => {
|
|
351
|
-
const token = e.token;
|
|
352
|
-
|
|
353
|
-
if (token.bindTo === "userData") {
|
|
354
|
-
e.update({
|
|
355
|
-
oldValue: this.userData,
|
|
356
|
-
newValue: data,
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Common use cases for manual value handling:
|
|
365
|
-
|
|
366
|
-
- Custom data transformation before binding
|
|
367
|
-
- Async data loading and caching
|
|
368
|
-
- Complex state management
|
|
369
|
-
- Integration with external data sources
|
|
370
|
-
- Custom validation or error handling
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joist/templating",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./target/lib.js",
|
|
6
6
|
"module": "./target/lib.js",
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"vitest.config.js",
|
|
61
61
|
"target/**"
|
|
62
62
|
],
|
|
63
|
-
"output": [],
|
|
64
63
|
"dependencies": [
|
|
65
64
|
"build"
|
|
66
65
|
]
|
package/src/lib/define.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./bind.element.js";
|
|
2
2
|
|
|
3
3
|
import { fixtureSync, html } from "@open-wc/testing";
|
|
4
4
|
import { assert } from "chai";
|
|
@@ -26,9 +26,9 @@ it("should pass props to child", () => {
|
|
|
26
26
|
}
|
|
27
27
|
}}
|
|
28
28
|
>
|
|
29
|
-
<j-props>
|
|
30
|
-
<a
|
|
31
|
-
</j-
|
|
29
|
+
<j-bind attrs="href:href" props="target:target.value">
|
|
30
|
+
<a>Hello World</a>
|
|
31
|
+
</j-bind>
|
|
32
32
|
</div>
|
|
33
33
|
`);
|
|
34
34
|
|
|
@@ -48,10 +48,10 @@ it("should pass props to specified child", () => {
|
|
|
48
48
|
});
|
|
49
49
|
}}
|
|
50
50
|
>
|
|
51
|
-
<j-
|
|
51
|
+
<j-bind attrs="href:href" target="#test">
|
|
52
52
|
<a>Default</a>
|
|
53
|
-
<a id="test"
|
|
54
|
-
</j-
|
|
53
|
+
<a id="test">Target</a>
|
|
54
|
+
</j-bind>
|
|
55
55
|
</div>
|
|
56
56
|
`);
|
|
57
57
|
|
|
@@ -60,3 +60,27 @@ it("should pass props to specified child", () => {
|
|
|
60
60
|
assert.equal(anchor[0].getAttribute("href"), null);
|
|
61
61
|
assert.equal(anchor[1].getAttribute("href"), "#foo");
|
|
62
62
|
});
|
|
63
|
+
|
|
64
|
+
it("should be case sensitive", () => {
|
|
65
|
+
const element = fixtureSync(html`
|
|
66
|
+
<div
|
|
67
|
+
@joist::value=${(e: JoistValueEvent) => {
|
|
68
|
+
e.update({ oldValue: null, newValue: 8 });
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<j-bind
|
|
72
|
+
props="
|
|
73
|
+
selectionStart:foo,
|
|
74
|
+
selectionEnd:foo
|
|
75
|
+
"
|
|
76
|
+
>
|
|
77
|
+
<input value="1234567890" />
|
|
78
|
+
</j-bind>
|
|
79
|
+
</div>
|
|
80
|
+
`);
|
|
81
|
+
|
|
82
|
+
const input = element.querySelector("input");
|
|
83
|
+
|
|
84
|
+
assert.equal(input?.selectionStart, 8);
|
|
85
|
+
assert.equal(input?.selectionEnd, 8);
|
|
86
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { attr, element, css, html } from "@joist/element";
|
|
2
|
+
|
|
3
|
+
// import { JoistValueEvent } from "../events.js";
|
|
4
|
+
import { JToken } from "../token.js";
|
|
5
|
+
import { JoistValueEvent } from "../events.js";
|
|
6
|
+
|
|
7
|
+
export class JAttrToken extends JToken {
|
|
8
|
+
mapTo: string;
|
|
9
|
+
|
|
10
|
+
constructor(binding: string) {
|
|
11
|
+
const [mapTo, bindTo] = binding.split(":");
|
|
12
|
+
|
|
13
|
+
if (!mapTo) {
|
|
14
|
+
throw new Error(`Invalid binding: ${binding}, should be in the format of "bindTo:mapTo"`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
super(bindTo);
|
|
18
|
+
|
|
19
|
+
this.mapTo = mapTo;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@element({
|
|
24
|
+
tagName: "j-bind",
|
|
25
|
+
// prettier-ignore
|
|
26
|
+
shadowDom: [css`:host{display: contents;}`, html`<slot></slot>`],
|
|
27
|
+
})
|
|
28
|
+
export class JoistIfElement extends HTMLElement {
|
|
29
|
+
@attr()
|
|
30
|
+
accessor props = "";
|
|
31
|
+
|
|
32
|
+
@attr()
|
|
33
|
+
accessor attrs = "";
|
|
34
|
+
|
|
35
|
+
@attr()
|
|
36
|
+
accessor target = "";
|
|
37
|
+
|
|
38
|
+
connectedCallback(): void {
|
|
39
|
+
const attrBindings = this.#parseBinding(this.attrs);
|
|
40
|
+
const propBindings = this.#parseBinding(this.props);
|
|
41
|
+
|
|
42
|
+
let child = this.firstElementChild;
|
|
43
|
+
|
|
44
|
+
if (this.target) {
|
|
45
|
+
child = this.querySelector(this.target);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!child) {
|
|
49
|
+
throw new Error("j-bind must have a child element or defined target");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
for (const attrValue of attrBindings) {
|
|
53
|
+
const token = new JAttrToken(attrValue);
|
|
54
|
+
|
|
55
|
+
this.#dispatch(token, (value) => {
|
|
56
|
+
if (value === true) {
|
|
57
|
+
child.setAttribute(token.mapTo, "");
|
|
58
|
+
} else if (value === false) {
|
|
59
|
+
child.removeAttribute(token.mapTo);
|
|
60
|
+
} else {
|
|
61
|
+
child.setAttribute(token.mapTo, String(value));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
for (const propValue of propBindings) {
|
|
67
|
+
const token = new JAttrToken(propValue);
|
|
68
|
+
|
|
69
|
+
this.#dispatch(token, (value) => {
|
|
70
|
+
Reflect.set(child, token.mapTo, value);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#parseBinding(binding: string) {
|
|
76
|
+
return binding
|
|
77
|
+
.split(",")
|
|
78
|
+
.map((b) => b.trim())
|
|
79
|
+
.filter((b) => b);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#dispatch(token: JToken, write: (value: unknown) => void) {
|
|
83
|
+
this.dispatchEvent(
|
|
84
|
+
new JoistValueEvent(token, ({ newValue, oldValue }) => {
|
|
85
|
+
if (newValue === oldValue) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let valueToWrite = newValue;
|
|
90
|
+
|
|
91
|
+
if (typeof newValue === "object" && newValue !== null) {
|
|
92
|
+
valueToWrite = token.readTokenValueFrom(newValue);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (token.isNegated) {
|
|
96
|
+
valueToWrite = !valueToWrite;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
write(valueToWrite);
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -23,7 +23,7 @@ it("should iterate over an iterable", () => {
|
|
|
23
23
|
<j-for bind="items" key="id">
|
|
24
24
|
<template>
|
|
25
25
|
<li>
|
|
26
|
-
<j-
|
|
26
|
+
<j-val bind="each.value.label"></j-val>
|
|
27
27
|
</li>
|
|
28
28
|
</template>
|
|
29
29
|
</j-for>
|
|
@@ -94,13 +94,13 @@ it("should update when items are added or removed", () => {
|
|
|
94
94
|
>
|
|
95
95
|
<j-for bind="items" key="id">
|
|
96
96
|
<template>
|
|
97
|
-
<j-
|
|
97
|
+
<j-val bind="each.value.text"></j-val>
|
|
98
98
|
</template>
|
|
99
99
|
</j-for>
|
|
100
100
|
</div>
|
|
101
101
|
`);
|
|
102
102
|
|
|
103
|
-
const items = element.querySelectorAll("j-
|
|
103
|
+
const items = element.querySelectorAll("j-val");
|
|
104
104
|
assert.equal(items.length, 2);
|
|
105
105
|
assert.equal(items[0].textContent?.trim(), "First");
|
|
106
106
|
assert.equal(items[1].textContent?.trim(), "Third");
|
|
@@ -118,9 +118,8 @@ it("should provide index and position information", () => {
|
|
|
118
118
|
>
|
|
119
119
|
<j-for bind="items">
|
|
120
120
|
<template>
|
|
121
|
-
<j-
|
|
122
|
-
(index: <j-
|
|
123
|
-
position: <j-value bind="each.position"></j-value>)
|
|
121
|
+
<j-val bind="each.value"></j-val>
|
|
122
|
+
(index: <j-val bind="each.index"></j-val>, position: <j-val bind="each.position"></j-val>)
|
|
124
123
|
</template>
|
|
125
124
|
</j-for>
|
|
126
125
|
</div>
|
|
@@ -160,7 +159,7 @@ it("should provide index and position information", () => {
|
|
|
160
159
|
// <div class="group">
|
|
161
160
|
// <j-for bind="each.value.items">
|
|
162
161
|
// <template>
|
|
163
|
-
// <j-
|
|
162
|
+
// <j-val class="child" bind="each.value"></j-val>
|
|
164
163
|
// </template>
|
|
165
164
|
// </j-for>
|
|
166
165
|
// </div>
|
|
@@ -207,13 +206,13 @@ it("should maintain DOM order when items are reordered", () => {
|
|
|
207
206
|
>
|
|
208
207
|
<j-for bind="items" key="id">
|
|
209
208
|
<template>
|
|
210
|
-
<j-
|
|
209
|
+
<j-val bind="each.value.text"></j-val>
|
|
211
210
|
</template>
|
|
212
211
|
</j-for>
|
|
213
212
|
</div>
|
|
214
213
|
`);
|
|
215
214
|
|
|
216
|
-
const items = element.querySelectorAll("j-
|
|
215
|
+
const items = element.querySelectorAll("j-val");
|
|
217
216
|
assert.equal(items.length, 3);
|
|
218
217
|
assert.equal(items[0].textContent?.trim(), "Third");
|
|
219
218
|
assert.equal(items[1].textContent?.trim(), "First");
|
|
@@ -4,12 +4,12 @@ import { JToken } from "../token.js";
|
|
|
4
4
|
|
|
5
5
|
declare global {
|
|
6
6
|
interface HTMLElementTagNameMap {
|
|
7
|
-
"j-
|
|
7
|
+
"j-val": JoistValueElement;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
@element({
|
|
12
|
-
tagName: "j-
|
|
12
|
+
tagName: "j-val",
|
|
13
13
|
// prettier-ignore
|
|
14
14
|
shadowDom: [css`:host{display: contents;}`, html`<slot></slot>`],
|
|
15
15
|
})
|
package/target/lib/define.d.ts
CHANGED
package/target/lib/define.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./elements/async.element.js";
|
|
2
2
|
import "./elements/for.element.js";
|
|
3
3
|
import "./elements/if.element.js";
|
|
4
|
-
import "./elements/
|
|
4
|
+
import "./elements/bind.element.js";
|
|
5
5
|
import "./elements/value.element.js";
|
|
6
6
|
//# sourceMappingURL=define.js.map
|
package/target/lib/define.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/lib/define.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,2BAA2B,CAAC;AACnC,OAAO,0BAA0B,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/lib/define.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,2BAA2B,CAAC;AACnC,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,6BAA6B,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { JToken } from "../token.js";
|
|
2
2
|
export declare class JAttrToken extends JToken {
|
|
3
3
|
mapTo: string;
|
|
4
|
-
|
|
5
|
-
constructor(attr: Attr);
|
|
4
|
+
constructor(binding: string);
|
|
6
5
|
}
|
|
7
6
|
export declare class JoistIfElement extends HTMLElement {
|
|
8
7
|
#private;
|
|
8
|
+
accessor props: string;
|
|
9
|
+
accessor attrs: string;
|
|
9
10
|
accessor target: string;
|
|
10
11
|
connectedCallback(): void;
|
|
11
12
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { attr, element, css, html } from "@joist/element";
|
|
3
|
+
import { JToken } from "../token.js";
|
|
4
|
+
import { JoistValueEvent } from "../events.js";
|
|
5
|
+
export class JAttrToken extends JToken {
|
|
6
|
+
mapTo;
|
|
7
|
+
constructor(binding) {
|
|
8
|
+
const [mapTo, bindTo] = binding.split(":");
|
|
9
|
+
if (!mapTo) {
|
|
10
|
+
throw new Error(`Invalid binding: ${binding}, should be in the format of "bindTo:mapTo"`);
|
|
11
|
+
}
|
|
12
|
+
super(bindTo);
|
|
13
|
+
this.mapTo = mapTo;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
let JoistIfElement = (() => {
|
|
17
|
+
let _classDecorators = [element({
|
|
18
|
+
tagName: "j-bind",
|
|
19
|
+
shadowDom: [css `:host{display: contents;}`, html `<slot></slot>`],
|
|
20
|
+
})];
|
|
21
|
+
let _classDescriptor;
|
|
22
|
+
let _classExtraInitializers = [];
|
|
23
|
+
let _classThis;
|
|
24
|
+
let _classSuper = HTMLElement;
|
|
25
|
+
let _props_decorators;
|
|
26
|
+
let _props_initializers = [];
|
|
27
|
+
let _props_extraInitializers = [];
|
|
28
|
+
let _attrs_decorators;
|
|
29
|
+
let _attrs_initializers = [];
|
|
30
|
+
let _attrs_extraInitializers = [];
|
|
31
|
+
let _target_decorators;
|
|
32
|
+
let _target_initializers = [];
|
|
33
|
+
let _target_extraInitializers = [];
|
|
34
|
+
var JoistIfElement = class extends _classSuper {
|
|
35
|
+
static { _classThis = this; }
|
|
36
|
+
static {
|
|
37
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
38
|
+
_props_decorators = [attr()];
|
|
39
|
+
_attrs_decorators = [attr()];
|
|
40
|
+
_target_decorators = [attr()];
|
|
41
|
+
__esDecorate(this, null, _props_decorators, { kind: "accessor", name: "props", static: false, private: false, access: { has: obj => "props" in obj, get: obj => obj.props, set: (obj, value) => { obj.props = value; } }, metadata: _metadata }, _props_initializers, _props_extraInitializers);
|
|
42
|
+
__esDecorate(this, null, _attrs_decorators, { kind: "accessor", name: "attrs", static: false, private: false, access: { has: obj => "attrs" in obj, get: obj => obj.attrs, set: (obj, value) => { obj.attrs = value; } }, metadata: _metadata }, _attrs_initializers, _attrs_extraInitializers);
|
|
43
|
+
__esDecorate(this, null, _target_decorators, { kind: "accessor", name: "target", static: false, private: false, access: { has: obj => "target" in obj, get: obj => obj.target, set: (obj, value) => { obj.target = value; } }, metadata: _metadata }, _target_initializers, _target_extraInitializers);
|
|
44
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
45
|
+
JoistIfElement = _classThis = _classDescriptor.value;
|
|
46
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
47
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
48
|
+
}
|
|
49
|
+
#props_accessor_storage = __runInitializers(this, _props_initializers, "");
|
|
50
|
+
get props() { return this.#props_accessor_storage; }
|
|
51
|
+
set props(value) { this.#props_accessor_storage = value; }
|
|
52
|
+
#attrs_accessor_storage = (__runInitializers(this, _props_extraInitializers), __runInitializers(this, _attrs_initializers, ""));
|
|
53
|
+
get attrs() { return this.#attrs_accessor_storage; }
|
|
54
|
+
set attrs(value) { this.#attrs_accessor_storage = value; }
|
|
55
|
+
#target_accessor_storage = (__runInitializers(this, _attrs_extraInitializers), __runInitializers(this, _target_initializers, ""));
|
|
56
|
+
get target() { return this.#target_accessor_storage; }
|
|
57
|
+
set target(value) { this.#target_accessor_storage = value; }
|
|
58
|
+
connectedCallback() {
|
|
59
|
+
const attrBindings = this.#parseBinding(this.attrs);
|
|
60
|
+
const propBindings = this.#parseBinding(this.props);
|
|
61
|
+
let child = this.firstElementChild;
|
|
62
|
+
if (this.target) {
|
|
63
|
+
child = this.querySelector(this.target);
|
|
64
|
+
}
|
|
65
|
+
if (!child) {
|
|
66
|
+
throw new Error("j-bind must have a child element or defined target");
|
|
67
|
+
}
|
|
68
|
+
for (const attrValue of attrBindings) {
|
|
69
|
+
const token = new JAttrToken(attrValue);
|
|
70
|
+
this.#dispatch(token, (value) => {
|
|
71
|
+
if (value === true) {
|
|
72
|
+
child.setAttribute(token.mapTo, "");
|
|
73
|
+
}
|
|
74
|
+
else if (value === false) {
|
|
75
|
+
child.removeAttribute(token.mapTo);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
child.setAttribute(token.mapTo, String(value));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
for (const propValue of propBindings) {
|
|
83
|
+
const token = new JAttrToken(propValue);
|
|
84
|
+
this.#dispatch(token, (value) => {
|
|
85
|
+
Reflect.set(child, token.mapTo, value);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
#parseBinding(binding) {
|
|
90
|
+
return binding
|
|
91
|
+
.split(",")
|
|
92
|
+
.map((b) => b.trim())
|
|
93
|
+
.filter((b) => b);
|
|
94
|
+
}
|
|
95
|
+
#dispatch(token, write) {
|
|
96
|
+
this.dispatchEvent(new JoistValueEvent(token, ({ newValue, oldValue }) => {
|
|
97
|
+
if (newValue === oldValue) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
let valueToWrite = newValue;
|
|
101
|
+
if (typeof newValue === "object" && newValue !== null) {
|
|
102
|
+
valueToWrite = token.readTokenValueFrom(newValue);
|
|
103
|
+
}
|
|
104
|
+
if (token.isNegated) {
|
|
105
|
+
valueToWrite = !valueToWrite;
|
|
106
|
+
}
|
|
107
|
+
write(valueToWrite);
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
constructor() {
|
|
111
|
+
super(...arguments);
|
|
112
|
+
__runInitializers(this, _target_extraInitializers);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return JoistIfElement = _classThis;
|
|
116
|
+
})();
|
|
117
|
+
export { JoistIfElement };
|
|
118
|
+
//# sourceMappingURL=bind.element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind.element.js","sourceRoot":"","sources":["../../../src/lib/elements/bind.element.ts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AAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,aAAa,CAAC,OAAe;YAC3B,OAAO,OAAO;iBACX,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;iBACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC;QAED,SAAS,CAAC,KAAa,EAAE,KAA+B;YACtD,IAAI,CAAC,aAAa,CAChB,IAAI,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACpD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBAC1B,OAAO;gBACT,CAAC;gBAED,IAAI,YAAY,GAAG,QAAQ,CAAC;gBAE5B,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;oBACtD,YAAY,GAAG,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;gBACpD,CAAC;gBAED,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;oBACpB,YAAY,GAAG,CAAC,YAAY,CAAC;gBAC/B,CAAC;gBAED,KAAK,CAAC,YAAY,CAAC,CAAC;YACtB,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;;;;;;;;SA1EU,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./bind.element.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./bind.element.js";
|
|
2
2
|
import { fixtureSync, html } from "@open-wc/testing";
|
|
3
3
|
import { assert } from "chai";
|
|
4
4
|
it("should pass props to child", () => {
|
|
@@ -21,9 +21,9 @@ it("should pass props to child", () => {
|
|
|
21
21
|
}
|
|
22
22
|
}}
|
|
23
23
|
>
|
|
24
|
-
<j-props>
|
|
25
|
-
<a
|
|
26
|
-
</j-
|
|
24
|
+
<j-bind attrs="href:href" props="target:target.value">
|
|
25
|
+
<a>Hello World</a>
|
|
26
|
+
</j-bind>
|
|
27
27
|
</div>
|
|
28
28
|
`);
|
|
29
29
|
const anchor = element.querySelector("a");
|
|
@@ -40,14 +40,35 @@ it("should pass props to specified child", () => {
|
|
|
40
40
|
});
|
|
41
41
|
}}
|
|
42
42
|
>
|
|
43
|
-
<j-
|
|
43
|
+
<j-bind attrs="href:href" target="#test">
|
|
44
44
|
<a>Default</a>
|
|
45
|
-
<a id="test"
|
|
46
|
-
</j-
|
|
45
|
+
<a id="test">Target</a>
|
|
46
|
+
</j-bind>
|
|
47
47
|
</div>
|
|
48
48
|
`);
|
|
49
49
|
const anchor = element.querySelectorAll("a");
|
|
50
50
|
assert.equal(anchor[0].getAttribute("href"), null);
|
|
51
51
|
assert.equal(anchor[1].getAttribute("href"), "#foo");
|
|
52
52
|
});
|
|
53
|
-
|
|
53
|
+
it("should be case sensitive", () => {
|
|
54
|
+
const element = fixtureSync(html `
|
|
55
|
+
<div
|
|
56
|
+
@joist::value=${(e) => {
|
|
57
|
+
e.update({ oldValue: null, newValue: 8 });
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<j-bind
|
|
61
|
+
props="
|
|
62
|
+
selectionStart:foo,
|
|
63
|
+
selectionEnd:foo
|
|
64
|
+
"
|
|
65
|
+
>
|
|
66
|
+
<input value="1234567890" />
|
|
67
|
+
</j-bind>
|
|
68
|
+
</div>
|
|
69
|
+
`);
|
|
70
|
+
const input = element.querySelector("input");
|
|
71
|
+
assert.equal(input?.selectionStart, 8);
|
|
72
|
+
assert.equal(input?.selectionEnd, 8);
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=bind.element.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind.element.test.js","sourceRoot":"","sources":["../../../src/lib/elements/bind.element.test.ts"],"names":[],"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AM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAE7C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAA;;sBAEZ,CAAC,CAAkB,EAAE,EAAE;QACrC,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;;;;;;;;;;;GAWJ,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAE7C,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;IACvC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC"}
|
|
@@ -19,7 +19,7 @@ it("should iterate over an iterable", () => {
|
|
|
19
19
|
<j-for bind="items" key="id">
|
|
20
20
|
<template>
|
|
21
21
|
<li>
|
|
22
|
-
<j-
|
|
22
|
+
<j-val bind="each.value.label"></j-val>
|
|
23
23
|
</li>
|
|
24
24
|
</template>
|
|
25
25
|
</j-for>
|
|
@@ -80,12 +80,12 @@ it("should update when items are added or removed", () => {
|
|
|
80
80
|
>
|
|
81
81
|
<j-for bind="items" key="id">
|
|
82
82
|
<template>
|
|
83
|
-
<j-
|
|
83
|
+
<j-val bind="each.value.text"></j-val>
|
|
84
84
|
</template>
|
|
85
85
|
</j-for>
|
|
86
86
|
</div>
|
|
87
87
|
`);
|
|
88
|
-
const items = element.querySelectorAll("j-
|
|
88
|
+
const items = element.querySelectorAll("j-val");
|
|
89
89
|
assert.equal(items.length, 2);
|
|
90
90
|
assert.equal(items[0].textContent?.trim(), "First");
|
|
91
91
|
assert.equal(items[1].textContent?.trim(), "Third");
|
|
@@ -102,9 +102,8 @@ it("should provide index and position information", () => {
|
|
|
102
102
|
>
|
|
103
103
|
<j-for bind="items">
|
|
104
104
|
<template>
|
|
105
|
-
<j-
|
|
106
|
-
(index: <j-
|
|
107
|
-
position: <j-value bind="each.position"></j-value>)
|
|
105
|
+
<j-val bind="each.value"></j-val>
|
|
106
|
+
(index: <j-val bind="each.index"></j-val>, position: <j-val bind="each.position"></j-val>)
|
|
108
107
|
</template>
|
|
109
108
|
</j-for>
|
|
110
109
|
</div>
|
|
@@ -139,12 +138,12 @@ it("should maintain DOM order when items are reordered", () => {
|
|
|
139
138
|
>
|
|
140
139
|
<j-for bind="items" key="id">
|
|
141
140
|
<template>
|
|
142
|
-
<j-
|
|
141
|
+
<j-val bind="each.value.text"></j-val>
|
|
143
142
|
</template>
|
|
144
143
|
</j-for>
|
|
145
144
|
</div>
|
|
146
145
|
`);
|
|
147
|
-
const items = element.querySelectorAll("j-
|
|
146
|
+
const items = element.querySelectorAll("j-val");
|
|
148
147
|
assert.equal(items.length, 3);
|
|
149
148
|
assert.equal(items[0].textContent?.trim(), "Third");
|
|
150
149
|
assert.equal(items[1].textContent?.trim(), "First");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"for.element.test.js","sourceRoot":"","sources":["../../../src/lib/elements/for.element.test.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAI9B,EAAE,CAAC,iCAAiC,EAAE,GAAG,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AE,QAAQ,EAAE;gBAC3B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE;aAC3B;SACF,CAAC,CAAC;QAGH,CAAC,CAAC,MAAM,CAAC;YACP,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE;gBACR,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC5B;SACF,CAAC,CAAC;IACL,CAAC;;;;;;;;GAQJ,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
2
2
|
import { attr, element, css, html, listen } from "@joist/element";
|
|
3
3
|
let JoistScopeElement = (() => {
|
|
4
4
|
let _classDecorators = [element({
|
|
5
|
-
tagName: "j-
|
|
5
|
+
tagName: "j-val",
|
|
6
6
|
shadowDom: [css `:host{display: contents;}`, html `<slot></slot>`],
|
|
7
7
|
})];
|
|
8
8
|
let _classDescriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/lib/elements/scope.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;IAerD,iBAAiB;4BAL7B,OAAO,CAAC;YACP,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/lib/elements/scope.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;IAerD,iBAAiB;4BAL7B,OAAO,CAAC;YACP,OAAO,EAAE,OAAO;YAEhB,SAAS,EAAE,CAAC,GAAG,CAAA,2BAA2B,EAAE,IAAI,CAAA,eAAe,CAAC;SACjE,CAAC;;;;sBACqC,WAAW;;;;;;;;;iCAAnB,SAAQ,WAAW;;;;gCAC/C,IAAI,EAAE;iCAGN,IAAI,EAAE;6CAKN,MAAM,CAAC,cAAc,CAAC;YAPvB,iKAAS,IAAI,6BAAJ,IAAI,mFAAM;YAGnB,oKAAS,KAAK,6BAAL,KAAK,qFAAM;YAKpB,sMAAA,iBAAiB,6DAQhB;YAlBH,6KAuBC;;;YAvBY,uDAAiB;;QAE5B,0BAFW,mDAAiB,8CAEZ,EAAE,GAAC;QAAnB,IAAS,IAAI,0CAAM;QAAnB,IAAS,IAAI,gDAAM;QAGnB,0HAAiB,EAAE,GAAC;QAApB,IAAS,KAAK,2CAAM;QAApB,IAAS,KAAK,iDAAM;QAEpB,QAAQ,uDAA2B,IAAI,EAAC;QAGxC,iBAAiB,CAAC,CAAkB;YAClC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;gBACjC,CAAC,CAAC,eAAe,EAAE,CAAC;gBAEpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAElB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAED,wBAAwB,CAAC,CAAS,EAAE,QAAgB,EAAE,QAAgB;YACpE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChD,CAAC;;;;SAtBU,iBAAiB"}
|
|
@@ -4,7 +4,7 @@ import { JoistValueEvent } from "../events.js";
|
|
|
4
4
|
import { JToken } from "../token.js";
|
|
5
5
|
let JoistValueElement = (() => {
|
|
6
6
|
let _classDecorators = [element({
|
|
7
|
-
tagName: "j-
|
|
7
|
+
tagName: "j-val",
|
|
8
8
|
shadowDom: [css `:host{display: contents;}`, html `<slot></slot>`],
|
|
9
9
|
})];
|
|
10
10
|
let _classDescriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.element.js","sourceRoot":"","sources":["../../../src/lib/elements/value.element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;IAaxB,iBAAiB;4BAL7B,OAAO,CAAC;YACP,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"value.element.js","sourceRoot":"","sources":["../../../src/lib/elements/value.element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;IAaxB,iBAAiB;4BAL7B,OAAO,CAAC;YACP,OAAO,EAAE,OAAO;YAEhB,SAAS,EAAE,CAAC,GAAG,CAAA,2BAA2B,EAAE,IAAI,CAAA,eAAe,CAAC;SACjE,CAAC;;;;sBACqC,WAAW;;;;iCAAnB,SAAQ,WAAW;;;;gCAC/C,IAAI,EAAE;YACP,iKAAS,IAAI,6BAAJ,IAAI,mFAAM;YAFrB,6KAuBC;;;YAvBY,uDAAiB;;QAE5B,qEAAgB,EAAE,EAAC;QAAnB,IAAS,IAAI,0CAAM;QAAnB,IAAS,IAAI,gDAAM;QAEnB,iBAAiB;YACf,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEpC,IAAI,CAAC,aAAa,CAChB,IAAI,eAAe,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACnC,IAAI,YAAoB,CAAC;gBAEzB,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;oBAClE,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAClE,CAAC;qBAAM,CAAC;oBACN,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACxC,CAAC;gBAED,IAAI,IAAI,CAAC,WAAW,KAAK,YAAY,EAAE,CAAC;oBACtC,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;;;;;;;;SAtBU,iBAAiB"}
|
|
@@ -8,7 +8,7 @@ it("should render content when the bind value is truthy", () => {
|
|
|
8
8
|
e.update({ oldValue: null, newValue: "Hello World" });
|
|
9
9
|
}}
|
|
10
10
|
>
|
|
11
|
-
<j-
|
|
11
|
+
<j-val bind="test"></j-val>
|
|
12
12
|
</div>
|
|
13
13
|
`);
|
|
14
14
|
assert.equal(element.textContent?.trim(), "Hello World");
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { attr, element, css, html } from "@joist/element";
|
|
2
|
-
|
|
3
|
-
import { JoistValueEvent } from "../events.js";
|
|
4
|
-
import { JToken } from "../token.js";
|
|
5
|
-
|
|
6
|
-
export class JAttrToken extends JToken {
|
|
7
|
-
mapTo: string;
|
|
8
|
-
mapsToProp: boolean;
|
|
9
|
-
|
|
10
|
-
constructor(attr: Attr) {
|
|
11
|
-
if (!attr.name.startsWith("$")) {
|
|
12
|
-
throw new Error(`Invalid attribute token: ${attr.name}, should start with $`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
super(attr.value);
|
|
16
|
-
|
|
17
|
-
this.mapsToProp = attr.name.startsWith("$.");
|
|
18
|
-
|
|
19
|
-
this.mapTo = attr.name.slice(this.mapsToProp ? 2 : 1);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@element({
|
|
24
|
-
tagName: "j-props",
|
|
25
|
-
// prettier-ignore
|
|
26
|
-
shadowDom: [css`:host{display: contents;}`, html`<slot></slot>`],
|
|
27
|
-
})
|
|
28
|
-
export class JoistIfElement extends HTMLElement {
|
|
29
|
-
@attr()
|
|
30
|
-
accessor target = "";
|
|
31
|
-
|
|
32
|
-
connectedCallback(): void {
|
|
33
|
-
this.#bindProps([this]); // bind own props
|
|
34
|
-
this.#bindProps(this.children); // bind child props
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
#bindProps(children: Iterable<Element>) {
|
|
38
|
-
for (const child of children) {
|
|
39
|
-
for (const attr of child.attributes) {
|
|
40
|
-
if (attr.name.startsWith("$")) {
|
|
41
|
-
const token = new JAttrToken(attr);
|
|
42
|
-
|
|
43
|
-
this.dispatchEvent(
|
|
44
|
-
new JoistValueEvent(token, ({ newValue, oldValue }) => {
|
|
45
|
-
if (newValue === oldValue) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let valueToWrite = newValue;
|
|
50
|
-
|
|
51
|
-
if (typeof newValue === "object" && newValue !== null) {
|
|
52
|
-
valueToWrite = token.readTokenValueFrom(newValue);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (token.isNegated) {
|
|
56
|
-
valueToWrite = !valueToWrite;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (token.mapsToProp) {
|
|
60
|
-
Reflect.set(child, token.mapTo, valueToWrite);
|
|
61
|
-
} else {
|
|
62
|
-
if (valueToWrite === true) {
|
|
63
|
-
child.setAttribute(token.mapTo, "");
|
|
64
|
-
} else if (valueToWrite === false) {
|
|
65
|
-
child.removeAttribute(token.mapTo);
|
|
66
|
-
} else {
|
|
67
|
-
child.setAttribute(token.mapTo, String(valueToWrite));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
-
import { attr, element, css, html } from "@joist/element";
|
|
3
|
-
import { JoistValueEvent } from "../events.js";
|
|
4
|
-
import { JToken } from "../token.js";
|
|
5
|
-
export class JAttrToken extends JToken {
|
|
6
|
-
mapTo;
|
|
7
|
-
mapsToProp;
|
|
8
|
-
constructor(attr) {
|
|
9
|
-
if (!attr.name.startsWith("$")) {
|
|
10
|
-
throw new Error(`Invalid attribute token: ${attr.name}, should start with $`);
|
|
11
|
-
}
|
|
12
|
-
super(attr.value);
|
|
13
|
-
this.mapsToProp = attr.name.startsWith("$.");
|
|
14
|
-
this.mapTo = attr.name.slice(this.mapsToProp ? 2 : 1);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
let JoistIfElement = (() => {
|
|
18
|
-
let _classDecorators = [element({
|
|
19
|
-
tagName: "j-props",
|
|
20
|
-
shadowDom: [css `:host{display: contents;}`, html `<slot></slot>`],
|
|
21
|
-
})];
|
|
22
|
-
let _classDescriptor;
|
|
23
|
-
let _classExtraInitializers = [];
|
|
24
|
-
let _classThis;
|
|
25
|
-
let _classSuper = HTMLElement;
|
|
26
|
-
let _target_decorators;
|
|
27
|
-
let _target_initializers = [];
|
|
28
|
-
let _target_extraInitializers = [];
|
|
29
|
-
var JoistIfElement = class extends _classSuper {
|
|
30
|
-
static { _classThis = this; }
|
|
31
|
-
static {
|
|
32
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
33
|
-
_target_decorators = [attr()];
|
|
34
|
-
__esDecorate(this, null, _target_decorators, { kind: "accessor", name: "target", static: false, private: false, access: { has: obj => "target" in obj, get: obj => obj.target, set: (obj, value) => { obj.target = value; } }, metadata: _metadata }, _target_initializers, _target_extraInitializers);
|
|
35
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
36
|
-
JoistIfElement = _classThis = _classDescriptor.value;
|
|
37
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
38
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
39
|
-
}
|
|
40
|
-
#target_accessor_storage = __runInitializers(this, _target_initializers, "");
|
|
41
|
-
get target() { return this.#target_accessor_storage; }
|
|
42
|
-
set target(value) { this.#target_accessor_storage = value; }
|
|
43
|
-
connectedCallback() {
|
|
44
|
-
this.#bindProps([this]);
|
|
45
|
-
this.#bindProps(this.children);
|
|
46
|
-
}
|
|
47
|
-
#bindProps(children) {
|
|
48
|
-
for (const child of children) {
|
|
49
|
-
for (const attr of child.attributes) {
|
|
50
|
-
if (attr.name.startsWith("$")) {
|
|
51
|
-
const token = new JAttrToken(attr);
|
|
52
|
-
this.dispatchEvent(new JoistValueEvent(token, ({ newValue, oldValue }) => {
|
|
53
|
-
if (newValue === oldValue) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
let valueToWrite = newValue;
|
|
57
|
-
if (typeof newValue === "object" && newValue !== null) {
|
|
58
|
-
valueToWrite = token.readTokenValueFrom(newValue);
|
|
59
|
-
}
|
|
60
|
-
if (token.isNegated) {
|
|
61
|
-
valueToWrite = !valueToWrite;
|
|
62
|
-
}
|
|
63
|
-
if (token.mapsToProp) {
|
|
64
|
-
Reflect.set(child, token.mapTo, valueToWrite);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
if (valueToWrite === true) {
|
|
68
|
-
child.setAttribute(token.mapTo, "");
|
|
69
|
-
}
|
|
70
|
-
else if (valueToWrite === false) {
|
|
71
|
-
child.removeAttribute(token.mapTo);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
child.setAttribute(token.mapTo, String(valueToWrite));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
constructor() {
|
|
83
|
-
super(...arguments);
|
|
84
|
-
__runInitializers(this, _target_extraInitializers);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
return JoistIfElement = _classThis;
|
|
88
|
-
})();
|
|
89
|
-
export { JoistIfElement };
|
|
90
|
-
//# sourceMappingURL=props.element.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"props.element.js","sourceRoot":"","sources":["../../../src/lib/elements/props.element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,UAAW,SAAQ,MAAM;IACpC,KAAK,CAAS;IACd,UAAU,CAAU;IAEpB,YAAY,IAA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