@sisense/sdk-ui-preact 1.34.0 → 2.0.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.
- package/dist/ai.cjs +133 -21
- package/dist/ai.js +1063 -884
- package/dist/index.cjs +25 -21
- package/dist/index.js +3744 -3709
- package/dist/packages/sdk-ui-preact/src/component-adapter/hook-adapter.d.ts +2 -2
- package/dist/packages/sdk-ui-preact/src/component-adapter/index.d.ts +1 -1
- package/dist/packages/sdk-ui-preact/src/component-adapter/utils/create-hook-api-facade.d.ts +31 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/utils/index.d.ts +1 -0
- package/dist/{use-common-filters-Bw15BNGn-9af1ab9b.js → use-common-filters-Cmyb86sc-4037986b.js} +17246 -17226
- package/dist/{use-common-filters-Bw15BNGn-57e81698.cjs → use-common-filters-Cmyb86sc-79bec783.cjs} +244 -244
- package/package.json +3 -3
|
@@ -5,11 +5,11 @@ export declare class HookAdapter<Hook extends AnyHookFunction> {
|
|
|
5
5
|
private hook;
|
|
6
6
|
private rootElement;
|
|
7
7
|
private componentAdapter;
|
|
8
|
-
private
|
|
8
|
+
private resultObserver;
|
|
9
9
|
private params;
|
|
10
10
|
constructor(hook: Hook, contextConnectors?: ContextConnector<ContextData>[]);
|
|
11
11
|
private handleHookResult;
|
|
12
12
|
run(...params: Parameters<Hook>): void;
|
|
13
|
-
subscribe(
|
|
13
|
+
subscribe(listener: (result: ReturnType<Hook>) => void): import("./utils").Subscription;
|
|
14
14
|
destroy(): void;
|
|
15
15
|
}
|
|
@@ -3,4 +3,4 @@ export * from './context-connector';
|
|
|
3
3
|
export * from './custom-element';
|
|
4
4
|
export * from './hook-adapter';
|
|
5
5
|
export type { AnyComponentFunction } from './types';
|
|
6
|
-
export { DataObserver } from './utils
|
|
6
|
+
export { createHookApiFacade, DataObserver } from './utils';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HookAdapter } from '../hook-adapter';
|
|
2
|
+
import { AnyHookFunction } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Extracts the keys of an object `T` whose values are functions.
|
|
5
|
+
*/
|
|
6
|
+
type FunctionKeys<T> = {
|
|
7
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
8
|
+
}[keyof T];
|
|
9
|
+
/**
|
|
10
|
+
* Extracts the names of all functions returned by a given hook.
|
|
11
|
+
*
|
|
12
|
+
* @typeParam Hook - A function that returns an object.
|
|
13
|
+
*/
|
|
14
|
+
type HookApiName<Hook extends AnyHookFunction> = FunctionKeys<ReturnType<Hook>>;
|
|
15
|
+
/**
|
|
16
|
+
* Extracts the parameter types of a specific function (by name) returned from a given hook.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam Hook - A hook function that returns an object.
|
|
19
|
+
* @typeParam Name - The key of the API method within the returned object.
|
|
20
|
+
*/
|
|
21
|
+
type HookApiParameters<Hook extends AnyHookFunction, Name extends HookApiName<Hook> = HookApiName<Hook>> = Parameters<ReturnType<Hook>[Name]>;
|
|
22
|
+
/**
|
|
23
|
+
* Extracts the return type of a specific function (by name) returned from a given hook.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam Hook - A hook function that returns an object.
|
|
26
|
+
* @typeParam Name - The key of the API method within the returned object.
|
|
27
|
+
*/
|
|
28
|
+
type HookApiReturnType<Hook extends AnyHookFunction, Name extends HookApiName<Hook> = HookApiName<Hook>> = ReturnType<ReturnType<Hook>[Name]>;
|
|
29
|
+
export declare function createHookApiFacade<Hook extends AnyHookFunction, Name extends HookApiName<Hook>>(hookAdapter: HookAdapter<Hook>, apiName: Name, shouldReturnHookApiResult: true): (...args: HookApiParameters<Hook, Name>) => Promise<HookApiReturnType<Hook, Name>>;
|
|
30
|
+
export declare function createHookApiFacade<Hook extends AnyHookFunction, Name extends HookApiName<Hook>>(hookAdapter: HookAdapter<Hook>, apiName: Name, shouldReturnHookApiResult?: false): (...args: HookApiParameters<Hook, Name>) => void;
|
|
31
|
+
export {};
|