@devtools-ui/navigation 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 +99 -0
- package/package.json +9 -9
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @devtools-ui/navigation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`@devtools-ui/navigation` 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 `Navigation` component that can be used to group actions in a row.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
To install `@devtools-ui/navigation`, you can use pnpm or yarn:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm i @devtools-ui/navigation
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
yarn add @devtools-ui/navigation
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
You can leverage this asset through the `@devtools-ui/plugin`:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { Navigation } 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
|
+
<Navigation>
|
|
36
|
+
<Navigation.Values>
|
|
37
|
+
<Asset type="action" />
|
|
38
|
+
<Asset type="action" />
|
|
39
|
+
</Navigation.Values>
|
|
40
|
+
</Navigation>
|
|
41
|
+
</MyView>,
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
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).
|
|
47
|
+
|
|
48
|
+
Or, your can leverage this asset in your own plugin:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// TransformPlugin.ts
|
|
52
|
+
import type { Player, PlayerPlugin } from "@player-ui/player";
|
|
53
|
+
import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin";
|
|
54
|
+
import { navigationTransform } from "@devtools-ui/navigation";
|
|
55
|
+
|
|
56
|
+
export class TransformsPlugin implements PlayerPlugin {
|
|
57
|
+
name = "my-plugin-transforms";
|
|
58
|
+
|
|
59
|
+
apply(player: Player) {
|
|
60
|
+
player.registerPlugin(
|
|
61
|
+
new AssetTransformPlugin([[{ type: "navigation" }, navigationTransform]])
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
// AssetRegistryPlugin.ts
|
|
69
|
+
import React from "react";
|
|
70
|
+
import type { Player } from "@player-ui/player";
|
|
71
|
+
import type {
|
|
72
|
+
ExtendedPlayerPlugin,
|
|
73
|
+
ReactPlayer,
|
|
74
|
+
ReactPlayerPlugin,
|
|
75
|
+
} from "@player-ui/react";
|
|
76
|
+
import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react";
|
|
77
|
+
import { TransformsPlugin } from "./TransformPlugin";
|
|
78
|
+
import { NavigationAsset, NavigationComponent } from "@devtools-ui/navigation";
|
|
79
|
+
|
|
80
|
+
export class AssetsRegistryPlugin
|
|
81
|
+
implements ReactPlayerPlugin, ExtendedPlayerPlugin<[NavigationAsset]>
|
|
82
|
+
{
|
|
83
|
+
name = "my-plugin";
|
|
84
|
+
|
|
85
|
+
applyReact(reactPlayer: ReactPlayer) {
|
|
86
|
+
reactPlayer.registerPlugin(
|
|
87
|
+
new AssetProviderPlugin([["navigation", NavigationComponent]])
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
apply(player: Player) {
|
|
92
|
+
player.registerPlugin(new TransformsPlugin());
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Contributing
|
|
98
|
+
|
|
99
|
+
We welcome contributions to `@devtools-ui/navigation`!
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
+
"sideEffects": false,
|
|
3
|
+
"files": [
|
|
4
|
+
"dist",
|
|
5
|
+
"src",
|
|
6
|
+
"types"
|
|
7
|
+
],
|
|
2
8
|
"name": "@devtools-ui/navigation",
|
|
3
|
-
"version": "0.4.1
|
|
9
|
+
"version": "0.4.1",
|
|
4
10
|
"main": "dist/cjs/index.cjs",
|
|
5
11
|
"dependencies": {
|
|
6
|
-
"@devtools-ui/collection": "0.4.1
|
|
7
|
-
"@devtools-ui/text": "0.4.1
|
|
12
|
+
"@devtools-ui/collection": "0.4.1",
|
|
13
|
+
"@devtools-ui/text": "0.4.1",
|
|
8
14
|
"@chakra-ui/react": "^2.8.2",
|
|
9
15
|
"@emotion/react": "^11.11.4",
|
|
10
16
|
"@emotion/styled": "^11.11.0",
|
|
@@ -16,7 +22,6 @@
|
|
|
16
22
|
},
|
|
17
23
|
"module": "dist/index.legacy-esm.js",
|
|
18
24
|
"types": "types/index.d.ts",
|
|
19
|
-
"sideEffects": false,
|
|
20
25
|
"exports": {
|
|
21
26
|
"./package.json": "./package.json",
|
|
22
27
|
"./dist/index.css": "./dist/index.css",
|
|
@@ -26,11 +31,6 @@
|
|
|
26
31
|
"default": "./dist/cjs/index.cjs"
|
|
27
32
|
}
|
|
28
33
|
},
|
|
29
|
-
"files": [
|
|
30
|
-
"dist",
|
|
31
|
-
"src",
|
|
32
|
-
"types"
|
|
33
|
-
],
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@player-lang/react-dsl": "1.0.1",
|
|
36
36
|
"@player-ui/types": "0.15.5",
|