@tko/build.reference 4.0.0-beta1.4 → 4.0.0-beta1.5

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/browser.js CHANGED
@@ -1,4 +1,5 @@
1
- // @tko/build.reference 🥊 4.0.0-beta1.4 IIFE
1
+ "use strict";
2
+ // @tko/build.reference 🥊 4.0.0-beta1.5 IIFE
2
3
  var tko = (() => {
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -2176,13 +2177,13 @@ var tko = (() => {
2176
2177
  return a != null ? a : b;
2177
2178
  },
2178
2179
  ".": function member(a, b) {
2179
- return a[b];
2180
+ return a == null ? void 0 : a[b];
2180
2181
  },
2181
- "?.": function optionalMember(a, b) {
2182
+ "?.": function omember(a, b) {
2182
2183
  return a == null ? void 0 : a[b];
2183
2184
  },
2184
- "[": function member2(a, b) {
2185
- return a[b];
2185
+ "[": function bmember(a, b) {
2186
+ return a == null ? void 0 : a[b];
2186
2187
  },
2187
2188
  ",": function comma(a, b) {
2188
2189
  return b;
@@ -2352,24 +2353,24 @@ var tko = (() => {
2352
2353
  this.parser = parser;
2353
2354
  }
2354
2355
  dereference(value2, $context, globals, node) {
2355
- let member3;
2356
+ let member2;
2356
2357
  let refs = this.dereferences || [];
2357
2358
  const $data = $context.$data || {};
2358
2359
  let lastValue;
2359
2360
  let i, n;
2360
2361
  for (i = 0, n = refs.length; i < n; ++i) {
2361
- member3 = Node2.value_of(refs[i], $context, globals, node);
2362
+ member2 = Node2.value_of(refs[i], $context, globals, node);
2362
2363
  if (typeof value2 === "function" && refs[i] instanceof Arguments) {
2363
- value2 = value2.apply(lastValue || $data, member3);
2364
+ value2 = value2.apply(lastValue || $data, member2);
2364
2365
  lastValue = value2;
2365
2366
  } else if (value2 === null || value2 === void 0) {
2366
- throw new Error(`dereference of null value in ${JSON.stringify(this, null, 2)} context: ${JSON.stringify($context, null, 2)}`);
2367
+ return value2;
2367
2368
  } else {
2368
2369
  lastValue = value2;
2369
- value2 = Node2.value_of(value2[member3], $context, globals, node);
2370
+ value2 = Node2.value_of(value2[member2], $context, globals, node);
2370
2371
  }
2371
2372
  }
2372
- if (typeof value2 === "function" && n > 0 && lastValue !== value2 && !hasOwnProperty(lastValue, member3)) {
2373
+ if (typeof value2 === "function" && n > 0 && lastValue !== value2 && !hasOwnProperty(lastValue, member2)) {
2373
2374
  return value2.bind(lastValue);
2374
2375
  }
2375
2376
  return value2;
@@ -2579,7 +2580,9 @@ ${name} ${msg} of
2579
2580
  this.white();
2580
2581
  ch = this.next();
2581
2582
  if (ch !== ":" && ch !== ",") {
2582
- this.error("Object name: " + name + " missing closing " + enclosedBy);
2583
+ this.error(
2584
+ "Object name: " + name + " missing closing " + enclosedBy
2585
+ );
2583
2586
  }
2584
2587
  return name;
2585
2588
  } else if (ch === ":" || ch <= " " || ch === "," || ch === "|") {
@@ -2888,7 +2891,7 @@ ${name} ${msg} of
2888
2891
  if (op === operators["?"]) {
2889
2892
  this.ternary(nodes);
2890
2893
  break;
2891
- } else if (op === operators["."]) {
2894
+ } else if (op === operators["."] || op === operators["?."]) {
2892
2895
  nodes.push(op);
2893
2896
  nodes.push(this.member());
2894
2897
  op = null;
@@ -2956,31 +2959,31 @@ ${name} ${msg} of
2956
2959
  this.error("Bad arguments to function");
2957
2960
  }
2958
2961
  member() {
2959
- let member3 = "";
2962
+ let member2 = "";
2960
2963
  let ch = this.white();
2961
2964
  let isIdentifierChar = Identifier.is_valid_start_char;
2962
2965
  while (ch) {
2963
2966
  if (!isIdentifierChar(ch)) {
2964
2967
  break;
2965
2968
  }
2966
- member3 += ch;
2969
+ member2 += ch;
2967
2970
  ch = this.next();
2968
2971
  isIdentifierChar = Identifier.is_valid_continue_char;
2969
2972
  }
2970
- return member3;
2973
+ return member2;
2971
2974
  }
2972
2975
  dereference() {
2973
- let member3;
2976
+ let member2;
2974
2977
  let ch = this.white();
2975
2978
  while (ch) {
2976
2979
  if (ch === "(") {
2977
2980
  return this.funcArguments();
2978
2981
  } else if (ch === "[") {
2979
2982
  this.next("[");
2980
- member3 = this.expression();
2983
+ member2 = this.expression();
2981
2984
  this.white();
2982
2985
  this.next("]");
2983
- return member3;
2986
+ return member2;
2984
2987
  } else if (ch === ".") {
2985
2988
  this.next(".");
2986
2989
  return this.member();
@@ -4276,13 +4279,17 @@ ${name} ${msg} of
4276
4279
  const provider = getBindingProvider();
4277
4280
  const getBindings = provider.getBindingAccessors;
4278
4281
  if (isProviderForNode(provider, node)) {
4279
- var bindingsUpdater = computed(function() {
4280
- bindings6 = sourceBindings ? sourceBindings(bindingContext2, node) : getBindings.call(provider, node, bindingContext2);
4281
- if (bindings6 && bindingContext2[contextSubscribeSymbol]) {
4282
- bindingContext2[contextSubscribeSymbol]();
4283
- }
4284
- return bindings6;
4285
- }, null, { disposeWhenNodeIsRemoved: node });
4282
+ var bindingsUpdater = computed(
4283
+ function() {
4284
+ bindings6 = sourceBindings ? sourceBindings(bindingContext2, node) : getBindings.call(provider, node, bindingContext2);
4285
+ if (bindings6 && bindingContext2[contextSubscribeSymbol]) {
4286
+ bindingContext2[contextSubscribeSymbol]();
4287
+ }
4288
+ return bindings6;
4289
+ },
4290
+ null,
4291
+ { disposeWhenNodeIsRemoved: node }
4292
+ );
4286
4293
  if (!bindings6 || !bindingsUpdater.isActive()) {
4287
4294
  bindingsUpdater = null;
4288
4295
  }
@@ -4290,9 +4297,10 @@ ${name} ${msg} of
4290
4297
  }
4291
4298
  var bindingHandlerThatControlsDescendantBindings;
4292
4299
  if (bindings6) {
4293
- let allBindings = function() {
4300
+ let allBindings2 = function() {
4294
4301
  return objectMap(bindingsUpdater ? bindingsUpdater() : bindings6, evaluateValueAccessor);
4295
4302
  };
4303
+ var allBindings = allBindings2;
4296
4304
  const $component = bindingContext2.$component || {};
4297
4305
  const allBindingHandlers = {};
4298
4306
  data_exports.set(node, "bindingHandlers", allBindingHandlers);
@@ -4304,8 +4312,8 @@ ${name} ${msg} of
4304
4312
  return valueAccessor(optionalValue);
4305
4313
  }
4306
4314
  } : (bindingKey) => bindings6[bindingKey];
4307
- allBindings.has = (key) => key in bindings6;
4308
- allBindings.get = (key) => bindings6[key] && evaluateValueAccessor(getValueAccessor(key));
4315
+ allBindings2.has = (key) => key in bindings6;
4316
+ allBindings2.get = (key) => bindings6[key] && evaluateValueAccessor(getValueAccessor(key));
4309
4317
  if (bindingEvent.childrenComplete in bindings6) {
4310
4318
  bindingEvent.subscribe(node, bindingEvent.childrenComplete, () => {
4311
4319
  const callback = evaluateValueAccessor(bindings6[bindingEvent.childrenComplete]);
@@ -4321,33 +4329,38 @@ ${name} ${msg} of
4321
4329
  const bindingsGenerated = topologicalSortBindings(bindings6, $component);
4322
4330
  const nodeAsyncBindingPromises = /* @__PURE__ */ new Set();
4323
4331
  for (const [key, BindingHandlerClass] of bindingsGenerated) {
4324
- let reportBindingError = function(during, errorCaptured) {
4332
+ let reportBindingError2 = function(during, errorCaptured) {
4325
4333
  onBindingError({
4326
4334
  during,
4327
4335
  errorCaptured,
4328
4336
  bindings: bindings6,
4329
- allBindings,
4337
+ allBindings: allBindings2,
4330
4338
  bindingKey: key,
4331
4339
  bindingContext: bindingContext2,
4332
4340
  element: node,
4333
4341
  valueAccessor: getValueAccessor(key)
4334
4342
  });
4335
4343
  };
4344
+ var reportBindingError = reportBindingError2;
4336
4345
  if (node.nodeType === 8 && !BindingHandlerClass.allowVirtualElements) {
4337
4346
  throw new Error(`The binding '${key}' cannot be used with virtual elements`);
4338
4347
  }
4339
4348
  try {
4340
- const bindingHandler = dependencyDetection_exports.ignore(() => new BindingHandlerClass({
4341
- allBindings,
4342
- $element: node,
4343
- $context: bindingContext2,
4344
- onError: reportBindingError,
4345
- valueAccessor(...v) {
4346
- return getValueAccessor(key)(...v);
4347
- }
4348
- }));
4349
+ const bindingHandler = dependencyDetection_exports.ignore(
4350
+ () => new BindingHandlerClass({
4351
+ allBindings: allBindings2,
4352
+ $element: node,
4353
+ $context: bindingContext2,
4354
+ onError: reportBindingError2,
4355
+ valueAccessor(...v) {
4356
+ return getValueAccessor(key)(...v);
4357
+ }
4358
+ })
4359
+ );
4349
4360
  if (bindingHandler.onValueChange) {
4350
- dependencyDetection_exports.ignore(() => bindingHandler.computed("onValueChange"));
4361
+ dependencyDetection_exports.ignore(
4362
+ () => bindingHandler.computed("onValueChange")
4363
+ );
4351
4364
  }
4352
4365
  allBindingHandlers[key] = bindingHandler;
4353
4366
  if (bindingHandler.controlsDescendants) {
@@ -4361,7 +4374,7 @@ ${name} ${msg} of
4361
4374
  nodeAsyncBindingPromises.add(bindingHandler.bindingCompleted);
4362
4375
  }
4363
4376
  } catch (err) {
4364
- reportBindingError("creation", err);
4377
+ reportBindingError2("creation", err);
4365
4378
  }
4366
4379
  }
4367
4380
  triggerDescendantsComplete(node, bindings6, nodeAsyncBindingPromises);
@@ -4868,15 +4881,19 @@ ${name} ${msg} of
4868
4881
  return !firstTargetNode || !domNodeIsAttachedToDocument(firstTargetNode);
4869
4882
  };
4870
4883
  var activelyDisposeWhenNodeIsRemoved = firstTargetNode && renderMode === "replaceNode" ? firstTargetNode.parentNode : firstTargetNode;
4871
- return computed(function() {
4872
- var bindingContext2 = dataOrBindingContext && dataOrBindingContext instanceof bindingContext ? dataOrBindingContext : new bindingContext(dataOrBindingContext, null, null, null, { "exportDependencies": true });
4873
- var templateName = resolveTemplateName(template, bindingContext2.$data, bindingContext2);
4874
- const renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext2, options3, afterBindingCallback);
4875
- if (renderMode === "replaceNode") {
4876
- targetNodeOrNodeArray = renderedNodesArray;
4877
- firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
4878
- }
4879
- }, null, { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved });
4884
+ return computed(
4885
+ function() {
4886
+ var bindingContext2 = dataOrBindingContext && dataOrBindingContext instanceof bindingContext ? dataOrBindingContext : new bindingContext(dataOrBindingContext, null, null, null, { "exportDependencies": true });
4887
+ var templateName = resolveTemplateName(template, bindingContext2.$data, bindingContext2);
4888
+ const renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext2, options3, afterBindingCallback);
4889
+ if (renderMode === "replaceNode") {
4890
+ targetNodeOrNodeArray = renderedNodesArray;
4891
+ firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
4892
+ }
4893
+ },
4894
+ null,
4895
+ { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved }
4896
+ );
4880
4897
  } else {
4881
4898
  return memoization_exports.memoize(function(domNode) {
4882
4899
  renderTemplate(template, dataOrBindingContext, options3, domNode, "replaceNode");
@@ -4888,9 +4905,13 @@ ${name} ${msg} of
4888
4905
  function executeTemplateForArrayItem(arrayValue, index) {
4889
4906
  if (options3.as) {
4890
4907
  if (options_default.createChildContextWithAs) {
4891
- arrayItemContext = parentBindingContext.createChildContext(arrayValue, options3.as, (context) => {
4892
- context.$index = index;
4893
- });
4908
+ arrayItemContext = parentBindingContext.createChildContext(
4909
+ arrayValue,
4910
+ options3.as,
4911
+ (context) => {
4912
+ context.$index = index;
4913
+ }
4914
+ );
4894
4915
  } else {
4895
4916
  arrayItemContext = parentBindingContext.extend({
4896
4917
  [options3.as]: arrayValue,
@@ -5191,14 +5212,19 @@ ${name} ${msg} of
5191
5212
  };
5192
5213
  }
5193
5214
  create(...additionalProperties) {
5194
- const instance = Object.assign({
5195
- get getBindingHandler() {
5196
- return options_default.getBindingHandler;
5215
+ const instance = Object.assign(
5216
+ {
5217
+ get getBindingHandler() {
5218
+ return options_default.getBindingHandler;
5219
+ },
5220
+ set getBindingHandler(fn) {
5221
+ options_default.set("getBindingHandler", fn);
5222
+ }
5197
5223
  },
5198
- set getBindingHandler(fn) {
5199
- options_default.set("getBindingHandler", fn);
5200
- }
5201
- }, knockout, this.providedProperties, ...additionalProperties);
5224
+ knockout,
5225
+ this.providedProperties,
5226
+ ...additionalProperties
5227
+ );
5202
5228
  instance.options.knockoutInstance = instance;
5203
5229
  return instance;
5204
5230
  }
@@ -5211,11 +5237,15 @@ ${name} ${msg} of
5211
5237
  this[nameOrObject] = value2;
5212
5238
  } else if (typeof nameOrObject === "object") {
5213
5239
  if (value2 !== void 0) {
5214
- options_default.onError(new Error("Given extraneous `value` parameter (first param should be a string, but it was an object)." + nameOrObject));
5240
+ options_default.onError(
5241
+ new Error("Given extraneous `value` parameter (first param should be a string, but it was an object)." + nameOrObject)
5242
+ );
5215
5243
  }
5216
5244
  Object.assign(this, nameOrObject);
5217
5245
  } else {
5218
- options_default.onError(new Error("Given a bad binding handler type: " + nameOrObject));
5246
+ options_default.onError(
5247
+ new Error("Given a bad binding handler type: " + nameOrObject)
5248
+ );
5219
5249
  }
5220
5250
  }
5221
5251
  get(nameOrDotted) {
@@ -5261,7 +5291,10 @@ ${name} ${msg} of
5261
5291
  }
5262
5292
  }
5263
5293
  makeAccessorsFromFunction(callback) {
5264
- return objectMap(dependencyDetection_exports.ignore(callback), (value2, key) => () => callback()[key]);
5294
+ return objectMap(
5295
+ dependencyDetection_exports.ignore(callback),
5296
+ (value2, key) => () => callback()[key]
5297
+ );
5265
5298
  }
5266
5299
  makeValueAccessor(value2) {
5267
5300
  return () => value2;
@@ -5735,7 +5768,10 @@ ${name} ${msg} of
5735
5768
  if (!accessors || Object.keys(accessors).length === 0) {
5736
5769
  return { $raw: {} };
5737
5770
  }
5738
- const $raw = objectMap(accessors, (value2) => computed(value2, null, { disposeWhenNodeIsRemoved: node }));
5771
+ const $raw = objectMap(
5772
+ accessors,
5773
+ (value2) => computed(value2, null, { disposeWhenNodeIsRemoved: node })
5774
+ );
5739
5775
  const params = objectMap($raw, (v) => this.makeParamValue(node, v));
5740
5776
  return Object.assign({ $raw }, params);
5741
5777
  }
@@ -6673,7 +6709,10 @@ ${name} ${msg} of
6673
6709
  constructor(...args) {
6674
6710
  super(...args);
6675
6711
  if (ieVersion < 11) {
6676
- this.addEventListener("propertychange", (event) => event.propertyName === "value" && this.updateModel(event));
6712
+ this.addEventListener(
6713
+ "propertychange",
6714
+ (event) => event.propertyName === "value" && this.updateModel(event)
6715
+ );
6677
6716
  }
6678
6717
  if (ieVersion >= 8 && ieVersion < 10) {
6679
6718
  this.watchForSelectionChangeEvent();
@@ -6759,7 +6798,10 @@ ${name} ${msg} of
6759
6798
  constructor(...args) {
6760
6799
  super(...args);
6761
6800
  if (this.isCheckboxOrRadio) {
6762
- applyBindingAccessorsToNode(this.$element, { checkedValue: this.valueAccessor });
6801
+ applyBindingAccessorsToNode(
6802
+ this.$element,
6803
+ { checkedValue: this.valueAccessor }
6804
+ );
6763
6805
  return;
6764
6806
  }
6765
6807
  this.propertyChangedFired = false;
@@ -7128,7 +7170,9 @@ ${name} ${msg} of
7128
7170
  this.container = virtualElements_exports.isStartComment(this.$element) ? this.$element.parentNode : this.$element;
7129
7171
  this.generateContext = this.createContextGenerator(this.as);
7130
7172
  this.$indexHasBeenRequested = false;
7131
- this.templateNode = makeTemplateNode(settings.templateNode || (settings.name ? document.getElementById(settings.name).cloneNode(true) : this.$element));
7173
+ this.templateNode = makeTemplateNode(
7174
+ settings.templateNode || (settings.name ? document.getElementById(settings.name).cloneNode(true) : this.$element)
7175
+ );
7132
7176
  ["afterAdd", "beforeRemove", "afterQueueFlush", "beforeQueueFlush"].forEach((p) => {
7133
7177
  this[p] = settings[p] || this.allBindings.get(p);
7134
7178
  });
@@ -7283,7 +7327,10 @@ ${name} ${msg} of
7283
7327
  var templateClone = this.templateNode.cloneNode(true);
7284
7328
  children = virtualElements_exports.childNodes(templateClone);
7285
7329
  this.updateFirstLastNodesList(index + i, children);
7286
- const bindingResult = applyBindingsToDescendants(this.generateContext(valuesToAdd[i]), templateClone);
7330
+ const bindingResult = applyBindingsToDescendants(
7331
+ this.generateContext(valuesToAdd[i]),
7332
+ templateClone
7333
+ );
7287
7334
  asyncBindingResults.push(bindingResult);
7288
7335
  }
7289
7336
  allChildNodes.push(...children);
@@ -7607,7 +7654,11 @@ ${name} ${msg} of
7607
7654
  adds.forEach((change) => this.addChange(...change));
7608
7655
  }
7609
7656
  addChange(index, jsx) {
7610
- this.nodeArrayOrObservableAtIndex.splice(index, 0, this.injectNode(jsx, this.lastNodeFor(index)));
7657
+ this.nodeArrayOrObservableAtIndex.splice(
7658
+ index,
7659
+ 0,
7660
+ this.injectNode(jsx, this.lastNodeFor(index))
7661
+ );
7611
7662
  }
7612
7663
  injectNode(jsx, nextNode) {
7613
7664
  let nodeArrayOrObservable;
@@ -7618,7 +7669,9 @@ ${name} ${msg} of
7618
7669
  } else if (typeof jsx !== "string" && isIterable(jsx)) {
7619
7670
  nodeArrayOrObservable = [];
7620
7671
  for (const child of jsx) {
7621
- nodeArrayOrObservable.unshift(this.injectNode(child, nextNode));
7672
+ nodeArrayOrObservable.unshift(
7673
+ this.injectNode(child, nextNode)
7674
+ );
7622
7675
  }
7623
7676
  } else {
7624
7677
  const $context = contextFor(this.parentNode);
@@ -7642,7 +7695,9 @@ ${name} ${msg} of
7642
7695
  return node.nodeType === 1 || node.nodeType === 8;
7643
7696
  }
7644
7697
  delChange(index) {
7645
- this.removeNodeArrayOrObservable(this.nodeArrayOrObservableAtIndex[index]);
7698
+ this.removeNodeArrayOrObservable(
7699
+ this.nodeArrayOrObservableAtIndex[index]
7700
+ );
7646
7701
  this.nodeArrayOrObservableAtIndex.splice(index, 1);
7647
7702
  }
7648
7703
  getSubscriptionsForNode(node) {
@@ -7709,9 +7764,11 @@ ${name} ${msg} of
7709
7764
  node[ORIGINAL_JSX_SYM] = jsx;
7710
7765
  if (isObservable(jsx.attributes)) {
7711
7766
  const subscriptions = this.getSubscriptionsForNode(node);
7712
- subscriptions.push(jsx.attributes.subscribe((attrs) => {
7713
- this.updateAttributes(node, unwrap(attrs));
7714
- }));
7767
+ subscriptions.push(
7768
+ jsx.attributes.subscribe((attrs) => {
7769
+ this.updateAttributes(node, unwrap(attrs));
7770
+ })
7771
+ );
7715
7772
  }
7716
7773
  this.updateAttributes(node, unwrap(jsx.attributes));
7717
7774
  this.addDisposable(new JsxObserver(jsx.children, node, null, xmlns, this.noInitialBinding));
@@ -7730,7 +7787,9 @@ ${name} ${msg} of
7730
7787
  for (const [name, value2] of Object.entries(attributes || {})) {
7731
7788
  toRemove.delete(name);
7732
7789
  if (isObservable(value2)) {
7733
- subscriptions.push(value2.subscribe((attr2) => this.setNodeAttribute(node, name, value2)));
7790
+ subscriptions.push(
7791
+ value2.subscribe((attr2) => this.setNodeAttribute(node, name, value2))
7792
+ );
7734
7793
  }
7735
7794
  this.setNodeAttribute(node, name, value2);
7736
7795
  }
@@ -7838,7 +7897,9 @@ ${name} ${msg} of
7838
7897
  var ComponentBinding = class extends DescendantBindingHandler {
7839
7898
  constructor(params) {
7840
7899
  super(params);
7841
- this.originalChildNodes = makeArray(virtualElements_exports.childNodes(this.$element));
7900
+ this.originalChildNodes = makeArray(
7901
+ virtualElements_exports.childNodes(this.$element)
7902
+ );
7842
7903
  this.computed("computeApplyComponent");
7843
7904
  }
7844
7905
  cloneTemplateIntoElement(componentName, template, element) {
@@ -7893,7 +7954,9 @@ ${name} ${msg} of
7893
7954
  const ctxExtender = (ctx) => Object.assign(ctx, {
7894
7955
  $component,
7895
7956
  $componentTemplateNodes: this.originalChildNodes,
7896
- $componentTemplateSlotNodes: this.makeTemplateSlotNodes(this.originalChildNodes)
7957
+ $componentTemplateSlotNodes: this.makeTemplateSlotNodes(
7958
+ this.originalChildNodes
7959
+ )
7897
7960
  });
7898
7961
  return this.$context.createChildContext($component, void 0, ctxExtender);
7899
7962
  }
@@ -8071,7 +8134,7 @@ ${name} ${msg} of
8071
8134
  { each: bindings4.foreach }
8072
8135
  ]
8073
8136
  });
8074
- var version = "4.0.0-beta1.4";
8137
+ var version = "4.0.0-beta1.5";
8075
8138
  var src_default = builder.create({
8076
8139
  jsx: {
8077
8140
  createElement,