@devtools-ui/collection 0.4.1--canary.62.3837 → 0.4.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/README.md +86 -0
- package/package.json +8 -8
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @devtools-ui/collection
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`@devtools-ui/collection` is a component package designed to be leveraged by a [Player-UI assets plugin](https://player-ui.github.io/next/plugins).
|
|
6
|
+
|
|
7
|
+
It provides a `Collection` component that can be used to group other Player assets into a stacked layout.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
To install `@devtools-ui/collection`, you can use pnpm or yarn:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm i @devtools-ui/collection
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
yarn add @devtools-ui/collection
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
You can leverage this asset through the `@devtools-ui/plugin`:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { Collection } from "@devtools-ui/plugin";
|
|
29
|
+
|
|
30
|
+
// and use it to define your Player-UI content:
|
|
31
|
+
myFlow = {
|
|
32
|
+
id: "my_flow",
|
|
33
|
+
views: [
|
|
34
|
+
<MyView>
|
|
35
|
+
<Collection>
|
|
36
|
+
<Collection.Values>
|
|
37
|
+
<Asset type="text">
|
|
38
|
+
<property name="value">Test 1</property>
|
|
39
|
+
</Asset>
|
|
40
|
+
<Asset type="text">
|
|
41
|
+
<property name="value">Test 2</property>
|
|
42
|
+
</Asset>
|
|
43
|
+
</Collection.Values>
|
|
44
|
+
</Collection>
|
|
45
|
+
</MyView>,
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For more information on how to author Player-UI content using DSL, please check our [Player-UI docs](https://player-ui.github.io/next/dsl#tsxjsx-content-authoring-player-dsl).
|
|
51
|
+
|
|
52
|
+
Or, your can leverage this asset in your own plugin:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// AssetRegistryPlugin.ts
|
|
56
|
+
import React from "react";
|
|
57
|
+
import type { Player } from "@player-ui/player";
|
|
58
|
+
import type {
|
|
59
|
+
ExtendedPlayerPlugin,
|
|
60
|
+
ReactPlayer,
|
|
61
|
+
ReactPlayerPlugin,
|
|
62
|
+
} from "@player-ui/react";
|
|
63
|
+
import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react";
|
|
64
|
+
import { TransformsPlugin } from "./TransformPlugin";
|
|
65
|
+
import { CollectionAsset, CollectionComponent } from "@devtools-ui/collection";
|
|
66
|
+
|
|
67
|
+
export class AssetsRegistryPlugin
|
|
68
|
+
implements ReactPlayerPlugin, ExtendedPlayerPlugin<[CollectionAsset]>
|
|
69
|
+
{
|
|
70
|
+
name = "my-plugin";
|
|
71
|
+
|
|
72
|
+
applyReact(reactPlayer: ReactPlayer) {
|
|
73
|
+
reactPlayer.registerPlugin(
|
|
74
|
+
new AssetProviderPlugin([["collection", CollectionComponent]])
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
apply(player: Player) {
|
|
79
|
+
player.registerPlugin(new TransformsPlugin());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
We welcome contributions to `@devtools-ui/collection`!
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"sideEffects": false,
|
|
3
|
+
"files": [
|
|
4
|
+
"dist",
|
|
5
|
+
"src",
|
|
6
|
+
"types"
|
|
7
|
+
],
|
|
2
8
|
"name": "@devtools-ui/collection",
|
|
3
|
-
"version": "0.4.1
|
|
9
|
+
"version": "0.4.1",
|
|
4
10
|
"main": "dist/cjs/index.cjs",
|
|
5
11
|
"dependencies": {
|
|
6
|
-
"@devtools-ui/text": "0.4.1
|
|
12
|
+
"@devtools-ui/text": "0.4.1",
|
|
7
13
|
"@chakra-ui/react": "^2.8.2",
|
|
8
14
|
"@emotion/react": "^11.11.4",
|
|
9
15
|
"@emotion/styled": "^11.11.0",
|
|
@@ -15,7 +21,6 @@
|
|
|
15
21
|
},
|
|
16
22
|
"module": "dist/index.legacy-esm.js",
|
|
17
23
|
"types": "types/index.d.ts",
|
|
18
|
-
"sideEffects": false,
|
|
19
24
|
"exports": {
|
|
20
25
|
"./package.json": "./package.json",
|
|
21
26
|
"./dist/index.css": "./dist/index.css",
|
|
@@ -25,11 +30,6 @@
|
|
|
25
30
|
"default": "./dist/cjs/index.cjs"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"src",
|
|
31
|
-
"types"
|
|
32
|
-
],
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@player-ui/player": "0.15.5",
|
|
35
35
|
"@player-lang/react-dsl": "1.0.1",
|