@vonq/hapi-elements-types 1.58.0 → 1.59.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.
@@ -52,6 +52,9 @@ export enum WindowHapiEventCommandName {
52
52
  domElementMounted = "dom:element-mounted",
53
53
  domElementUnmounted = "dom:element-unmounted",
54
54
  domChangeIcons = "dom:change-icons",
55
+ domScrollTo = "dom:scroll-to",
56
+ domGetScroll = "dom:get-scroll",
57
+ domEventTriggered = "dom:dom-event-triggered",
55
58
 
56
59
  /* Location */
57
60
  locationSetHref = "location:href",
package/common/types.ts CHANGED
@@ -301,3 +301,5 @@ export type HapiFeatureBranch = {
301
301
  export type FlattenedItem = { label: string; value: any }
302
302
 
303
303
  export type StringifiedJSON<T> = string
304
+
305
+ export type DOMEventType = keyof GlobalEventHandlersEventMap
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.58.0",
4
+ "version": "1.59.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
@@ -1,7 +1,12 @@
1
1
  import { WindowHapiService } from "../_window/service.types"
2
2
  import { WindowHapiModuleWithConstructorArgs } from "../_window"
3
3
 
4
- import { HapiUIIconConfig } from "./types"
4
+ import {
5
+ HAPIDomEventTriggeredEventSerializable,
6
+ HAPIDOMEventTriggeredEventType,
7
+ HapiUIIconConfig,
8
+ HAPIUIScrollPosition,
9
+ } from "./types"
5
10
 
6
11
  export type WindowHapiServiceUI = WindowHapiModuleWithConstructorArgs<
7
12
  {
@@ -39,6 +44,20 @@ export type WindowHapiServiceUI = WindowHapiModuleWithConstructorArgs<
39
44
  hideElement: (elementSelector: string) => Promise<string>
40
45
  showElement: (elementSelector: string) => Promise<string>
41
46
  changeIcons: (configs: HapiUIIconConfig[]) => Promise<void>
47
+ scrollTo: (
48
+ iframeName: string,
49
+ elementSelector: string,
50
+ scrollToOptions: ScrollToOptions,
51
+ ) => Promise<void>
52
+ getScrollPosition: (
53
+ iframeName: string,
54
+ elementSelector: string,
55
+ ) => Promise<HAPIUIScrollPosition>
56
+ onDOMEvent: (
57
+ elementSelector: string,
58
+ eventName: HAPIDOMEventTriggeredEventType,
59
+ callback: (event: HAPIDomEventTriggeredEventSerializable) => void,
60
+ ) => Promise<string>
42
61
  },
43
62
  { readonly service: WindowHapiService }
44
63
  >
package/ui/types.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { HapiUIIconType } from "./enums"
2
+ import { DOMEventType } from "../common"
2
3
 
3
4
  export type HapiUIIconConfig = {
4
5
  fromType: HapiUIIconType
@@ -8,3 +9,24 @@ export type HapiUIIconConfig = {
8
9
  // lottieFilePath can only be used when the 'toType' is of type 'lottie'
9
10
  lottieFilePath?: string
10
11
  }
12
+
13
+ export type HAPIUIScrollPosition = {
14
+ top: number
15
+ left: number
16
+ }
17
+
18
+ export type HAPIDOMEventTriggeredEventType = Extract<DOMEventType, "scroll">
19
+
20
+ export type HAPIDomEventTriggeredEventSerializable = {
21
+ type: string
22
+ timeStamp: number
23
+ target: string
24
+ currentTarget: string
25
+ key?: string
26
+ code?: string
27
+ value?: string
28
+ checked?: boolean
29
+ scrollTop?: number
30
+ scrollLeft?: number
31
+ path: string[]
32
+ }