@devtools-ui/object-inspector 0.0.2--canary.11.588

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.
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ ObjectInspector: () => ObjectInspector,
34
+ ObjectInspectorComponent: () => ObjectInspectorComponent,
35
+ objectInspectorTransform: () => objectInspectorTransform
36
+ });
37
+ module.exports = __toCommonJS(src_exports);
38
+
39
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/components/ObjectInspectorComponent.tsx
40
+ var import_react = __toESM(require("react"));
41
+ var import_react2 = require("@chakra-ui/react");
42
+ var import_object_inspector = require("@devtools-ds/object-inspector");
43
+ var import_react3 = require("@player-ui/react");
44
+ var ObjectInspectorComponent = (props) => {
45
+ const { data, label, id } = props;
46
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, label && /* @__PURE__ */ import_react.default.createElement(import_react3.ReactAsset, { ...label }), data ? /* @__PURE__ */ import_react.default.createElement(
47
+ import_object_inspector.ObjectInspector,
48
+ {
49
+ data,
50
+ includePrototypes: false,
51
+ expandLevel: 7,
52
+ id
53
+ }
54
+ ) : /* @__PURE__ */ import_react.default.createElement(import_react2.Text, null, "No data available"));
55
+ };
56
+
57
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/dsl/ObjectInspector.tsx
58
+ var import_react4 = __toESM(require("react"));
59
+ var import_dsl = require("@player-tools/dsl");
60
+ var import_text = require("@devtools-ui/text");
61
+ var import_collection = require("@devtools-ui/collection");
62
+ var ObjectInspector = (props) => {
63
+ const { children, binding, ...rest } = props;
64
+ return /* @__PURE__ */ import_react4.default.createElement(import_dsl.Asset, { type: "object-inspector", ...rest }, binding && /* @__PURE__ */ import_react4.default.createElement("property", { name: "binding" }, binding.toValue()), children);
65
+ };
66
+ var CollectionComp = (props) => {
67
+ return /* @__PURE__ */ import_react4.default.createElement(import_collection.Collection, null, /* @__PURE__ */ import_react4.default.createElement(import_collection.Collection.Values, null, props.children));
68
+ };
69
+ ObjectInspector.Label = (0, import_dsl.createSlot)({
70
+ name: "label",
71
+ TextComp: import_text.Text,
72
+ CollectionComp,
73
+ isArray: false,
74
+ wrapInAsset: true
75
+ });
76
+
77
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/transformer/index.ts
78
+ var objectInspectorTransform = (asset, options) => {
79
+ return {
80
+ ...asset,
81
+ data: asset.binding === void 0 ? void 0 : options.data.model.get(asset.binding, {
82
+ includeInvalid: true,
83
+ formatted: false
84
+ })
85
+ };
86
+ };
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ ObjectInspector,
90
+ ObjectInspectorComponent,
91
+ objectInspectorTransform
92
+ });
93
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/components/ObjectInspectorComponent.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/dsl/ObjectInspector.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/transformer/index.ts"],"sourcesContent":["export * from \"./components\";\nexport * from \"./dsl\";\nexport * from \"./types\";\nexport * from \"./transformer\";\n","import React from \"react\";\nimport { Text } from \"@chakra-ui/react\";\nimport { ObjectInspector as ObjectorInspectorDS } from \"@devtools-ds/object-inspector\";\nimport { ReactAsset } from \"@player-ui/react\";\nimport { ObjectInspectorAsset } from \"../types\";\n\nexport const ObjectInspectorComponent = (props: ObjectInspectorAsset) => {\n const { data, label, id } = props;\n\n return (\n <>\n {label && <ReactAsset {...label} />}\n {data ? (\n <ObjectorInspectorDS\n data={data}\n includePrototypes={false}\n expandLevel={7}\n id={id}\n />\n ) : (\n <Text>No data available</Text>\n )}\n </>\n );\n};\n","import React from \"react\";\nimport {\n AssetPropsWithChildren,\n Asset,\n createSlot,\n BindingTemplateInstance,\n} from \"@player-tools/dsl\";\nimport type { Asset as AssetType } from \"@player-ui/player\";\nimport { Text } from \"@devtools-ui/text\";\nimport { Collection } from \"@devtools-ui/collection\";\nimport type { ObjectInspectorAsset } from \"../types\";\n\nexport const ObjectInspector = (\n props: Omit<AssetPropsWithChildren<ObjectInspectorAsset>, \"binding\"> & {\n /** The binding */\n binding?: BindingTemplateInstance;\n }\n) => {\n const { children, binding, ...rest } = props;\n\n return (\n <Asset type=\"object-inspector\" {...rest}>\n {binding && <property name=\"binding\">{binding.toValue()}</property>}\n {children}\n </Asset>\n );\n};\n\nconst CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {\n return (\n <Collection>\n <Collection.Values>{props.children}</Collection.Values>\n </Collection>\n );\n};\n\nObjectInspector.Label = createSlot({\n name: \"label\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n","import type { TransformFunction } from \"@player-ui/player\";\nimport { ObjectInspectorAsset, TransformedObjectInspector } from \"../types\";\n\n/**\n * Access the object from the data model\n */\nexport const objectInspectorTransform: TransformFunction<\n ObjectInspectorAsset,\n TransformedObjectInspector\n> = (asset, options) => {\n return {\n ...asset,\n data:\n asset.binding === undefined\n ? undefined\n : options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: false,\n }),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;AAClB,IAAAA,gBAAqB;AACrB,8BAAuD;AACvD,IAAAA,gBAA2B;AAGpB,IAAM,2BAA2B,CAAC,UAAgC;AACvE,QAAM,EAAE,MAAM,OAAO,GAAG,IAAI;AAE5B,SACE,6BAAAC,QAAA,2BAAAA,QAAA,gBACG,SAAS,6BAAAA,QAAA,cAAC,4BAAY,GAAG,OAAO,GAChC,OACC,6BAAAA,QAAA;AAAA,IAAC,wBAAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb;AAAA;AAAA,EACF,IAEA,6BAAAD,QAAA,cAAC,0BAAK,mBAAiB,CAE3B;AAEJ;;;ACxBA,IAAAE,gBAAkB;AAClB,iBAKO;AAEP,kBAAqB;AACrB,wBAA2B;AAGpB,IAAM,kBAAkB,CAC7B,UAIG;AACH,QAAM,EAAE,UAAU,SAAS,GAAG,KAAK,IAAI;AAEvC,SACE,8BAAAC,QAAA,cAAC,oBAAM,MAAK,oBAAoB,GAAG,QAChC,WAAW,8BAAAA,QAAA,cAAC,cAAS,MAAK,aAAW,QAAQ,QAAQ,CAAE,GACvD,QACH;AAEJ;AAEA,IAAM,iBAAiB,CAAC,UAA6C;AACnE,SACE,8BAAAA,QAAA,cAAC,oCACC,8BAAAA,QAAA,cAAC,6BAAW,QAAX,MAAmB,MAAM,QAAS,CACrC;AAEJ;AAEA,gBAAgB,YAAQ,uBAAW;AAAA,EACjC,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;;;ACpCM,IAAM,2BAGT,CAAC,OAAO,YAAY;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MACE,MAAM,YAAY,SACd,SACA,QAAQ,KAAK,MAAM,IAAI,MAAM,SAAS;AAAA,MACpC,gBAAgB;AAAA,MAChB,WAAW;AAAA,IACb,CAAC;AAAA,EACT;AACF;","names":["import_react","React","ObjectorInspectorDS","import_react","React"]}
@@ -0,0 +1,57 @@
1
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/components/ObjectInspectorComponent.tsx
2
+ import React from "react";
3
+ import { Text } from "@chakra-ui/react";
4
+ import { ObjectInspector as ObjectorInspectorDS } from "@devtools-ds/object-inspector";
5
+ import { ReactAsset } from "@player-ui/react";
6
+ var ObjectInspectorComponent = (props) => {
7
+ const { data, label, id } = props;
8
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, label && /* @__PURE__ */ React.createElement(ReactAsset, { ...label }), data ? /* @__PURE__ */ React.createElement(
9
+ ObjectorInspectorDS,
10
+ {
11
+ data,
12
+ includePrototypes: false,
13
+ expandLevel: 7,
14
+ id
15
+ }
16
+ ) : /* @__PURE__ */ React.createElement(Text, null, "No data available"));
17
+ };
18
+
19
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/dsl/ObjectInspector.tsx
20
+ import React2 from "react";
21
+ import {
22
+ Asset,
23
+ createSlot
24
+ } from "@player-tools/dsl";
25
+ import { Text as Text2 } from "@devtools-ui/text";
26
+ import { Collection } from "@devtools-ui/collection";
27
+ var ObjectInspector = (props) => {
28
+ const { children, binding, ...rest } = props;
29
+ return /* @__PURE__ */ React2.createElement(Asset, { type: "object-inspector", ...rest }, binding && /* @__PURE__ */ React2.createElement("property", { name: "binding" }, binding.toValue()), children);
30
+ };
31
+ var CollectionComp = (props) => {
32
+ return /* @__PURE__ */ React2.createElement(Collection, null, /* @__PURE__ */ React2.createElement(Collection.Values, null, props.children));
33
+ };
34
+ ObjectInspector.Label = createSlot({
35
+ name: "label",
36
+ TextComp: Text2,
37
+ CollectionComp,
38
+ isArray: false,
39
+ wrapInAsset: true
40
+ });
41
+
42
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/transformer/index.ts
43
+ var objectInspectorTransform = (asset, options) => {
44
+ return {
45
+ ...asset,
46
+ data: asset.binding === void 0 ? void 0 : options.data.model.get(asset.binding, {
47
+ includeInvalid: true,
48
+ formatted: false
49
+ })
50
+ };
51
+ };
52
+ export {
53
+ ObjectInspector,
54
+ ObjectInspectorComponent,
55
+ objectInspectorTransform
56
+ };
57
+ //# sourceMappingURL=index.mjs.map
package/dist/index.mjs ADDED
@@ -0,0 +1,57 @@
1
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/components/ObjectInspectorComponent.tsx
2
+ import React from "react";
3
+ import { Text } from "@chakra-ui/react";
4
+ import { ObjectInspector as ObjectorInspectorDS } from "@devtools-ds/object-inspector";
5
+ import { ReactAsset } from "@player-ui/react";
6
+ var ObjectInspectorComponent = (props) => {
7
+ const { data, label, id } = props;
8
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, label && /* @__PURE__ */ React.createElement(ReactAsset, { ...label }), data ? /* @__PURE__ */ React.createElement(
9
+ ObjectorInspectorDS,
10
+ {
11
+ data,
12
+ includePrototypes: false,
13
+ expandLevel: 7,
14
+ id
15
+ }
16
+ ) : /* @__PURE__ */ React.createElement(Text, null, "No data available"));
17
+ };
18
+
19
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/dsl/ObjectInspector.tsx
20
+ import React2 from "react";
21
+ import {
22
+ Asset,
23
+ createSlot
24
+ } from "@player-tools/dsl";
25
+ import { Text as Text2 } from "@devtools-ui/text";
26
+ import { Collection } from "@devtools-ui/collection";
27
+ var ObjectInspector = (props) => {
28
+ const { children, binding, ...rest } = props;
29
+ return /* @__PURE__ */ React2.createElement(Asset, { type: "object-inspector", ...rest }, binding && /* @__PURE__ */ React2.createElement("property", { name: "binding" }, binding.toValue()), children);
30
+ };
31
+ var CollectionComp = (props) => {
32
+ return /* @__PURE__ */ React2.createElement(Collection, null, /* @__PURE__ */ React2.createElement(Collection.Values, null, props.children));
33
+ };
34
+ ObjectInspector.Label = createSlot({
35
+ name: "label",
36
+ TextComp: Text2,
37
+ CollectionComp,
38
+ isArray: false,
39
+ wrapInAsset: true
40
+ });
41
+
42
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/transformer/index.ts
43
+ var objectInspectorTransform = (asset, options) => {
44
+ return {
45
+ ...asset,
46
+ data: asset.binding === void 0 ? void 0 : options.data.model.get(asset.binding, {
47
+ includeInvalid: true,
48
+ formatted: false
49
+ })
50
+ };
51
+ };
52
+ export {
53
+ ObjectInspector,
54
+ ObjectInspectorComponent,
55
+ objectInspectorTransform
56
+ };
57
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/components/ObjectInspectorComponent.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/dsl/ObjectInspector.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/object-inspector/src/transformer/index.ts"],"sourcesContent":["import React from \"react\";\nimport { Text } from \"@chakra-ui/react\";\nimport { ObjectInspector as ObjectorInspectorDS } from \"@devtools-ds/object-inspector\";\nimport { ReactAsset } from \"@player-ui/react\";\nimport { ObjectInspectorAsset } from \"../types\";\n\nexport const ObjectInspectorComponent = (props: ObjectInspectorAsset) => {\n const { data, label, id } = props;\n\n return (\n <>\n {label && <ReactAsset {...label} />}\n {data ? (\n <ObjectorInspectorDS\n data={data}\n includePrototypes={false}\n expandLevel={7}\n id={id}\n />\n ) : (\n <Text>No data available</Text>\n )}\n </>\n );\n};\n","import React from \"react\";\nimport {\n AssetPropsWithChildren,\n Asset,\n createSlot,\n BindingTemplateInstance,\n} from \"@player-tools/dsl\";\nimport type { Asset as AssetType } from \"@player-ui/player\";\nimport { Text } from \"@devtools-ui/text\";\nimport { Collection } from \"@devtools-ui/collection\";\nimport type { ObjectInspectorAsset } from \"../types\";\n\nexport const ObjectInspector = (\n props: Omit<AssetPropsWithChildren<ObjectInspectorAsset>, \"binding\"> & {\n /** The binding */\n binding?: BindingTemplateInstance;\n }\n) => {\n const { children, binding, ...rest } = props;\n\n return (\n <Asset type=\"object-inspector\" {...rest}>\n {binding && <property name=\"binding\">{binding.toValue()}</property>}\n {children}\n </Asset>\n );\n};\n\nconst CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {\n return (\n <Collection>\n <Collection.Values>{props.children}</Collection.Values>\n </Collection>\n );\n};\n\nObjectInspector.Label = createSlot({\n name: \"label\",\n TextComp: Text,\n CollectionComp,\n isArray: false,\n wrapInAsset: true,\n});\n","import type { TransformFunction } from \"@player-ui/player\";\nimport { ObjectInspectorAsset, TransformedObjectInspector } from \"../types\";\n\n/**\n * Access the object from the data model\n */\nexport const objectInspectorTransform: TransformFunction<\n ObjectInspectorAsset,\n TransformedObjectInspector\n> = (asset, options) => {\n return {\n ...asset,\n data:\n asset.binding === undefined\n ? undefined\n : options.data.model.get(asset.binding, {\n includeInvalid: true,\n formatted: false,\n }),\n };\n};\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,mBAAmB,2BAA2B;AACvD,SAAS,kBAAkB;AAGpB,IAAM,2BAA2B,CAAC,UAAgC;AACvE,QAAM,EAAE,MAAM,OAAO,GAAG,IAAI;AAE5B,SACE,0DACG,SAAS,oCAAC,cAAY,GAAG,OAAO,GAChC,OACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,mBAAmB;AAAA,MACnB,aAAa;AAAA,MACb;AAAA;AAAA,EACF,IAEA,oCAAC,YAAK,mBAAiB,CAE3B;AAEJ;;;ACxBA,OAAOA,YAAW;AAClB;AAAA,EAEE;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,QAAAC,aAAY;AACrB,SAAS,kBAAkB;AAGpB,IAAM,kBAAkB,CAC7B,UAIG;AACH,QAAM,EAAE,UAAU,SAAS,GAAG,KAAK,IAAI;AAEvC,SACE,gBAAAD,OAAA,cAAC,SAAM,MAAK,oBAAoB,GAAG,QAChC,WAAW,gBAAAA,OAAA,cAAC,cAAS,MAAK,aAAW,QAAQ,QAAQ,CAAE,GACvD,QACH;AAEJ;AAEA,IAAM,iBAAiB,CAAC,UAA6C;AACnE,SACE,gBAAAA,OAAA,cAAC,kBACC,gBAAAA,OAAA,cAAC,WAAW,QAAX,MAAmB,MAAM,QAAS,CACrC;AAEJ;AAEA,gBAAgB,QAAQ,WAAW;AAAA,EACjC,MAAM;AAAA,EACN,UAAUC;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;;;ACpCM,IAAM,2BAGT,CAAC,OAAO,YAAY;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,MACE,MAAM,YAAY,SACd,SACA,QAAQ,KAAK,MAAM,IAAI,MAAM,SAAS;AAAA,MACpC,gBAAgB;AAAA,MAChB,WAAW;AAAA,IACb,CAAC;AAAA,EACT;AACF;","names":["React","Text"]}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@devtools-ui/object-inspector",
3
+ "version": "0.0.2--canary.11.588",
4
+ "main": "dist/cjs/index.cjs",
5
+ "dependencies": {
6
+ "@devtools-ui/collection": "0.0.2--canary.11.588",
7
+ "@devtools-ui/text": "0.0.2--canary.11.588",
8
+ "@types/react": "^18.2.51",
9
+ "react": "^18.2.0",
10
+ "@devtools-ds/object-inspector": "^1.1.2",
11
+ "@player-tools/dsl": "0.5.2--canary.87.2261",
12
+ "@chakra-ui/react": "^2.8.2",
13
+ "@emotion/react": "^11.11.4",
14
+ "@emotion/styled": "^11.11.0",
15
+ "framer-motion": "^11.0.8",
16
+ "@player-ui/player": "0.7.1",
17
+ "@player-ui/react": "^0.7.1",
18
+ "@player-ui/types": "0.7.1",
19
+ "dlv": "^1.1.3",
20
+ "eslint-plugin-storybook": "^0.8.0",
21
+ "tslib": "^2.6.2"
22
+ },
23
+ "module": "dist/index.legacy-esm.js",
24
+ "types": "types/index.d.ts",
25
+ "sideEffects": false,
26
+ "exports": {
27
+ "./package.json": "./package.json",
28
+ ".": {
29
+ "types": "./types/index.d.ts",
30
+ "import": "./dist/index.mjs",
31
+ "default": "./dist/cjs/index.cjs"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "src",
37
+ "types"
38
+ ],
39
+ "peerDependencies": {}
40
+ }
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { Text } from "@chakra-ui/react";
3
+ import { ObjectInspector as ObjectorInspectorDS } from "@devtools-ds/object-inspector";
4
+ import { ReactAsset } from "@player-ui/react";
5
+ import { ObjectInspectorAsset } from "../types";
6
+
7
+ export const ObjectInspectorComponent = (props: ObjectInspectorAsset) => {
8
+ const { data, label, id } = props;
9
+
10
+ return (
11
+ <>
12
+ {label && <ReactAsset {...label} />}
13
+ {data ? (
14
+ <ObjectorInspectorDS
15
+ data={data}
16
+ includePrototypes={false}
17
+ expandLevel={7}
18
+ id={id}
19
+ />
20
+ ) : (
21
+ <Text>No data available</Text>
22
+ )}
23
+ </>
24
+ );
25
+ };
@@ -0,0 +1 @@
1
+ export { ObjectInspectorComponent } from "./ObjectInspectorComponent";
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import {
3
+ AssetPropsWithChildren,
4
+ Asset,
5
+ createSlot,
6
+ BindingTemplateInstance,
7
+ } from "@player-tools/dsl";
8
+ import type { Asset as AssetType } from "@player-ui/player";
9
+ import { Text } from "@devtools-ui/text";
10
+ import { Collection } from "@devtools-ui/collection";
11
+ import type { ObjectInspectorAsset } from "../types";
12
+
13
+ export const ObjectInspector = (
14
+ props: Omit<AssetPropsWithChildren<ObjectInspectorAsset>, "binding"> & {
15
+ /** The binding */
16
+ binding?: BindingTemplateInstance;
17
+ }
18
+ ) => {
19
+ const { children, binding, ...rest } = props;
20
+
21
+ return (
22
+ <Asset type="object-inspector" {...rest}>
23
+ {binding && <property name="binding">{binding.toValue()}</property>}
24
+ {children}
25
+ </Asset>
26
+ );
27
+ };
28
+
29
+ const CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {
30
+ return (
31
+ <Collection>
32
+ <Collection.Values>{props.children}</Collection.Values>
33
+ </Collection>
34
+ );
35
+ };
36
+
37
+ ObjectInspector.Label = createSlot({
38
+ name: "label",
39
+ TextComp: Text,
40
+ CollectionComp,
41
+ isArray: false,
42
+ wrapInAsset: true,
43
+ });
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { describe, expect, test } from "vitest";
3
+ import { render, binding as b } from "@player-tools/dsl";
4
+ import { ObjectInspector } from "../ObjectInspector";
5
+
6
+ describe("DSL: Object Inspector", () => {
7
+ test("basic", async () => {
8
+ const rendered = await render(
9
+ <ObjectInspector binding={b`foo`}>
10
+ <ObjectInspector.Label>Hello</ObjectInspector.Label>
11
+ </ObjectInspector>
12
+ );
13
+
14
+ expect(rendered.jsonValue).toStrictEqual({
15
+ id: "root",
16
+ type: "object-inspector",
17
+ binding: "foo",
18
+ label: {
19
+ asset: {
20
+ id: "label",
21
+ type: "text",
22
+ value: "Hello",
23
+ },
24
+ },
25
+ });
26
+ });
27
+ });
@@ -0,0 +1 @@
1
+ export { ObjectInspector } from "./ObjectInspector";
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./components";
2
+ export * from "./dsl";
3
+ export * from "./types";
4
+ export * from "./transformer";
@@ -0,0 +1,21 @@
1
+ import type { TransformFunction } from "@player-ui/player";
2
+ import { ObjectInspectorAsset, TransformedObjectInspector } from "../types";
3
+
4
+ /**
5
+ * Access the object from the data model
6
+ */
7
+ export const objectInspectorTransform: TransformFunction<
8
+ ObjectInspectorAsset,
9
+ TransformedObjectInspector
10
+ > = (asset, options) => {
11
+ return {
12
+ ...asset,
13
+ data:
14
+ asset.binding === undefined
15
+ ? undefined
16
+ : options.data.model.get(asset.binding, {
17
+ includeInvalid: true,
18
+ formatted: false,
19
+ }),
20
+ };
21
+ };
@@ -0,0 +1,16 @@
1
+ import { Asset, AssetWrapper } from "@player-ui/types";
2
+
3
+ export interface ObjectInspectorAsset<AnyTextAsset extends Asset = Asset>
4
+ extends Asset<"object-inspector"> {
5
+ /** binding pointing to the object to inspect */
6
+ binding?: string;
7
+
8
+ /** A text-like asset for the action's label */
9
+ label?: AssetWrapper<AnyTextAsset>;
10
+ }
11
+
12
+ export interface TransformedObjectInspector extends ObjectInspectorAsset {
13
+ /** A stateful instance of an action */
14
+ /** object to inspect */
15
+ data: unknown;
16
+ }
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ObjectInspectorAsset } from "../types";
3
+ export declare const ObjectInspectorComponent: (props: ObjectInspectorAsset) => React.JSX.Element;
4
+ //# sourceMappingURL=ObjectInspectorComponent.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { ObjectInspectorComponent } from "./ObjectInspectorComponent";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { AssetPropsWithChildren, BindingTemplateInstance } from "@player-tools/dsl";
3
+ import type { ObjectInspectorAsset } from "../types";
4
+ export declare const ObjectInspector: {
5
+ (props: Omit<AssetPropsWithChildren<ObjectInspectorAsset>, "binding"> & {
6
+ /** The binding */
7
+ binding?: BindingTemplateInstance;
8
+ }): React.JSX.Element;
9
+ Label: (props: {
10
+ children?: React.ReactNode;
11
+ }) => React.JSX.Element;
12
+ };
13
+ //# sourceMappingURL=ObjectInspector.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { ObjectInspector } from "./ObjectInspector";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ export * from "./components";
2
+ export * from "./dsl";
3
+ export * from "./types";
4
+ export * from "./transformer";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { TransformFunction } from "@player-ui/player";
2
+ import { ObjectInspectorAsset, TransformedObjectInspector } from "../types";
3
+ /**
4
+ * Access the object from the data model
5
+ */
6
+ export declare const objectInspectorTransform: TransformFunction<ObjectInspectorAsset, TransformedObjectInspector>;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { Asset, AssetWrapper } from "@player-ui/types";
2
+ export interface ObjectInspectorAsset<AnyTextAsset extends Asset = Asset> extends Asset<"object-inspector"> {
3
+ /** binding pointing to the object to inspect */
4
+ binding?: string;
5
+ /** A text-like asset for the action's label */
6
+ label?: AssetWrapper<AnyTextAsset>;
7
+ }
8
+ export interface TransformedObjectInspector extends ObjectInspectorAsset {
9
+ /** A stateful instance of an action */
10
+ /** object to inspect */
11
+ data: unknown;
12
+ }
13
+ //# sourceMappingURL=index.d.ts.map