@player-ui/player 1.1.0-next.1 → 1.1.0-next.3

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/types/types.d.ts CHANGED
@@ -5,8 +5,36 @@ import type { ExpressionEvaluator } from "./expressions";
5
5
  import type { Logger } from "./logger";
6
6
  import type { ViewController, DataController, ValidationController, FlowController, ErrorController } from "./controllers";
7
7
  import type { ReadOnlyDataController } from "./controllers/data/utils";
8
- import { SyncHook, SyncWaterfallHook } from "tapable-ts";
8
+ import { SyncBailHook, SyncHook, SyncWaterfallHook } from "tapable-ts";
9
9
  import { ViewInstance } from "./view";
10
+ /**
11
+ * Metadata describing the incoming content to `Player.start()`. Passed
12
+ * alongside the raw payload through the `transformContent` hook so plugins
13
+ * can decide whether to claim/convert it.
14
+ */
15
+ export interface ContentMeta {
16
+ /**
17
+ * Content format identifier. `"player"` (default) means the input is
18
+ * already a `Flow` and needs no conversion. Anything else is a free-form
19
+ * string a plugin can recognize.
20
+ */
21
+ format: string;
22
+ /**
23
+ * Optional format version (e.g., `"0.9"`). Free-form — plugins decide the
24
+ * convention. Lets a single format plugin dispatch across major/minor
25
+ * versions without the caller picking a different `format` string.
26
+ */
27
+ version?: string;
28
+ }
29
+ /**
30
+ * Options passed to `Player.start()` alongside the payload.
31
+ */
32
+ export interface StartOptions {
33
+ /** Identifier of the input content's format. Default: `"player"`. */
34
+ format?: string;
35
+ /** Optional content-format version. See `ContentMeta.version`. */
36
+ version?: string;
37
+ }
10
38
  /**
11
39
  * Public Player Hooks
12
40
  */
@@ -39,6 +67,16 @@ export interface PlayerHooks {
39
67
  resolveFlowContent: SyncWaterfallHook<[
40
68
  Flow<Asset<string>>
41
69
  ], Record<string, any>>;
70
+ /**
71
+ * Transform raw input content into a Player `Flow` before any state is set
72
+ * up. Fires at the top of `Player.start()` — after plugins are applied,
73
+ * before `resolveFlowContent`. Being a bail hook, taps inspect `meta.format`
74
+ * (and optionally `meta.version`) and return a `Flow` to claim the content;
75
+ * returning `undefined` passes to the next tap. Player registers a default
76
+ * tap for the `"player"` format that returns the payload as-is, so the hook
77
+ * is guaranteed to yield a `Flow` and `start()` needs no type-casting.
78
+ */
79
+ transformContent: SyncBailHook<[unknown, ContentMeta], Flow<Asset<string>>>;
42
80
  }
43
81
  /** The status for a flow's execution state */
44
82
  export type PlayerFlowStatus = "not-started" | "in-progress" | "completed" | "error";
@@ -32,5 +32,7 @@ export declare class ValidationMiddleware implements DataModelMiddleware {
32
32
  set(transaction: BatchSetTransaction, options?: DataModelOptions, next?: DataModelImpl): Updates;
33
33
  get(binding: BindingInstance, options?: DataModelOptions, next?: DataModelImpl): any;
34
34
  delete(binding: BindingInstance, options?: DataModelOptions, next?: DataModelImpl): void | undefined;
35
+ /** Clears any invalid values staged in the shadow model */
36
+ reset(): void;
35
37
  }
36
38
  //# sourceMappingURL=validation-middleware.d.ts.map