@devtools-ui/code-editor 0.4.0 → 0.4.1--canary.62.3837
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/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 +6 -6
- 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/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 ],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AAC,CAAC;AAC1D,gBAAQ,SAAS,MAAM,GAAG;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;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,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\",\n ],\n },\n },\n };\n};\n\nexport const codeEditorTransform = compose(\n transform,\n composeBefore(expPropTransform)\n);\n"],"mappings":";AACA,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,SAAS,YAAY;AAErB,IAAM,aAAa,CAAC,KAAK,CAAC;AAEnB,IAAM,sBAAsB,CAAC,UAAiC;AACnE,QAAM,EAAE,MAAM,IAAI,IAAI;AAEtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,WAAU;AAAA,MACV,OAAM;AAAA,MACN,UAAU;AAAA,MACV;AAAA;AAAA,EACF;AAEJ;;;ACnBA,OAAOA,YAAW;AAClB;AAAA,EAEE;AAAA,OAGK;AAOA,IAAM,aAAa,CACxB,UASG;AACH,QAAM,EAAE,KAAK,SAAS,GAAG,KAAK,IAAI;AAElC,SACE,gBAAAA,OAAA,cAAC,SAAM,MAAK,eAAe,GAAG,QAC5B,gBAAAA,OAAA,cAAC,cAAS,MAAK,aAAW,QAAQ,QAAQ,CAAE,GAC5C,gBAAAA,OAAA,cAAC,cAAS,MAAK,SAAO,IAAI,QAAQ,CAAE,CACtC;AAEJ;;;AC1BA,SAAS,SAAS,qBAAqB;AAMhC,IAAM,YAGT,CAAC,OAAO,YAAY;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MACE,MAAM,YAAY,SACd,KACA,KAAK;AAAA,MACH,QAAQ,KAAK,MAAM,IAAI,MAAM,SAAS;AAAA,QACpC,gBAAgB;AAAA,QAChB,WAAW;AAAA,MACb,CAAC;AAAA,MACD;AAAA,MACA;AAAA,IACF;AAAA,IACN,IAAI,MAAe;AACjB,UAAI,MAAM,KAAK;AAEb,cAAM,uBAAuB,MAAM,IAAI,MAAM,iBAAiB;AAG9D,gCACE,QAAQ,KAAK,MAAM,IAAI,CAAC,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC,CAAC;AAC1D,gBAAQ,SAAS,MAAM,GAAG;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devtools-ui/code-editor",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1--canary.62.3837",
|
|
4
4
|
"main": "dist/cjs/index.cjs",
|
|
5
5
|
"module": "dist/index.legacy-esm.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -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
|