@microsoft/fast-element 2.0.0-beta.21 → 2.0.0-beta.23
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 +54 -0
- package/CHANGELOG.md +21 -1
- package/dist/dts/binding/binding.d.ts +49 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/{templating/binding-signal.d.ts → binding/signal.d.ts} +16 -3
- package/dist/dts/{templating/binding-two-way.d.ts → binding/two-way.d.ts} +6 -4
- package/dist/dts/components/element-controller.d.ts +20 -5
- package/dist/dts/context.d.ts +21 -8
- package/dist/dts/index.d.ts +7 -2
- package/dist/dts/interfaces.d.ts +9 -4
- package/dist/dts/metadata.d.ts +1 -0
- package/dist/dts/platform.d.ts +9 -1
- package/dist/dts/styles/css-binding-directive.d.ts +60 -0
- package/dist/dts/styles/css.d.ts +9 -2
- package/dist/dts/styles/host.d.ts +2 -5
- package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +3 -34
- package/dist/dts/templating/html-directive.d.ts +3 -35
- package/dist/dts/templating/render.d.ts +19 -5
- package/dist/dts/templating/repeat.d.ts +3 -2
- package/dist/dts/templating/template.d.ts +2 -6
- package/dist/dts/templating/view.d.ts +16 -6
- package/dist/dts/testing/fakes.d.ts +2 -1
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/{templating/binding-signal.js → binding/signal.js} +20 -10
- package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +14 -15
- package/dist/esm/components/element-controller.js +33 -8
- package/dist/esm/context.js +22 -1
- package/dist/esm/index.js +9 -2
- package/dist/esm/interfaces.js +3 -3
- package/dist/esm/metadata.js +3 -1
- package/dist/esm/observation/observable.js +3 -6
- package/dist/esm/platform.js +9 -0
- package/dist/esm/styles/css-binding-directive.js +76 -0
- package/dist/esm/styles/css.js +14 -2
- package/dist/esm/templating/compiler.js +2 -1
- package/dist/esm/templating/{binding.js → html-binding-directive.js} +3 -70
- package/dist/esm/templating/html-directive.js +2 -25
- package/dist/esm/templating/render.js +25 -12
- package/dist/esm/templating/repeat.js +3 -3
- package/dist/esm/templating/template.js +9 -10
- package/dist/esm/templating/view.js +2 -6
- package/dist/esm/testing/fakes.js +1 -1
- package/dist/fast-element.api.json +1129 -222
- package/dist/fast-element.d.ts +125 -33
- package/dist/fast-element.debug.js +217 -117
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +217 -117
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +132 -72
- package/docs/api-report.md +52 -48
- package/package.json +5 -5
|
@@ -109,17 +109,17 @@ switch (kernelMode) {
|
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Determines whether or not an object is a function.
|
|
112
|
-
* @
|
|
112
|
+
* @public
|
|
113
113
|
*/
|
|
114
114
|
const isFunction = (object) => typeof object === "function";
|
|
115
115
|
/**
|
|
116
116
|
* Determines whether or not an object is a string.
|
|
117
|
-
* @
|
|
117
|
+
* @public
|
|
118
118
|
*/
|
|
119
119
|
const isString = (object) => typeof object === "string";
|
|
120
120
|
/**
|
|
121
121
|
* A function which does nothing.
|
|
122
|
-
* @
|
|
122
|
+
* @public
|
|
123
123
|
*/
|
|
124
124
|
const noop = () => void 0;
|
|
125
125
|
|
|
@@ -238,6 +238,14 @@ function createMetadataLocator() {
|
|
|
238
238
|
return metadata;
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Makes a type noop for JSON serialization.
|
|
243
|
+
* @param type - The type to make noop for JSON serialization.
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
|
+
function makeSerializationNoop(type) {
|
|
247
|
+
type.prototype.toJSON = noop;
|
|
248
|
+
}
|
|
241
249
|
|
|
242
250
|
/**
|
|
243
251
|
* The type of HTML aspect to target.
|
|
@@ -989,10 +997,6 @@ const Observable = FAST.getById(KernelServiceId.observable, () => {
|
|
|
989
997
|
this.propertyName = void 0;
|
|
990
998
|
this.notifier = void 0;
|
|
991
999
|
this.next = void 0;
|
|
992
|
-
/**
|
|
993
|
-
* Opts out of JSON stringification.
|
|
994
|
-
*/
|
|
995
|
-
this.toJSON = noop;
|
|
996
1000
|
}
|
|
997
1001
|
setMode(isAsync) {
|
|
998
1002
|
this.isAsync = this.needsQueue = isAsync;
|
|
@@ -1094,6 +1098,7 @@ const Observable = FAST.getById(KernelServiceId.observable, () => {
|
|
|
1094
1098
|
}
|
|
1095
1099
|
}
|
|
1096
1100
|
}
|
|
1101
|
+
makeSerializationNoop(ExpressionNotifierImplementation);
|
|
1097
1102
|
return Object.freeze({
|
|
1098
1103
|
/**
|
|
1099
1104
|
* @internal
|
|
@@ -1817,6 +1822,88 @@ function lengthOf(array) {
|
|
|
1817
1822
|
return array.length;
|
|
1818
1823
|
}
|
|
1819
1824
|
|
|
1825
|
+
/**
|
|
1826
|
+
* Captures a binding expression along with related information and capabilities.
|
|
1827
|
+
*
|
|
1828
|
+
* @public
|
|
1829
|
+
*/
|
|
1830
|
+
class Binding {
|
|
1831
|
+
/**
|
|
1832
|
+
* Creates a binding.
|
|
1833
|
+
* @param evaluate - Evaluates the binding.
|
|
1834
|
+
* @param policy - The security policy to associate with this binding.
|
|
1835
|
+
* @param isVolatile - Indicates whether the binding is volatile.
|
|
1836
|
+
*/
|
|
1837
|
+
constructor(evaluate, policy, isVolatile = false) {
|
|
1838
|
+
this.evaluate = evaluate;
|
|
1839
|
+
this.policy = policy;
|
|
1840
|
+
this.isVolatile = isVolatile;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
class OneWayBinding extends Binding {
|
|
1845
|
+
createObserver(subscriber) {
|
|
1846
|
+
return Observable.binding(this.evaluate, subscriber, this.isVolatile);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Creates an standard binding.
|
|
1851
|
+
* @param expression - The binding to refresh when changed.
|
|
1852
|
+
* @param policy - The security policy to associate with th binding.
|
|
1853
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
1854
|
+
* @returns A binding configuration.
|
|
1855
|
+
* @public
|
|
1856
|
+
*/
|
|
1857
|
+
function oneWay(expression, policy, isVolatile = Observable.isVolatileBinding(expression)) {
|
|
1858
|
+
return new OneWayBinding(expression, policy, isVolatile);
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Creates an event listener binding.
|
|
1862
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
1863
|
+
* @param options - Event listener options.
|
|
1864
|
+
* @returns A binding configuration.
|
|
1865
|
+
* @public
|
|
1866
|
+
*/
|
|
1867
|
+
function listener(expression, options) {
|
|
1868
|
+
const config = new OneWayBinding(expression);
|
|
1869
|
+
config.options = options;
|
|
1870
|
+
return config;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
class OneTimeBinding extends Binding {
|
|
1874
|
+
createObserver() {
|
|
1875
|
+
return this;
|
|
1876
|
+
}
|
|
1877
|
+
bind(controller) {
|
|
1878
|
+
return this.evaluate(controller.source, controller.context);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
makeSerializationNoop(OneTimeBinding);
|
|
1882
|
+
/**
|
|
1883
|
+
* Creates a one time binding
|
|
1884
|
+
* @param expression - The binding to refresh when signaled.
|
|
1885
|
+
* @param policy - The security policy to associate with th binding.
|
|
1886
|
+
* @returns A binding configuration.
|
|
1887
|
+
* @public
|
|
1888
|
+
*/
|
|
1889
|
+
function oneTime(expression, policy) {
|
|
1890
|
+
return new OneTimeBinding(expression, policy);
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
/**
|
|
1894
|
+
* Normalizes the input value into a binding.
|
|
1895
|
+
* @param value - The value to create the default binding for.
|
|
1896
|
+
* @returns A binding configuration for the provided value.
|
|
1897
|
+
* @public
|
|
1898
|
+
*/
|
|
1899
|
+
function normalizeBinding(value) {
|
|
1900
|
+
return isFunction(value)
|
|
1901
|
+
? oneWay(value)
|
|
1902
|
+
: value instanceof Binding
|
|
1903
|
+
? value
|
|
1904
|
+
: oneTime(() => value);
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1820
1907
|
let DefaultStyleStrategy;
|
|
1821
1908
|
function reduceStyles(styles) {
|
|
1822
1909
|
return styles
|
|
@@ -1945,6 +2032,85 @@ function cssDirective() {
|
|
|
1945
2032
|
};
|
|
1946
2033
|
}
|
|
1947
2034
|
|
|
2035
|
+
function handleChange(directive, controller, observer) {
|
|
2036
|
+
controller.source.style.setProperty(directive.targetAspect, observer.bind(controller));
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Enables bindings in CSS.
|
|
2040
|
+
*
|
|
2041
|
+
* @public
|
|
2042
|
+
*/
|
|
2043
|
+
class CSSBindingDirective {
|
|
2044
|
+
/**
|
|
2045
|
+
* Creates an instance of CSSBindingDirective.
|
|
2046
|
+
* @param dataBinding - The binding to use in CSS.
|
|
2047
|
+
* @param targetAspect - The CSS property to target.
|
|
2048
|
+
*/
|
|
2049
|
+
constructor(dataBinding, targetAspect) {
|
|
2050
|
+
this.dataBinding = dataBinding;
|
|
2051
|
+
this.targetAspect = targetAspect;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Creates a CSS fragment to interpolate into the CSS document.
|
|
2055
|
+
* @returns - the string to interpolate into CSS
|
|
2056
|
+
*/
|
|
2057
|
+
createCSS(add) {
|
|
2058
|
+
add(this);
|
|
2059
|
+
return `var(${this.targetAspect})`;
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Executed when this behavior is attached to a controller.
|
|
2063
|
+
* @param controller - Controls the behavior lifecycle.
|
|
2064
|
+
*/
|
|
2065
|
+
addedCallback(controller) {
|
|
2066
|
+
var _a;
|
|
2067
|
+
const element = controller.source;
|
|
2068
|
+
if (!element.$cssBindings) {
|
|
2069
|
+
element.$cssBindings = new Map();
|
|
2070
|
+
const setAttribute = element.setAttribute;
|
|
2071
|
+
element.setAttribute = (attr, value) => {
|
|
2072
|
+
setAttribute.call(element, attr, value);
|
|
2073
|
+
if (attr === "style") {
|
|
2074
|
+
element.$cssBindings.forEach((v, k) => handleChange(k, v.controller, v.observer));
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
const observer = (_a = controller[this.targetAspect]) !== null && _a !== void 0 ? _a : (controller[this.targetAspect] = this.dataBinding.createObserver(this, this));
|
|
2079
|
+
observer.controller = controller;
|
|
2080
|
+
controller.source.$cssBindings.set(this, { controller, observer });
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Executed when this behavior's host is connected.
|
|
2084
|
+
* @param controller - Controls the behavior lifecycle.
|
|
2085
|
+
*/
|
|
2086
|
+
connectedCallback(controller) {
|
|
2087
|
+
handleChange(this, controller, controller[this.targetAspect]);
|
|
2088
|
+
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Executed when this behavior is detached from a controller.
|
|
2091
|
+
* @param controller - Controls the behavior lifecycle.
|
|
2092
|
+
*/
|
|
2093
|
+
removedCallback(controller) {
|
|
2094
|
+
if (controller.source.$cssBindings) {
|
|
2095
|
+
controller.source.$cssBindings.delete(this);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Called when a subject this instance has subscribed to changes.
|
|
2100
|
+
* @param subject - The subject of the change.
|
|
2101
|
+
* @param args - The event args detailing the change that occurred.
|
|
2102
|
+
*
|
|
2103
|
+
* @internal
|
|
2104
|
+
*/
|
|
2105
|
+
handleChange(_, observer) {
|
|
2106
|
+
handleChange(this, observer.controller, observer);
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
CSSDirective.define(CSSBindingDirective);
|
|
2110
|
+
|
|
2111
|
+
const marker$1 = `${Math.random().toString(36).substring(2, 8)}`;
|
|
2112
|
+
let varId = 0;
|
|
2113
|
+
const nextCSSVariable = () => `--v${marker$1}${++varId}`;
|
|
1948
2114
|
function collectStyles(strings, values) {
|
|
1949
2115
|
const styles = [];
|
|
1950
2116
|
let cssString = "";
|
|
@@ -1955,7 +2121,13 @@ function collectStyles(strings, values) {
|
|
|
1955
2121
|
for (let i = 0, ii = strings.length - 1; i < ii; ++i) {
|
|
1956
2122
|
cssString += strings[i];
|
|
1957
2123
|
let value = values[i];
|
|
1958
|
-
if (
|
|
2124
|
+
if (isFunction(value)) {
|
|
2125
|
+
value = new CSSBindingDirective(oneWay(value), nextCSSVariable()).createCSS(add);
|
|
2126
|
+
}
|
|
2127
|
+
else if (value instanceof Binding) {
|
|
2128
|
+
value = new CSSBindingDirective(value, nextCSSVariable()).createCSS(add);
|
|
2129
|
+
}
|
|
2130
|
+
else if (CSSDirective.getForInstance(value) !== void 0) {
|
|
1959
2131
|
value = value.createCSS(add);
|
|
1960
2132
|
}
|
|
1961
2133
|
if (value instanceof ElementStyles || value instanceof CSSStyleSheet) {
|
|
@@ -2178,24 +2350,6 @@ function htmlDirective(options) {
|
|
|
2178
2350
|
HTMLDirective.define(type, options);
|
|
2179
2351
|
};
|
|
2180
2352
|
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Captures a binding expression along with related information and capabilities.
|
|
2183
|
-
*
|
|
2184
|
-
* @public
|
|
2185
|
-
*/
|
|
2186
|
-
class Binding {
|
|
2187
|
-
/**
|
|
2188
|
-
* Creates a binding.
|
|
2189
|
-
* @param evaluate - Evaluates the binding.
|
|
2190
|
-
* @param policy - The security policy to associate with this binding.
|
|
2191
|
-
* @param isVolatile - Indicates whether the binding is volatile.
|
|
2192
|
-
*/
|
|
2193
|
-
constructor(evaluate, policy, isVolatile = false) {
|
|
2194
|
-
this.evaluate = evaluate;
|
|
2195
|
-
this.policy = policy;
|
|
2196
|
-
this.isVolatile = isVolatile;
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
2353
|
/**
|
|
2200
2354
|
* A base class used for attribute directives that don't need internal state.
|
|
2201
2355
|
* @public
|
|
@@ -2207,11 +2361,6 @@ class StatelessAttachedAttributeDirective {
|
|
|
2207
2361
|
*/
|
|
2208
2362
|
constructor(options) {
|
|
2209
2363
|
this.options = options;
|
|
2210
|
-
/**
|
|
2211
|
-
* Opts out of JSON stringification.
|
|
2212
|
-
* @internal
|
|
2213
|
-
*/
|
|
2214
|
-
this.toJSON = noop;
|
|
2215
2364
|
}
|
|
2216
2365
|
/**
|
|
2217
2366
|
* Creates a placeholder string based on the directive's index within the template.
|
|
@@ -2230,28 +2379,8 @@ class StatelessAttachedAttributeDirective {
|
|
|
2230
2379
|
return this;
|
|
2231
2380
|
}
|
|
2232
2381
|
}
|
|
2382
|
+
makeSerializationNoop(StatelessAttachedAttributeDirective);
|
|
2233
2383
|
|
|
2234
|
-
class OnChangeBinding extends Binding {
|
|
2235
|
-
createObserver(_, subscriber) {
|
|
2236
|
-
return Observable.binding(this.evaluate, subscriber, this.isVolatile);
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
class OneTimeBinding extends Binding {
|
|
2240
|
-
constructor() {
|
|
2241
|
-
super(...arguments);
|
|
2242
|
-
/**
|
|
2243
|
-
* Opts out of JSON stringification.
|
|
2244
|
-
* @internal
|
|
2245
|
-
*/
|
|
2246
|
-
this.toJSON = noop;
|
|
2247
|
-
}
|
|
2248
|
-
createObserver() {
|
|
2249
|
-
return this;
|
|
2250
|
-
}
|
|
2251
|
-
bind(controller) {
|
|
2252
|
-
return this.evaluate(controller.source, controller.context);
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
2384
|
function updateContent(target, aspect, value, controller) {
|
|
2256
2385
|
// If there's no actual value, then this equates to the
|
|
2257
2386
|
// empty string for the purposes of content bindings.
|
|
@@ -2440,52 +2569,6 @@ class HTMLBindingDirective {
|
|
|
2440
2569
|
}
|
|
2441
2570
|
}
|
|
2442
2571
|
HTMLDirective.define(HTMLBindingDirective, { aspected: true });
|
|
2443
|
-
/**
|
|
2444
|
-
* Creates an standard binding.
|
|
2445
|
-
* @param expression - The binding to refresh when changed.
|
|
2446
|
-
* @param policy - The security policy to associate with th binding.
|
|
2447
|
-
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
2448
|
-
* @returns A binding configuration.
|
|
2449
|
-
* @public
|
|
2450
|
-
*/
|
|
2451
|
-
function bind(expression, policy, isVolatile = Observable.isVolatileBinding(expression)) {
|
|
2452
|
-
return new OnChangeBinding(expression, policy, isVolatile);
|
|
2453
|
-
}
|
|
2454
|
-
/**
|
|
2455
|
-
* Creates a one time binding
|
|
2456
|
-
* @param expression - The binding to refresh when signaled.
|
|
2457
|
-
* @param policy - The security policy to associate with th binding.
|
|
2458
|
-
* @returns A binding configuration.
|
|
2459
|
-
* @public
|
|
2460
|
-
*/
|
|
2461
|
-
function oneTime(expression, policy) {
|
|
2462
|
-
return new OneTimeBinding(expression, policy);
|
|
2463
|
-
}
|
|
2464
|
-
/**
|
|
2465
|
-
* Creates an event listener binding.
|
|
2466
|
-
* @param expression - The binding to invoke when the event is raised.
|
|
2467
|
-
* @param options - Event listener options.
|
|
2468
|
-
* @returns A binding configuration.
|
|
2469
|
-
* @public
|
|
2470
|
-
*/
|
|
2471
|
-
function listener(expression, options) {
|
|
2472
|
-
const config = new OnChangeBinding(expression);
|
|
2473
|
-
config.options = options;
|
|
2474
|
-
return config;
|
|
2475
|
-
}
|
|
2476
|
-
/**
|
|
2477
|
-
* Normalizes the input value into a binding.
|
|
2478
|
-
* @param value - The value to create the default binding for.
|
|
2479
|
-
* @returns A binding configuration for the provided value.
|
|
2480
|
-
* @public
|
|
2481
|
-
*/
|
|
2482
|
-
function normalizeBinding(value) {
|
|
2483
|
-
return isFunction(value)
|
|
2484
|
-
? bind(value)
|
|
2485
|
-
: value instanceof Binding
|
|
2486
|
-
? value
|
|
2487
|
-
: oneTime(() => value);
|
|
2488
|
-
}
|
|
2489
2572
|
|
|
2490
2573
|
function removeNodeSequence(firstNode, lastNode) {
|
|
2491
2574
|
const parent = firstNode.parentNode;
|
|
@@ -2538,11 +2621,6 @@ class HTMLView {
|
|
|
2538
2621
|
* The length of the current collection within a repeat context.
|
|
2539
2622
|
*/
|
|
2540
2623
|
this.length = 0;
|
|
2541
|
-
/**
|
|
2542
|
-
* Opts out of JSON stringification.
|
|
2543
|
-
* @internal
|
|
2544
|
-
*/
|
|
2545
|
-
this.toJSON = noop;
|
|
2546
2624
|
this.firstChild = fragment.firstChild;
|
|
2547
2625
|
this.lastChild = fragment.lastChild;
|
|
2548
2626
|
}
|
|
@@ -2723,6 +2801,7 @@ class HTMLView {
|
|
|
2723
2801
|
}
|
|
2724
2802
|
}
|
|
2725
2803
|
}
|
|
2804
|
+
makeSerializationNoop(HTMLView);
|
|
2726
2805
|
Observable.defineProperty(HTMLView.prototype, "index");
|
|
2727
2806
|
Observable.defineProperty(HTMLView.prototype, "length");
|
|
2728
2807
|
|
|
@@ -3063,11 +3142,6 @@ class ViewTemplate {
|
|
|
3063
3142
|
constructor(html, factories = {}, policy) {
|
|
3064
3143
|
this.policy = policy;
|
|
3065
3144
|
this.result = null;
|
|
3066
|
-
/**
|
|
3067
|
-
* Opts out of JSON stringification.
|
|
3068
|
-
* @internal
|
|
3069
|
-
*/
|
|
3070
|
-
this.toJSON = noop;
|
|
3071
3145
|
this.html = html;
|
|
3072
3146
|
this.factories = factories;
|
|
3073
3147
|
}
|
|
@@ -3146,7 +3220,7 @@ class ViewTemplate {
|
|
|
3146
3220
|
let definition;
|
|
3147
3221
|
html += currentString;
|
|
3148
3222
|
if (isFunction(currentValue)) {
|
|
3149
|
-
currentValue = new HTMLBindingDirective(
|
|
3223
|
+
currentValue = new HTMLBindingDirective(oneWay(currentValue));
|
|
3150
3224
|
}
|
|
3151
3225
|
else if (currentValue instanceof Binding) {
|
|
3152
3226
|
currentValue = new HTMLBindingDirective(currentValue);
|
|
@@ -3160,6 +3234,7 @@ class ViewTemplate {
|
|
|
3160
3234
|
return new ViewTemplate(html + strings[strings.length - 1], factories, policy);
|
|
3161
3235
|
}
|
|
3162
3236
|
}
|
|
3237
|
+
makeSerializationNoop(ViewTemplate);
|
|
3163
3238
|
/**
|
|
3164
3239
|
* Transforms a template literal string into a ViewTemplate.
|
|
3165
3240
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -3252,8 +3327,8 @@ class RepeatBehavior {
|
|
|
3252
3327
|
this.bindView = bindWithoutPositioning;
|
|
3253
3328
|
/** @internal */
|
|
3254
3329
|
this.views = [];
|
|
3255
|
-
this.itemsBindingObserver = directive.dataBinding.createObserver(
|
|
3256
|
-
this.templateBindingObserver = directive.templateBinding.createObserver(
|
|
3330
|
+
this.itemsBindingObserver = directive.dataBinding.createObserver(this, directive);
|
|
3331
|
+
this.templateBindingObserver = directive.templateBinding.createObserver(this, directive);
|
|
3257
3332
|
if (directive.options.positioning) {
|
|
3258
3333
|
this.bindView = bindWithPositioning;
|
|
3259
3334
|
}
|
|
@@ -4040,11 +4115,6 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4040
4115
|
* If `null` then the element is managing its own rendering.
|
|
4041
4116
|
*/
|
|
4042
4117
|
this.view = null;
|
|
4043
|
-
/**
|
|
4044
|
-
* Opts out of JSON stringification.
|
|
4045
|
-
* @internal
|
|
4046
|
-
*/
|
|
4047
|
-
this.toJSON = noop;
|
|
4048
4118
|
this.source = element;
|
|
4049
4119
|
this.definition = definition;
|
|
4050
4120
|
const shadowOptions = definition.shadowOptions;
|
|
@@ -4085,6 +4155,27 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4085
4155
|
Observable.track(this, isConnectedPropertyName);
|
|
4086
4156
|
return this.stage === 1 /* Stages.connected */;
|
|
4087
4157
|
}
|
|
4158
|
+
/**
|
|
4159
|
+
* The context the expression is evaluated against.
|
|
4160
|
+
*/
|
|
4161
|
+
get context() {
|
|
4162
|
+
var _a, _b;
|
|
4163
|
+
return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.context) !== null && _b !== void 0 ? _b : ExecutionContext.default;
|
|
4164
|
+
}
|
|
4165
|
+
/**
|
|
4166
|
+
* Indicates whether the controller is bound.
|
|
4167
|
+
*/
|
|
4168
|
+
get isBound() {
|
|
4169
|
+
var _a, _b;
|
|
4170
|
+
return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.isBound) !== null && _b !== void 0 ? _b : false;
|
|
4171
|
+
}
|
|
4172
|
+
/**
|
|
4173
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
4174
|
+
*/
|
|
4175
|
+
get sourceLifetime() {
|
|
4176
|
+
var _a;
|
|
4177
|
+
return (_a = this.view) === null || _a === void 0 ? void 0 : _a.sourceLifetime;
|
|
4178
|
+
}
|
|
4088
4179
|
/**
|
|
4089
4180
|
* Gets/sets the template used to render the component.
|
|
4090
4181
|
* @remarks
|
|
@@ -4147,6 +4238,14 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4147
4238
|
this.addStyles(value);
|
|
4148
4239
|
}
|
|
4149
4240
|
}
|
|
4241
|
+
/**
|
|
4242
|
+
* Registers an unbind handler with the controller.
|
|
4243
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
4244
|
+
*/
|
|
4245
|
+
onUnbind(behavior) {
|
|
4246
|
+
var _a;
|
|
4247
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.onUnbind(behavior);
|
|
4248
|
+
}
|
|
4150
4249
|
/**
|
|
4151
4250
|
* Adds the behavior to the component.
|
|
4152
4251
|
* @param behavior - The behavior to add.
|
|
@@ -4379,6 +4478,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4379
4478
|
elementControllerStrategy = strategy;
|
|
4380
4479
|
}
|
|
4381
4480
|
}
|
|
4481
|
+
makeSerializationNoop(ElementController);
|
|
4382
4482
|
// Set default strategy for ElementController
|
|
4383
4483
|
ElementController.setStrategy(ElementController);
|
|
4384
4484
|
/**
|
|
@@ -4548,4 +4648,4 @@ function customElement(nameOrDef) {
|
|
|
4548
4648
|
|
|
4549
4649
|
DOM.setPolicy(DOMPolicy.create());
|
|
4550
4650
|
|
|
4551
|
-
export { ArrayObserver, AttributeConfiguration, AttributeDefinition, Binding, CSSDirective, ChildrenDirective, Compiler, DOM, DOMAspect, ElementController, ElementStyles, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, InlineTemplateDirective, Markup, NodeObservationDirective, Observable, Parser, PropertyChangeNotifier, RefDirective, RepeatBehavior, RepeatDirective, SlottedDirective, SourceLifetime, Splice, SpliceStrategy, SpliceStrategySupport, StatelessAttachedAttributeDirective, SubscriberSet, Updates, ViewTemplate, attr,
|
|
4651
|
+
export { ArrayObserver, AttributeConfiguration, AttributeDefinition, Binding, CSSBindingDirective, CSSDirective, ChildrenDirective, Compiler, DOM, DOMAspect, ElementController, ElementStyles, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, InlineTemplateDirective, Markup, NodeObservationDirective, Observable, Parser, PropertyChangeNotifier, RefDirective, RepeatBehavior, RepeatDirective, SlottedDirective, SourceLifetime, Splice, SpliceStrategy, SpliceStrategySupport, StatelessAttachedAttributeDirective, SubscriberSet, Updates, ViewTemplate, attr, booleanConverter, children, css, cssDirective, customElement, elements, emptyArray, html, htmlDirective, lengthOf, listener, normalizeBinding, nullableBooleanConverter, nullableNumberConverter, observable, oneTime, oneWay, ref, repeat, slotted, volatile, when };
|