aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorgeireann <geireann.lindfield@gmail.com>2021-08-25 14:59:09 -0400
committergeireann <geireann.lindfield@gmail.com>2021-08-25 14:59:09 -0400
commit66f5ebb389315200d37e88ef5da1414f7f615042 (patch)
tree3f14f96cc45c686ae522e485145f5c510a535e07 /src/Utils.ts
parent281c178eb39caceb8868be1e77dbd3bbf65d2e13 (diff)
parent2790d5b6c374ca24e7307b03f1fd72be7172b033 (diff)
Merge branch 'master' into menu_updates_geireann
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index d653acd34..b7e6b83a0 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -117,13 +117,21 @@ export namespace Utils {
return { r: r, g: g, b: b, a: a };
}
+ const isTransparentFunctionHack = "isTransparent(__value__)";
+ const noRecursionHack = "__noRecursion";
+ export function IsRecursiveFilter(val: string) {
+ return !val.includes(noRecursionHack);
+ }
+ export function HasTransparencyFilter(val: string) {
+ return val.includes(isTransparentFunctionHack);
+ }
export function IsTransparentFilter() {
// bcz: isTransparent(__value__) is a hack. it would be nice to have acual functions be parsed, but now Doc.matchFieldValue is hardwired to recognize just this one
- return ["backgroundColor:isTransparent(__value__):check"];
+ return `backgroundColor:${isTransparentFunctionHack},${noRecursionHack}:check`;// bcz: hack. noRecursion should probably be either another ':' delimited field, or it should be a modifier to the comparision (eg., check, x, etc) field
}
export function IsOpaqueFilter() {
// bcz: isTransparent(__value__) is a hack. it would be nice to have acual functions be parsed, but now Doc.matchFieldValue is hardwired to recognize just this one
- return ["backgroundColor:isTransparent(__value__):x"];
+ return `backgroundColor:${isTransparentFunctionHack},${noRecursionHack}:x`;// bcz: hack. noRecursion should probably be either another ':' delimited field, or it should be a modifier to the comparision (eg., check, x, etc) field
}
@@ -450,6 +458,7 @@ export function emptyFunction() { }
export function unimplementedFunction() { throw new Error("This function is not implemented, but should be."); }
+
export type Without<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type Predicate<K, V> = (entry: [K, V]) => boolean;