@tko/binding.template 4.0.0-alpha9.0 → 4.0.0-beta1.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/dist/foreach.js +32 -0
- package/dist/foreach.js.map +7 -0
- package/dist/index.cjs +3518 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +15 -0
- package/dist/index.mjs.map +7 -0
- package/dist/nativeTemplateEngine.js +27 -0
- package/dist/nativeTemplateEngine.js.map +7 -0
- package/dist/templateEngine.js +38 -0
- package/dist/templateEngine.js.map +7 -0
- package/dist/templateSources.js +80 -0
- package/dist/templateSources.js.map +7 -0
- package/dist/templating.js +315 -0
- package/dist/templating.js.map +7 -0
- package/helpers/{dummyTemplateEngine.js → dummyTemplateEngine.ts} +4 -3
- package/package.json +19 -29
- package/dist/binding.template.es6.js +0 -557
- package/dist/binding.template.es6.js.map +0 -1
- package/dist/binding.template.js +0 -579
- package/dist/binding.template.js.map +0 -1
package/dist/binding.template.js
DELETED
|
@@ -1,579 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* TKO Template bindings 🥊 @tko/binding.template@4.0.0-alpha9.0
|
|
3
|
-
* (c) The Knockout.js Team - https://tko.io
|
|
4
|
-
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { tagNameLower, setHtml, domData, parseHtmlForTemplateNodes, extend, options, virtualElements, fixUpContinuousNodeArray, replaceDomNodes, memoization, domNodeIsAttachedToDocument, moveCleanedNodesToContainerElement, arrayFilter, ieVersion, makeArray, parseHtmlFragment } from '@tko/utils';
|
|
8
|
-
import { applyBindings, setDomNodeChildrenFromArrayMapping, AsyncBindingHandler, bindingEvent, bindingContext } from '@tko/bind';
|
|
9
|
-
import { computed } from '@tko/computed';
|
|
10
|
-
import { isObservable, dependencyDetection, unwrap, observable, isObservableArray, peek } from '@tko/observable';
|
|
11
|
-
|
|
12
|
-
/*! *****************************************************************************
|
|
13
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
15
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
16
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
|
|
18
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
20
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
21
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
22
|
-
|
|
23
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
24
|
-
and limitations under the License.
|
|
25
|
-
***************************************************************************** */
|
|
26
|
-
/* global Reflect, Promise */
|
|
27
|
-
|
|
28
|
-
var extendStatics = function(d, b) {
|
|
29
|
-
extendStatics = Object.setPrototypeOf ||
|
|
30
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
32
|
-
return extendStatics(d, b);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
function __extends(d, b) {
|
|
36
|
-
extendStatics(d, b);
|
|
37
|
-
function __() { this.constructor = d; }
|
|
38
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving
|
|
42
|
-
// ---- ko.templateSources.domElement -----
|
|
43
|
-
// template types
|
|
44
|
-
var templateScript = 1, templateTextArea = 2, templateTemplate = 3, templateElement = 4;
|
|
45
|
-
function domElement(element) {
|
|
46
|
-
this.domElement = element;
|
|
47
|
-
if (!element) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
var tagNameLower$$1 = tagNameLower(element);
|
|
51
|
-
this.templateType =
|
|
52
|
-
tagNameLower$$1 === 'script' ? templateScript
|
|
53
|
-
: tagNameLower$$1 === 'textarea' ? templateTextArea
|
|
54
|
-
// For browsers with proper <template> element support, where the .content property gives a document fragment
|
|
55
|
-
: tagNameLower$$1 == 'template' && element.content && element.content.nodeType === 11 ? templateTemplate
|
|
56
|
-
: templateElement;
|
|
57
|
-
}
|
|
58
|
-
domElement.prototype.text = function ( /* valueToWrite */) {
|
|
59
|
-
var elemContentsProperty = this.templateType === templateScript ? 'text'
|
|
60
|
-
: this.templateType === templateTextArea ? 'value'
|
|
61
|
-
: 'innerHTML';
|
|
62
|
-
if (arguments.length == 0) {
|
|
63
|
-
return this.domElement[elemContentsProperty];
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
var valueToWrite = arguments[0];
|
|
67
|
-
if (elemContentsProperty === 'innerHTML') {
|
|
68
|
-
setHtml(this.domElement, valueToWrite);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.domElement[elemContentsProperty] = valueToWrite;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var dataDomDataPrefix = domData.nextKey() + '_';
|
|
76
|
-
domElement.prototype.data = function (key /*, valueToWrite */) {
|
|
77
|
-
if (arguments.length === 1) {
|
|
78
|
-
return domData.get(this.domElement, dataDomDataPrefix + key);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
var templatesDomDataKey = domData.nextKey();
|
|
85
|
-
function getTemplateDomData(element) {
|
|
86
|
-
return domData.get(element, templatesDomDataKey) || {};
|
|
87
|
-
}
|
|
88
|
-
function setTemplateDomData(element, data) {
|
|
89
|
-
domData.set(element, templatesDomDataKey, data);
|
|
90
|
-
}
|
|
91
|
-
domElement.prototype.nodes = function ( /* valueToWrite */) {
|
|
92
|
-
var element = this.domElement;
|
|
93
|
-
if (arguments.length == 0) {
|
|
94
|
-
var templateData = getTemplateDomData(element);
|
|
95
|
-
var nodes = templateData.containerData || (this.templateType === templateTemplate ? element.content :
|
|
96
|
-
this.templateType === templateElement ? element :
|
|
97
|
-
undefined);
|
|
98
|
-
if (!nodes || templateData.alwaysCheckText) {
|
|
99
|
-
// If the template is associated with an element that stores the template as text,
|
|
100
|
-
// parse and cache the nodes whenever there's new text content available. This allows
|
|
101
|
-
// the user to update the template content by updating the text of template node.
|
|
102
|
-
var text = this['text']();
|
|
103
|
-
if (text) {
|
|
104
|
-
nodes = parseHtmlForTemplateNodes(text, element.ownerDocument);
|
|
105
|
-
this['text'](''); // clear the text from the node
|
|
106
|
-
setTemplateDomData(element, { containerData: nodes, alwaysCheckText: true });
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return nodes;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
var valueToWrite = arguments[0];
|
|
113
|
-
setTemplateDomData(element, { containerData: valueToWrite });
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
// ---- ko.templateSources.anonymousTemplate -----
|
|
117
|
-
// Anonymous templates are normally saved/retrieved as DOM nodes through "nodes".
|
|
118
|
-
// For compatibility, you can also read "text"; it will be serialized from the nodes on demand.
|
|
119
|
-
// Writing to "text" is still supported, but then the template data will not be available as DOM nodes.
|
|
120
|
-
function anonymousTemplate(element) {
|
|
121
|
-
this.domElement = element;
|
|
122
|
-
}
|
|
123
|
-
anonymousTemplate.prototype = new domElement();
|
|
124
|
-
anonymousTemplate.prototype.constructor = anonymousTemplate;
|
|
125
|
-
anonymousTemplate.prototype.text = function ( /* valueToWrite */) {
|
|
126
|
-
if (arguments.length == 0) {
|
|
127
|
-
var templateData = getTemplateDomData(this.domElement);
|
|
128
|
-
if (templateData.textData === undefined && templateData.containerData) {
|
|
129
|
-
templateData.textData = templateData.containerData.innerHTML;
|
|
130
|
-
}
|
|
131
|
-
return templateData.textData;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
var valueToWrite = arguments[0];
|
|
135
|
-
setTemplateDomData(this.domElement, { textData: valueToWrite });
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// If you want to make a custom template engine,
|
|
140
|
-
function templateEngine() { }
|
|
141
|
-
extend(templateEngine.prototype, {
|
|
142
|
-
renderTemplateSource: function (templateSource, bindingContext$$1, options$$1, templateDocument) {
|
|
143
|
-
options$$1.onError('Override renderTemplateSource');
|
|
144
|
-
},
|
|
145
|
-
createJavaScriptEvaluatorBlock: function (script) {
|
|
146
|
-
options.onError('Override createJavaScriptEvaluatorBlock');
|
|
147
|
-
},
|
|
148
|
-
makeTemplateSource: function (template, templateDocument) {
|
|
149
|
-
// Named template
|
|
150
|
-
if (typeof template === 'string') {
|
|
151
|
-
templateDocument = templateDocument || document;
|
|
152
|
-
var elem = templateDocument.getElementById(template);
|
|
153
|
-
if (!elem) {
|
|
154
|
-
options.onError('Cannot find template with ID ' + template);
|
|
155
|
-
}
|
|
156
|
-
return new domElement(elem);
|
|
157
|
-
}
|
|
158
|
-
else if ((template.nodeType == 1) || (template.nodeType == 8)) {
|
|
159
|
-
// Anonymous template
|
|
160
|
-
return new anonymousTemplate(template);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
options.onError('Unknown template type: ' + template);
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
renderTemplate: function (template, bindingContext$$1, options$$1, templateDocument) {
|
|
167
|
-
var templateSource = this['makeTemplateSource'](template, templateDocument);
|
|
168
|
-
return this.renderTemplateSource(templateSource, bindingContext$$1, options$$1, templateDocument);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
var _templateEngine;
|
|
173
|
-
var cleanContainerDomDataKey = domData.nextKey();
|
|
174
|
-
function setTemplateEngine(tEngine) {
|
|
175
|
-
if ((tEngine !== undefined) && !(tEngine instanceof templateEngine)) {
|
|
176
|
-
// TODO: ko.templateEngine to appropriate name
|
|
177
|
-
throw new Error('templateEngine must inherit from ko.templateEngine');
|
|
178
|
-
}
|
|
179
|
-
_templateEngine = tEngine;
|
|
180
|
-
}
|
|
181
|
-
function invokeForEachNodeInContinuousRange(firstNode, lastNode, action) {
|
|
182
|
-
var node;
|
|
183
|
-
var nextInQueue = firstNode;
|
|
184
|
-
var firstOutOfRangeNode = virtualElements.nextSibling(lastNode);
|
|
185
|
-
while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) {
|
|
186
|
-
nextInQueue = virtualElements.nextSibling(node);
|
|
187
|
-
action(node, nextInQueue);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext$$1, afterBindingCallback) {
|
|
191
|
-
// To be used on any nodes that have been rendered by a template and have been inserted into some parent element
|
|
192
|
-
// Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because
|
|
193
|
-
// the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,
|
|
194
|
-
// (1) Does a regular "applyBindings" to associate bindingContext with this node and to activate any non-memoized bindings
|
|
195
|
-
// (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)
|
|
196
|
-
if (continuousNodeArray.length) {
|
|
197
|
-
var firstNode = continuousNodeArray[0];
|
|
198
|
-
var lastNode = continuousNodeArray[continuousNodeArray.length - 1];
|
|
199
|
-
var parentNode = firstNode.parentNode;
|
|
200
|
-
var provider = options.bindingProviderInstance;
|
|
201
|
-
var preprocessNode = provider.preprocessNode;
|
|
202
|
-
if (preprocessNode) {
|
|
203
|
-
invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node, nextNodeInRange) {
|
|
204
|
-
var nodePreviousSibling = node.previousSibling;
|
|
205
|
-
var newNodes = preprocessNode.call(provider, node);
|
|
206
|
-
if (newNodes) {
|
|
207
|
-
if (node === firstNode) {
|
|
208
|
-
firstNode = newNodes[0] || nextNodeInRange;
|
|
209
|
-
}
|
|
210
|
-
if (node === lastNode) {
|
|
211
|
-
lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
// Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.
|
|
216
|
-
// We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real
|
|
217
|
-
// first node needs to be in the array).
|
|
218
|
-
continuousNodeArray.length = 0;
|
|
219
|
-
if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (firstNode === lastNode) {
|
|
223
|
-
continuousNodeArray.push(firstNode);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
continuousNodeArray.push(firstNode, lastNode);
|
|
227
|
-
fixUpContinuousNodeArray(continuousNodeArray, parentNode);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
// Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
|
|
231
|
-
// whereas a regular applyBindings won't introduce new memoized nodes
|
|
232
|
-
invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node) {
|
|
233
|
-
if (node.nodeType === 1 || node.nodeType === 8) {
|
|
234
|
-
applyBindings(bindingContext$$1, node).then(afterBindingCallback);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node) {
|
|
238
|
-
if (node.nodeType === 1 || node.nodeType === 8) {
|
|
239
|
-
memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext$$1]);
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
// Make sure any changes done by applyBindings or unmemoize are reflected in the array
|
|
243
|
-
fixUpContinuousNodeArray(continuousNodeArray, parentNode);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function getFirstNodeFromPossibleArray(nodeOrNodeArray) {
|
|
247
|
-
return nodeOrNodeArray.nodeType ? nodeOrNodeArray
|
|
248
|
-
: nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0]
|
|
249
|
-
: null;
|
|
250
|
-
}
|
|
251
|
-
function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext$$1, options$$1, afterBindingCallback) {
|
|
252
|
-
options$$1 = options$$1 || {};
|
|
253
|
-
var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
|
|
254
|
-
var templateDocument = (firstTargetNode || template || {}).ownerDocument;
|
|
255
|
-
var templateEngineToUse = (options$$1.templateEngine || _templateEngine);
|
|
256
|
-
var renderedNodesArray = templateEngineToUse.renderTemplate(template, bindingContext$$1, options$$1, templateDocument);
|
|
257
|
-
// Loosely check result is an array of DOM nodes
|
|
258
|
-
if ((typeof renderedNodesArray.length !== 'number') || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType !== 'number')) {
|
|
259
|
-
throw new Error('Template engine must return an array of DOM nodes');
|
|
260
|
-
}
|
|
261
|
-
var haveAddedNodesToParent = false;
|
|
262
|
-
switch (renderMode) {
|
|
263
|
-
case 'replaceChildren':
|
|
264
|
-
virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray);
|
|
265
|
-
haveAddedNodesToParent = true;
|
|
266
|
-
break;
|
|
267
|
-
case 'replaceNode':
|
|
268
|
-
replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray);
|
|
269
|
-
haveAddedNodesToParent = true;
|
|
270
|
-
break;
|
|
271
|
-
case 'ignoreTargetNode': break;
|
|
272
|
-
default:
|
|
273
|
-
throw new Error('Unknown renderMode: ' + renderMode);
|
|
274
|
-
}
|
|
275
|
-
if (haveAddedNodesToParent) {
|
|
276
|
-
activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext$$1, afterBindingCallback);
|
|
277
|
-
if (options$$1.afterRender) {
|
|
278
|
-
dependencyDetection.ignore(options$$1.afterRender, null, [renderedNodesArray, bindingContext$$1['$data']]);
|
|
279
|
-
}
|
|
280
|
-
if (renderMode === 'replaceChildren') {
|
|
281
|
-
bindingEvent.notify(targetNodeOrNodeArray, bindingEvent.childrenComplete);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return renderedNodesArray;
|
|
285
|
-
}
|
|
286
|
-
function resolveTemplateName(template, data, context) {
|
|
287
|
-
// The template can be specified as:
|
|
288
|
-
if (isObservable(template)) {
|
|
289
|
-
// 1. An observable, with string value
|
|
290
|
-
return template();
|
|
291
|
-
}
|
|
292
|
-
else if (typeof template === 'function') {
|
|
293
|
-
// 2. A function of (data, context) returning a string
|
|
294
|
-
return template(data, context);
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
// 3. A string
|
|
298
|
-
return template;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function renderTemplate(template, dataOrBindingContext, options$$1, targetNodeOrNodeArray, renderMode, afterBindingCallback) {
|
|
302
|
-
options$$1 = options$$1 || {};
|
|
303
|
-
if ((options$$1.templateEngine || _templateEngine) === undefined) {
|
|
304
|
-
throw new Error('Set a template engine before calling renderTemplate');
|
|
305
|
-
}
|
|
306
|
-
renderMode = renderMode || 'replaceChildren';
|
|
307
|
-
if (targetNodeOrNodeArray) {
|
|
308
|
-
var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
|
|
309
|
-
var whenToDispose = function () { return (!firstTargetNode) || !domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation)
|
|
310
|
-
var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode === 'replaceNode') ? firstTargetNode.parentNode : firstTargetNode;
|
|
311
|
-
return computed(// So the DOM is automatically updated when any dependency changes
|
|
312
|
-
function () {
|
|
313
|
-
// Ensure we've got a proper binding context to work with
|
|
314
|
-
var bindingContext$$1 = (dataOrBindingContext && (dataOrBindingContext instanceof bindingContext))
|
|
315
|
-
? dataOrBindingContext
|
|
316
|
-
: new bindingContext(dataOrBindingContext, null, null, null, { 'exportDependencies': true });
|
|
317
|
-
var templateName = resolveTemplateName(template, bindingContext$$1.$data, bindingContext$$1);
|
|
318
|
-
var renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext$$1, options$$1, afterBindingCallback);
|
|
319
|
-
if (renderMode === 'replaceNode') {
|
|
320
|
-
targetNodeOrNodeArray = renderedNodesArray;
|
|
321
|
-
firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
|
|
322
|
-
}
|
|
323
|
-
}, null, { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved });
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
// We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node
|
|
327
|
-
return memoization.memoize(function (domNode) {
|
|
328
|
-
renderTemplate(template, dataOrBindingContext, options$$1, domNode, 'replaceNode');
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
function renderTemplateForEach(template, arrayOrObservableArray, options$$1, targetNode, parentBindingContext, afterBindingCallback) {
|
|
333
|
-
// Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then
|
|
334
|
-
// activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.
|
|
335
|
-
var arrayItemContext;
|
|
336
|
-
// This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode
|
|
337
|
-
function executeTemplateForArrayItem(arrayValue, index) {
|
|
338
|
-
var _a;
|
|
339
|
-
// Support selecting template as a function of the data being rendered
|
|
340
|
-
if (options$$1.as) {
|
|
341
|
-
if (options.createChildContextWithAs) {
|
|
342
|
-
arrayItemContext = parentBindingContext.createChildContext(arrayValue, options$$1.as, function (context) { context.$index = index; });
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
arrayItemContext = parentBindingContext.extend((_a = {},
|
|
346
|
-
_a[options$$1.as] = arrayValue,
|
|
347
|
-
_a.$index = index,
|
|
348
|
-
_a));
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
arrayItemContext = parentBindingContext.createChildContext(arrayValue, options$$1.as, function (context) { context.$index = index; });
|
|
353
|
-
}
|
|
354
|
-
var templateName = resolveTemplateName(template, arrayValue, arrayItemContext);
|
|
355
|
-
return executeTemplate(targetNode, 'ignoreTargetNode', templateName, arrayItemContext, options$$1, afterBindingCallback);
|
|
356
|
-
}
|
|
357
|
-
// This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode
|
|
358
|
-
var activateBindingsCallback = function (arrayValue, addedNodesArray /*, index */) {
|
|
359
|
-
activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext, afterBindingCallback);
|
|
360
|
-
if (options$$1.afterRender) {
|
|
361
|
-
options$$1.afterRender(addedNodesArray, arrayValue);
|
|
362
|
-
}
|
|
363
|
-
// release the "cache" variable, so that it can be collected by
|
|
364
|
-
// the GC when its value isn't used from within the bindings anymore.
|
|
365
|
-
arrayItemContext = null;
|
|
366
|
-
};
|
|
367
|
-
// Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function).
|
|
368
|
-
// If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping.
|
|
369
|
-
function localSetDomNodeChildrenFromArrayMapping(newArray, changeList) {
|
|
370
|
-
dependencyDetection.ignore(setDomNodeChildrenFromArrayMapping, null, [targetNode, newArray, executeTemplateForArrayItem, options$$1, activateBindingsCallback, changeList]);
|
|
371
|
-
bindingEvent.notify(targetNode, bindingEvent.childrenComplete);
|
|
372
|
-
}
|
|
373
|
-
var shouldHideDestroyed = (options$$1.includeDestroyed === false) || (options.foreachHidesDestroyed && !options$$1.includeDestroyed);
|
|
374
|
-
if (!shouldHideDestroyed && !options$$1.beforeRemove && isObservableArray(arrayOrObservableArray)) {
|
|
375
|
-
localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray.peek());
|
|
376
|
-
var subscription = arrayOrObservableArray.subscribe(function (changeList) {
|
|
377
|
-
localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray(), changeList);
|
|
378
|
-
}, null, 'arrayChange');
|
|
379
|
-
subscription.disposeWhenNodeIsRemoved(targetNode);
|
|
380
|
-
return subscription;
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
return computed(function () {
|
|
384
|
-
var unwrappedArray = unwrap(arrayOrObservableArray) || [];
|
|
385
|
-
var unwrappedIsIterable = Symbol.iterator in unwrappedArray;
|
|
386
|
-
if (!unwrappedIsIterable) {
|
|
387
|
-
unwrappedArray = [unwrappedArray];
|
|
388
|
-
}
|
|
389
|
-
if (shouldHideDestroyed) {
|
|
390
|
-
// Filter out any entries marked as destroyed
|
|
391
|
-
unwrappedArray = arrayFilter(unwrappedArray, function (item) {
|
|
392
|
-
return item === undefined || item === null || !unwrap(item._destroy);
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
localSetDomNodeChildrenFromArrayMapping(unwrappedArray);
|
|
396
|
-
}, null, { disposeWhenNodeIsRemoved: targetNode });
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
var templateComputedDomDataKey = domData.nextKey();
|
|
400
|
-
var TemplateBindingHandler = /** @class */ (function (_super) {
|
|
401
|
-
__extends(TemplateBindingHandler, _super);
|
|
402
|
-
function TemplateBindingHandler(params) {
|
|
403
|
-
var _this = _super.call(this, params) || this;
|
|
404
|
-
var element = _this.$element;
|
|
405
|
-
var bindingValue = unwrap(_this.value);
|
|
406
|
-
// Expose 'conditional' for `else` chaining.
|
|
407
|
-
domData.set(element, 'conditional', {
|
|
408
|
-
elseChainSatisfied: observable(true)
|
|
409
|
-
});
|
|
410
|
-
// Support anonymous templates
|
|
411
|
-
if (typeof bindingValue === 'string' || bindingValue.name) {
|
|
412
|
-
_this.bindNamedTemplate();
|
|
413
|
-
}
|
|
414
|
-
else if ('nodes' in bindingValue) {
|
|
415
|
-
_this.bindNodeTemplate(bindingValue.nodes || []);
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
_this.bindAnonymousTemplate();
|
|
419
|
-
}
|
|
420
|
-
return _this;
|
|
421
|
-
}
|
|
422
|
-
TemplateBindingHandler.prototype.bindNamedTemplate = function () {
|
|
423
|
-
// It's a named template - clear the element
|
|
424
|
-
virtualElements.emptyNode(this.$element);
|
|
425
|
-
};
|
|
426
|
-
// We've been given an array of DOM nodes. Save them as the template source.
|
|
427
|
-
// There is no known use case for the node array being an observable array (if the output
|
|
428
|
-
// varies, put that behavior *into* your template - that's what templates are for), and
|
|
429
|
-
// the implementation would be a mess, so assert that it's not observable.
|
|
430
|
-
TemplateBindingHandler.prototype.bindNodeTemplate = function (nodes) {
|
|
431
|
-
if (isObservable(nodes)) {
|
|
432
|
-
throw new Error('The "nodes" option must be a plain, non-observable array.');
|
|
433
|
-
}
|
|
434
|
-
// If the nodes are already attached to a KO-generated container, we reuse that container without moving the
|
|
435
|
-
// elements to a new one (we check only the first node, as the nodes are always moved together)
|
|
436
|
-
var container = nodes[0] && nodes[0].parentNode;
|
|
437
|
-
if (!container || !domData.get(container, cleanContainerDomDataKey)) {
|
|
438
|
-
container = moveCleanedNodesToContainerElement(nodes);
|
|
439
|
-
domData.set(container, cleanContainerDomDataKey, true);
|
|
440
|
-
}
|
|
441
|
-
new anonymousTemplate(this.$element).nodes(container);
|
|
442
|
-
};
|
|
443
|
-
TemplateBindingHandler.prototype.bindAnonymousTemplate = function () {
|
|
444
|
-
// It's an anonymous template - store the element contents, then clear the element
|
|
445
|
-
var templateNodes = virtualElements.childNodes(this.$element);
|
|
446
|
-
if (templateNodes.length === 0) {
|
|
447
|
-
throw new Error('Anonymous template defined, but no template content was provided.');
|
|
448
|
-
}
|
|
449
|
-
var container = moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
|
|
450
|
-
new anonymousTemplate(this.$element).nodes(container);
|
|
451
|
-
};
|
|
452
|
-
TemplateBindingHandler.prototype.onValueChange = function () {
|
|
453
|
-
var element = this.$element;
|
|
454
|
-
var bindingContext$$1 = this.$context;
|
|
455
|
-
var value = this.value;
|
|
456
|
-
var options$$1 = unwrap(value);
|
|
457
|
-
var shouldDisplay = true;
|
|
458
|
-
var templateComputed = null;
|
|
459
|
-
var elseChainSatisfied = domData.get(element, 'conditional').elseChainSatisfied;
|
|
460
|
-
var templateName;
|
|
461
|
-
if (typeof options$$1 === 'string') {
|
|
462
|
-
templateName = value;
|
|
463
|
-
options$$1 = {};
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
templateName = options$$1.name;
|
|
467
|
-
// Support "if"/"ifnot" conditions
|
|
468
|
-
if ('if' in options$$1) {
|
|
469
|
-
shouldDisplay = unwrap(options$$1["if"]);
|
|
470
|
-
}
|
|
471
|
-
if (shouldDisplay && 'ifnot' in options$$1) {
|
|
472
|
-
shouldDisplay = !unwrap(options$$1.ifnot);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
if ('foreach' in options$$1) {
|
|
476
|
-
// Render once for each data point (treating data set as empty if shouldDisplay==false)
|
|
477
|
-
var dataArray = (shouldDisplay && options$$1.foreach) || [];
|
|
478
|
-
templateComputed = renderTemplateForEach(templateName || element, dataArray, options$$1, element, bindingContext$$1, this.completeBinding);
|
|
479
|
-
elseChainSatisfied((unwrap(dataArray) || []).length !== 0);
|
|
480
|
-
}
|
|
481
|
-
else if (shouldDisplay) {
|
|
482
|
-
// Render once for this single data point (or use the viewModel if no data was provided)
|
|
483
|
-
var innerBindingContext = ('data' in options$$1)
|
|
484
|
-
? bindingContext$$1.createStaticChildContext(options$$1.data, options$$1.as) // Given an explicit 'data' value, we create a child binding context for it
|
|
485
|
-
: bindingContext$$1; // Given no explicit 'data' value, we retain the same binding context
|
|
486
|
-
templateComputed = renderTemplate(templateName || element, innerBindingContext, options$$1, element, undefined, this.completeBinding);
|
|
487
|
-
elseChainSatisfied(true);
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
virtualElements.emptyNode(element);
|
|
491
|
-
elseChainSatisfied(false);
|
|
492
|
-
}
|
|
493
|
-
// It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?)
|
|
494
|
-
this.disposeOldComputedAndStoreNewOne(element, templateComputed);
|
|
495
|
-
};
|
|
496
|
-
TemplateBindingHandler.prototype.disposeOldComputedAndStoreNewOne = function (element, newComputed) {
|
|
497
|
-
var oldComputed = domData.get(element, templateComputedDomDataKey);
|
|
498
|
-
if (oldComputed && (typeof oldComputed.dispose === 'function')) {
|
|
499
|
-
oldComputed.dispose();
|
|
500
|
-
}
|
|
501
|
-
domData.set(element, templateComputedDomDataKey, (newComputed && (!newComputed.isActive || newComputed.isActive())) ? newComputed : undefined);
|
|
502
|
-
};
|
|
503
|
-
Object.defineProperty(TemplateBindingHandler.prototype, "controlsDescendants", {
|
|
504
|
-
get: function () { return true; },
|
|
505
|
-
enumerable: true,
|
|
506
|
-
configurable: true
|
|
507
|
-
});
|
|
508
|
-
Object.defineProperty(TemplateBindingHandler, "allowVirtualElements", {
|
|
509
|
-
get: function () { return true; },
|
|
510
|
-
enumerable: true,
|
|
511
|
-
configurable: true
|
|
512
|
-
});
|
|
513
|
-
return TemplateBindingHandler;
|
|
514
|
-
}(AsyncBindingHandler));
|
|
515
|
-
|
|
516
|
-
function nativeTemplateEngine() {
|
|
517
|
-
}
|
|
518
|
-
nativeTemplateEngine.prototype = new templateEngine();
|
|
519
|
-
nativeTemplateEngine.prototype.constructor = nativeTemplateEngine;
|
|
520
|
-
nativeTemplateEngine.prototype.renderTemplateSource = function (templateSource, bindingContext$$1, options$$1, templateDocument) {
|
|
521
|
-
var useNodesIfAvailable = !(ieVersion < 9), // IE<9 cloneNode doesn't work properly
|
|
522
|
-
templateNodesFunc = useNodesIfAvailable ? templateSource.nodes : null, templateNodes = templateNodesFunc ? templateSource.nodes() : null;
|
|
523
|
-
if (templateNodes) {
|
|
524
|
-
return makeArray(templateNodes.cloneNode(true).childNodes);
|
|
525
|
-
}
|
|
526
|
-
else {
|
|
527
|
-
var templateText = templateSource.text();
|
|
528
|
-
return parseHtmlFragment(templateText, templateDocument);
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
nativeTemplateEngine.instance = new nativeTemplateEngine();
|
|
532
|
-
setTemplateEngine(nativeTemplateEngine.instance);
|
|
533
|
-
|
|
534
|
-
// "foreach: someExpression" is equivalent to "template: { foreach: someExpression }"
|
|
535
|
-
// "foreach: { data: someExpression, afterAdd: myfn }" is equivalent to "template: { foreach: someExpression, afterAdd: myfn }"
|
|
536
|
-
var TemplateForEachBindingHandler = /** @class */ (function (_super) {
|
|
537
|
-
__extends(TemplateForEachBindingHandler, _super);
|
|
538
|
-
function TemplateForEachBindingHandler() {
|
|
539
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
540
|
-
}
|
|
541
|
-
Object.defineProperty(TemplateForEachBindingHandler.prototype, "value", {
|
|
542
|
-
get: function () {
|
|
543
|
-
var modelValue = this.valueAccessor();
|
|
544
|
-
var unwrappedValue = peek(modelValue); // Unwrap without setting a dependency here
|
|
545
|
-
// If unwrappedValue is the array, pass in the wrapped value on its own
|
|
546
|
-
// The value will be unwrapped and tracked within the template binding
|
|
547
|
-
// (See https://github.com/SteveSanderson/knockout/issues/523)
|
|
548
|
-
if (!unwrappedValue || typeof unwrappedValue.length === 'number') {
|
|
549
|
-
return { foreach: modelValue, templateEngine: nativeTemplateEngine.instance };
|
|
550
|
-
}
|
|
551
|
-
// If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates
|
|
552
|
-
unwrap(modelValue);
|
|
553
|
-
return {
|
|
554
|
-
foreach: unwrappedValue.data,
|
|
555
|
-
as: unwrappedValue.as,
|
|
556
|
-
includeDestroyed: unwrappedValue.includeDestroyed,
|
|
557
|
-
afterAdd: unwrappedValue.afterAdd,
|
|
558
|
-
beforeRemove: unwrappedValue.beforeRemove,
|
|
559
|
-
afterRender: unwrappedValue.afterRender,
|
|
560
|
-
beforeMove: unwrappedValue.beforeMove,
|
|
561
|
-
afterMove: unwrappedValue.afterMove,
|
|
562
|
-
templateEngine: nativeTemplateEngine.instance
|
|
563
|
-
};
|
|
564
|
-
},
|
|
565
|
-
enumerable: true,
|
|
566
|
-
configurable: true
|
|
567
|
-
});
|
|
568
|
-
return TemplateForEachBindingHandler;
|
|
569
|
-
}(TemplateBindingHandler));
|
|
570
|
-
|
|
571
|
-
// 'let': letBinding,
|
|
572
|
-
// template: template,
|
|
573
|
-
var bindings = {
|
|
574
|
-
foreach: TemplateForEachBindingHandler,
|
|
575
|
-
template: TemplateBindingHandler
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
export { bindings, nativeTemplateEngine, templateEngine, setTemplateEngine, renderTemplate, TemplateBindingHandler, domElement, anonymousTemplate };
|
|
579
|
-
//# sourceMappingURL=binding.template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binding.template.js","sources":["../../../node_modules/tslib/tslib.es6.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;AAgBA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IAC/B,aAAa,GAAG,MAAM,CAAC,cAAc;SAChC,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;QAC5E,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC9B,CAAC;;AAEF,SAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;IAC5B,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE;IACvC,CAAC,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;CACxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|