@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
package/dist/fast-element.js
CHANGED
|
@@ -44,17 +44,17 @@ switch (kernelMode) {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Determines whether or not an object is a function.
|
|
47
|
-
* @
|
|
47
|
+
* @public
|
|
48
48
|
*/
|
|
49
49
|
const isFunction = (object) => typeof object === "function";
|
|
50
50
|
/**
|
|
51
51
|
* Determines whether or not an object is a string.
|
|
52
|
-
* @
|
|
52
|
+
* @public
|
|
53
53
|
*/
|
|
54
54
|
const isString = (object) => typeof object === "string";
|
|
55
55
|
/**
|
|
56
56
|
* A function which does nothing.
|
|
57
|
-
* @
|
|
57
|
+
* @public
|
|
58
58
|
*/
|
|
59
59
|
const noop = () => void 0;
|
|
60
60
|
|
|
@@ -173,6 +173,14 @@ function createMetadataLocator() {
|
|
|
173
173
|
return metadata;
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Makes a type noop for JSON serialization.
|
|
178
|
+
* @param type - The type to make noop for JSON serialization.
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
function makeSerializationNoop(type) {
|
|
182
|
+
type.prototype.toJSON = noop;
|
|
183
|
+
}
|
|
176
184
|
|
|
177
185
|
/**
|
|
178
186
|
* The type of HTML aspect to target.
|
|
@@ -924,10 +932,6 @@ const Observable = FAST.getById(KernelServiceId.observable, () => {
|
|
|
924
932
|
this.propertyName = void 0;
|
|
925
933
|
this.notifier = void 0;
|
|
926
934
|
this.next = void 0;
|
|
927
|
-
/**
|
|
928
|
-
* Opts out of JSON stringification.
|
|
929
|
-
*/
|
|
930
|
-
this.toJSON = noop;
|
|
931
935
|
}
|
|
932
936
|
setMode(isAsync) {
|
|
933
937
|
this.isAsync = this.needsQueue = isAsync;
|
|
@@ -1029,6 +1033,7 @@ const Observable = FAST.getById(KernelServiceId.observable, () => {
|
|
|
1029
1033
|
}
|
|
1030
1034
|
}
|
|
1031
1035
|
}
|
|
1036
|
+
makeSerializationNoop(ExpressionNotifierImplementation);
|
|
1032
1037
|
return Object.freeze({
|
|
1033
1038
|
/**
|
|
1034
1039
|
* @internal
|
|
@@ -1752,6 +1757,88 @@ function lengthOf(array) {
|
|
|
1752
1757
|
return array.length;
|
|
1753
1758
|
}
|
|
1754
1759
|
|
|
1760
|
+
/**
|
|
1761
|
+
* Captures a binding expression along with related information and capabilities.
|
|
1762
|
+
*
|
|
1763
|
+
* @public
|
|
1764
|
+
*/
|
|
1765
|
+
class Binding {
|
|
1766
|
+
/**
|
|
1767
|
+
* Creates a binding.
|
|
1768
|
+
* @param evaluate - Evaluates the binding.
|
|
1769
|
+
* @param policy - The security policy to associate with this binding.
|
|
1770
|
+
* @param isVolatile - Indicates whether the binding is volatile.
|
|
1771
|
+
*/
|
|
1772
|
+
constructor(evaluate, policy, isVolatile = false) {
|
|
1773
|
+
this.evaluate = evaluate;
|
|
1774
|
+
this.policy = policy;
|
|
1775
|
+
this.isVolatile = isVolatile;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
class OneWayBinding extends Binding {
|
|
1780
|
+
createObserver(subscriber) {
|
|
1781
|
+
return Observable.binding(this.evaluate, subscriber, this.isVolatile);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Creates an standard binding.
|
|
1786
|
+
* @param expression - The binding to refresh when changed.
|
|
1787
|
+
* @param policy - The security policy to associate with th binding.
|
|
1788
|
+
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
1789
|
+
* @returns A binding configuration.
|
|
1790
|
+
* @public
|
|
1791
|
+
*/
|
|
1792
|
+
function oneWay(expression, policy, isVolatile = Observable.isVolatileBinding(expression)) {
|
|
1793
|
+
return new OneWayBinding(expression, policy, isVolatile);
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Creates an event listener binding.
|
|
1797
|
+
* @param expression - The binding to invoke when the event is raised.
|
|
1798
|
+
* @param options - Event listener options.
|
|
1799
|
+
* @returns A binding configuration.
|
|
1800
|
+
* @public
|
|
1801
|
+
*/
|
|
1802
|
+
function listener(expression, options) {
|
|
1803
|
+
const config = new OneWayBinding(expression);
|
|
1804
|
+
config.options = options;
|
|
1805
|
+
return config;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
class OneTimeBinding extends Binding {
|
|
1809
|
+
createObserver() {
|
|
1810
|
+
return this;
|
|
1811
|
+
}
|
|
1812
|
+
bind(controller) {
|
|
1813
|
+
return this.evaluate(controller.source, controller.context);
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
makeSerializationNoop(OneTimeBinding);
|
|
1817
|
+
/**
|
|
1818
|
+
* Creates a one time binding
|
|
1819
|
+
* @param expression - The binding to refresh when signaled.
|
|
1820
|
+
* @param policy - The security policy to associate with th binding.
|
|
1821
|
+
* @returns A binding configuration.
|
|
1822
|
+
* @public
|
|
1823
|
+
*/
|
|
1824
|
+
function oneTime(expression, policy) {
|
|
1825
|
+
return new OneTimeBinding(expression, policy);
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Normalizes the input value into a binding.
|
|
1830
|
+
* @param value - The value to create the default binding for.
|
|
1831
|
+
* @returns A binding configuration for the provided value.
|
|
1832
|
+
* @public
|
|
1833
|
+
*/
|
|
1834
|
+
function normalizeBinding(value) {
|
|
1835
|
+
return isFunction(value)
|
|
1836
|
+
? oneWay(value)
|
|
1837
|
+
: value instanceof Binding
|
|
1838
|
+
? value
|
|
1839
|
+
: oneTime(() => value);
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1755
1842
|
let DefaultStyleStrategy;
|
|
1756
1843
|
function reduceStyles(styles) {
|
|
1757
1844
|
return styles
|
|
@@ -1880,6 +1967,85 @@ function cssDirective() {
|
|
|
1880
1967
|
};
|
|
1881
1968
|
}
|
|
1882
1969
|
|
|
1970
|
+
function handleChange(directive, controller, observer) {
|
|
1971
|
+
controller.source.style.setProperty(directive.targetAspect, observer.bind(controller));
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Enables bindings in CSS.
|
|
1975
|
+
*
|
|
1976
|
+
* @public
|
|
1977
|
+
*/
|
|
1978
|
+
class CSSBindingDirective {
|
|
1979
|
+
/**
|
|
1980
|
+
* Creates an instance of CSSBindingDirective.
|
|
1981
|
+
* @param dataBinding - The binding to use in CSS.
|
|
1982
|
+
* @param targetAspect - The CSS property to target.
|
|
1983
|
+
*/
|
|
1984
|
+
constructor(dataBinding, targetAspect) {
|
|
1985
|
+
this.dataBinding = dataBinding;
|
|
1986
|
+
this.targetAspect = targetAspect;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Creates a CSS fragment to interpolate into the CSS document.
|
|
1990
|
+
* @returns - the string to interpolate into CSS
|
|
1991
|
+
*/
|
|
1992
|
+
createCSS(add) {
|
|
1993
|
+
add(this);
|
|
1994
|
+
return `var(${this.targetAspect})`;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Executed when this behavior is attached to a controller.
|
|
1998
|
+
* @param controller - Controls the behavior lifecycle.
|
|
1999
|
+
*/
|
|
2000
|
+
addedCallback(controller) {
|
|
2001
|
+
var _a;
|
|
2002
|
+
const element = controller.source;
|
|
2003
|
+
if (!element.$cssBindings) {
|
|
2004
|
+
element.$cssBindings = new Map();
|
|
2005
|
+
const setAttribute = element.setAttribute;
|
|
2006
|
+
element.setAttribute = (attr, value) => {
|
|
2007
|
+
setAttribute.call(element, attr, value);
|
|
2008
|
+
if (attr === "style") {
|
|
2009
|
+
element.$cssBindings.forEach((v, k) => handleChange(k, v.controller, v.observer));
|
|
2010
|
+
}
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
const observer = (_a = controller[this.targetAspect]) !== null && _a !== void 0 ? _a : (controller[this.targetAspect] = this.dataBinding.createObserver(this, this));
|
|
2014
|
+
observer.controller = controller;
|
|
2015
|
+
controller.source.$cssBindings.set(this, { controller, observer });
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
2018
|
+
* Executed when this behavior's host is connected.
|
|
2019
|
+
* @param controller - Controls the behavior lifecycle.
|
|
2020
|
+
*/
|
|
2021
|
+
connectedCallback(controller) {
|
|
2022
|
+
handleChange(this, controller, controller[this.targetAspect]);
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Executed when this behavior is detached from a controller.
|
|
2026
|
+
* @param controller - Controls the behavior lifecycle.
|
|
2027
|
+
*/
|
|
2028
|
+
removedCallback(controller) {
|
|
2029
|
+
if (controller.source.$cssBindings) {
|
|
2030
|
+
controller.source.$cssBindings.delete(this);
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
/**
|
|
2034
|
+
* Called when a subject this instance has subscribed to changes.
|
|
2035
|
+
* @param subject - The subject of the change.
|
|
2036
|
+
* @param args - The event args detailing the change that occurred.
|
|
2037
|
+
*
|
|
2038
|
+
* @internal
|
|
2039
|
+
*/
|
|
2040
|
+
handleChange(_, observer) {
|
|
2041
|
+
handleChange(this, observer.controller, observer);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
CSSDirective.define(CSSBindingDirective);
|
|
2045
|
+
|
|
2046
|
+
const marker$1 = `${Math.random().toString(36).substring(2, 8)}`;
|
|
2047
|
+
let varId = 0;
|
|
2048
|
+
const nextCSSVariable = () => `--v${marker$1}${++varId}`;
|
|
1883
2049
|
function collectStyles(strings, values) {
|
|
1884
2050
|
const styles = [];
|
|
1885
2051
|
let cssString = "";
|
|
@@ -1890,7 +2056,13 @@ function collectStyles(strings, values) {
|
|
|
1890
2056
|
for (let i = 0, ii = strings.length - 1; i < ii; ++i) {
|
|
1891
2057
|
cssString += strings[i];
|
|
1892
2058
|
let value = values[i];
|
|
1893
|
-
if (
|
|
2059
|
+
if (isFunction(value)) {
|
|
2060
|
+
value = new CSSBindingDirective(oneWay(value), nextCSSVariable()).createCSS(add);
|
|
2061
|
+
}
|
|
2062
|
+
else if (value instanceof Binding) {
|
|
2063
|
+
value = new CSSBindingDirective(value, nextCSSVariable()).createCSS(add);
|
|
2064
|
+
}
|
|
2065
|
+
else if (CSSDirective.getForInstance(value) !== void 0) {
|
|
1894
2066
|
value = value.createCSS(add);
|
|
1895
2067
|
}
|
|
1896
2068
|
if (value instanceof ElementStyles || value instanceof CSSStyleSheet) {
|
|
@@ -2113,24 +2285,6 @@ function htmlDirective(options) {
|
|
|
2113
2285
|
HTMLDirective.define(type, options);
|
|
2114
2286
|
};
|
|
2115
2287
|
}
|
|
2116
|
-
/**
|
|
2117
|
-
* Captures a binding expression along with related information and capabilities.
|
|
2118
|
-
*
|
|
2119
|
-
* @public
|
|
2120
|
-
*/
|
|
2121
|
-
class Binding {
|
|
2122
|
-
/**
|
|
2123
|
-
* Creates a binding.
|
|
2124
|
-
* @param evaluate - Evaluates the binding.
|
|
2125
|
-
* @param policy - The security policy to associate with this binding.
|
|
2126
|
-
* @param isVolatile - Indicates whether the binding is volatile.
|
|
2127
|
-
*/
|
|
2128
|
-
constructor(evaluate, policy, isVolatile = false) {
|
|
2129
|
-
this.evaluate = evaluate;
|
|
2130
|
-
this.policy = policy;
|
|
2131
|
-
this.isVolatile = isVolatile;
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
2288
|
/**
|
|
2135
2289
|
* A base class used for attribute directives that don't need internal state.
|
|
2136
2290
|
* @public
|
|
@@ -2142,11 +2296,6 @@ class StatelessAttachedAttributeDirective {
|
|
|
2142
2296
|
*/
|
|
2143
2297
|
constructor(options) {
|
|
2144
2298
|
this.options = options;
|
|
2145
|
-
/**
|
|
2146
|
-
* Opts out of JSON stringification.
|
|
2147
|
-
* @internal
|
|
2148
|
-
*/
|
|
2149
|
-
this.toJSON = noop;
|
|
2150
2299
|
}
|
|
2151
2300
|
/**
|
|
2152
2301
|
* Creates a placeholder string based on the directive's index within the template.
|
|
@@ -2165,28 +2314,8 @@ class StatelessAttachedAttributeDirective {
|
|
|
2165
2314
|
return this;
|
|
2166
2315
|
}
|
|
2167
2316
|
}
|
|
2317
|
+
makeSerializationNoop(StatelessAttachedAttributeDirective);
|
|
2168
2318
|
|
|
2169
|
-
class OnChangeBinding extends Binding {
|
|
2170
|
-
createObserver(_, subscriber) {
|
|
2171
|
-
return Observable.binding(this.evaluate, subscriber, this.isVolatile);
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
class OneTimeBinding extends Binding {
|
|
2175
|
-
constructor() {
|
|
2176
|
-
super(...arguments);
|
|
2177
|
-
/**
|
|
2178
|
-
* Opts out of JSON stringification.
|
|
2179
|
-
* @internal
|
|
2180
|
-
*/
|
|
2181
|
-
this.toJSON = noop;
|
|
2182
|
-
}
|
|
2183
|
-
createObserver() {
|
|
2184
|
-
return this;
|
|
2185
|
-
}
|
|
2186
|
-
bind(controller) {
|
|
2187
|
-
return this.evaluate(controller.source, controller.context);
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
2319
|
function updateContent(target, aspect, value, controller) {
|
|
2191
2320
|
// If there's no actual value, then this equates to the
|
|
2192
2321
|
// empty string for the purposes of content bindings.
|
|
@@ -2375,52 +2504,6 @@ class HTMLBindingDirective {
|
|
|
2375
2504
|
}
|
|
2376
2505
|
}
|
|
2377
2506
|
HTMLDirective.define(HTMLBindingDirective, { aspected: true });
|
|
2378
|
-
/**
|
|
2379
|
-
* Creates an standard binding.
|
|
2380
|
-
* @param expression - The binding to refresh when changed.
|
|
2381
|
-
* @param policy - The security policy to associate with th binding.
|
|
2382
|
-
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
2383
|
-
* @returns A binding configuration.
|
|
2384
|
-
* @public
|
|
2385
|
-
*/
|
|
2386
|
-
function bind(expression, policy, isVolatile = Observable.isVolatileBinding(expression)) {
|
|
2387
|
-
return new OnChangeBinding(expression, policy, isVolatile);
|
|
2388
|
-
}
|
|
2389
|
-
/**
|
|
2390
|
-
* Creates a one time binding
|
|
2391
|
-
* @param expression - The binding to refresh when signaled.
|
|
2392
|
-
* @param policy - The security policy to associate with th binding.
|
|
2393
|
-
* @returns A binding configuration.
|
|
2394
|
-
* @public
|
|
2395
|
-
*/
|
|
2396
|
-
function oneTime(expression, policy) {
|
|
2397
|
-
return new OneTimeBinding(expression, policy);
|
|
2398
|
-
}
|
|
2399
|
-
/**
|
|
2400
|
-
* Creates an event listener binding.
|
|
2401
|
-
* @param expression - The binding to invoke when the event is raised.
|
|
2402
|
-
* @param options - Event listener options.
|
|
2403
|
-
* @returns A binding configuration.
|
|
2404
|
-
* @public
|
|
2405
|
-
*/
|
|
2406
|
-
function listener(expression, options) {
|
|
2407
|
-
const config = new OnChangeBinding(expression);
|
|
2408
|
-
config.options = options;
|
|
2409
|
-
return config;
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Normalizes the input value into a binding.
|
|
2413
|
-
* @param value - The value to create the default binding for.
|
|
2414
|
-
* @returns A binding configuration for the provided value.
|
|
2415
|
-
* @public
|
|
2416
|
-
*/
|
|
2417
|
-
function normalizeBinding(value) {
|
|
2418
|
-
return isFunction(value)
|
|
2419
|
-
? bind(value)
|
|
2420
|
-
: value instanceof Binding
|
|
2421
|
-
? value
|
|
2422
|
-
: oneTime(() => value);
|
|
2423
|
-
}
|
|
2424
2507
|
|
|
2425
2508
|
function removeNodeSequence(firstNode, lastNode) {
|
|
2426
2509
|
const parent = firstNode.parentNode;
|
|
@@ -2473,11 +2556,6 @@ class HTMLView {
|
|
|
2473
2556
|
* The length of the current collection within a repeat context.
|
|
2474
2557
|
*/
|
|
2475
2558
|
this.length = 0;
|
|
2476
|
-
/**
|
|
2477
|
-
* Opts out of JSON stringification.
|
|
2478
|
-
* @internal
|
|
2479
|
-
*/
|
|
2480
|
-
this.toJSON = noop;
|
|
2481
2559
|
this.firstChild = fragment.firstChild;
|
|
2482
2560
|
this.lastChild = fragment.lastChild;
|
|
2483
2561
|
}
|
|
@@ -2658,6 +2736,7 @@ class HTMLView {
|
|
|
2658
2736
|
}
|
|
2659
2737
|
}
|
|
2660
2738
|
}
|
|
2739
|
+
makeSerializationNoop(HTMLView);
|
|
2661
2740
|
Observable.defineProperty(HTMLView.prototype, "index");
|
|
2662
2741
|
Observable.defineProperty(HTMLView.prototype, "length");
|
|
2663
2742
|
|
|
@@ -2998,11 +3077,6 @@ class ViewTemplate {
|
|
|
2998
3077
|
constructor(html, factories = {}, policy) {
|
|
2999
3078
|
this.policy = policy;
|
|
3000
3079
|
this.result = null;
|
|
3001
|
-
/**
|
|
3002
|
-
* Opts out of JSON stringification.
|
|
3003
|
-
* @internal
|
|
3004
|
-
*/
|
|
3005
|
-
this.toJSON = noop;
|
|
3006
3080
|
this.html = html;
|
|
3007
3081
|
this.factories = factories;
|
|
3008
3082
|
}
|
|
@@ -3081,7 +3155,7 @@ class ViewTemplate {
|
|
|
3081
3155
|
let definition;
|
|
3082
3156
|
html += currentString;
|
|
3083
3157
|
if (isFunction(currentValue)) {
|
|
3084
|
-
currentValue = new HTMLBindingDirective(
|
|
3158
|
+
currentValue = new HTMLBindingDirective(oneWay(currentValue));
|
|
3085
3159
|
}
|
|
3086
3160
|
else if (currentValue instanceof Binding) {
|
|
3087
3161
|
currentValue = new HTMLBindingDirective(currentValue);
|
|
@@ -3095,6 +3169,7 @@ class ViewTemplate {
|
|
|
3095
3169
|
return new ViewTemplate(html + strings[strings.length - 1], factories, policy);
|
|
3096
3170
|
}
|
|
3097
3171
|
}
|
|
3172
|
+
makeSerializationNoop(ViewTemplate);
|
|
3098
3173
|
/**
|
|
3099
3174
|
* Transforms a template literal string into a ViewTemplate.
|
|
3100
3175
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -3187,8 +3262,8 @@ class RepeatBehavior {
|
|
|
3187
3262
|
this.bindView = bindWithoutPositioning;
|
|
3188
3263
|
/** @internal */
|
|
3189
3264
|
this.views = [];
|
|
3190
|
-
this.itemsBindingObserver = directive.dataBinding.createObserver(
|
|
3191
|
-
this.templateBindingObserver = directive.templateBinding.createObserver(
|
|
3265
|
+
this.itemsBindingObserver = directive.dataBinding.createObserver(this, directive);
|
|
3266
|
+
this.templateBindingObserver = directive.templateBinding.createObserver(this, directive);
|
|
3192
3267
|
if (directive.options.positioning) {
|
|
3193
3268
|
this.bindView = bindWithPositioning;
|
|
3194
3269
|
}
|
|
@@ -3975,11 +4050,6 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
3975
4050
|
* If `null` then the element is managing its own rendering.
|
|
3976
4051
|
*/
|
|
3977
4052
|
this.view = null;
|
|
3978
|
-
/**
|
|
3979
|
-
* Opts out of JSON stringification.
|
|
3980
|
-
* @internal
|
|
3981
|
-
*/
|
|
3982
|
-
this.toJSON = noop;
|
|
3983
4053
|
this.source = element;
|
|
3984
4054
|
this.definition = definition;
|
|
3985
4055
|
const shadowOptions = definition.shadowOptions;
|
|
@@ -4020,6 +4090,27 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4020
4090
|
Observable.track(this, isConnectedPropertyName);
|
|
4021
4091
|
return this.stage === 1 /* Stages.connected */;
|
|
4022
4092
|
}
|
|
4093
|
+
/**
|
|
4094
|
+
* The context the expression is evaluated against.
|
|
4095
|
+
*/
|
|
4096
|
+
get context() {
|
|
4097
|
+
var _a, _b;
|
|
4098
|
+
return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.context) !== null && _b !== void 0 ? _b : ExecutionContext.default;
|
|
4099
|
+
}
|
|
4100
|
+
/**
|
|
4101
|
+
* Indicates whether the controller is bound.
|
|
4102
|
+
*/
|
|
4103
|
+
get isBound() {
|
|
4104
|
+
var _a, _b;
|
|
4105
|
+
return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.isBound) !== null && _b !== void 0 ? _b : false;
|
|
4106
|
+
}
|
|
4107
|
+
/**
|
|
4108
|
+
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
4109
|
+
*/
|
|
4110
|
+
get sourceLifetime() {
|
|
4111
|
+
var _a;
|
|
4112
|
+
return (_a = this.view) === null || _a === void 0 ? void 0 : _a.sourceLifetime;
|
|
4113
|
+
}
|
|
4023
4114
|
/**
|
|
4024
4115
|
* Gets/sets the template used to render the component.
|
|
4025
4116
|
* @remarks
|
|
@@ -4082,6 +4173,14 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4082
4173
|
this.addStyles(value);
|
|
4083
4174
|
}
|
|
4084
4175
|
}
|
|
4176
|
+
/**
|
|
4177
|
+
* Registers an unbind handler with the controller.
|
|
4178
|
+
* @param behavior - An object to call when the controller unbinds.
|
|
4179
|
+
*/
|
|
4180
|
+
onUnbind(behavior) {
|
|
4181
|
+
var _a;
|
|
4182
|
+
(_a = this.view) === null || _a === void 0 ? void 0 : _a.onUnbind(behavior);
|
|
4183
|
+
}
|
|
4085
4184
|
/**
|
|
4086
4185
|
* Adds the behavior to the component.
|
|
4087
4186
|
* @param behavior - The behavior to add.
|
|
@@ -4314,6 +4413,7 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
4314
4413
|
elementControllerStrategy = strategy;
|
|
4315
4414
|
}
|
|
4316
4415
|
}
|
|
4416
|
+
makeSerializationNoop(ElementController);
|
|
4317
4417
|
// Set default strategy for ElementController
|
|
4318
4418
|
ElementController.setStrategy(ElementController);
|
|
4319
4419
|
/**
|
|
@@ -4483,4 +4583,4 @@ function customElement(nameOrDef) {
|
|
|
4483
4583
|
|
|
4484
4584
|
DOM.setPolicy(DOMPolicy.create());
|
|
4485
4585
|
|
|
4486
|
-
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,
|
|
4586
|
+
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 };
|