@sisense/sdk-ui-preact 1.32.0 → 1.34.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 +29 -29
- package/dist/ai.js +899 -880
- package/dist/index.cjs +28 -16
- package/dist/index.js +7195 -6047
- package/dist/packages/sdk-ui-preact/src/component-adapter/component-adapter.d.ts +6 -8
- package/dist/packages/sdk-ui-preact/src/component-adapter/context-connector.d.ts +6 -12
- package/dist/packages/sdk-ui-preact/src/component-adapter/hook-adapter.d.ts +15 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/hook-wrapper-component.d.ts +18 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/index.d.ts +3 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/types.d.ts +11 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/utils/data-observer.d.ts +12 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/utils/index.d.ts +2 -0
- package/dist/packages/sdk-ui-preact/src/component-adapter/utils/observable.d.ts +10 -0
- package/dist/packages/sdk-ui-preact/src/index.d.ts +2 -2
- package/dist/packages/sdk-ui-preact/src/render.d.ts +2 -2
- package/dist/{use-common-filters-BanIIIUW-694e5ae8.cjs → use-common-filters-Bw15BNGn-57e81698.cjs} +255 -255
- package/dist/{use-common-filters-BanIIIUW-ea070c76.js → use-common-filters-Bw15BNGn-9af1ab9b.js} +21849 -21815
- package/package.json +6 -6
- package/dist/packages/sdk-ui-preact/src/component-adapter/utils.d.ts +0 -5
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { type VNode } from 'preact';
|
|
2
1
|
import { ContextConnector } from './context-connector';
|
|
3
|
-
type ContextData
|
|
4
|
-
type ComponentBuilder = () => VNode;
|
|
2
|
+
import type { AnyComponentFunction, ContextData } from './types';
|
|
5
3
|
/** @internal */
|
|
6
|
-
export declare class ComponentAdapter {
|
|
7
|
-
private
|
|
4
|
+
export declare class ComponentAdapter<Component extends AnyComponentFunction> {
|
|
5
|
+
private component;
|
|
8
6
|
private contextConnectors;
|
|
9
7
|
private rootElement;
|
|
10
8
|
private contexts;
|
|
11
9
|
private subscriptions;
|
|
12
|
-
|
|
10
|
+
private props;
|
|
11
|
+
constructor(component: Component, contextConnectors?: ContextConnector<ContextData>[]);
|
|
13
12
|
private prepareContexts;
|
|
14
13
|
private renderComponentWithContext;
|
|
15
|
-
render(rootElement: HTMLElement): void;
|
|
14
|
+
render(rootElement: HTMLElement, props: Parameters<Component>[0]): void;
|
|
16
15
|
destroy(): void;
|
|
17
16
|
}
|
|
18
|
-
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
1
|
+
import { type CustomContextProviderProps } from '@sisense/sdk-ui';
|
|
2
|
+
import { AnyComponentFunction } from './types';
|
|
3
|
+
import { DataObserver } from './utils/data-observer';
|
|
3
4
|
/** @internal */
|
|
4
|
-
export type ContextConnector<
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export type ContextConnector<P extends CustomContextProviderProps<any>> = {
|
|
6
|
+
propsObserver: DataObserver<P>;
|
|
7
|
+
providerComponent: AnyComponentFunction<P>;
|
|
7
8
|
};
|
|
8
|
-
type AbstractContextProviderProps = {
|
|
9
|
-
context?: any;
|
|
10
|
-
error?: Error;
|
|
11
|
-
};
|
|
12
|
-
/** @internal */
|
|
13
|
-
export declare function createContextProviderRenderer<T extends AbstractContextProviderProps>(provider: FunctionComponent<T>): (contextData: T['context'], children: VNode, error?: Error) => VNode<{}>;
|
|
14
|
-
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContextConnector } from './context-connector';
|
|
2
|
+
import { AnyHookFunction, ContextData } from './types';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare class HookAdapter<Hook extends AnyHookFunction> {
|
|
5
|
+
private hook;
|
|
6
|
+
private rootElement;
|
|
7
|
+
private componentAdapter;
|
|
8
|
+
private resultSubscribeFn;
|
|
9
|
+
private params;
|
|
10
|
+
constructor(hook: Hook, contextConnectors?: ContextConnector<ContextData>[]);
|
|
11
|
+
private handleHookResult;
|
|
12
|
+
run(...params: Parameters<Hook>): void;
|
|
13
|
+
subscribe(hookResultSubscribeFn: (result: ReturnType<Hook>) => void): void;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
import { AnyHookFunction } from './types';
|
|
3
|
+
interface HookWrapperComponentProps<Hook extends AnyHookFunction> {
|
|
4
|
+
/**
|
|
5
|
+
* The hook to call
|
|
6
|
+
*/
|
|
7
|
+
hook: Hook;
|
|
8
|
+
/**
|
|
9
|
+
* The parameters to pass to the hook
|
|
10
|
+
*/
|
|
11
|
+
params: Parameters<Hook>;
|
|
12
|
+
/**
|
|
13
|
+
* The hook result callback function
|
|
14
|
+
*/
|
|
15
|
+
onResult: (result: ReturnType<Hook>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function HookWrapperComponent<Hook extends AnyHookFunction>({ hook, params, onResult, }: HookWrapperComponentProps<Hook>): null;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type VNode } from 'preact';
|
|
2
|
+
export type ContextData = any;
|
|
3
|
+
export type ComponentBuilder = () => VNode;
|
|
4
|
+
export type Context = {
|
|
5
|
+
isReady: boolean;
|
|
6
|
+
data?: ContextData;
|
|
7
|
+
error?: Error;
|
|
8
|
+
};
|
|
9
|
+
export type AnyHookFunction = (...args: any[]) => any;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export type AnyComponentFunction<P = any> = (props: P) => any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Listener, Subscription } from './observable';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare class DataObserver<T> {
|
|
4
|
+
private data;
|
|
5
|
+
private observable;
|
|
6
|
+
constructor(initialValue?: T);
|
|
7
|
+
subscribe(listener: Listener<T>, immediateTriggerLastData?: boolean): Subscription;
|
|
8
|
+
setValue(newValue: T): void;
|
|
9
|
+
getValue(): T | undefined;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function isDataObserver<T>(object: any): object is DataObserver<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Listener<T> = (newValue: T) => void;
|
|
2
|
+
export interface Subscription {
|
|
3
|
+
unsubscribe: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare class Observable<T> {
|
|
6
|
+
private listeners;
|
|
7
|
+
subscribe(listener: Listener<T>): Subscription;
|
|
8
|
+
notify(newValue: T): void;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentChildren, type FunctionComponent, type VNode } from 'preact';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export declare const preactRenderComponent: <P>(rootElement: HTMLDivElement, component: FunctionComponent<P>, componentProps: P) => void;
|
|
4
4
|
/** @internal */
|
|
5
5
|
export declare const createElement: <P>(component: FunctionComponent<P>, props: P, children?: ComponentChildren) => VNode;
|
|
6
6
|
/** @internal */
|
|
7
|
-
export declare const createWrapperElement: (nativeElement: HTMLDivElement) =>
|
|
7
|
+
export declare const createWrapperElement: <R = VNode<{}>>(nativeElement: HTMLDivElement) => R;
|
|
8
8
|
type AnyObject = Record<string, any>;
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare const createWrapperElementHandler: <P extends AnyObject>(handler: (props: P) => HTMLDivElement) => (props: P) => VNode<{}>;
|