@player-ui/reference-assets-plugin 0.7.4-next.4 → 0.7.5--canary.434.14868
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/ReferenceAssetsPlugin.native.js +821 -0
- package/dist/ReferenceAssetsPlugin.native.js.map +1 -0
- package/dist/cjs/index.cjs +215 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/index.legacy-esm.js +181 -0
- package/dist/index.mjs +181 -0
- package/dist/index.mjs.map +1 -0
- package/dist/xlr/ActionAsset.json +126 -0
- package/dist/xlr/ChoiceAsset.json +191 -0
- package/dist/xlr/CollectionAsset.json +40 -0
- package/dist/xlr/ImageAsset.json +65 -0
- package/dist/xlr/InfoAsset.json +58 -0
- package/dist/xlr/InputAsset.json +109 -0
- package/dist/xlr/TextAsset.json +125 -0
- package/dist/xlr/manifest.js +18 -0
- package/dist/xlr/manifest.json +24 -0
- package/package.json +27 -60
- package/src/assets/action/__tests__/transform.test.ts +118 -0
- package/src/assets/action/index.ts +2 -2
- package/src/assets/action/transform.ts +10 -10
- package/src/assets/action/types.ts +3 -3
- package/src/assets/choice/__tests__/transform.test.ts +145 -0
- package/src/assets/choice/index.ts +2 -0
- package/src/assets/choice/transform.ts +55 -0
- package/src/assets/choice/types.ts +73 -0
- package/src/assets/collection/index.ts +1 -1
- package/src/assets/collection/types.ts +2 -2
- package/src/assets/image/__tests__/transform.test.ts +35 -0
- package/src/assets/image/index.ts +2 -2
- package/src/assets/image/transform.ts +4 -4
- package/src/assets/image/types.ts +3 -3
- package/src/assets/index.ts +7 -6
- package/src/assets/info/__tests__/transform.test.ts +143 -0
- package/src/assets/info/index.ts +2 -2
- package/src/assets/info/transform.ts +8 -8
- package/src/assets/info/types.ts +3 -3
- package/src/assets/input/index.ts +2 -2
- package/src/assets/input/transform.ts +4 -4
- package/src/assets/input/types.ts +3 -3
- package/src/assets/text/index.ts +1 -1
- package/src/assets/text/types.ts +4 -4
- package/src/index.ts +2 -2
- package/src/plugin.ts +34 -10
- package/types/assets/action/index.d.ts +3 -0
- package/types/assets/action/transform.d.ts +14 -0
- package/types/assets/action/types.d.ts +32 -0
- package/types/assets/choice/index.d.ts +3 -0
- package/types/assets/choice/transform.d.ts +7 -0
- package/types/assets/choice/types.d.ts +51 -0
- package/types/assets/collection/index.d.ts +2 -0
- package/types/assets/collection/types.d.ts +8 -0
- package/types/assets/image/index.d.ts +3 -0
- package/types/assets/image/transform.d.ts +7 -0
- package/types/assets/image/types.d.ts +21 -0
- package/types/assets/index.d.ts +8 -0
- package/types/assets/info/index.d.ts +3 -0
- package/types/assets/info/transform.d.ts +8 -0
- package/types/assets/info/types.d.ts +28 -0
- package/types/assets/input/index.d.ts +3 -0
- package/types/assets/input/transform.d.ts +7 -0
- package/types/assets/input/types.d.ts +34 -0
- package/types/assets/text/index.d.ts +2 -0
- package/types/assets/text/types.d.ts +31 -0
- package/types/index.d.ts +3 -0
- package/types/plugin.d.ts +19 -0
- package/dist/index.cjs.js +0 -204
- package/dist/index.d.ts +0 -185
- package/dist/index.esm.js +0 -194
- package/dist/reference-assets-plugin.dev.js +0 -675
- package/dist/reference-assets-plugin.prod.js +0 -1
package/src/plugin.ts
CHANGED
|
@@ -1,26 +1,50 @@
|
|
|
1
|
-
import type { Player,
|
|
2
|
-
import { AssetTransformPlugin } from
|
|
1
|
+
import type { Player, ExtendedPlayerPlugin } from "@player-ui/player";
|
|
2
|
+
import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin";
|
|
3
|
+
import type {
|
|
4
|
+
ActionAsset,
|
|
5
|
+
InputAsset,
|
|
6
|
+
ImageAsset,
|
|
7
|
+
InfoAsset,
|
|
8
|
+
TextAsset,
|
|
9
|
+
CollectionAsset,
|
|
10
|
+
ChoiceAsset,
|
|
11
|
+
} from "./assets";
|
|
3
12
|
import {
|
|
4
13
|
inputTransform,
|
|
5
14
|
actionTransform,
|
|
6
15
|
imageTransform,
|
|
7
16
|
infoTransform,
|
|
8
|
-
|
|
17
|
+
choiceTransform,
|
|
18
|
+
} from "./assets";
|
|
9
19
|
|
|
10
20
|
/**
|
|
11
21
|
* A plugin to add transforms for the reference assets
|
|
12
22
|
*/
|
|
13
|
-
export class ReferenceAssetsPlugin
|
|
14
|
-
|
|
23
|
+
export class ReferenceAssetsPlugin
|
|
24
|
+
implements
|
|
25
|
+
ExtendedPlayerPlugin<
|
|
26
|
+
[
|
|
27
|
+
ActionAsset,
|
|
28
|
+
InputAsset,
|
|
29
|
+
ImageAsset,
|
|
30
|
+
TextAsset,
|
|
31
|
+
CollectionAsset,
|
|
32
|
+
ChoiceAsset,
|
|
33
|
+
],
|
|
34
|
+
[InfoAsset]
|
|
35
|
+
>
|
|
36
|
+
{
|
|
37
|
+
name = "reference-assets-transforms";
|
|
15
38
|
|
|
16
39
|
apply(player: Player) {
|
|
17
40
|
player.registerPlugin(
|
|
18
41
|
new AssetTransformPlugin([
|
|
19
|
-
[{ type:
|
|
20
|
-
[{ type:
|
|
21
|
-
[{ type:
|
|
22
|
-
[{ type:
|
|
23
|
-
|
|
42
|
+
[{ type: "action" }, actionTransform],
|
|
43
|
+
[{ type: "input" }, inputTransform],
|
|
44
|
+
[{ type: "image" }, imageTransform],
|
|
45
|
+
[{ type: "info" }, infoTransform],
|
|
46
|
+
[{ type: "choice" }, choiceTransform],
|
|
47
|
+
]),
|
|
24
48
|
);
|
|
25
49
|
}
|
|
26
50
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Asset, BeforeTransformFunction } from "@player-ui/player";
|
|
2
|
+
import type { ActionAsset } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Function to find prev button
|
|
5
|
+
*/
|
|
6
|
+
export declare function isBackAction(action: ActionAsset): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist
|
|
9
|
+
*
|
|
10
|
+
* @param asset - Asset to apply the transform to
|
|
11
|
+
*/
|
|
12
|
+
export declare const expPropTransform: BeforeTransformFunction<Asset>;
|
|
13
|
+
export declare const actionTransform: import("@player-ui/player").TransformFunctions;
|
|
14
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Asset, AssetWrapper, Expression } from "@player-ui/player";
|
|
2
|
+
import type { BeaconDataType } from "@player-ui/beacon-plugin";
|
|
3
|
+
/**
|
|
4
|
+
* User actions can be represented in several places.
|
|
5
|
+
* Each view typically has one or more actions that allow the user to navigate away from that view.
|
|
6
|
+
* In addition, several asset types can have actions that apply to that asset only.
|
|
7
|
+
*/
|
|
8
|
+
export interface ActionAsset<AnyTextAsset extends Asset = Asset> extends Asset<"action"> {
|
|
9
|
+
/** The transition value of the action in the state machine */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** A text-like asset for the action's label */
|
|
12
|
+
label?: AssetWrapper<AnyTextAsset>;
|
|
13
|
+
/** An optional expression to execute before transitioning */
|
|
14
|
+
exp?: Expression;
|
|
15
|
+
/** An optional string that describes the action for screen-readers */
|
|
16
|
+
accessibility?: string;
|
|
17
|
+
/** Additional optional data to assist with the action interactions on the page */
|
|
18
|
+
metaData?: {
|
|
19
|
+
/** Additional data to beacon */
|
|
20
|
+
beacon?: BeaconDataType;
|
|
21
|
+
/** Force transition to the next view without checking for validation */
|
|
22
|
+
skipValidation?: boolean;
|
|
23
|
+
/** string value to decide for the left anchor sign */
|
|
24
|
+
role?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** A stateful instance of an action */
|
|
28
|
+
export interface TransformedAction extends ActionAsset {
|
|
29
|
+
/** A method to execute the action */
|
|
30
|
+
run: () => void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransformFunction } from "@player-ui/player";
|
|
2
|
+
import type { ChoiceAsset, TransformedChoice } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Docs about the asset transform
|
|
5
|
+
*/
|
|
6
|
+
export declare const choiceTransform: TransformFunction<ChoiceAsset, TransformedChoice>;
|
|
7
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Asset, AssetWrapper, Binding, ValidationResponse, Schema } from "@player-ui/player";
|
|
2
|
+
import type { BeaconMetaData } from "@player-ui/beacon-plugin";
|
|
3
|
+
/**
|
|
4
|
+
* A choice asset represents a single selection choice, often displayed as radio buttons in a web context.
|
|
5
|
+
* This will allow users to test out more complex flows than just inputs + buttons.
|
|
6
|
+
*/
|
|
7
|
+
export interface ChoiceAsset<AnyTextAsset extends Asset = Asset> extends Asset<"choice"> {
|
|
8
|
+
/** A text-like asset for the choice's label */
|
|
9
|
+
title?: AssetWrapper<AnyTextAsset>;
|
|
10
|
+
/** Asset container for a note. */
|
|
11
|
+
note?: AssetWrapper<AnyTextAsset>;
|
|
12
|
+
/** The location in the data-model to store the data */
|
|
13
|
+
binding?: Binding;
|
|
14
|
+
/** The options to select from */
|
|
15
|
+
items?: Array<ChoiceItem>;
|
|
16
|
+
/** Optional additional data */
|
|
17
|
+
metaData?: BeaconMetaData;
|
|
18
|
+
}
|
|
19
|
+
export type ValueType = string | number | boolean | null;
|
|
20
|
+
export interface ChoiceItem<AnyTextAsset extends Asset = Asset> {
|
|
21
|
+
/** The id associated with the choice item */
|
|
22
|
+
id: string;
|
|
23
|
+
/** A text-like asset for the choice's label */
|
|
24
|
+
label?: AssetWrapper<AnyTextAsset>;
|
|
25
|
+
/** The value of the input from the data-model */
|
|
26
|
+
value?: ValueType;
|
|
27
|
+
}
|
|
28
|
+
/** A stateful instance of a choice */
|
|
29
|
+
export interface TransformedChoice extends ChoiceAsset {
|
|
30
|
+
/**
|
|
31
|
+
* A function to unselect all of the options
|
|
32
|
+
* This is typically used when selecting a placeholder value
|
|
33
|
+
*/
|
|
34
|
+
clearSelection: () => void;
|
|
35
|
+
/** The transformed options to select from */
|
|
36
|
+
items?: Array<TransformedChoiceItem>;
|
|
37
|
+
/** The value of the selected choice from the data-model */
|
|
38
|
+
value?: ValueType;
|
|
39
|
+
/** Any validation associated with the current choice's value */
|
|
40
|
+
validation?: ValidationResponse;
|
|
41
|
+
/** The dataType defined from the schema */
|
|
42
|
+
dataType?: Schema.DataType;
|
|
43
|
+
}
|
|
44
|
+
/** A stateful instance of a Choice Item */
|
|
45
|
+
export interface TransformedChoiceItem extends ChoiceItem {
|
|
46
|
+
/** The function that is called when a choice item is selected */
|
|
47
|
+
select: () => void;
|
|
48
|
+
/** The function that is called when a choice item is unSelected */
|
|
49
|
+
unselect: () => void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AssetWrapper, Asset } from "@player-ui/player";
|
|
2
|
+
export interface CollectionAsset extends Asset<"collection"> {
|
|
3
|
+
/** An optional label to title the collection */
|
|
4
|
+
label?: AssetWrapper;
|
|
5
|
+
/** The string value to show */
|
|
6
|
+
values?: Array<AssetWrapper>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransformFunction } from "@player-ui/player";
|
|
2
|
+
import type { ImageAsset, TransformedImage } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Sets the Image's placeholder and accessibilty
|
|
5
|
+
*/
|
|
6
|
+
export declare const imageTransform: TransformFunction<ImageAsset, TransformedImage>;
|
|
7
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Asset, AssetWrapper } from "@player-ui/player";
|
|
2
|
+
export interface ImageAsset extends Asset<"image"> {
|
|
3
|
+
/** Reference to the image */
|
|
4
|
+
metaData: ImageMetaData;
|
|
5
|
+
/** Optional placeholder text */
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
/** Optional caption */
|
|
8
|
+
caption?: AssetWrapper;
|
|
9
|
+
}
|
|
10
|
+
/** A modifier to turn the text into a link */
|
|
11
|
+
export interface ImageMetaData {
|
|
12
|
+
/** The location of the image to load */
|
|
13
|
+
ref: string;
|
|
14
|
+
/** Used for accessibility support */
|
|
15
|
+
accessibility?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TransformedImage extends ImageAsset {
|
|
18
|
+
/** Alt text */
|
|
19
|
+
altText: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TransformFunction } from "@player-ui/player";
|
|
2
|
+
import type { InfoAsset, InfoAssetTransform } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* This transform should add segmentedActions to the info asset.
|
|
5
|
+
* Segmented actions display side by side in larger viewports. Segmented Actions is an object of next and prev actions
|
|
6
|
+
*/
|
|
7
|
+
export declare const infoTransform: TransformFunction<InfoAsset, InfoAssetTransform>;
|
|
8
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AssetWrapper, Asset } from "@player-ui/player";
|
|
2
|
+
import type { ActionAsset } from "../action/types";
|
|
3
|
+
export interface InfoAsset extends Asset<"info"> {
|
|
4
|
+
/** The string value to show */
|
|
5
|
+
title?: AssetWrapper;
|
|
6
|
+
/** subtitle */
|
|
7
|
+
subTitle?: AssetWrapper;
|
|
8
|
+
/** Primary place for info */
|
|
9
|
+
primaryInfo?: AssetWrapper;
|
|
10
|
+
/** List of actions to show at the bottom of the page */
|
|
11
|
+
actions?: Array<AssetWrapper>;
|
|
12
|
+
}
|
|
13
|
+
export interface InfoAssetTransform extends InfoAsset {
|
|
14
|
+
/**
|
|
15
|
+
* This is an array of next and prev actions
|
|
16
|
+
*/
|
|
17
|
+
segmentedActions?: {
|
|
18
|
+
/**
|
|
19
|
+
* Array of next actions
|
|
20
|
+
*/
|
|
21
|
+
next: Array<AssetWrapper<ActionAsset>>;
|
|
22
|
+
/**
|
|
23
|
+
* Array of prev actions
|
|
24
|
+
*/
|
|
25
|
+
prev: Array<AssetWrapper<ActionAsset>>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TransformFunction } from "@player-ui/player";
|
|
2
|
+
import type { InputAsset, TransformedInput } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Docs about the asset transform
|
|
5
|
+
*/
|
|
6
|
+
export declare const inputTransform: TransformFunction<InputAsset, TransformedInput>;
|
|
7
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Asset, AssetWrapper, Schema, Binding, ValidationResponse } from "@player-ui/player";
|
|
2
|
+
import type { BeaconDataType } from "@player-ui/beacon-plugin";
|
|
3
|
+
/**
|
|
4
|
+
* This is the most generic way of gathering data. The input is bound to a data model using the 'binding' property.
|
|
5
|
+
* Players can get field type information from the 'schema' definition, thus to decide the input controls for visual rendering.
|
|
6
|
+
* */
|
|
7
|
+
export interface InputAsset<AnyTextAsset extends Asset = Asset> extends Asset<"input"> {
|
|
8
|
+
/** Asset container for a field label. */
|
|
9
|
+
label?: AssetWrapper<AnyTextAsset>;
|
|
10
|
+
/** Asset container for a note. */
|
|
11
|
+
note?: AssetWrapper<AnyTextAsset>;
|
|
12
|
+
/** The location in the data-model to store the data */
|
|
13
|
+
binding: Binding;
|
|
14
|
+
/** Optional additional data */
|
|
15
|
+
metaData?: {
|
|
16
|
+
/** Additional data to beacon when this input changes */
|
|
17
|
+
beacon?: BeaconDataType;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
type ValueType = string | undefined;
|
|
21
|
+
export interface TransformedInput extends InputAsset {
|
|
22
|
+
/** A function to commit the new value to the data-model */
|
|
23
|
+
set: (newValue: ValueType) => void;
|
|
24
|
+
/** A function to format a value */
|
|
25
|
+
format: (newValue: ValueType) => ValueType;
|
|
26
|
+
/** The current value of the input from the data-model */
|
|
27
|
+
value: ValueType;
|
|
28
|
+
/** Any validation associated with the current input's value */
|
|
29
|
+
validation?: ValidationResponse;
|
|
30
|
+
/** The dataType defined from the schema */
|
|
31
|
+
dataType?: Schema.DataType;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Asset, Expression } from "@player-ui/player";
|
|
2
|
+
export interface TextAsset extends Asset<"text"> {
|
|
3
|
+
/** The text to display */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Any modifiers on the text */
|
|
6
|
+
modifiers?: Array<TextModifier>;
|
|
7
|
+
}
|
|
8
|
+
export type TextModifier = BasicTextModifier | LinkModifier;
|
|
9
|
+
export interface BasicTextModifier {
|
|
10
|
+
/** The modifier type */
|
|
11
|
+
type: string;
|
|
12
|
+
/** Modifiers can be named when used in strings */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** A spot for other metaData or properties */
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/** A modifier to turn the text into a link */
|
|
18
|
+
export interface LinkModifier {
|
|
19
|
+
/** The link type denotes this as a link */
|
|
20
|
+
type: "link";
|
|
21
|
+
/** An optional expression to run before the link is opened */
|
|
22
|
+
exp?: Expression;
|
|
23
|
+
/** metaData about the link's target */
|
|
24
|
+
metaData: {
|
|
25
|
+
/** The location of the link to load */
|
|
26
|
+
ref: string;
|
|
27
|
+
/** Used to indicate an application specific resolver to use */
|
|
28
|
+
"mime-type"?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Player, ExtendedPlayerPlugin } from "@player-ui/player";
|
|
2
|
+
import type { ActionAsset, InputAsset, ImageAsset, InfoAsset, TextAsset, CollectionAsset, ChoiceAsset } from "./assets";
|
|
3
|
+
/**
|
|
4
|
+
* A plugin to add transforms for the reference assets
|
|
5
|
+
*/
|
|
6
|
+
export declare class ReferenceAssetsPlugin implements ExtendedPlayerPlugin<[
|
|
7
|
+
ActionAsset,
|
|
8
|
+
InputAsset,
|
|
9
|
+
ImageAsset,
|
|
10
|
+
TextAsset,
|
|
11
|
+
CollectionAsset,
|
|
12
|
+
ChoiceAsset
|
|
13
|
+
], [
|
|
14
|
+
InfoAsset
|
|
15
|
+
]> {
|
|
16
|
+
name: string;
|
|
17
|
+
apply(player: Player): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/index.cjs.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var assetTransformPlugin = require('@player-ui/asset-transform-plugin');
|
|
6
|
-
|
|
7
|
-
var __defProp$3 = Object.defineProperty;
|
|
8
|
-
var __defProps$3 = Object.defineProperties;
|
|
9
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
10
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
11
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues$3 = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
17
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols$3)
|
|
19
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
20
|
-
if (__propIsEnum$3.call(b, prop))
|
|
21
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
26
|
-
const inputTransform = (asset, options) => {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
return __spreadProps$3(__spreadValues$3({}, asset), {
|
|
29
|
-
format(val) {
|
|
30
|
-
if (asset.binding === void 0) {
|
|
31
|
-
return val;
|
|
32
|
-
}
|
|
33
|
-
return options.data.format(asset.binding, val);
|
|
34
|
-
},
|
|
35
|
-
set(val) {
|
|
36
|
-
if (asset.binding === void 0) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
return options.data.model.set([[asset.binding, val]], {
|
|
40
|
-
formatted: true
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
value: asset.binding === void 0 ? "" : options.data.model.get(asset.binding, {
|
|
44
|
-
includeInvalid: true,
|
|
45
|
-
formatted: true
|
|
46
|
-
}),
|
|
47
|
-
validation: asset.binding === void 0 ? void 0 : (_a = options.validation) == null ? void 0 : _a.get(asset.binding, { track: true }),
|
|
48
|
-
dataType: asset.binding === void 0 ? void 0 : (_b = options.validation) == null ? void 0 : _b.type(asset.binding)
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var __defProp$2 = Object.defineProperty;
|
|
53
|
-
var __defProps$2 = Object.defineProperties;
|
|
54
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
55
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
56
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
57
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
58
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
59
|
-
var __spreadValues$2 = (a, b) => {
|
|
60
|
-
for (var prop in b || (b = {}))
|
|
61
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
62
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
63
|
-
if (__getOwnPropSymbols$2)
|
|
64
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
65
|
-
if (__propIsEnum$2.call(b, prop))
|
|
66
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
67
|
-
}
|
|
68
|
-
return a;
|
|
69
|
-
};
|
|
70
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
71
|
-
function isBackAction(action) {
|
|
72
|
-
return action.value === "Prev";
|
|
73
|
-
}
|
|
74
|
-
const transform = (action, options) => {
|
|
75
|
-
return __spreadProps$2(__spreadValues$2({}, action), {
|
|
76
|
-
run() {
|
|
77
|
-
var _a, _b;
|
|
78
|
-
if (action.exp) {
|
|
79
|
-
options.evaluate(action.exp);
|
|
80
|
-
}
|
|
81
|
-
if (action.value) {
|
|
82
|
-
const skipValidation = (_a = action.metaData) == null ? void 0 : _a.skipValidation;
|
|
83
|
-
(_b = options.transition) == null ? void 0 : _b.call(options, action.value, { force: skipValidation });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const backIconTransform = (action) => {
|
|
89
|
-
var _a;
|
|
90
|
-
if (isBackAction(action) && ((_a = action == null ? void 0 : action.metaData) == null ? void 0 : _a.role) === void 0) {
|
|
91
|
-
return __spreadProps$2(__spreadValues$2({}, action), {
|
|
92
|
-
metaData: __spreadProps$2(__spreadValues$2({}, action == null ? void 0 : action.metaData), {
|
|
93
|
-
role: "back"
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return action;
|
|
98
|
-
};
|
|
99
|
-
const expPropTransform = (asset) => {
|
|
100
|
-
var _a, _b, _c, _d, _e, _f;
|
|
101
|
-
const skipArray = (_b = (_a = asset.plugins) == null ? void 0 : _a.stringResolver) == null ? void 0 : _b.propertiesToSkip;
|
|
102
|
-
if (skipArray && skipArray.indexOf("exp") > 1) {
|
|
103
|
-
return asset;
|
|
104
|
-
}
|
|
105
|
-
return __spreadProps$2(__spreadValues$2({}, asset), {
|
|
106
|
-
plugins: __spreadProps$2(__spreadValues$2({}, asset.plugins), {
|
|
107
|
-
stringResolver: __spreadProps$2(__spreadValues$2({}, (_c = asset == null ? void 0 : asset.plugins) == null ? void 0 : _c.stringResolver), {
|
|
108
|
-
propertiesToSkip: [
|
|
109
|
-
...(_f = (_e = (_d = asset.plugins) == null ? void 0 : _d.stringResolver) == null ? void 0 : _e.propertiesToSkip) != null ? _f : [],
|
|
110
|
-
"exp"
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
const actionTransform = assetTransformPlugin.compose(transform, backIconTransform, assetTransformPlugin.composeBefore(expPropTransform));
|
|
117
|
-
|
|
118
|
-
var __defProp$1 = Object.defineProperty;
|
|
119
|
-
var __defProps$1 = Object.defineProperties;
|
|
120
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
121
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
122
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
123
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
124
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
125
|
-
var __spreadValues$1 = (a, b) => {
|
|
126
|
-
for (var prop in b || (b = {}))
|
|
127
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
128
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
129
|
-
if (__getOwnPropSymbols$1)
|
|
130
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
131
|
-
if (__propIsEnum$1.call(b, prop))
|
|
132
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
133
|
-
}
|
|
134
|
-
return a;
|
|
135
|
-
};
|
|
136
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
137
|
-
const infoTransform = (infoAsset) => {
|
|
138
|
-
const actions = infoAsset == null ? void 0 : infoAsset.actions;
|
|
139
|
-
const segmentedActions = actions == null ? void 0 : actions.reduce((segmentedActionsArray, action) => {
|
|
140
|
-
segmentedActionsArray[isBackAction(action.asset) ? "prev" : "next"].push(action);
|
|
141
|
-
return segmentedActionsArray;
|
|
142
|
-
}, { next: [], prev: [] });
|
|
143
|
-
return __spreadProps$1(__spreadValues$1({}, infoAsset), {
|
|
144
|
-
segmentedActions
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
var __defProp = Object.defineProperty;
|
|
149
|
-
var __defProps = Object.defineProperties;
|
|
150
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
151
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
152
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
153
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
154
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
155
|
-
var __spreadValues = (a, b) => {
|
|
156
|
-
for (var prop in b || (b = {}))
|
|
157
|
-
if (__hasOwnProp.call(b, prop))
|
|
158
|
-
__defNormalProp(a, prop, b[prop]);
|
|
159
|
-
if (__getOwnPropSymbols)
|
|
160
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
161
|
-
if (__propIsEnum.call(b, prop))
|
|
162
|
-
__defNormalProp(a, prop, b[prop]);
|
|
163
|
-
}
|
|
164
|
-
return a;
|
|
165
|
-
};
|
|
166
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
167
|
-
const getImageAlt = (props) => {
|
|
168
|
-
const { metaData, placeholder } = props;
|
|
169
|
-
if (metaData.accessibility)
|
|
170
|
-
return metaData.accessibility;
|
|
171
|
-
if (placeholder)
|
|
172
|
-
return placeholder;
|
|
173
|
-
return "Image";
|
|
174
|
-
};
|
|
175
|
-
const imageTransform = (props) => {
|
|
176
|
-
const altText = getImageAlt(props);
|
|
177
|
-
const newImage = __spreadProps(__spreadValues({}, props), {
|
|
178
|
-
altText
|
|
179
|
-
});
|
|
180
|
-
return newImage;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
class ReferenceAssetsPlugin {
|
|
184
|
-
constructor() {
|
|
185
|
-
this.name = "reference-assets-transforms";
|
|
186
|
-
}
|
|
187
|
-
apply(player) {
|
|
188
|
-
player.registerPlugin(new assetTransformPlugin.AssetTransformPlugin([
|
|
189
|
-
[{ type: "action" }, actionTransform],
|
|
190
|
-
[{ type: "input" }, inputTransform],
|
|
191
|
-
[{ type: "image" }, imageTransform],
|
|
192
|
-
[{ type: "info" }, infoTransform]
|
|
193
|
-
]));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
exports.ReferenceAssetsPlugin = ReferenceAssetsPlugin;
|
|
198
|
-
exports.actionTransform = actionTransform;
|
|
199
|
-
exports.expPropTransform = expPropTransform;
|
|
200
|
-
exports.imageTransform = imageTransform;
|
|
201
|
-
exports.infoTransform = infoTransform;
|
|
202
|
-
exports.inputTransform = inputTransform;
|
|
203
|
-
exports.isBackAction = isBackAction;
|
|
204
|
-
//# sourceMappingURL=index.cjs.js.map
|