@statoscope/types
Advanced tools
Comparing version 5.22.0 to 5.27.0
{ | ||
"name": "@statoscope/types", | ||
"version": "5.22.0", | ||
"version": "5.27.0", | ||
"description": "Statoscope types", | ||
@@ -20,3 +20,3 @@ "types": "./types/index.d.ts", | ||
"homepage": "https://github.com/statoscope/statoscope/", | ||
"gitHead": "0d2e09d892c1bb6e019778e270079f99cb80d332" | ||
"gitHead": "9fbcea0159a2e50316d9618c73b312fd41091a79" | ||
} |
@@ -24,2 +24,3 @@ export type ViewRenderFn<TData, TContext> = ( | ||
} | ||
interface View<TData, TContext> { | ||
@@ -30,3 +31,5 @@ name: string; | ||
} | ||
type ViewConfigData = Record<string, unknown>; | ||
interface Page<TData, TContext> { | ||
@@ -37,2 +40,3 @@ name: string; | ||
} | ||
interface PageOptions { | ||
@@ -44,2 +48,3 @@ reuseEl?: boolean; | ||
} | ||
interface RenderState { | ||
@@ -53,2 +58,3 @@ pageEl: HTMLElement; | ||
export interface WidgetOptions { | ||
container?: HTMLElement; | ||
defaultPageId?: string; | ||
@@ -70,3 +76,5 @@ isolateStyleMarker?: string; | ||
constructor(config: unknown); | ||
toggle(el: HTMLElement, fn: (popupEl: HTMLElement) => void): void; | ||
hide(): void; | ||
@@ -135,2 +143,3 @@ } | ||
addQueryHelpers(extensions: { [key: string]: unknown }): void; | ||
defineObjectMarker<TValue>( | ||
@@ -157,7 +166,3 @@ name: string, | ||
constructor( | ||
container: HTMLElement, | ||
defaultPage?: ViewConfig<TData, TContext>, | ||
options?: WidgetOptions | ||
); | ||
constructor(options?: WidgetOptions); | ||
} | ||
@@ -180,1 +185,66 @@ | ||
}; | ||
declare namespace DiscoverJS { | ||
export type ReadonlyPublisher<T> = { | ||
subscribe(callback: PublisherCallback<T>, thisArg: any): () => void; | ||
subscribeSync(callback: PublisherCallback<T>, thisArg: any): () => void; | ||
unsubscribe(callback: PublisherCallback<T>, thisArg: any): void; | ||
get value(): T; | ||
}; | ||
export type PublisherCallback<T> = (value: T, unsubscribe: () => void) => void; | ||
export class Publisher<T> { | ||
static setValue<T>(publisher: Publisher<T>, value: T): boolean | any[]; | ||
constructor(initValue: T, shouldPublish: (newValue: T, oldValue: T) => boolean); | ||
get readonly(): boolean; | ||
subscribe(callback: PublisherCallback<T>, thisArg: any): () => void; | ||
subscribeSync(callback: PublisherCallback<T>, thisArg: any): () => void; | ||
unsubscribe(callback: PublisherCallback<T>, thisArg: any): void; | ||
shouldPublish(newValue: T, oldValue: T): boolean; | ||
set(value: T): boolean; | ||
asyncSet(value: T): Promise<boolean>; | ||
} | ||
export type ProgressBarState = { stage: string; progress?: number; error?: boolean }; | ||
export type ProgressBarTimingEntry = { stage: string; title: string; duration: number }; | ||
export class ProgressBar extends Publisher<ProgressBarState> { | ||
el: HTMLDivElement; | ||
constructor(options: { | ||
onTiming?: (entry: ProgressBarTimingEntry) => void; | ||
onFinish?: () => ProgressBarTimingEntry[]; | ||
delay?: true | number; | ||
domReady?: () => Promise<void>; | ||
}); | ||
recordTiming(stage: string, start: number, end?: number): void; | ||
setState(state: ProgressBarState): Promise<void>; | ||
finish(error: boolean): void; | ||
dispose(): void; | ||
} | ||
type LoaderResult<T> = { | ||
state: Publisher<ProgressBarState>; | ||
result: Promise<{ data: T }>; | ||
}; | ||
export const utils: { | ||
progressbar: ProgressBar; | ||
loadDataFromStream<T>(stream: ReadableStream, options: any): LoaderResult<T>; | ||
loadDataFromFile<T>(file: File, options: any): LoaderResult<T>; | ||
loadDataFromEvent<T>(event: DragEvent, options: any): LoaderResult<T>; | ||
loadDataFromUrl<T>(url: string, options: any): LoaderResult<T>; | ||
syncLoaderWithProgressbar<T>( | ||
loader: LoaderResult<T>, | ||
progressbar: ProgressBar | ||
): Promise<void>; | ||
}; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11179
300