@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/info/types.ts",
|
|
3
|
+
"name": "InfoAsset",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"title": {
|
|
7
|
+
"required": false,
|
|
8
|
+
"node": {
|
|
9
|
+
"type": "ref",
|
|
10
|
+
"ref": "AssetWrapper",
|
|
11
|
+
"title": "InfoAsset.title",
|
|
12
|
+
"description": "The string value to show"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"subTitle": {
|
|
16
|
+
"required": false,
|
|
17
|
+
"node": {
|
|
18
|
+
"type": "ref",
|
|
19
|
+
"ref": "AssetWrapper",
|
|
20
|
+
"title": "InfoAsset.subTitle",
|
|
21
|
+
"description": "subtitle"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"primaryInfo": {
|
|
25
|
+
"required": false,
|
|
26
|
+
"node": {
|
|
27
|
+
"type": "ref",
|
|
28
|
+
"ref": "AssetWrapper",
|
|
29
|
+
"title": "InfoAsset.primaryInfo",
|
|
30
|
+
"description": "Primary place for info"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"actions": {
|
|
34
|
+
"required": false,
|
|
35
|
+
"node": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"elementType": {
|
|
38
|
+
"type": "ref",
|
|
39
|
+
"ref": "AssetWrapper"
|
|
40
|
+
},
|
|
41
|
+
"title": "InfoAsset.actions",
|
|
42
|
+
"description": "List of actions to show at the bottom of the page"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"title": "InfoAsset",
|
|
48
|
+
"extends": {
|
|
49
|
+
"type": "ref",
|
|
50
|
+
"ref": "Asset<\"info\">",
|
|
51
|
+
"genericArguments": [
|
|
52
|
+
{
|
|
53
|
+
"type": "string",
|
|
54
|
+
"const": "info"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/input/types.ts",
|
|
3
|
+
"name": "InputAsset",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"label": {
|
|
7
|
+
"required": false,
|
|
8
|
+
"node": {
|
|
9
|
+
"type": "ref",
|
|
10
|
+
"ref": "AssetWrapper<AnyTextAsset>",
|
|
11
|
+
"genericArguments": [
|
|
12
|
+
{
|
|
13
|
+
"type": "ref",
|
|
14
|
+
"ref": "AnyTextAsset"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"title": "InputAsset.label",
|
|
18
|
+
"description": "Asset container for a field label."
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"note": {
|
|
22
|
+
"required": false,
|
|
23
|
+
"node": {
|
|
24
|
+
"type": "ref",
|
|
25
|
+
"ref": "AssetWrapper<AnyTextAsset>",
|
|
26
|
+
"genericArguments": [
|
|
27
|
+
{
|
|
28
|
+
"type": "ref",
|
|
29
|
+
"ref": "AnyTextAsset"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"title": "InputAsset.note",
|
|
33
|
+
"description": "Asset container for a note."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"binding": {
|
|
37
|
+
"required": true,
|
|
38
|
+
"node": {
|
|
39
|
+
"type": "ref",
|
|
40
|
+
"ref": "Binding",
|
|
41
|
+
"title": "InputAsset.binding",
|
|
42
|
+
"description": "The location in the data-model to store the data"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"metaData": {
|
|
46
|
+
"required": false,
|
|
47
|
+
"node": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"beacon": {
|
|
51
|
+
"required": false,
|
|
52
|
+
"node": {
|
|
53
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+beacon-plugin@0.0.0/node_modules/@player-ui/beacon-plugin/types/beacon.d.ts",
|
|
54
|
+
"name": "BeaconDataType",
|
|
55
|
+
"type": "or",
|
|
56
|
+
"or": [
|
|
57
|
+
{
|
|
58
|
+
"type": "string",
|
|
59
|
+
"title": "BeaconDataType"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "record",
|
|
63
|
+
"keyType": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
},
|
|
66
|
+
"valueType": {
|
|
67
|
+
"type": "any"
|
|
68
|
+
},
|
|
69
|
+
"title": "BeaconDataType"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"title": "InputAsset.metaData.beacon",
|
|
73
|
+
"description": "Additional data to beacon when this input changes"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"additionalProperties": false,
|
|
78
|
+
"title": "InputAsset.metaData",
|
|
79
|
+
"description": "Optional additional data"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"title": "InputAsset",
|
|
85
|
+
"description": "This is the most generic way of gathering data. The input is bound to a data model using the 'binding' property.\nPlayers can get field type information from the 'schema' definition, thus to decide the input controls for visual rendering.",
|
|
86
|
+
"genericTokens": [
|
|
87
|
+
{
|
|
88
|
+
"symbol": "AnyTextAsset",
|
|
89
|
+
"constraints": {
|
|
90
|
+
"type": "ref",
|
|
91
|
+
"ref": "Asset"
|
|
92
|
+
},
|
|
93
|
+
"default": {
|
|
94
|
+
"type": "ref",
|
|
95
|
+
"ref": "Asset"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"extends": {
|
|
100
|
+
"type": "ref",
|
|
101
|
+
"ref": "Asset<\"input\">",
|
|
102
|
+
"genericArguments": [
|
|
103
|
+
{
|
|
104
|
+
"type": "string",
|
|
105
|
+
"const": "input"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
|
|
3
|
+
"name": "TextAsset",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"value": {
|
|
7
|
+
"required": true,
|
|
8
|
+
"node": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "TextAsset.value",
|
|
11
|
+
"description": "The text to display"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"modifiers": {
|
|
15
|
+
"required": false,
|
|
16
|
+
"node": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"elementType": {
|
|
19
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
|
|
20
|
+
"name": "TextModifier",
|
|
21
|
+
"type": "or",
|
|
22
|
+
"or": [
|
|
23
|
+
{
|
|
24
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
|
|
25
|
+
"name": "BasicTextModifier",
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"type": {
|
|
29
|
+
"required": true,
|
|
30
|
+
"node": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"title": "BasicTextModifier.type",
|
|
33
|
+
"description": "The modifier type"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"name": {
|
|
37
|
+
"required": false,
|
|
38
|
+
"node": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"title": "BasicTextModifier.name",
|
|
41
|
+
"description": "Modifiers can be named when used in strings"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"additionalProperties": {
|
|
46
|
+
"type": "unknown"
|
|
47
|
+
},
|
|
48
|
+
"title": "BasicTextModifier"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2147/execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/text/types.ts",
|
|
52
|
+
"name": "LinkModifier",
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"type": {
|
|
56
|
+
"required": true,
|
|
57
|
+
"node": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"const": "link",
|
|
60
|
+
"title": "LinkModifier.type",
|
|
61
|
+
"description": "The link type denotes this as a link"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"exp": {
|
|
65
|
+
"required": false,
|
|
66
|
+
"node": {
|
|
67
|
+
"type": "ref",
|
|
68
|
+
"ref": "Expression",
|
|
69
|
+
"title": "LinkModifier.exp",
|
|
70
|
+
"description": "An optional expression to run before the link is opened"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"metaData": {
|
|
74
|
+
"required": true,
|
|
75
|
+
"node": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"ref": {
|
|
79
|
+
"required": true,
|
|
80
|
+
"node": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"title": "LinkModifier.metaData.ref",
|
|
83
|
+
"description": "The location of the link to load"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"\"mime-type\"": {
|
|
87
|
+
"required": false,
|
|
88
|
+
"node": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"title": "LinkModifier.metaData.\"mime-type\"",
|
|
91
|
+
"description": "Used to indicate an application specific resolver to use"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"title": "LinkModifier.metaData",
|
|
97
|
+
"description": "metaData about the link's target"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"additionalProperties": false,
|
|
102
|
+
"title": "LinkModifier",
|
|
103
|
+
"description": "A modifier to turn the text into a link"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"title": "TextModifier"
|
|
107
|
+
},
|
|
108
|
+
"title": "TextAsset.modifiers",
|
|
109
|
+
"description": "Any modifiers on the text"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"additionalProperties": false,
|
|
114
|
+
"title": "TextAsset",
|
|
115
|
+
"extends": {
|
|
116
|
+
"type": "ref",
|
|
117
|
+
"ref": "Asset<\"text\">",
|
|
118
|
+
"genericArguments": [
|
|
119
|
+
{
|
|
120
|
+
"type": "string",
|
|
121
|
+
"const": "text"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const ActionAsset = require("./ActionAsset.json")
|
|
2
|
+
const InputAsset = require("./InputAsset.json")
|
|
3
|
+
const ImageAsset = require("./ImageAsset.json")
|
|
4
|
+
const TextAsset = require("./TextAsset.json")
|
|
5
|
+
const CollectionAsset = require("./CollectionAsset.json")
|
|
6
|
+
const ChoiceAsset = require("./ChoiceAsset.json")
|
|
7
|
+
const InfoAsset = require("./InfoAsset.json")
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
"pluginName": "reference-assets-transforms",
|
|
11
|
+
"capabilities": {
|
|
12
|
+
"Assets":[ActionAsset,InputAsset,ImageAsset,TextAsset,CollectionAsset,ChoiceAsset],
|
|
13
|
+
"Views":[InfoAsset],
|
|
14
|
+
},
|
|
15
|
+
"customPrimitives": [
|
|
16
|
+
"Expression","Asset","Binding","AssetWrapper","Schema.DataType","ExpressionHandler"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginName": "reference-assets-transforms",
|
|
3
|
+
"capabilities": {
|
|
4
|
+
"Assets": [
|
|
5
|
+
"ActionAsset",
|
|
6
|
+
"InputAsset",
|
|
7
|
+
"ImageAsset",
|
|
8
|
+
"TextAsset",
|
|
9
|
+
"CollectionAsset",
|
|
10
|
+
"ChoiceAsset"
|
|
11
|
+
],
|
|
12
|
+
"Views": [
|
|
13
|
+
"InfoAsset"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"customPrimitives": [
|
|
17
|
+
"Expression",
|
|
18
|
+
"Asset",
|
|
19
|
+
"Binding",
|
|
20
|
+
"AssetWrapper",
|
|
21
|
+
"Schema.DataType",
|
|
22
|
+
"ExpressionHandler"
|
|
23
|
+
]
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,68 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/reference-assets-plugin",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"registry": "https://registry.npmjs.org"
|
|
7
|
-
},
|
|
8
|
-
"peerDependencies": {
|
|
9
|
-
"@player-ui/player": "0.7.4-next.4"
|
|
10
|
-
},
|
|
3
|
+
"version": "0.7.5--canary.434.14868",
|
|
4
|
+
"main": "dist/cjs/index.cjs",
|
|
11
5
|
"dependencies": {
|
|
12
|
-
"@player-ui/
|
|
13
|
-
"@player-ui/
|
|
14
|
-
"
|
|
6
|
+
"@player-ui/asset-transform-plugin": "0.7.5--canary.434.14868",
|
|
7
|
+
"@player-ui/beacon-plugin": "0.7.5--canary.434.14868",
|
|
8
|
+
"tslib": "^2.6.2"
|
|
15
9
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"sideEffects": false,
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "https://github.com/player-ui/player-ui"
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@player-ui/asset-testing-library": "workspace:*",
|
|
12
|
+
"@player-ui/common-types-plugin": "workspace:*"
|
|
24
13
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@player-ui/player": "0.7.5--canary.434.14868"
|
|
27
16
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"name": "Harris Borawski",
|
|
40
|
-
"url": "https://github.com/hborawski"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"name": "Jeremiah Zucker",
|
|
44
|
-
"url": "https://github.com/sugarmanz"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"name": "Ketan Reddy",
|
|
48
|
-
"url": "https://github.com/KetanReddy"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": "Brocollie08",
|
|
52
|
-
"url": "https://github.com/brocollie08"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"name": "Kelly Harrop",
|
|
56
|
-
"url": "https://github.com/kharrop"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "Alejandro Fimbres",
|
|
60
|
-
"url": "https://github.com/lexfm"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"name": "Rafael Campos",
|
|
64
|
-
"url": "https://github.com/rafbcampos"
|
|
17
|
+
"module": "dist/index.legacy-esm.js",
|
|
18
|
+
"types": "types/index.d.ts",
|
|
19
|
+
"bundle": "dist/ReferenceAssetsPlugin.native.js",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"exports": {
|
|
22
|
+
"./package.json": "./package.json",
|
|
23
|
+
"./dist/index.css": "./dist/index.css",
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./types/index.d.ts",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"default": "./dist/cjs/index.cjs"
|
|
65
28
|
}
|
|
66
|
-
|
|
67
|
-
"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"src",
|
|
33
|
+
"types"
|
|
34
|
+
]
|
|
68
35
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { runTransform } from "@player-ui/asset-testing-library";
|
|
3
|
+
import type { InProgressState } from "@player-ui/player";
|
|
4
|
+
import { actionTransform } from "..";
|
|
5
|
+
|
|
6
|
+
describe("action transform", () => {
|
|
7
|
+
it("adds a run method that evals an expression", () => {
|
|
8
|
+
const ref = runTransform("action", actionTransform, {
|
|
9
|
+
type: "action",
|
|
10
|
+
exp: "{{count}} = 100",
|
|
11
|
+
id: "action",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
ref.current?.run();
|
|
15
|
+
|
|
16
|
+
expect(ref.controllers?.data.get("count")).toBe(100);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("transitions between things", async () => {
|
|
20
|
+
const ref = runTransform("action", actionTransform, {
|
|
21
|
+
id: "test-flow",
|
|
22
|
+
views: [
|
|
23
|
+
{
|
|
24
|
+
type: "action",
|
|
25
|
+
id: "view-1",
|
|
26
|
+
value: "Next",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "action",
|
|
30
|
+
id: "view-2",
|
|
31
|
+
value: "Next",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
navigation: {
|
|
35
|
+
BEGIN: "FLOW_1",
|
|
36
|
+
FLOW_1: {
|
|
37
|
+
startState: "view_1",
|
|
38
|
+
view_1: {
|
|
39
|
+
state_type: "VIEW",
|
|
40
|
+
ref: "view-1",
|
|
41
|
+
transitions: {
|
|
42
|
+
"*": "view_2",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
view_2: {
|
|
46
|
+
state_type: "VIEW",
|
|
47
|
+
ref: "view-2",
|
|
48
|
+
transitions: {
|
|
49
|
+
"*": "end",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
end: {
|
|
53
|
+
state_type: "END",
|
|
54
|
+
outcome: "done",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(ref.current?.id).toBe("view-1");
|
|
61
|
+
ref.current?.run();
|
|
62
|
+
expect(ref.current?.id).toBe("view-2");
|
|
63
|
+
ref.current?.run();
|
|
64
|
+
|
|
65
|
+
await (ref.player.getState() as InProgressState).flowResult;
|
|
66
|
+
expect(ref.player.getState().status).toBe("completed");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("prev button transitions", async () => {
|
|
70
|
+
const ref = runTransform("action", actionTransform, {
|
|
71
|
+
id: "test-flow",
|
|
72
|
+
views: [
|
|
73
|
+
{
|
|
74
|
+
type: "action",
|
|
75
|
+
id: "view-1",
|
|
76
|
+
value: "Prev",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: "action",
|
|
80
|
+
id: "view-2",
|
|
81
|
+
value: "Prev",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
navigation: {
|
|
85
|
+
BEGIN: "FLOW_1",
|
|
86
|
+
FLOW_1: {
|
|
87
|
+
startState: "view_1",
|
|
88
|
+
view_1: {
|
|
89
|
+
state_type: "VIEW",
|
|
90
|
+
ref: "view-1",
|
|
91
|
+
transitions: {
|
|
92
|
+
"*": "view_2",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
view_2: {
|
|
96
|
+
state_type: "VIEW",
|
|
97
|
+
ref: "view-2",
|
|
98
|
+
transitions: {
|
|
99
|
+
"*": "end",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
end: {
|
|
103
|
+
state_type: "END",
|
|
104
|
+
outcome: "done",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
expect(ref?.current?.metaData?.role).toBe("back");
|
|
110
|
+
expect(ref.current?.id).toBe("view-1");
|
|
111
|
+
ref.current?.run();
|
|
112
|
+
expect(ref.current?.id).toBe("view-2");
|
|
113
|
+
ref.current?.run();
|
|
114
|
+
|
|
115
|
+
await (ref.player.getState() as InProgressState).flowResult;
|
|
116
|
+
expect(ref.player.getState().status).toBe("completed");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./transform";
|
|
2
|
+
export * from "./types";
|
|
@@ -2,15 +2,15 @@ import type {
|
|
|
2
2
|
Asset,
|
|
3
3
|
TransformFunction,
|
|
4
4
|
BeforeTransformFunction,
|
|
5
|
-
} from
|
|
6
|
-
import { compose, composeBefore } from
|
|
7
|
-
import type { ActionAsset, TransformedAction } from
|
|
5
|
+
} from "@player-ui/player";
|
|
6
|
+
import { compose, composeBefore } from "@player-ui/asset-transform-plugin";
|
|
7
|
+
import type { ActionAsset, TransformedAction } from "./types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Function to find prev button
|
|
11
11
|
*/
|
|
12
12
|
export function isBackAction(action: ActionAsset): boolean {
|
|
13
|
-
return action.value ===
|
|
13
|
+
return action.value === "Prev";
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -18,7 +18,7 @@ export function isBackAction(action: ActionAsset): boolean {
|
|
|
18
18
|
*/
|
|
19
19
|
const transform: TransformFunction<ActionAsset, TransformedAction> = (
|
|
20
20
|
action,
|
|
21
|
-
options
|
|
21
|
+
options,
|
|
22
22
|
) => {
|
|
23
23
|
return {
|
|
24
24
|
...action,
|
|
@@ -39,7 +39,7 @@ const transform: TransformFunction<ActionAsset, TransformedAction> = (
|
|
|
39
39
|
* De couples back button from the back icon
|
|
40
40
|
*/
|
|
41
41
|
const backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (
|
|
42
|
-
action
|
|
42
|
+
action,
|
|
43
43
|
) => {
|
|
44
44
|
/** For previous versions of player, the back button would already have the back icon.
|
|
45
45
|
* This ensures that the old functionality does not break and back button is still visible when they update the player.
|
|
@@ -49,7 +49,7 @@ const backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (
|
|
|
49
49
|
...action,
|
|
50
50
|
metaData: {
|
|
51
51
|
...action?.metaData,
|
|
52
|
-
role:
|
|
52
|
+
role: "back",
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
}
|
|
@@ -65,7 +65,7 @@ const backIconTransform: TransformFunction<ActionAsset, ActionAsset> = (
|
|
|
65
65
|
export const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {
|
|
66
66
|
const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;
|
|
67
67
|
|
|
68
|
-
if (skipArray && skipArray.indexOf(
|
|
68
|
+
if (skipArray && skipArray.indexOf("exp") > 1) {
|
|
69
69
|
return asset;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -77,7 +77,7 @@ export const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {
|
|
|
77
77
|
...asset?.plugins?.stringResolver,
|
|
78
78
|
propertiesToSkip: [
|
|
79
79
|
...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),
|
|
80
|
-
|
|
80
|
+
"exp",
|
|
81
81
|
],
|
|
82
82
|
},
|
|
83
83
|
},
|
|
@@ -87,5 +87,5 @@ export const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {
|
|
|
87
87
|
export const actionTransform = compose(
|
|
88
88
|
transform,
|
|
89
89
|
backIconTransform,
|
|
90
|
-
composeBefore(expPropTransform)
|
|
90
|
+
composeBefore(expPropTransform),
|
|
91
91
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Asset, AssetWrapper, Expression } from
|
|
2
|
-
import type { BeaconDataType } from
|
|
1
|
+
import type { Asset, AssetWrapper, Expression } from "@player-ui/player";
|
|
2
|
+
import type { BeaconDataType } from "@player-ui/beacon-plugin";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* User actions can be represented in several places.
|
|
@@ -7,7 +7,7 @@ import type { BeaconDataType } from '@player-ui/beacon-plugin';
|
|
|
7
7
|
* In addition, several asset types can have actions that apply to that asset only.
|
|
8
8
|
*/
|
|
9
9
|
export interface ActionAsset<AnyTextAsset extends Asset = Asset>
|
|
10
|
-
extends Asset<
|
|
10
|
+
extends Asset<"action"> {
|
|
11
11
|
/** The transition value of the action in the state machine */
|
|
12
12
|
value?: string;
|
|
13
13
|
|