@24i/bigscreen-sdk 1.0.7-alpha.2158 → 1.0.7-alpha.2159

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.7-alpha.2158",
3
+ "version": "1.0.7-alpha.2159",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,6 +2,8 @@ import { Reference, unwrapReference } from '@24i/bigscreen-sdk/jsx';
2
2
  import { isRtl } from '@24i/bigscreen-sdk/i18n';
3
3
  import { SCREEN_WIDTH } from './sizes';
4
4
 
5
+ type Condition = (wrapperElement: HTMLElement) => boolean;
6
+
5
7
  const SAFE_TIMEOUT = 100;
6
8
 
7
9
  export const isElementVisible = (
@@ -36,15 +38,15 @@ export const isElementFullyVisible = (
36
38
  export const isElementWrappedBy = (
37
39
  elementOrReference: HTMLElement | Reference<HTMLElement>,
38
40
  wrapperElementOrReferenceOrCondition:
39
- HTMLElement | Reference<HTMLElement> | ((currentWrapper: HTMLElement) => boolean),
41
+ HTMLElement | Reference<HTMLElement> | Condition,
40
42
  includesElementItself = false,
41
43
  ) => {
42
44
  const element = unwrapReference(elementOrReference);
43
45
  let currentParent = includesElementItself ? element : element.parentElement;
44
46
  let wrapperElement: HTMLElement | null = null;
45
- let condition: ((currentWrapper: HTMLElement) => boolean) | null = null;
47
+ let condition: Condition | null = null;
46
48
  if (typeof wrapperElementOrReferenceOrCondition === 'function') {
47
- condition = wrapperElementOrReferenceOrCondition as (currentWrapper: HTMLElement) => boolean;
49
+ condition = wrapperElementOrReferenceOrCondition as Condition;
48
50
  } else {
49
51
  wrapperElement = unwrapReference(wrapperElementOrReferenceOrCondition);
50
52
  if (!wrapperElement) return false;