@devtools-ui/collection 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,69 @@
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/collection/src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ Collection: () => Collection,
34
+ CollectionComponent: () => CollectionComponent
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+
38
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/components/CollectionComponent.tsx
39
+ var import_react = __toESM(require("react"));
40
+ var import_react2 = require("@chakra-ui/react");
41
+ var import_react3 = require("@player-ui/react");
42
+ var CollectionComponent = (props) => {
43
+ return /* @__PURE__ */ import_react.default.createElement(import_react2.Flex, { direction: "column", gap: "5" }, props.values?.map((a) => /* @__PURE__ */ import_react.default.createElement(import_react3.ReactAsset, { key: a.asset.id, ...a })));
44
+ };
45
+
46
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/dsl/Collection.tsx
47
+ var import_react4 = __toESM(require("react"));
48
+ var import_dsl = require("@player-tools/dsl");
49
+ var import_text = require("@devtools-ui/text");
50
+ var Collection = (props) => {
51
+ const { children, ...rest } = props;
52
+ return /* @__PURE__ */ import_react4.default.createElement(import_dsl.Asset, { type: "collection", ...rest }, children);
53
+ };
54
+ var CollectionComp = (props) => {
55
+ return /* @__PURE__ */ import_react4.default.createElement(Collection, null, /* @__PURE__ */ import_react4.default.createElement(Collection.Values, null, props.children));
56
+ };
57
+ Collection.Values = (0, import_dsl.createSlot)({
58
+ name: "values",
59
+ TextComp: import_text.Text,
60
+ CollectionComp,
61
+ isArray: true,
62
+ wrapInAsset: true
63
+ });
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ Collection,
67
+ CollectionComponent
68
+ });
69
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/index.ts","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/components/CollectionComponent.tsx","../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/dsl/Collection.tsx"],"sourcesContent":["export * from \"./types\";\nexport * from \"./components\";\nexport * from \"./dsl\";\n","import React from \"react\";\nimport { Flex } from \"@chakra-ui/react\";\nimport { ReactAsset } from \"@player-ui/react\";\nimport { CollectionAsset } from \"../types\";\n\nexport const CollectionComponent = (props: CollectionAsset) => {\n return (\n <Flex direction=\"column\" gap=\"5\">\n {props.values?.map((a) => (\n <ReactAsset key={a.asset.id} {...a} />\n ))}\n </Flex>\n );\n};\n","import React from \"react\";\nimport { AssetPropsWithChildren, Asset, createSlot } from \"@player-tools/dsl\";\nimport type { Asset as AssetType } from \"@player-ui/player\";\nimport { CollectionAsset } from \"../types\";\nimport { Text } from \"@devtools-ui/text\";\n\nexport const Collection = (props: AssetPropsWithChildren<CollectionAsset>) => {\n const { children, ...rest } = props;\n return (\n <Asset type=\"collection\" {...rest}>\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\nCollection.Values = createSlot({\n name: \"values\",\n TextComp: Text,\n CollectionComp,\n isArray: true,\n wrapInAsset: true,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkB;AAClB,IAAAA,gBAAqB;AACrB,IAAAA,gBAA2B;AAGpB,IAAM,sBAAsB,CAAC,UAA2B;AAC7D,SACE,6BAAAC,QAAA,cAAC,sBAAK,WAAU,UAAS,KAAI,OAC1B,MAAM,QAAQ,IAAI,CAAC,MAClB,6BAAAA,QAAA,cAAC,4BAAW,KAAK,EAAE,MAAM,IAAK,GAAG,GAAG,CACrC,CACH;AAEJ;;;ACbA,IAAAC,gBAAkB;AAClB,iBAA0D;AAG1D,kBAAqB;AAEd,IAAM,aAAa,CAAC,UAAmD;AAC5E,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,SACE,8BAAAC,QAAA,cAAC,oBAAM,MAAK,cAAc,GAAG,QAC1B,QACH;AAEJ;AAEA,IAAM,iBAAiB,CAAC,UAA6C;AACnE,SACE,8BAAAA,QAAA,cAAC,kBACC,8BAAAA,QAAA,cAAC,WAAW,QAAX,MAAmB,MAAM,QAAS,CACrC;AAEJ;AAEA,WAAW,aAAS,uBAAW;AAAA,EAC7B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;","names":["import_react","React","import_react","React"]}
@@ -0,0 +1,31 @@
1
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/components/CollectionComponent.tsx
2
+ import React from "react";
3
+ import { Flex } from "@chakra-ui/react";
4
+ import { ReactAsset } from "@player-ui/react";
5
+ var CollectionComponent = (props) => {
6
+ return /* @__PURE__ */ React.createElement(Flex, { direction: "column", gap: "5" }, props.values?.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, { key: a.asset.id, ...a })));
7
+ };
8
+
9
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/dsl/Collection.tsx
10
+ import React2 from "react";
11
+ import { Asset, createSlot } from "@player-tools/dsl";
12
+ import { Text } from "@devtools-ui/text";
13
+ var Collection = (props) => {
14
+ const { children, ...rest } = props;
15
+ return /* @__PURE__ */ React2.createElement(Asset, { type: "collection", ...rest }, children);
16
+ };
17
+ var CollectionComp = (props) => {
18
+ return /* @__PURE__ */ React2.createElement(Collection, null, /* @__PURE__ */ React2.createElement(Collection.Values, null, props.children));
19
+ };
20
+ Collection.Values = createSlot({
21
+ name: "values",
22
+ TextComp: Text,
23
+ CollectionComp,
24
+ isArray: true,
25
+ wrapInAsset: true
26
+ });
27
+ export {
28
+ Collection,
29
+ CollectionComponent
30
+ };
31
+ //# sourceMappingURL=index.mjs.map
package/dist/index.mjs ADDED
@@ -0,0 +1,31 @@
1
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/components/CollectionComponent.tsx
2
+ import React from "react";
3
+ import { Flex } from "@chakra-ui/react";
4
+ import { ReactAsset } from "@player-ui/react";
5
+ var CollectionComponent = (props) => {
6
+ return /* @__PURE__ */ React.createElement(Flex, { direction: "column", gap: "5" }, props.values?.map((a) => /* @__PURE__ */ React.createElement(ReactAsset, { key: a.asset.id, ...a })));
7
+ };
8
+
9
+ // ../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/dsl/Collection.tsx
10
+ import React2 from "react";
11
+ import { Asset, createSlot } from "@player-tools/dsl";
12
+ import { Text } from "@devtools-ui/text";
13
+ var Collection = (props) => {
14
+ const { children, ...rest } = props;
15
+ return /* @__PURE__ */ React2.createElement(Asset, { type: "collection", ...rest }, children);
16
+ };
17
+ var CollectionComp = (props) => {
18
+ return /* @__PURE__ */ React2.createElement(Collection, null, /* @__PURE__ */ React2.createElement(Collection.Values, null, props.children));
19
+ };
20
+ Collection.Values = createSlot({
21
+ name: "values",
22
+ TextComp: Text,
23
+ CollectionComp,
24
+ isArray: true,
25
+ wrapInAsset: true
26
+ });
27
+ export {
28
+ Collection,
29
+ CollectionComponent
30
+ };
31
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/components/CollectionComponent.tsx","../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/collection/src/dsl/Collection.tsx"],"sourcesContent":["import React from \"react\";\nimport { Flex } from \"@chakra-ui/react\";\nimport { ReactAsset } from \"@player-ui/react\";\nimport { CollectionAsset } from \"../types\";\n\nexport const CollectionComponent = (props: CollectionAsset) => {\n return (\n <Flex direction=\"column\" gap=\"5\">\n {props.values?.map((a) => (\n <ReactAsset key={a.asset.id} {...a} />\n ))}\n </Flex>\n );\n};\n","import React from \"react\";\nimport { AssetPropsWithChildren, Asset, createSlot } from \"@player-tools/dsl\";\nimport type { Asset as AssetType } from \"@player-ui/player\";\nimport { CollectionAsset } from \"../types\";\nimport { Text } from \"@devtools-ui/text\";\n\nexport const Collection = (props: AssetPropsWithChildren<CollectionAsset>) => {\n const { children, ...rest } = props;\n return (\n <Asset type=\"collection\" {...rest}>\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\nCollection.Values = createSlot({\n name: \"values\",\n TextComp: Text,\n CollectionComp,\n isArray: true,\n wrapInAsset: true,\n});\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAGpB,IAAM,sBAAsB,CAAC,UAA2B;AAC7D,SACE,oCAAC,QAAK,WAAU,UAAS,KAAI,OAC1B,MAAM,QAAQ,IAAI,CAAC,MAClB,oCAAC,cAAW,KAAK,EAAE,MAAM,IAAK,GAAG,GAAG,CACrC,CACH;AAEJ;;;ACbA,OAAOA,YAAW;AAClB,SAAiC,OAAO,kBAAkB;AAG1D,SAAS,YAAY;AAEd,IAAM,aAAa,CAAC,UAAmD;AAC5E,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,SACE,gBAAAA,OAAA,cAAC,SAAM,MAAK,cAAc,GAAG,QAC1B,QACH;AAEJ;AAEA,IAAM,iBAAiB,CAAC,UAA6C;AACnE,SACE,gBAAAA,OAAA,cAAC,kBACC,gBAAAA,OAAA,cAAC,WAAW,QAAX,MAAmB,MAAM,QAAS,CACrC;AAEJ;AAEA,WAAW,SAAS,WAAW;AAAA,EAC7B,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACf,CAAC;","names":["React"]}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@devtools-ui/collection",
3
+ "version": "0.0.2--canary.11.588",
4
+ "main": "dist/cjs/index.cjs",
5
+ "dependencies": {
6
+ "@devtools-ui/text": "0.0.2--canary.11.588",
7
+ "@chakra-ui/react": "^2.8.2",
8
+ "@emotion/react": "^11.11.4",
9
+ "@emotion/styled": "^11.11.0",
10
+ "@player-tools/dsl": "0.5.2--canary.87.2261",
11
+ "@player-ui/types": "0.7.1",
12
+ "@types/react": "^18.2.51",
13
+ "@player-ui/react": "^0.7.1",
14
+ "framer-motion": "^11.0.8",
15
+ "@player-ui/player": "0.7.1",
16
+ "react": "^18.2.0",
17
+ "dlv": "^1.1.3",
18
+ "eslint-plugin-storybook": "^0.8.0",
19
+ "tslib": "^2.6.2"
20
+ },
21
+ "module": "dist/index.legacy-esm.js",
22
+ "types": "types/index.d.ts",
23
+ "sideEffects": false,
24
+ "exports": {
25
+ "./package.json": "./package.json",
26
+ ".": {
27
+ "types": "./types/index.d.ts",
28
+ "import": "./dist/index.mjs",
29
+ "default": "./dist/cjs/index.cjs"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "src",
35
+ "types"
36
+ ],
37
+ "peerDependencies": {}
38
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Flex } from "@chakra-ui/react";
3
+ import { ReactAsset } from "@player-ui/react";
4
+ import { CollectionAsset } from "../types";
5
+
6
+ export const CollectionComponent = (props: CollectionAsset) => {
7
+ return (
8
+ <Flex direction="column" gap="5">
9
+ {props.values?.map((a) => (
10
+ <ReactAsset key={a.asset.id} {...a} />
11
+ ))}
12
+ </Flex>
13
+ );
14
+ };
@@ -0,0 +1 @@
1
+ export { CollectionComponent } from "./CollectionComponent";
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { AssetPropsWithChildren, Asset, createSlot } from "@player-tools/dsl";
3
+ import type { Asset as AssetType } from "@player-ui/player";
4
+ import { CollectionAsset } from "../types";
5
+ import { Text } from "@devtools-ui/text";
6
+
7
+ export const Collection = (props: AssetPropsWithChildren<CollectionAsset>) => {
8
+ const { children, ...rest } = props;
9
+ return (
10
+ <Asset type="collection" {...rest}>
11
+ {children}
12
+ </Asset>
13
+ );
14
+ };
15
+
16
+ const CollectionComp = (props: AssetPropsWithChildren<AssetType>) => {
17
+ return (
18
+ <Collection>
19
+ <Collection.Values>{props.children}</Collection.Values>
20
+ </Collection>
21
+ );
22
+ };
23
+
24
+ Collection.Values = createSlot({
25
+ name: "values",
26
+ TextComp: Text,
27
+ CollectionComp,
28
+ isArray: true,
29
+ wrapInAsset: true,
30
+ });
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { describe, expect, test } from "vitest";
3
+ import { Asset, render } from "@player-tools/dsl";
4
+ import { Collection } from "../Collection";
5
+
6
+ describe("DSL: Collection", () => {
7
+ test("with values", async () => {
8
+ const rendered = await render(
9
+ <Collection>
10
+ <Collection.Values>
11
+ <Asset type="text">
12
+ <property name="value">Test 1</property>
13
+ </Asset>
14
+ <Asset type="text">
15
+ <property name="value">Test 2</property>
16
+ </Asset>
17
+ </Collection.Values>
18
+ </Collection>
19
+ );
20
+
21
+ expect(rendered.jsonValue).toStrictEqual({
22
+ id: "root",
23
+ type: "collection",
24
+ values: [
25
+ {
26
+ asset: {
27
+ id: "values-0",
28
+ type: "text",
29
+ value: "Test 1",
30
+ },
31
+ },
32
+ {
33
+ asset: {
34
+ id: "values-1",
35
+ type: "text",
36
+ value: "Test 2",
37
+ },
38
+ },
39
+ ],
40
+ });
41
+ });
42
+ });
@@ -0,0 +1 @@
1
+ export { Collection } from "./Collection";
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./components";
3
+ export * from "./dsl";
@@ -0,0 +1,6 @@
1
+ import { Asset, AssetWrapper } from "@player-ui/types";
2
+
3
+ export interface CollectionAsset extends Asset<"collection"> {
4
+ /** list of assets in the collection */
5
+ values?: Array<AssetWrapper>;
6
+ }
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { CollectionAsset } from "../types";
3
+ export declare const CollectionComponent: (props: CollectionAsset) => React.JSX.Element;
4
+ //# sourceMappingURL=CollectionComponent.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { CollectionComponent } from "./CollectionComponent";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { AssetPropsWithChildren } from "@player-tools/dsl";
3
+ import { CollectionAsset } from "../types";
4
+ export declare const Collection: {
5
+ (props: AssetPropsWithChildren<CollectionAsset>): React.JSX.Element;
6
+ Values: (props: {
7
+ children?: React.ReactNode;
8
+ }) => React.JSX.Element;
9
+ };
10
+ //# sourceMappingURL=Collection.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { Collection } from "./Collection";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from "./types";
2
+ export * from "./components";
3
+ export * from "./dsl";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { Asset, AssetWrapper } from "@player-ui/types";
2
+ export interface CollectionAsset extends Asset<"collection"> {
3
+ /** list of assets in the collection */
4
+ values?: Array<AssetWrapper>;
5
+ }
6
+ //# sourceMappingURL=index.d.ts.map