@genesislcap/foundation-utils 13.1.0 → 13.2.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.
@@ -1,2 +1,3 @@
1
1
  export * from './sync';
2
+ export * from './when-else';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './when-else';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/directives/when-else/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Binding, CaptureType, SyntheticViewTemplate } from '@microsoft/fast-element';
2
+ type WhenTemplate<TSource> = SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>;
3
+ export declare function whenElse<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, trueTemplateOrTemplateBinding: WhenTemplate<TSource>, falseTemplateOrTemplateBinding: WhenTemplate<TSource>): CaptureType<TSource>;
4
+ export {};
5
+ //# sourceMappingURL=when-else.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when-else.d.ts","sourceRoot":"","sources":["../../../../src/directives/when-else/when-else.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EAEX,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,KAAK,YAAY,CAAC,OAAO,IAAI,qBAAqB,GAAG,OAAO,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;AAU7F,wBAAgB,QAAQ,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EACnD,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAClC,6BAA6B,EAAE,YAAY,CAAC,OAAO,CAAC,EACpD,8BAA8B,EAAE,YAAY,CAAC,OAAO,CAAC,GACpD,WAAW,CAAC,OAAO,CAAC,CAStB"}
@@ -1 +1,2 @@
1
1
  export * from './sync';
2
+ export * from './when-else';
@@ -0,0 +1 @@
1
+ export * from './when-else';
@@ -0,0 +1,6 @@
1
+ export function whenElse(binding, trueTemplateOrTemplateBinding, falseTemplateOrTemplateBinding) {
2
+ const getTemplate = (template) => typeof template === 'function' ? template : () => template;
3
+ const trueTemplate = getTemplate(trueTemplateOrTemplateBinding);
4
+ const falseTemplate = getTemplate(falseTemplateOrTemplateBinding);
5
+ return (source, context) => binding(source, context) ? trueTemplate(source, context) : falseTemplate(source, context);
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-utils",
3
3
  "description": "Genesis Foundation Utils",
4
- "version": "13.1.0",
4
+ "version": "13.2.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -90,5 +90,5 @@
90
90
  "publishConfig": {
91
91
  "access": "public"
92
92
  },
93
- "gitHead": "39bf570c9614148441adcf214ce2a56ab7984174"
93
+ "gitHead": "9edee19ccfbd785feccc855c576741fa53664b60"
94
94
  }