@tko/binding.template 4.0.0-beta1.3 → 4.0.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 CHANGED
@@ -1,14 +1,8 @@
1
- // @tko/binding.template 🥊 4.0.0-beta1.3 ESM
2
- import {
3
- unwrap,
4
- peek
5
- } from "@tko/observable";
6
- import {
7
- nativeTemplateEngine
8
- } from "./nativeTemplateEngine";
9
- import {
10
- TemplateBindingHandler
11
- } from "./templating";
1
+ // @tko/binding.template 🥊 4.0.0 ESM
2
+ "use strict";
3
+ import { unwrap, peek } from "@tko/observable";
4
+ import { nativeTemplateEngine } from "./nativeTemplateEngine";
5
+ import { TemplateBindingHandler } from "./templating";
12
6
  export class TemplateForEachBindingHandler extends TemplateBindingHandler {
13
7
  get value() {
14
8
  const modelValue = this.valueAccessor();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/foreach.ts"],
4
- "sourcesContent": ["\nimport {\n unwrap, peek\n} from '@tko/observable'\n\nimport {\n nativeTemplateEngine\n} from './nativeTemplateEngine'\n\nimport {\n TemplateBindingHandler\n} from './templating'\n\n// \"foreach: someExpression\" is equivalent to \"template: { foreach: someExpression }\"\n// \"foreach: { data: someExpression, afterAdd: myfn }\" is equivalent to \"template: { foreach: someExpression, afterAdd: myfn }\"\nexport class TemplateForEachBindingHandler extends TemplateBindingHandler {\n get value () {\n const modelValue = this.valueAccessor()\n const unwrappedValue = peek(modelValue) // Unwrap without setting a dependency here\n\n // If unwrappedValue is the array, pass in the wrapped value on its own\n // The value will be unwrapped and tracked within the template binding\n // (See https://github.com/SteveSanderson/knockout/issues/523)\n if (!unwrappedValue || typeof unwrappedValue.length === 'number') {\n return { foreach: modelValue, templateEngine: nativeTemplateEngine.instance }\n }\n\n // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates\n unwrap(modelValue)\n return {\n foreach: unwrappedValue.data,\n as: unwrappedValue.as,\n includeDestroyed: unwrappedValue.includeDestroyed,\n afterAdd: unwrappedValue.afterAdd,\n beforeRemove: unwrappedValue.beforeRemove,\n afterRender: unwrappedValue.afterRender,\n beforeMove: unwrappedValue.beforeMove,\n afterMove: unwrappedValue.afterMove,\n templateEngine: nativeTemplateEngine.instance\n }\n }\n}\n"],
5
- "mappings": ";AACA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA;AAAA;AAAA;AAMO,aAAM,sCAAsC,uBAAuB;AAAA,MACpE,QAAS;AACX,UAAM,aAAa,KAAK,cAAc;AACtC,UAAM,iBAAiB,KAAK,UAAU;AAKtC,QAAI,CAAC,kBAAkB,OAAO,eAAe,WAAW,UAAU;AAChE,aAAO,EAAE,SAAS,YAAY,gBAAgB,qBAAqB,SAAS;AAAA,IAC9E;AAGA,WAAO,UAAU;AACjB,WAAO;AAAA,MACL,SAAS,eAAe;AAAA,MACxB,IAAI,eAAe;AAAA,MACnB,kBAAkB,eAAe;AAAA,MACjC,UAAU,eAAe;AAAA,MACzB,cAAc,eAAe;AAAA,MAC7B,aAAa,eAAe;AAAA,MAC5B,YAAY,eAAe;AAAA,MAC3B,WAAW,eAAe;AAAA,MAC1B,gBAAgB,qBAAqB;AAAA,IACvC;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { unwrap, peek } from '@tko/observable'\n\nimport { nativeTemplateEngine } from './nativeTemplateEngine'\n\nimport { TemplateBindingHandler } from './templating'\n\n// \"foreach: someExpression\" is equivalent to \"template: { foreach: someExpression }\"\n// \"foreach: { data: someExpression, afterAdd: myfn }\" is equivalent to \"template: { foreach: someExpression, afterAdd: myfn }\"\nexport class TemplateForEachBindingHandler extends TemplateBindingHandler {\n override get value() {\n const modelValue = this.valueAccessor()\n const unwrappedValue = peek(modelValue) // Unwrap without setting a dependency here\n\n // If unwrappedValue is the array, pass in the wrapped value on its own\n // The value will be unwrapped and tracked within the template binding\n // (See https://github.com/SteveSanderson/knockout/issues/523)\n if (!unwrappedValue || typeof unwrappedValue.length === 'number') {\n return { foreach: modelValue, templateEngine: nativeTemplateEngine.instance }\n }\n\n // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates\n unwrap(modelValue)\n return {\n foreach: unwrappedValue.data,\n as: unwrappedValue.as,\n includeDestroyed: unwrappedValue.includeDestroyed,\n afterAdd: unwrappedValue.afterAdd,\n beforeRemove: unwrappedValue.beforeRemove,\n afterRender: unwrappedValue.afterRender,\n beforeMove: unwrappedValue.beforeMove,\n afterMove: unwrappedValue.afterMove,\n templateEngine: nativeTemplateEngine.instance\n }\n }\n}\n"],
5
+ "mappings": ";;AAAA,SAAS,QAAQ,YAAY;AAE7B,SAAS,4BAA4B;AAErC,SAAS,8BAA8B;AAIhC,aAAM,sCAAsC,uBAAuB;AAAA,EACxE,IAAa,QAAQ;AACnB,UAAM,aAAa,KAAK,cAAc;AACtC,UAAM,iBAAiB,KAAK,UAAU;AAKtC,QAAI,CAAC,kBAAkB,OAAO,eAAe,WAAW,UAAU;AAChE,aAAO,EAAE,SAAS,YAAY,gBAAgB,qBAAqB,SAAS;AAAA,IAC9E;AAGA,WAAO,UAAU;AACjB,WAAO;AAAA,MACL,SAAS,eAAe;AAAA,MACxB,IAAI,eAAe;AAAA,MACnB,kBAAkB,eAAe;AAAA,MACjC,UAAU,eAAe;AAAA,MACzB,cAAc,eAAe;AAAA,MAC7B,aAAa,eAAe;AAAA,MAC5B,YAAY,eAAe;AAAA,MAC3B,WAAW,eAAe;AAAA,MAC1B,gBAAgB,qBAAqB;AAAA,IACvC;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }