@vonq/hapi-elements-types 1.53.0 → 1.55.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.
@@ -87,10 +87,20 @@ export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
87
87
  name: WindowHapiEventCommandNames,
88
88
  id?: string,
89
89
  ) => WindowHapiEventListener | undefined
90
+ createListener: (
91
+ name: WindowHapiEventCommandNames,
92
+ callback: WindowHapiEventCommandCallbackHandler | undefined,
93
+ id?: string,
94
+ parentListenerId?: string,
95
+ ) => WindowHapiEventListener
96
+ addEventListenerToEventStorage: (
97
+ listener: WindowHapiEventListener,
98
+ ) => void
90
99
  addEventListener: (
91
100
  name: WindowHapiEventCommandNames,
92
101
  callback: WindowHapiEventCommandCallbackHandler,
93
102
  id?: string,
103
+ parentListenerId?: string,
94
104
  ) => WindowHapiEventListener
95
105
  removeEventListener: (eventId: string) => void
96
106
  },
@@ -115,6 +125,9 @@ export type WindowHapiEventMediator = WindowHapiModuleWithConstructorArgs<
115
125
  }
116
126
  >
117
127
 
128
+ export type WindowHapiEventStorageRemoveHandler = (id: string) => void
129
+ export type WindowHapiEventStorageClearHandler = () => void
130
+
118
131
  export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
119
132
  {
120
133
  cache: (WindowHapiEventCommand | WindowHapiEventListener)[]
@@ -127,7 +140,7 @@ export type WindowHapiEventStorage = WindowHapiModuleWithConstructorArgs<
127
140
  add: (
128
141
  eventCommand: WindowHapiEventCommand | WindowHapiEventListener,
129
142
  ) => void
130
- remove: (id: string) => void
143
+ remove: WindowHapiEventStorageRemoveHandler
131
144
  removeByName: (name: string) => void
132
145
  getEventsByName: (
133
146
  name: string,
@@ -55,6 +55,7 @@ import { ProductCacheState } from "../product/state.cache.types"
55
55
  import { WindowHapiValidationsUI } from "../ui/validations.types"
56
56
  import { WindowHapiUtilsUI } from "../ui/utils.types"
57
57
  import { UIState } from "types/ui/state.types"
58
+ import { WindowHapiEventStorageRemoveHandler } from "./events.types"
58
59
 
59
60
  export type WindowHapiSDKModule<
60
61
  APIModule,
@@ -172,6 +173,7 @@ export type WindowHapiSDK = WindowHapiModuleWithConstructorArgs<
172
173
  [WindowHapiModuleName.alert]: WindowHapiSDKAlert
173
174
  [WindowHapiModuleName.ui]: WindowHapiSDKUI
174
175
  [WindowHapiModuleName.experimental]: WindowHapiSDKExperimental
176
+ removeEventById: WindowHapiEventStorageRemoveHandler
175
177
  },
176
178
  { readonly core: WindowHapiClassInterface }
177
179
  >
@@ -25,7 +25,7 @@ export type HapiServiceFunctionLifecycleHookCallbackHandler = (
25
25
  export type HapiServiceFunctionLifecycleHookHandler = (
26
26
  callback: HapiServiceFunctionLifecycleHookCallbackHandler,
27
27
  runArgs?: any[],
28
- ) => void
28
+ ) => string
29
29
 
30
30
  export type HapiServiceFunctionWithLifecycleHooks<HandlerType> = {
31
31
  functionName: string
@@ -119,7 +119,7 @@ export type WindowHapiStateBase<T, CacheType = undefined> = {
119
119
  }
120
120
 
121
121
  export type HapiStateValueWithListener<T> = {
122
- onChange: (callback: WindowHapiEventCommandCallbackHandler) => void
122
+ onChange: (callback: WindowHapiEventCommandCallbackHandler) => string
123
123
  value: T
124
124
  }
125
125
 
@@ -45,6 +45,9 @@ export enum WindowHapiEventCommandName {
45
45
  domSetAttribute = "dom:set-attribute",
46
46
  domAddClass = "dom:add-class",
47
47
  domRemoveClass = "dom:remove-class",
48
+ domSetStyle = "dom:set-style",
49
+ domAddStyleSheet = "dom:add-stylesheet",
50
+ domRemoveStyleSheet = "dom:remove-stylesheet",
48
51
  domSlotAvailable = "dom:slot-available",
49
52
  domElementMounted = "dom:element-mounted",
50
53
  domElementUnmounted = "dom:element-unmounted",
@@ -48,9 +48,12 @@ export type WindowHapiEventCommandWithCallback = WindowHapiEventCommand & {
48
48
  }
49
49
 
50
50
  export type WindowHapiEventListener = {
51
- id?: string
51
+ id: string
52
52
  name: WindowHapiEventCommandNames
53
53
  callback:
54
54
  | WindowHapiEventCommandCallbackHandler
55
55
  | WindowHapiEventCommandCommitHandler
56
+ | undefined
57
+ parentListenerId?: string
58
+ setCallback: (callback: WindowHapiEventCommandCallbackHandler) => void
56
59
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@vonq/hapi-elements-types",
4
- "version": "1.53.0",
4
+ "version": "1.55.0",
5
5
  "description": "This package contains Typescript definitions for HAPI Elements",
6
6
  "author": "VONQ HAPI Team",
7
7
  "license": "BSD-3-Clause",
@@ -5,26 +5,39 @@ import { HapiUIIconConfig } from "./types"
5
5
 
6
6
  export type WindowHapiServiceUI = WindowHapiModuleWithConstructorArgs<
7
7
  {
8
- onIframeLoaded: (callback: (iframeName: string) => void) => void
9
- onIframeUnloaded: (callback: (iframeName: string) => void) => void
8
+ onIframeLoaded: (callback: (iframeName: string) => void) => string
9
+ onIframeUnloaded: (callback: (iframeName: string) => void) => string
10
10
  setStyleAttribute: (
11
11
  selector: string,
12
12
  attributeName: string,
13
13
  attributeValue: any,
14
- ) => Promise<void>
15
- setStyle: (selector: string, style: any) => Promise<void>
16
- addClass: (selector: string, className: string) => Promise<void>
17
- removeClass: (selector: string, className: string) => Promise<void>
14
+ ) => Promise<string>
15
+ setAttribute: (
16
+ selector: string,
17
+ attributeName: string,
18
+ attributeValue: string,
19
+ ) => Promise<string>
20
+ setStyle: (
21
+ selector: string,
22
+ style: Record<string, string | number>,
23
+ ) => Promise<string>
24
+ addClass: (selector: string, className: string) => Promise<string>
25
+ removeClass: (selector: string, className: string) => Promise<string>
26
+ addStyleSheet: (
27
+ idWithoutPoundSign: string,
28
+ stylesheetStr: string,
29
+ ) => Promise<string>
30
+ removeStyleSheet: (idWithoutPoundSign: string) => Promise<void>
18
31
  appendChildToSlot: (
19
32
  slotId: string,
20
33
  element: HTMLElement,
21
- ) => Promise<void>
34
+ ) => Promise<string>
22
35
  removeChildFromSlot: (
23
36
  slotId: string,
24
37
  elementSelector: string,
25
38
  ) => Promise<void>
26
- hideElement: (elementSelector: string) => Promise<void>
27
- showElement: (elementSelector: string) => Promise<void>
39
+ hideElement: (elementSelector: string) => Promise<string>
40
+ showElement: (elementSelector: string) => Promise<string>
28
41
  changeIcons: (configs: HapiUIIconConfig[]) => Promise<void>
29
42
  },
30
43
  { readonly service: WindowHapiService }