@player-ui/async-node-plugin 0.7.4-next.3 → 0.7.5--canary.432.14776

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/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Node } from '@player-ui/player';
1
+ import type { Node } from "@player-ui/player";
2
2
 
3
3
  export type AsyncNodeHandler = (
4
4
  node: Node.Node,
5
- update: (object: any) => void
5
+ update: (object: any) => void,
6
6
  ) => void;
@@ -0,0 +1,38 @@
1
+ import type { Player, PlayerPlugin, Node, ViewInstance, Parser, ViewPlugin, Resolver } from "@player-ui/player";
2
+ import { AsyncParallelBailHook } from "tapable-ts";
3
+ export * from "./types";
4
+ export interface AsyncNodePluginOptions {
5
+ /** A set of plugins to load */
6
+ plugins?: AsyncNodeViewPlugin[];
7
+ }
8
+ export interface AsyncNodeViewPlugin extends ViewPlugin {
9
+ /** Use this to tap into the async node plugin hooks */
10
+ applyPlugin: (asyncNodePlugin: AsyncNodePlugin) => void;
11
+ asyncNode: AsyncParallelBailHook<[Node.Async], any>;
12
+ }
13
+ /**
14
+ * Async node plugin used to resolve async nodes in the content
15
+ * If an async node is present, allow users to provide a replacement node to be rendered when ready
16
+ */
17
+ export declare class AsyncNodePlugin implements PlayerPlugin {
18
+ private plugins;
19
+ constructor(options: AsyncNodePluginOptions);
20
+ readonly hooks: {
21
+ onAsyncNode: AsyncParallelBailHook<[Node.Async], any, Record<string, any>>;
22
+ };
23
+ name: string;
24
+ apply(player: Player): void;
25
+ }
26
+ export declare class AsyncNodePluginPlugin implements AsyncNodeViewPlugin {
27
+ asyncNode: AsyncParallelBailHook<[Node.Async], any, Record<string, any>>;
28
+ private basePlugin;
29
+ name: string;
30
+ private resolvedMapping;
31
+ private currentView;
32
+ private isAsync;
33
+ applyParser(parser: Parser): void;
34
+ applyResolverHooks(resolver: Resolver): void;
35
+ apply(view: ViewInstance): void;
36
+ applyPlugin(asyncNodePlugin: AsyncNodePlugin): void;
37
+ }
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { Node } from "@player-ui/player";
2
+ export type AsyncNodeHandler = (node: Node.Node, update: (object: any) => void) => void;
3
+ //# sourceMappingURL=types.d.ts.map