@player-ui/reference-assets-plugin-react 0.4.0 → 0.4.1-next.1
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/index.cjs.js +140 -116
- package/dist/index.d.ts +14 -5
- package/dist/index.esm.js +140 -117
- package/dist/xlr/ActionAsset.json +126 -0
- package/dist/xlr/CollectionAsset.json +40 -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 +16 -0
- package/dist/xlr/manifest.json +22 -0
- package/package.json +14 -6
- package/src/assets/action/Action.tsx +1 -1
- package/src/assets/image/Image.tsx +18 -0
- package/src/assets/image/index.tsx +1 -0
- package/src/assets/index.tsx +1 -0
- package/src/assets/info/Info.tsx +5 -29
- package/src/plugin.tsx +21 -3
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.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/2798/execroot/player/node_modules/@player-ui/beacon-plugin/dist/index.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/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.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/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.ts",
|
|
20
|
+
"name": "TextModifier",
|
|
21
|
+
"type": "or",
|
|
22
|
+
"or": [
|
|
23
|
+
{
|
|
24
|
+
"source": "/home/circleci/.cache/bazel/_bazel_circleci/e8362d362e14c7d23506d1dfa3aea8b8/sandbox/processwrapper-sandbox/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.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/2798/execroot/player/node_modules/@player-ui/reference-assets-plugin/dist/index.d.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,16 @@
|
|
|
1
|
+
const InputAsset = require('./InputAsset.json')
|
|
2
|
+
const TextAsset = require('./TextAsset.json')
|
|
3
|
+
const ActionAsset = require('./ActionAsset.json')
|
|
4
|
+
const CollectionAsset = require('./CollectionAsset.json')
|
|
5
|
+
const InfoAsset = require('./InfoAsset.json')
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
"pluginName": "reference-assets-web-plugin",
|
|
9
|
+
"capabilities": {
|
|
10
|
+
"Assets":[InputAsset,TextAsset,ActionAsset,CollectionAsset],
|
|
11
|
+
"Views":[InfoAsset],
|
|
12
|
+
},
|
|
13
|
+
"customPrimitives": [
|
|
14
|
+
'Expression','Asset','Binding','AssetWrapper','Schema.DataType','ExpressionHandler'
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginName": "reference-assets-web-plugin",
|
|
3
|
+
"capabilities": {
|
|
4
|
+
"Assets": [
|
|
5
|
+
"InputAsset",
|
|
6
|
+
"TextAsset",
|
|
7
|
+
"ActionAsset",
|
|
8
|
+
"CollectionAsset"
|
|
9
|
+
],
|
|
10
|
+
"Views": [
|
|
11
|
+
"InfoAsset"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"customPrimitives": [
|
|
15
|
+
"Expression",
|
|
16
|
+
"Asset",
|
|
17
|
+
"Binding",
|
|
18
|
+
"AssetWrapper",
|
|
19
|
+
"Schema.DataType",
|
|
20
|
+
"ExpressionHandler"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-ui/reference-assets-plugin-react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1-next.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"@types/node": "^16.11.12",
|
|
10
|
-
"@player-ui/react": "0.4.
|
|
10
|
+
"@player-ui/react": "0.4.1-next.1"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@player-ui/reference-assets-plugin": "0.4.
|
|
14
|
-
"@player-ui/partial-match-registry": "0.4.
|
|
15
|
-
"@player-ui/asset-provider-plugin-react": "0.4.
|
|
16
|
-
"@player-ui/beacon-plugin-react": "0.4.
|
|
13
|
+
"@player-ui/reference-assets-plugin": "0.4.1-next.1",
|
|
14
|
+
"@player-ui/partial-match-registry": "0.4.1-next.1",
|
|
15
|
+
"@player-ui/asset-provider-plugin-react": "0.4.1-next.1",
|
|
16
|
+
"@player-ui/beacon-plugin-react": "0.4.1-next.1",
|
|
17
17
|
"clsx": "^1.1.1",
|
|
18
18
|
"@chakra-ui/react": "^1.7.3",
|
|
19
19
|
"@chakra-ui/icons": "^1.1.1",
|
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
{
|
|
61
61
|
"name": "Kelly Harrop",
|
|
62
62
|
"url": "https://github.com/kharrop"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "Alejandro Fimbres",
|
|
66
|
+
"url": "https://github.com/lexfm"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "Rafael Campos",
|
|
70
|
+
"url": "https://github.com/rafbcampos"
|
|
63
71
|
}
|
|
64
72
|
]
|
|
65
73
|
}
|
|
@@ -19,7 +19,7 @@ export const Action = (props: TransformedAction) => {
|
|
|
19
19
|
variant={isBackAction(props) ? 'ghost' : 'solid'}
|
|
20
20
|
{...buttonProps}
|
|
21
21
|
>
|
|
22
|
-
{
|
|
22
|
+
{props?.metaData?.role === 'back' && <ChevronLeftIcon />}
|
|
23
23
|
{label && (
|
|
24
24
|
<Text>
|
|
25
25
|
<ReactAsset {...label} />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactAsset } from '@player-ui/react';
|
|
3
|
+
import type { TransformedImage } from '@player-ui/reference-assets-plugin';
|
|
4
|
+
|
|
5
|
+
export const Image = (props: TransformedImage) => {
|
|
6
|
+
const { metaData, caption, altText } = props;
|
|
7
|
+
console.log(props);
|
|
8
|
+
return (
|
|
9
|
+
<figure className="figure">
|
|
10
|
+
<img className="figure-img img-fluid" src={metaData.ref} alt={altText} />
|
|
11
|
+
{caption && (
|
|
12
|
+
<figcaption className="figure-caption" style={{ marginTop: 15 }}>
|
|
13
|
+
<ReactAsset {...caption} />
|
|
14
|
+
</figcaption>
|
|
15
|
+
)}
|
|
16
|
+
</figure>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Image';
|
package/src/assets/index.tsx
CHANGED
package/src/assets/info/Info.tsx
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
ActionAsset,
|
|
4
|
-
InfoAsset,
|
|
5
|
-
} from '@player-ui/reference-assets-plugin';
|
|
6
|
-
import { isBackAction } from '@player-ui/reference-assets-plugin';
|
|
2
|
+
import type { InfoAssetTransform } from '@player-ui/reference-assets-plugin';
|
|
7
3
|
import { ReactAsset } from '@player-ui/react';
|
|
8
4
|
import {
|
|
9
5
|
ButtonGroup,
|
|
@@ -13,29 +9,9 @@ import {
|
|
|
13
9
|
Stack,
|
|
14
10
|
HStack,
|
|
15
11
|
} from '@chakra-ui/react';
|
|
16
|
-
import type { AssetWrapper } from '@player-ui/react';
|
|
17
12
|
|
|
18
13
|
/** The info view type is used to show information to the user */
|
|
19
|
-
export const Info = (props:
|
|
20
|
-
const segmentedActions = React.useMemo(() => {
|
|
21
|
-
if (!props.actions?.length) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return props.actions?.reduce(
|
|
26
|
-
(memo, next) => {
|
|
27
|
-
memo[isBackAction(next.asset as ActionAsset) ? 'prev' : 'next'].push(
|
|
28
|
-
next as AssetWrapper<ActionAsset>
|
|
29
|
-
);
|
|
30
|
-
return memo;
|
|
31
|
-
},
|
|
32
|
-
{ prev: [], next: [] } as {
|
|
33
|
-
prev: Array<AssetWrapper<ActionAsset>>;
|
|
34
|
-
next: Array<AssetWrapper<ActionAsset>>;
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}, [props.actions]);
|
|
38
|
-
|
|
14
|
+
export const Info = (props: InfoAssetTransform) => {
|
|
39
15
|
return (
|
|
40
16
|
<Box minW={{ base: undefined, md: 'md' }}>
|
|
41
17
|
<Stack gap="10">
|
|
@@ -51,15 +27,15 @@ export const Info = (props: InfoAsset) => {
|
|
|
51
27
|
)}
|
|
52
28
|
<Box>{props.primaryInfo && <ReactAsset {...props.primaryInfo} />}</Box>
|
|
53
29
|
<Stack gap="4">
|
|
54
|
-
{segmentedActions && <Divider />}
|
|
30
|
+
{props?.segmentedActions && <Divider />}
|
|
55
31
|
<HStack justifyContent="space-between">
|
|
56
32
|
<ButtonGroup spacing="6">
|
|
57
|
-
{segmentedActions?.prev?.map((a) => (
|
|
33
|
+
{props?.segmentedActions?.prev?.map((a) => (
|
|
58
34
|
<ReactAsset key={a.asset.id} {...a} />
|
|
59
35
|
))}
|
|
60
36
|
</ButtonGroup>
|
|
61
37
|
<ButtonGroup spacing="6">
|
|
62
|
-
{segmentedActions?.next?.map((a) => (
|
|
38
|
+
{props?.segmentedActions?.next?.map((a) => (
|
|
63
39
|
<ReactAsset key={a.asset.id} {...a} />
|
|
64
40
|
))}
|
|
65
41
|
</ButtonGroup>
|
package/src/plugin.tsx
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactPlayer, ReactPlayerPlugin } from '@player-ui/react';
|
|
3
|
-
import type { Player } from '@player-ui/player';
|
|
3
|
+
import type { Player, ExtendedPlayerPlugin } from '@player-ui/player';
|
|
4
4
|
import { AssetProviderPlugin } from '@player-ui/asset-provider-plugin-react';
|
|
5
5
|
import { ChakraProvider, useTheme } from '@chakra-ui/react';
|
|
6
|
+
import type {
|
|
7
|
+
InputAsset,
|
|
8
|
+
TextAsset,
|
|
9
|
+
CollectionAsset,
|
|
10
|
+
ActionAsset,
|
|
11
|
+
InfoAsset,
|
|
12
|
+
} from '@player-ui/reference-assets-plugin';
|
|
6
13
|
import { ReferenceAssetsPlugin as ReferenceAssetsCorePlugin } from '@player-ui/reference-assets-plugin';
|
|
7
|
-
import { Input, Text, Collection, Action, Info } from './assets';
|
|
14
|
+
import { Input, Text, Collection, Action, Info, Image } from './assets';
|
|
8
15
|
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
9
19
|
const OptionalChakraThemeProvider = (
|
|
10
20
|
props: React.PropsWithChildren<unknown>
|
|
11
21
|
) => {
|
|
@@ -22,7 +32,14 @@ const OptionalChakraThemeProvider = (
|
|
|
22
32
|
/**
|
|
23
33
|
* A plugin to register the base reference assets
|
|
24
34
|
*/
|
|
25
|
-
export class ReferenceAssetsPlugin
|
|
35
|
+
export class ReferenceAssetsPlugin
|
|
36
|
+
implements
|
|
37
|
+
ReactPlayerPlugin,
|
|
38
|
+
ExtendedPlayerPlugin<
|
|
39
|
+
[InputAsset, TextAsset, ActionAsset, CollectionAsset],
|
|
40
|
+
[InfoAsset]
|
|
41
|
+
>
|
|
42
|
+
{
|
|
26
43
|
name = 'reference-assets-web-plugin';
|
|
27
44
|
|
|
28
45
|
applyReact(reactPlayer: ReactPlayer) {
|
|
@@ -33,6 +50,7 @@ export class ReferenceAssetsPlugin implements ReactPlayerPlugin {
|
|
|
33
50
|
['action', Action],
|
|
34
51
|
['info', Info],
|
|
35
52
|
['collection', Collection],
|
|
53
|
+
['image', Image],
|
|
36
54
|
])
|
|
37
55
|
);
|
|
38
56
|
|