-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
136a3c7
commit 2cfe251
Showing
32 changed files
with
1,429 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# @devtools-ui/action | ||
|
||
## Overview | ||
|
||
`@devtools-ui/action` is a component package designed to be leveraged by a [Player-UI assets plugin](https://player-ui.github.io/next/plugins). | ||
|
||
It provides a `Action` component that can be used to allow a user interaction (e.g., [transition](https://player-ui.github.io/next/content/navigation)), usually rendered as a `<button>`. | ||
|
||
## Installation | ||
|
||
To install `@devtools-ui/action`, you can use pnpm or yarn: | ||
|
||
```sh | ||
pnpm i @devtools-ui/action | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
yarn add @devtools-ui/action | ||
``` | ||
|
||
## Usage | ||
|
||
You can leverage this asset through the `@devtools-ui/plugin`: | ||
|
||
```ts | ||
import { Action } from "@devtools-ui/plugin"; | ||
|
||
// and use it to define your Player-UI content: | ||
myFlow = { | ||
id: "my_flow", | ||
views: [ | ||
<MyView> | ||
<MyView.Actions> | ||
<Action exp={e`noop`}> | ||
<Action.Label>Label</Action.Label> | ||
<Action.Icon> | ||
<Asset type="icon"> | ||
<property name="value">SomeIcon</property> | ||
</Asset> | ||
</Action.Icon> | ||
</Action> | ||
</MyView.Actions> | ||
</MyView>, | ||
], | ||
}; | ||
``` | ||
|
||
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). | ||
|
||
Or, your can leverage this asset in your own plugin: | ||
|
||
```ts | ||
// TransformPlugin.ts | ||
import type { Player, PlayerPlugin } from "@player-ui/player"; | ||
import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin"; | ||
import { actionTransform } from "@devtools-ui/action"; | ||
|
||
export class TransformsPlugin implements PlayerPlugin { | ||
name = "my-plugin-transforms"; | ||
|
||
apply(player: Player) { | ||
player.registerPlugin( | ||
new AssetTransformPlugin([[{ type: "action" }, actionTransform]]) | ||
); | ||
} | ||
} | ||
``` | ||
|
||
```ts | ||
// AssetRegistryPlugin.ts | ||
import React from "react"; | ||
import type { Player } from "@player-ui/player"; | ||
import type { | ||
ExtendedPlayerPlugin, | ||
ReactPlayer, | ||
ReactPlayerPlugin, | ||
} from "@player-ui/react"; | ||
import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react"; | ||
import { TransformsPlugin } from "./TransformPlugin"; | ||
import { ActionAsset, ActionComponent } from "@devtools-ui/action"; | ||
|
||
export class AssetsRegistryPlugin | ||
implements ReactPlayerPlugin, ExtendedPlayerPlugin<[ActionAsset]> | ||
{ | ||
name = "my-plugin"; | ||
|
||
applyReact(reactPlayer: ReactPlayer) { | ||
reactPlayer.registerPlugin( | ||
new AssetProviderPlugin([["action", ActionComponent]]) | ||
); | ||
} | ||
|
||
apply(player: Player) { | ||
player.registerPlugin(new TransformsPlugin()); | ||
} | ||
} | ||
``` | ||
|
||
## Contributing | ||
|
||
We welcome contributions to `@devtools-ui/action`! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# @devtools-ui/collection | ||
|
||
## Overview | ||
|
||
`@devtools-ui/collection` is a component package designed to be leveraged by a [Player-UI assets plugin](https://player-ui.github.io/next/plugins). | ||
|
||
It provides a `Collection` component that can be used to group other Player assets into a stacked layout. | ||
|
||
## Installation | ||
|
||
To install `@devtools-ui/collection`, you can use pnpm or yarn: | ||
|
||
```sh | ||
pnpm i @devtools-ui/collection | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
yarn add @devtools-ui/collection | ||
``` | ||
|
||
## Usage | ||
|
||
You can leverage this asset through the `@devtools-ui/plugin`: | ||
|
||
```ts | ||
import { Collection } from "@devtools-ui/plugin"; | ||
|
||
// and use it to define your Player-UI content: | ||
myFlow = { | ||
id: "my_flow", | ||
views: [ | ||
<MyView> | ||
<Collection> | ||
<Collection.Values> | ||
<Asset type="text"> | ||
<property name="value">Test 1</property> | ||
</Asset> | ||
<Asset type="text"> | ||
<property name="value">Test 2</property> | ||
</Asset> | ||
</Collection.Values> | ||
</Collection> | ||
</MyView>, | ||
], | ||
}; | ||
``` | ||
|
||
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). | ||
|
||
Or, your can leverage this asset in your own plugin: | ||
|
||
```ts | ||
// AssetRegistryPlugin.ts | ||
import React from "react"; | ||
import type { Player } from "@player-ui/player"; | ||
import type { | ||
ExtendedPlayerPlugin, | ||
ReactPlayer, | ||
ReactPlayerPlugin, | ||
} from "@player-ui/react"; | ||
import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react"; | ||
import { TransformsPlugin } from "./TransformPlugin"; | ||
import { CollectionAsset, CollectionComponent } from "@devtools-ui/collection"; | ||
|
||
export class AssetsRegistryPlugin | ||
implements ReactPlayerPlugin, ExtendedPlayerPlugin<[CollectionAsset]> | ||
{ | ||
name = "my-plugin"; | ||
|
||
applyReact(reactPlayer: ReactPlayer) { | ||
reactPlayer.registerPlugin( | ||
new AssetProviderPlugin([["collection", CollectionComponent]]) | ||
); | ||
} | ||
|
||
apply(player: Player) { | ||
player.registerPlugin(new TransformsPlugin()); | ||
} | ||
} | ||
``` | ||
|
||
## Contributing | ||
|
||
We welcome contributions to `@devtools-ui/collection`! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Canvas, Meta } from '@storybook/blocks'; | ||
import * as CollectionStories from "./Collection.stories"; | ||
|
||
<Meta of={CollectionStories} /> | ||
|
||
# Collection Asset | ||
|
||
> type: `collection` | ||
It provides a `Collection` component that can be used to group other Player assets into a stacked layout. | ||
|
||
## DSL Properties | ||
|
||
| Property | Type | Required | Description | | ||
| --- | --- | --- | --- | | ||
| `values` | `Array<AssetWrapper>` | false | list of assets in the collection | | ||
|
||
## Basic Use Case | ||
|
||
<Canvas of={CollectionStories.Basic} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Canvas, Meta } from '@storybook/blocks'; | ||
import * as InputStories from "./Input.stories"; | ||
|
||
<Meta of={InputStories} /> | ||
|
||
# Input Asset | ||
|
||
> type: `input` | ||
It provides an `Input` component that can be used to acquire data from the user. | ||
|
||
## DSL Properties | ||
|
||
| Property | Type | Required | Description | | ||
| --- | --- | --- | --- | | ||
| `binding` | `string` | false | The location in the data-model to store the data | | ||
| `label` | `AssetWrapper<TextAsset>` | false | A text asset for the action's label | | ||
| `note` | `AssetWrapper<TextAsset>` | false | Asset container for a note | | ||
| `size` | `"xs" | "sm" | "md" | "lg"` | false | Size of the Input height | | ||
| `placeholder` | `string` | false | A text asset for the input's placeholder | | ||
| `maxLength` | `number` | false | Max character length in the Input | | ||
|
||
## Basic Use Case | ||
|
||
<Canvas of={InputStories.Basic} /> |
Oops, something went wrong.