@devtools-ui/code-editor 0.4.0 → 0.4.1-next.0
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 +92 -0
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/dsl/__tests__/index.test.tsx +1 -1
- package/src/dsl/index.tsx +1 -1
- package/types/dsl/index.d.ts +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @devtools-ui/code-editor
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`@devtools-ui/code-editor` 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 `CodeEditor` component that can be used to edit JSON content and call an expression on changes.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
To install `@devtools-ui/code-editor`, you can use pnpm or yarn:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm i @devtools-ui/code-editor
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
yarn add @devtools-ui/code-editor
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
You can leverage this asset through the `@devtools-ui/plugin`:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { CodeEditor } from "@devtools-ui/plugin";
|
|
29
|
+
|
|
30
|
+
// and use it to define your Player-UI content:
|
|
31
|
+
myFlow = {
|
|
32
|
+
id: "my_flow",
|
|
33
|
+
views: [<CodeEditor />],
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
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).
|
|
38
|
+
|
|
39
|
+
Or, your can leverage this asset in your own plugin:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// TransformPlugin.ts
|
|
43
|
+
import type { Player, PlayerPlugin } from "@player-ui/player";
|
|
44
|
+
import { AssetTransformPlugin } from "@player-ui/asset-transform-plugin";
|
|
45
|
+
import { code-editorTransform } from "@devtools-ui/code-editor";
|
|
46
|
+
|
|
47
|
+
export class TransformsPlugin implements PlayerPlugin {
|
|
48
|
+
name = "my-plugin-transforms";
|
|
49
|
+
|
|
50
|
+
apply(player: Player) {
|
|
51
|
+
player.registerPlugin(
|
|
52
|
+
new AssetTransformPlugin([
|
|
53
|
+
[{ type: "code-editor" }, code-editorTransform],
|
|
54
|
+
])
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// AssetRegistryPlugin.ts
|
|
62
|
+
import React from "react";
|
|
63
|
+
import type { Player } from "@player-ui/player";
|
|
64
|
+
import type {
|
|
65
|
+
ExtendedPlayerPlugin,
|
|
66
|
+
ReactPlayer,
|
|
67
|
+
ReactPlayerPlugin,
|
|
68
|
+
} from "@player-ui/react";
|
|
69
|
+
import { AssetProviderPlugin } from "@player-ui/asset-provider-plugin-react";
|
|
70
|
+
import { TransformsPlugin } from "./TransformPlugin";
|
|
71
|
+
import { CodeEditorAsset, CodeEditorComponent } from "@devtools-ui/code-editor";
|
|
72
|
+
|
|
73
|
+
export class AssetsRegistryPlugin
|
|
74
|
+
implements ReactPlayerPlugin, ExtendedPlayerPlugin<[CodeEditorAsset]>
|
|
75
|
+
{
|
|
76
|
+
name = "my-plugin";
|
|
77
|
+
|
|
78
|
+
applyReact(reactPlayer: ReactPlayer) {
|
|
79
|
+
reactPlayer.registerPlugin(
|
|
80
|
+
new AssetProviderPlugin([["code-editor", CodeEditorComponent]])
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
apply(player: Player) {
|
|
85
|
+
player.registerPlugin(new TransformsPlugin());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Contributing
|
|
91
|
+
|
|
92
|
+
We welcome contributions to `@devtools-ui/code-editor`!
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -59,10 +59,10 @@ var CodeEditorComponent = (props) => {
|
|
|
59
59
|
|
|
60
60
|
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/dsl/index.tsx
|
|
61
61
|
var import_react2 = __toESM(require("react"));
|
|
62
|
-
var
|
|
62
|
+
var import_react_dsl = require("@player-lang/react-dsl");
|
|
63
63
|
var CodeEditor = (props) => {
|
|
64
64
|
const { exp, binding, ...rest } = props;
|
|
65
|
-
return /* @__PURE__ */ import_react2.default.createElement(
|
|
65
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react_dsl.Asset, { type: "code-editor", ...rest }, /* @__PURE__ */ import_react2.default.createElement("property", { name: "binding" }, binding.toValue()), /* @__PURE__ */ import_react2.default.createElement("property", { name: "exp" }, exp.toValue()));
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
// ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/transform/index.ts
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/component/index.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/dsl/index.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/transform/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./component\";\nexport * from \"./dsl\";\nexport * from \"./transform\";\n","import type { TransformedCodeEditor } from \"../types\";\nimport React from \"react\";\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\n\nconst extensions = [json()];\n\nexport const CodeEditorComponent = (props: TransformedCodeEditor) => {\n const { code, run } = props;\n\n return (\n <CodeMirror\n value={code}\n minHeight=\"300px\"\n theme=\"dark\"\n onChange={run}\n extensions={extensions}\n />\n );\n};\n","import React from \"react\";\nimport {\n AssetPropsWithChildren,\n Asset,\n BindingTemplateInstance,\n ExpressionTemplateInstance,\n} from \"@player-
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/component/index.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/dsl/index.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/transform/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./component\";\nexport * from \"./dsl\";\nexport * from \"./transform\";\n","import type { TransformedCodeEditor } from \"../types\";\nimport React from \"react\";\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\n\nconst extensions = [json()];\n\nexport const CodeEditorComponent = (props: TransformedCodeEditor) => {\n const { code, run } = props;\n\n return (\n <CodeMirror\n value={code}\n minHeight=\"300px\"\n theme=\"dark\"\n onChange={run}\n extensions={extensions}\n />\n );\n};\n","import React from \"react\";\nimport {\n AssetPropsWithChildren,\n Asset,\n BindingTemplateInstance,\n ExpressionTemplateInstance,\n} from \"@player-lang/react-dsl\";\nimport type { CodeEditorAsset } from \"../types\";\n\n/**\n * Defines the component DSL representation, so users of this plugin can author Player-UI\n * content leveraging .jsx/.tsx syntax.\n */\nexport const CodeEditor = (\n props: Omit<\n AssetPropsWithChildren<CodeEditorAsset>,\n \"binding\" | \"expression\"\n > & {\n /** The binding */\n binding: BindingTemplateInstance;\n /** Expression as template string */\n exp: ExpressionTemplateInstance;\n }\n) => {\n const { exp, binding, ...rest } = props;\n\n return (\n <Asset type=\"code-editor\" {...rest}>\n <property name=\"binding\">{binding.toValue()}</property>\n <property name=\"exp\">{exp.toValue()}</property>\n </Asset>\n );\n};\n","import type {\n Asset,\n BeforeTransformFunction,\n TransformFunction,\n} from \"@player-ui/player\";\nimport type { CodeEditorAsset, TransformedCodeEditor } from \"../types\";\nimport { compose, composeBefore } from \"@player-ui/asset-transform-plugin\";\n\n/**\n * Platform-agnostic transform function that takes the properties we get from the Player Content (DSL > JSON)\n * and embeds Player state and methods:\n */\nexport const transform: TransformFunction<\n CodeEditorAsset,\n TransformedCodeEditor\n> = (asset, options) => {\n return {\n ...asset,\n code:\n asset.binding === undefined\n ? \"\"\n : JSON.stringify(\n options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: false,\n }),\n null,\n 2\n ),\n run(code?: string) {\n if (asset.exp) {\n // get the referenced expression property holder from the expression\n const referencedExpression = asset.exp.match(/{{\\s*(.*?)\\s*}}/);\n // set the referenced expression property to the new expression\n // so it is available to the asset.exp\n referencedExpression &&\n options.data.model.set([[referencedExpression[1], code]]);\n options.evaluate(asset.exp);\n }\n },\n };\n};\n\n/**\n * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist\n */\nexport const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {\n const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;\n\n if (skipArray && skipArray.indexOf(\"exp\") > 1) {\n return asset;\n }\n\n return {\n ...asset,\n plugins: {\n ...asset.plugins,\n stringResolver: {\n ...asset?.plugins?.stringResolver,\n propertiesToSkip: [\n ...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),\n \"exp\",\n ],\n },\n },\n };\n};\n\nexport const codeEditorTransform = compose(\n transform,\n composeBefore(expPropTransform)\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA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QAAM,YAAY,MAAM,SAAS,gBAAgB;AAEjD,MAAI,aAAa,UAAU,QAAQ,KAAK,IAAI,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,MAAM;AAAA,MACT,gBAAgB;AAAA,QACd,GAAG,OAAO,SAAS;AAAA,QACnB,kBAAkB;AAAA,UAChB,GAAI,MAAM,SAAS,gBAAgB,oBAAoB,CAAC;AAAA,UACxD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,0BAAsB;AAAA,EACjC;AAAA,MACA,6CAAc,gBAAgB;AAChC;","names":["React","CodeMirror","import_react","React"]}
|
package/dist/index.legacy-esm.js
CHANGED
|
@@ -21,7 +21,7 @@ var CodeEditorComponent = (props) => {
|
|
|
21
21
|
import React2 from "react";
|
|
22
22
|
import {
|
|
23
23
|
Asset
|
|
24
|
-
} from "@player-
|
|
24
|
+
} from "@player-lang/react-dsl";
|
|
25
25
|
var CodeEditor = (props) => {
|
|
26
26
|
const { exp, binding, ...rest } = props;
|
|
27
27
|
return /* @__PURE__ */ React2.createElement(Asset, { type: "code-editor", ...rest }, /* @__PURE__ */ React2.createElement("property", { name: "binding" }, binding.toValue()), /* @__PURE__ */ React2.createElement("property", { name: "exp" }, exp.toValue()));
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ var CodeEditorComponent = (props) => {
|
|
|
21
21
|
import React2 from "react";
|
|
22
22
|
import {
|
|
23
23
|
Asset
|
|
24
|
-
} from "@player-
|
|
24
|
+
} from "@player-lang/react-dsl";
|
|
25
25
|
var CodeEditor = (props) => {
|
|
26
26
|
const { exp, binding, ...rest } = props;
|
|
27
27
|
return /* @__PURE__ */ React2.createElement(Asset, { type: "code-editor", ...rest }, /* @__PURE__ */ React2.createElement("property", { name: "binding" }, binding.toValue()), /* @__PURE__ */ React2.createElement("property", { name: "exp" }, exp.toValue()));
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/component/index.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/dsl/index.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/transform/index.ts"],"sourcesContent":["import type { TransformedCodeEditor } from \"../types\";\nimport React from \"react\";\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\n\nconst extensions = [json()];\n\nexport const CodeEditorComponent = (props: TransformedCodeEditor) => {\n const { code, run } = props;\n\n return (\n <CodeMirror\n value={code}\n minHeight=\"300px\"\n theme=\"dark\"\n onChange={run}\n extensions={extensions}\n />\n );\n};\n","import React from \"react\";\nimport {\n AssetPropsWithChildren,\n Asset,\n BindingTemplateInstance,\n ExpressionTemplateInstance,\n} from \"@player-
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/component/index.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/dsl/index.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/code-editor/src/transform/index.ts"],"sourcesContent":["import type { TransformedCodeEditor } from \"../types\";\nimport React from \"react\";\nimport CodeMirror from \"@uiw/react-codemirror\";\nimport { json } from \"@codemirror/lang-json\";\n\nconst extensions = [json()];\n\nexport const CodeEditorComponent = (props: TransformedCodeEditor) => {\n const { code, run } = props;\n\n return (\n <CodeMirror\n value={code}\n minHeight=\"300px\"\n theme=\"dark\"\n onChange={run}\n extensions={extensions}\n />\n );\n};\n","import React from \"react\";\nimport {\n AssetPropsWithChildren,\n Asset,\n BindingTemplateInstance,\n ExpressionTemplateInstance,\n} from \"@player-lang/react-dsl\";\nimport type { CodeEditorAsset } from \"../types\";\n\n/**\n * Defines the component DSL representation, so users of this plugin can author Player-UI\n * content leveraging .jsx/.tsx syntax.\n */\nexport const CodeEditor = (\n props: Omit<\n AssetPropsWithChildren<CodeEditorAsset>,\n \"binding\" | \"expression\"\n > & {\n /** The binding */\n binding: BindingTemplateInstance;\n /** Expression as template string */\n exp: ExpressionTemplateInstance;\n }\n) => {\n const { exp, binding, ...rest } = props;\n\n return (\n <Asset type=\"code-editor\" {...rest}>\n <property name=\"binding\">{binding.toValue()}</property>\n <property name=\"exp\">{exp.toValue()}</property>\n </Asset>\n );\n};\n","import type {\n Asset,\n BeforeTransformFunction,\n TransformFunction,\n} from \"@player-ui/player\";\nimport type { CodeEditorAsset, TransformedCodeEditor } from \"../types\";\nimport { compose, composeBefore } from \"@player-ui/asset-transform-plugin\";\n\n/**\n * Platform-agnostic transform function that takes the properties we get from the Player Content (DSL > JSON)\n * and embeds Player state and methods:\n */\nexport const transform: TransformFunction<\n CodeEditorAsset,\n TransformedCodeEditor\n> = (asset, options) => {\n return {\n ...asset,\n code:\n asset.binding === undefined\n ? \"\"\n : JSON.stringify(\n options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: false,\n }),\n null,\n 2\n ),\n run(code?: string) {\n if (asset.exp) {\n // get the referenced expression property holder from the expression\n const referencedExpression = asset.exp.match(/{{\\s*(.*?)\\s*}}/);\n // set the referenced expression property to the new expression\n // so it is available to the asset.exp\n referencedExpression &&\n options.data.model.set([[referencedExpression[1], code]]);\n options.evaluate(asset.exp);\n }\n },\n };\n};\n\n/**\n * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist\n */\nexport const expPropTransform: BeforeTransformFunction<Asset> = (asset) => {\n const skipArray = asset.plugins?.stringResolver?.propertiesToSkip;\n\n if (skipArray && skipArray.indexOf(\"exp\") > 1) {\n return asset;\n }\n\n return {\n ...asset,\n plugins: {\n ...asset.plugins,\n stringResolver: {\n ...asset?.plugins?.stringResolver,\n propertiesToSkip: [\n ...(asset.plugins?.stringResolver?.propertiesToSkip ?? []),\n \"exp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F;AACF;AAKO,IAAM,mBAAmD,CAAC,UAAU;AACzE,QAAM,YAAY,MAAM,SAAS,gBAAgB;AAEjD,MAAI,aAAa,UAAU,QAAQ,KAAK,IAAI,GAAG;AAC7C,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,MAAM;AAAA,MACT,gBAAgB;AAAA,QACd,GAAG,OAAO,SAAS;AAAA,QACnB,kBAAkB;AAAA,UAChB,GAAI,MAAM,SAAS,gBAAgB,oBAAoB,CAAC;AAAA,UACxD;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA,cAAc,gBAAgB;AAChC;","names":["React"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"sideEffects": false,
|
|
3
|
+
"files": [
|
|
4
|
+
"dist",
|
|
5
|
+
"src",
|
|
6
|
+
"types"
|
|
7
|
+
],
|
|
2
8
|
"name": "@devtools-ui/code-editor",
|
|
3
|
-
"version": "0.4.0",
|
|
9
|
+
"version": "0.4.1-next.0",
|
|
4
10
|
"main": "dist/cjs/index.cjs",
|
|
5
11
|
"module": "dist/index.legacy-esm.js",
|
|
6
12
|
"types": "types/index.d.ts",
|
|
7
|
-
"sideEffects": false,
|
|
8
13
|
"exports": {
|
|
9
14
|
"./package.json": "./package.json",
|
|
10
15
|
"./dist/index.css": "./dist/index.css",
|
|
@@ -14,11 +19,6 @@
|
|
|
14
19
|
"default": "./dist/cjs/index.cjs"
|
|
15
20
|
}
|
|
16
21
|
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist",
|
|
19
|
-
"src",
|
|
20
|
-
"types"
|
|
21
|
-
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@chakra-ui/react": "^2.8.2",
|
|
24
24
|
"@codemirror/lang-json": "^6.0.1",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"tslib": "^2.6.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@player-
|
|
37
|
-
"@player-ui/asset-transform-plugin": "0.
|
|
38
|
-
"@player-ui/player": "0.
|
|
39
|
-
"@player-ui/react": "0.
|
|
40
|
-
"@player-ui/types": "0.
|
|
36
|
+
"@player-lang/react-dsl": "1.0.1",
|
|
37
|
+
"@player-ui/asset-transform-plugin": "0.15.5",
|
|
38
|
+
"@player-ui/player": "0.15.5",
|
|
39
|
+
"@player-ui/react": "0.15.5",
|
|
40
|
+
"@player-ui/types": "0.15.5"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { render, expression as e, binding as b } from "@player-
|
|
3
|
+
import { render, expression as e, binding as b } from "@player-lang/react-dsl";
|
|
4
4
|
import { CodeEditor } from "../";
|
|
5
5
|
|
|
6
6
|
describe("DSL: CodeEditor", () => {
|
package/src/dsl/index.tsx
CHANGED
package/types/dsl/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AssetPropsWithChildren, BindingTemplateInstance, ExpressionTemplateInstance } from "@player-
|
|
2
|
+
import { AssetPropsWithChildren, BindingTemplateInstance, ExpressionTemplateInstance } from "@player-lang/react-dsl";
|
|
3
3
|
import type { CodeEditorAsset } from "../types";
|
|
4
4
|
/**
|
|
5
5
|
* Defines the component DSL representation, so users of this plugin can author Player-UI
|