@microsoft/fast-element 2.0.0-beta.13 → 2.0.0-beta.14
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/CHANGELOG.json +21 -0
- package/CHANGELOG.md +10 -1
- package/dist/dts/templating/binding.d.ts +7 -13
- package/dist/dts/testing/fakes.d.ts +1 -1
- package/dist/esm/templating/binding.js +33 -40
- package/dist/esm/testing/fakes.js +1 -1
- package/dist/fast-element.api.json +9 -9
- package/dist/fast-element.d.ts +6 -9
- package/dist/fast-element.debug.js +33 -40
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +33 -40
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +7 -13
- package/docs/api-report.md +4 -10
- package/package.json +1 -1
- package/yarn-error.log +177 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Fri, 14 Oct 2022 18:26:11 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v2.0.0-beta.14",
|
|
7
|
+
"version": "2.0.0-beta.14",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "roeisenb@microsoft.com",
|
|
12
|
+
"package": "@microsoft/fast-element",
|
|
13
|
+
"commit": "19f1ae727e2ff6e629d2b134fc045a81d83caaed",
|
|
14
|
+
"comment": "fix: tokenList bindings track adds and removes from multiple sources"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "roeisenb@microsoft.com",
|
|
18
|
+
"package": "@microsoft/fast-element",
|
|
19
|
+
"commit": "0248fa906f986d6b0cbdeb26cf388742e871449e",
|
|
20
|
+
"comment": "refactor: remove duplication and re-organize binding behavior logic"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
4
25
|
{
|
|
5
26
|
"date": "Mon, 10 Oct 2022 20:28:02 GMT",
|
|
6
27
|
"tag": "@microsoft/fast-element_v2.0.0-beta.13",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 14 Oct 2022 18:26:11 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.0.0-beta.14
|
|
8
|
+
|
|
9
|
+
Fri, 14 Oct 2022 18:26:11 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- fix: tokenList bindings track adds and removes from multiple sources (roeisenb@microsoft.com)
|
|
14
|
+
- refactor: remove duplication and re-organize binding behavior logic (roeisenb@microsoft.com)
|
|
15
|
+
|
|
7
16
|
## 2.0.0-beta.13
|
|
8
17
|
|
|
9
18
|
Mon, 10 Oct 2022 20:28:02 GMT
|
|
@@ -80,13 +80,7 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
80
80
|
*/
|
|
81
81
|
createBehavior(): ViewBehavior;
|
|
82
82
|
/** @internal */
|
|
83
|
-
|
|
84
|
-
/** @internal */
|
|
85
|
-
bind: (controller: ViewController) => void;
|
|
86
|
-
/** @internal */
|
|
87
|
-
bindContent(controller: ViewController): void;
|
|
88
|
-
/** @internal */
|
|
89
|
-
bindEvent(controller: ViewController): void;
|
|
83
|
+
bind(controller: ViewController): void;
|
|
90
84
|
/** @internal */
|
|
91
85
|
unbind(controller: ViewController): void;
|
|
92
86
|
/** @internal */
|
|
@@ -96,27 +90,27 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
96
90
|
}
|
|
97
91
|
/**
|
|
98
92
|
* Creates an standard binding.
|
|
99
|
-
* @param
|
|
93
|
+
* @param expression - The binding to refresh when changed.
|
|
100
94
|
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
101
95
|
* @returns A binding configuration.
|
|
102
96
|
* @public
|
|
103
97
|
*/
|
|
104
|
-
export declare function bind<T = any>(
|
|
98
|
+
export declare function bind<T = any>(expression: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
105
99
|
/**
|
|
106
100
|
* Creates a one time binding
|
|
107
|
-
* @param
|
|
101
|
+
* @param expression - The binding to refresh when signaled.
|
|
108
102
|
* @returns A binding configuration.
|
|
109
103
|
* @public
|
|
110
104
|
*/
|
|
111
|
-
export declare function oneTime<T = any>(
|
|
105
|
+
export declare function oneTime<T = any>(expression: Expression<T>): Binding<T>;
|
|
112
106
|
/**
|
|
113
107
|
* Creates an event listener binding.
|
|
114
|
-
* @param
|
|
108
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
115
109
|
* @param options - Event listener options.
|
|
116
110
|
* @returns A binding configuration.
|
|
117
111
|
* @public
|
|
118
112
|
*/
|
|
119
|
-
export declare function listener<T = any>(
|
|
113
|
+
export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
120
114
|
/**
|
|
121
115
|
* Normalizes the input value into a binding.
|
|
122
116
|
* @param value - The value to create the default binding for.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExecutionContext, ViewBehavior, ViewBehaviorTargets } from "../index.js";
|
|
2
2
|
export declare const Fake: Readonly<{
|
|
3
3
|
executionContext<TParent = any>(parent?: TParent | undefined, parentContext?: ExecutionContext<TParent> | undefined): ExecutionContext<TParent>;
|
|
4
|
-
viewController<TSource = any, TParent_1 = any>(targets
|
|
4
|
+
viewController<TSource = any, TParent_1 = any>(targets?: ViewBehaviorTargets, ...behaviors: ViewBehavior<TSource, TParent_1>[]): {
|
|
5
5
|
isBound: boolean;
|
|
6
6
|
context: ExecutionContext<TParent_1>;
|
|
7
7
|
onUnbind(object: any): void;
|
|
@@ -88,9 +88,9 @@ function updateContent(target, aspect, value, controller) {
|
|
|
88
88
|
function updateTokenList(target, aspect, value) {
|
|
89
89
|
var _a;
|
|
90
90
|
const lookup = `${this.id}-t`;
|
|
91
|
-
const state = (_a = target[lookup]) !== null && _a !== void 0 ? _a : (target[lookup] = {
|
|
92
|
-
const
|
|
93
|
-
let
|
|
91
|
+
const state = (_a = target[lookup]) !== null && _a !== void 0 ? _a : (target[lookup] = { v: 0, cv: Object.create(null) });
|
|
92
|
+
const classVersions = state.cv;
|
|
93
|
+
let version = state.v;
|
|
94
94
|
const tokenList = target[aspect];
|
|
95
95
|
// Add the classes, tracking the version at which they were added.
|
|
96
96
|
if (value !== null && value !== undefined && value.length) {
|
|
@@ -100,19 +100,19 @@ function updateTokenList(target, aspect, value) {
|
|
|
100
100
|
if (currentName === "") {
|
|
101
101
|
continue;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
classVersions[currentName] = version;
|
|
104
104
|
tokenList.add(currentName);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
state.v =
|
|
107
|
+
state.v = version + 1;
|
|
108
108
|
// If this is the first call to add classes, there's no need to remove old ones.
|
|
109
|
-
if (
|
|
109
|
+
if (version === 0) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
// Remove classes from the previous version.
|
|
113
|
-
|
|
114
|
-
for (const name in
|
|
115
|
-
if (
|
|
113
|
+
version -= 1;
|
|
114
|
+
for (const name in classVersions) {
|
|
115
|
+
if (classVersions[name] === version) {
|
|
116
116
|
tokenList.remove(name);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -139,8 +139,6 @@ export class HTMLBindingDirective {
|
|
|
139
139
|
* The type of aspect to target.
|
|
140
140
|
*/
|
|
141
141
|
this.aspectType = Aspect.content;
|
|
142
|
-
/** @internal */
|
|
143
|
-
this.bind = this.bindDefault;
|
|
144
142
|
this.data = `${this.id}-d`;
|
|
145
143
|
}
|
|
146
144
|
/**
|
|
@@ -169,14 +167,12 @@ export class HTMLBindingDirective {
|
|
|
169
167
|
this.updateTarget = setProperty;
|
|
170
168
|
break;
|
|
171
169
|
case 4:
|
|
172
|
-
this.bind = this.bindContent;
|
|
173
170
|
this.updateTarget = updateContent;
|
|
174
171
|
break;
|
|
175
172
|
case 5:
|
|
176
173
|
this.updateTarget = updateTokenList;
|
|
177
174
|
break;
|
|
178
175
|
case 6:
|
|
179
|
-
this.bind = this.bindEvent;
|
|
180
176
|
this.updateTarget = eventTarget;
|
|
181
177
|
break;
|
|
182
178
|
default:
|
|
@@ -186,29 +182,26 @@ export class HTMLBindingDirective {
|
|
|
186
182
|
return this;
|
|
187
183
|
}
|
|
188
184
|
/** @internal */
|
|
189
|
-
|
|
185
|
+
bind(controller) {
|
|
190
186
|
var _a;
|
|
191
187
|
const target = controller.targets[this.nodeId];
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
188
|
+
switch (this.updateTarget) {
|
|
189
|
+
case eventTarget:
|
|
190
|
+
target[this.data] = controller;
|
|
191
|
+
target.addEventListener(this.targetAspect, this, this.dataBinding.options);
|
|
192
|
+
break;
|
|
193
|
+
case updateContent:
|
|
194
|
+
controller.onUnbind(this);
|
|
195
|
+
// intentional fall through
|
|
196
|
+
default:
|
|
197
|
+
const observer = (_a = target[this.data]) !== null && _a !== void 0 ? _a : (target[this.data] = this.dataBinding.createObserver(this, this));
|
|
198
|
+
observer.target = target;
|
|
199
|
+
observer.controller = controller;
|
|
200
|
+
this.updateTarget(target, this.targetAspect, observer.bind(controller), controller);
|
|
201
|
+
break;
|
|
198
202
|
}
|
|
199
203
|
}
|
|
200
204
|
/** @internal */
|
|
201
|
-
bindContent(controller) {
|
|
202
|
-
this.bindDefault(controller);
|
|
203
|
-
controller.onUnbind(this);
|
|
204
|
-
}
|
|
205
|
-
/** @internal */
|
|
206
|
-
bindEvent(controller) {
|
|
207
|
-
const target = controller.targets[this.nodeId];
|
|
208
|
-
target[this.data] = controller;
|
|
209
|
-
target.addEventListener(this.targetAspect, this, this.dataBinding.options);
|
|
210
|
-
}
|
|
211
|
-
/** @internal */
|
|
212
205
|
unbind(controller) {
|
|
213
206
|
const target = controller.targets[this.nodeId];
|
|
214
207
|
const view = target.$fastView;
|
|
@@ -239,32 +232,32 @@ export class HTMLBindingDirective {
|
|
|
239
232
|
HTMLDirective.define(HTMLBindingDirective, { aspected: true });
|
|
240
233
|
/**
|
|
241
234
|
* Creates an standard binding.
|
|
242
|
-
* @param
|
|
235
|
+
* @param expression - The binding to refresh when changed.
|
|
243
236
|
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
244
237
|
* @returns A binding configuration.
|
|
245
238
|
* @public
|
|
246
239
|
*/
|
|
247
|
-
export function bind(
|
|
248
|
-
return new OnChangeBinding(
|
|
240
|
+
export function bind(expression, isVolatile = Observable.isVolatileBinding(expression)) {
|
|
241
|
+
return new OnChangeBinding(expression, isVolatile);
|
|
249
242
|
}
|
|
250
243
|
/**
|
|
251
244
|
* Creates a one time binding
|
|
252
|
-
* @param
|
|
245
|
+
* @param expression - The binding to refresh when signaled.
|
|
253
246
|
* @returns A binding configuration.
|
|
254
247
|
* @public
|
|
255
248
|
*/
|
|
256
|
-
export function oneTime(
|
|
257
|
-
return new OneTimeBinding(
|
|
249
|
+
export function oneTime(expression) {
|
|
250
|
+
return new OneTimeBinding(expression);
|
|
258
251
|
}
|
|
259
252
|
/**
|
|
260
253
|
* Creates an event listener binding.
|
|
261
|
-
* @param
|
|
254
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
262
255
|
* @param options - Event listener options.
|
|
263
256
|
* @returns A binding configuration.
|
|
264
257
|
* @public
|
|
265
258
|
*/
|
|
266
|
-
export function listener(
|
|
267
|
-
const config = new OnChangeBinding(
|
|
259
|
+
export function listener(expression, options) {
|
|
260
|
+
const config = new OnChangeBinding(expression, false);
|
|
268
261
|
config.options = options;
|
|
269
262
|
return config;
|
|
270
263
|
}
|
|
@@ -1442,7 +1442,7 @@
|
|
|
1442
1442
|
{
|
|
1443
1443
|
"kind": "Function",
|
|
1444
1444
|
"canonicalReference": "@microsoft/fast-element!bind:function(1)",
|
|
1445
|
-
"docComment": "/**\n * Creates an standard binding.\n *\n * @param
|
|
1445
|
+
"docComment": "/**\n * Creates an standard binding.\n *\n * @param expression - The binding to refresh when changed.\n *\n * @param isVolatile - Indicates whether the binding is volatile or not.\n *\n * @returns A binding configuration.\n *\n * @public\n */\n",
|
|
1446
1446
|
"excerptTokens": [
|
|
1447
1447
|
{
|
|
1448
1448
|
"kind": "Content",
|
|
@@ -1454,7 +1454,7 @@
|
|
|
1454
1454
|
},
|
|
1455
1455
|
{
|
|
1456
1456
|
"kind": "Content",
|
|
1457
|
-
"text": ">(
|
|
1457
|
+
"text": ">(expression: "
|
|
1458
1458
|
},
|
|
1459
1459
|
{
|
|
1460
1460
|
"kind": "Reference",
|
|
@@ -1499,7 +1499,7 @@
|
|
|
1499
1499
|
"overloadIndex": 1,
|
|
1500
1500
|
"parameters": [
|
|
1501
1501
|
{
|
|
1502
|
-
"parameterName": "
|
|
1502
|
+
"parameterName": "expression",
|
|
1503
1503
|
"parameterTypeTokenRange": {
|
|
1504
1504
|
"startIndex": 3,
|
|
1505
1505
|
"endIndex": 5
|
|
@@ -10141,7 +10141,7 @@
|
|
|
10141
10141
|
{
|
|
10142
10142
|
"kind": "Function",
|
|
10143
10143
|
"canonicalReference": "@microsoft/fast-element!listener:function(1)",
|
|
10144
|
-
"docComment": "/**\n * Creates an event listener binding.\n *\n * @param
|
|
10144
|
+
"docComment": "/**\n * Creates an event listener binding.\n *\n * @param expression - The binding to invoke when the event is raised.\n *\n * @param options - Event listener options.\n *\n * @returns A binding configuration.\n *\n * @public\n */\n",
|
|
10145
10145
|
"excerptTokens": [
|
|
10146
10146
|
{
|
|
10147
10147
|
"kind": "Content",
|
|
@@ -10153,7 +10153,7 @@
|
|
|
10153
10153
|
},
|
|
10154
10154
|
{
|
|
10155
10155
|
"kind": "Content",
|
|
10156
|
-
"text": ">(
|
|
10156
|
+
"text": ">(expression: "
|
|
10157
10157
|
},
|
|
10158
10158
|
{
|
|
10159
10159
|
"kind": "Reference",
|
|
@@ -10199,7 +10199,7 @@
|
|
|
10199
10199
|
"overloadIndex": 1,
|
|
10200
10200
|
"parameters": [
|
|
10201
10201
|
{
|
|
10202
|
-
"parameterName": "
|
|
10202
|
+
"parameterName": "expression",
|
|
10203
10203
|
"parameterTypeTokenRange": {
|
|
10204
10204
|
"startIndex": 3,
|
|
10205
10205
|
"endIndex": 5
|
|
@@ -11397,7 +11397,7 @@
|
|
|
11397
11397
|
{
|
|
11398
11398
|
"kind": "Function",
|
|
11399
11399
|
"canonicalReference": "@microsoft/fast-element!oneTime:function(1)",
|
|
11400
|
-
"docComment": "/**\n * Creates a one time binding\n *\n * @param
|
|
11400
|
+
"docComment": "/**\n * Creates a one time binding\n *\n * @param expression - The binding to refresh when signaled.\n *\n * @returns A binding configuration.\n *\n * @public\n */\n",
|
|
11401
11401
|
"excerptTokens": [
|
|
11402
11402
|
{
|
|
11403
11403
|
"kind": "Content",
|
|
@@ -11409,7 +11409,7 @@
|
|
|
11409
11409
|
},
|
|
11410
11410
|
{
|
|
11411
11411
|
"kind": "Content",
|
|
11412
|
-
"text": ">(
|
|
11412
|
+
"text": ">(expression: "
|
|
11413
11413
|
},
|
|
11414
11414
|
{
|
|
11415
11415
|
"kind": "Reference",
|
|
@@ -11446,7 +11446,7 @@
|
|
|
11446
11446
|
"overloadIndex": 1,
|
|
11447
11447
|
"parameters": [
|
|
11448
11448
|
{
|
|
11449
|
-
"parameterName": "
|
|
11449
|
+
"parameterName": "expression",
|
|
11450
11450
|
"parameterTypeTokenRange": {
|
|
11451
11451
|
"startIndex": 3,
|
|
11452
11452
|
"endIndex": 5
|
package/dist/fast-element.d.ts
CHANGED
|
@@ -258,12 +258,12 @@ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "f
|
|
|
258
258
|
|
|
259
259
|
/**
|
|
260
260
|
* Creates an standard binding.
|
|
261
|
-
* @param
|
|
261
|
+
* @param expression - The binding to refresh when changed.
|
|
262
262
|
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
263
263
|
* @returns A binding configuration.
|
|
264
264
|
* @public
|
|
265
265
|
*/
|
|
266
|
-
export declare function bind<T = any>(
|
|
266
|
+
export declare function bind<T = any>(expression: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* Captures a binding expression along with related information and capabilities.
|
|
@@ -1295,10 +1295,7 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1295
1295
|
* Creates a behavior.
|
|
1296
1296
|
*/
|
|
1297
1297
|
createBehavior(): ViewBehavior;
|
|
1298
|
-
/* Excluded from this release type: bindDefault */
|
|
1299
1298
|
/* Excluded from this release type: bind */
|
|
1300
|
-
/* Excluded from this release type: bindContent */
|
|
1301
|
-
/* Excluded from this release type: bindEvent */
|
|
1302
1299
|
/* Excluded from this release type: unbind */
|
|
1303
1300
|
/* Excluded from this release type: handleEvent */
|
|
1304
1301
|
/* Excluded from this release type: handleChange */
|
|
@@ -1524,12 +1521,12 @@ export declare function lengthOf<T>(array: readonly T[]): number;
|
|
|
1524
1521
|
|
|
1525
1522
|
/**
|
|
1526
1523
|
* Creates an event listener binding.
|
|
1527
|
-
* @param
|
|
1524
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
1528
1525
|
* @param options - Event listener options.
|
|
1529
1526
|
* @returns A binding configuration.
|
|
1530
1527
|
* @public
|
|
1531
1528
|
*/
|
|
1532
|
-
export declare function listener<T = any>(
|
|
1529
|
+
export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
|
|
1533
1530
|
|
|
1534
1531
|
/**
|
|
1535
1532
|
* Common APIs related to markup generation.
|
|
@@ -1776,11 +1773,11 @@ export declare interface ObservationRecord {
|
|
|
1776
1773
|
|
|
1777
1774
|
/**
|
|
1778
1775
|
* Creates a one time binding
|
|
1779
|
-
* @param
|
|
1776
|
+
* @param expression - The binding to refresh when signaled.
|
|
1780
1777
|
* @returns A binding configuration.
|
|
1781
1778
|
* @public
|
|
1782
1779
|
*/
|
|
1783
|
-
export declare function oneTime<T = any>(
|
|
1780
|
+
export declare function oneTime<T = any>(expression: Expression<T>): Binding<T>;
|
|
1784
1781
|
|
|
1785
1782
|
/**
|
|
1786
1783
|
* Common APIs related to content parsing.
|
|
@@ -1963,9 +1963,9 @@ function updateContent(target, aspect, value, controller) {
|
|
|
1963
1963
|
function updateTokenList(target, aspect, value) {
|
|
1964
1964
|
var _a;
|
|
1965
1965
|
const lookup = `${this.id}-t`;
|
|
1966
|
-
const state = (_a = target[lookup]) !== null && _a !== void 0 ? _a : (target[lookup] = {
|
|
1967
|
-
const
|
|
1968
|
-
let
|
|
1966
|
+
const state = (_a = target[lookup]) !== null && _a !== void 0 ? _a : (target[lookup] = { v: 0, cv: Object.create(null) });
|
|
1967
|
+
const classVersions = state.cv;
|
|
1968
|
+
let version = state.v;
|
|
1969
1969
|
const tokenList = target[aspect];
|
|
1970
1970
|
// Add the classes, tracking the version at which they were added.
|
|
1971
1971
|
if (value !== null && value !== undefined && value.length) {
|
|
@@ -1975,19 +1975,19 @@ function updateTokenList(target, aspect, value) {
|
|
|
1975
1975
|
if (currentName === "") {
|
|
1976
1976
|
continue;
|
|
1977
1977
|
}
|
|
1978
|
-
|
|
1978
|
+
classVersions[currentName] = version;
|
|
1979
1979
|
tokenList.add(currentName);
|
|
1980
1980
|
}
|
|
1981
1981
|
}
|
|
1982
|
-
state.v =
|
|
1982
|
+
state.v = version + 1;
|
|
1983
1983
|
// If this is the first call to add classes, there's no need to remove old ones.
|
|
1984
|
-
if (
|
|
1984
|
+
if (version === 0) {
|
|
1985
1985
|
return;
|
|
1986
1986
|
}
|
|
1987
1987
|
// Remove classes from the previous version.
|
|
1988
|
-
|
|
1989
|
-
for (const name in
|
|
1990
|
-
if (
|
|
1988
|
+
version -= 1;
|
|
1989
|
+
for (const name in classVersions) {
|
|
1990
|
+
if (classVersions[name] === version) {
|
|
1991
1991
|
tokenList.remove(name);
|
|
1992
1992
|
}
|
|
1993
1993
|
}
|
|
@@ -2014,8 +2014,6 @@ class HTMLBindingDirective {
|
|
|
2014
2014
|
* The type of aspect to target.
|
|
2015
2015
|
*/
|
|
2016
2016
|
this.aspectType = Aspect.content;
|
|
2017
|
-
/** @internal */
|
|
2018
|
-
this.bind = this.bindDefault;
|
|
2019
2017
|
this.data = `${this.id}-d`;
|
|
2020
2018
|
}
|
|
2021
2019
|
/**
|
|
@@ -2044,14 +2042,12 @@ class HTMLBindingDirective {
|
|
|
2044
2042
|
this.updateTarget = setProperty;
|
|
2045
2043
|
break;
|
|
2046
2044
|
case 4:
|
|
2047
|
-
this.bind = this.bindContent;
|
|
2048
2045
|
this.updateTarget = updateContent;
|
|
2049
2046
|
break;
|
|
2050
2047
|
case 5:
|
|
2051
2048
|
this.updateTarget = updateTokenList;
|
|
2052
2049
|
break;
|
|
2053
2050
|
case 6:
|
|
2054
|
-
this.bind = this.bindEvent;
|
|
2055
2051
|
this.updateTarget = eventTarget;
|
|
2056
2052
|
break;
|
|
2057
2053
|
default:
|
|
@@ -2061,29 +2057,26 @@ class HTMLBindingDirective {
|
|
|
2061
2057
|
return this;
|
|
2062
2058
|
}
|
|
2063
2059
|
/** @internal */
|
|
2064
|
-
|
|
2060
|
+
bind(controller) {
|
|
2065
2061
|
var _a;
|
|
2066
2062
|
const target = controller.targets[this.nodeId];
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2063
|
+
switch (this.updateTarget) {
|
|
2064
|
+
case eventTarget:
|
|
2065
|
+
target[this.data] = controller;
|
|
2066
|
+
target.addEventListener(this.targetAspect, this, this.dataBinding.options);
|
|
2067
|
+
break;
|
|
2068
|
+
case updateContent:
|
|
2069
|
+
controller.onUnbind(this);
|
|
2070
|
+
// intentional fall through
|
|
2071
|
+
default:
|
|
2072
|
+
const observer = (_a = target[this.data]) !== null && _a !== void 0 ? _a : (target[this.data] = this.dataBinding.createObserver(this, this));
|
|
2073
|
+
observer.target = target;
|
|
2074
|
+
observer.controller = controller;
|
|
2075
|
+
this.updateTarget(target, this.targetAspect, observer.bind(controller), controller);
|
|
2076
|
+
break;
|
|
2073
2077
|
}
|
|
2074
2078
|
}
|
|
2075
2079
|
/** @internal */
|
|
2076
|
-
bindContent(controller) {
|
|
2077
|
-
this.bindDefault(controller);
|
|
2078
|
-
controller.onUnbind(this);
|
|
2079
|
-
}
|
|
2080
|
-
/** @internal */
|
|
2081
|
-
bindEvent(controller) {
|
|
2082
|
-
const target = controller.targets[this.nodeId];
|
|
2083
|
-
target[this.data] = controller;
|
|
2084
|
-
target.addEventListener(this.targetAspect, this, this.dataBinding.options);
|
|
2085
|
-
}
|
|
2086
|
-
/** @internal */
|
|
2087
2080
|
unbind(controller) {
|
|
2088
2081
|
const target = controller.targets[this.nodeId];
|
|
2089
2082
|
const view = target.$fastView;
|
|
@@ -2114,32 +2107,32 @@ class HTMLBindingDirective {
|
|
|
2114
2107
|
HTMLDirective.define(HTMLBindingDirective, { aspected: true });
|
|
2115
2108
|
/**
|
|
2116
2109
|
* Creates an standard binding.
|
|
2117
|
-
* @param
|
|
2110
|
+
* @param expression - The binding to refresh when changed.
|
|
2118
2111
|
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
2119
2112
|
* @returns A binding configuration.
|
|
2120
2113
|
* @public
|
|
2121
2114
|
*/
|
|
2122
|
-
function bind(
|
|
2123
|
-
return new OnChangeBinding(
|
|
2115
|
+
function bind(expression, isVolatile = Observable.isVolatileBinding(expression)) {
|
|
2116
|
+
return new OnChangeBinding(expression, isVolatile);
|
|
2124
2117
|
}
|
|
2125
2118
|
/**
|
|
2126
2119
|
* Creates a one time binding
|
|
2127
|
-
* @param
|
|
2120
|
+
* @param expression - The binding to refresh when signaled.
|
|
2128
2121
|
* @returns A binding configuration.
|
|
2129
2122
|
* @public
|
|
2130
2123
|
*/
|
|
2131
|
-
function oneTime(
|
|
2132
|
-
return new OneTimeBinding(
|
|
2124
|
+
function oneTime(expression) {
|
|
2125
|
+
return new OneTimeBinding(expression);
|
|
2133
2126
|
}
|
|
2134
2127
|
/**
|
|
2135
2128
|
* Creates an event listener binding.
|
|
2136
|
-
* @param
|
|
2129
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
2137
2130
|
* @param options - Event listener options.
|
|
2138
2131
|
* @returns A binding configuration.
|
|
2139
2132
|
* @public
|
|
2140
2133
|
*/
|
|
2141
|
-
function listener(
|
|
2142
|
-
const config = new OnChangeBinding(
|
|
2134
|
+
function listener(expression, options) {
|
|
2135
|
+
const config = new OnChangeBinding(expression, false);
|
|
2143
2136
|
config.options = options;
|
|
2144
2137
|
return config;
|
|
2145
2138
|
}
|