@webstudio-is/react-sdk 0.5.0 → 0.5.1
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/lib/arg-types/utils.d.ts +19 -1
- package/lib/arg-types/utils.d.ts.map +1 -1
- package/lib/arg-types/utils.js +7 -6
- package/lib/components/body.d.ts +3 -0
- package/lib/components/body.d.ts.map +1 -0
- package/lib/components/body.js +8 -0
- package/lib/components/body.props.json +2234 -0
- package/lib/components/body.stories.d.ts +7 -0
- package/lib/components/body.stories.d.ts.map +1 -0
- package/lib/components/body.stories.js +16 -0
- package/lib/components/body.ws.d.ts +5 -0
- package/lib/components/body.ws.d.ts.map +1 -0
- package/lib/components/body.ws.js +64 -0
- package/lib/components/bold.props.json +37 -7
- package/lib/components/bold.ws.d.ts +5 -0
- package/lib/components/bold.ws.d.ts.map +1 -0
- package/lib/components/bold.ws.js +14 -0
- package/lib/components/box.d.ts +7 -2
- package/lib/components/box.d.ts.map +1 -1
- package/lib/components/box.js +3 -2
- package/lib/components/box.props.json +102 -7
- package/lib/components/box.stories.d.ts +6 -2
- package/lib/components/box.stories.d.ts.map +1 -1
- package/lib/components/box.ws.d.ts +5 -0
- package/lib/components/box.ws.d.ts.map +1 -0
- package/lib/components/box.ws.js +21 -0
- package/lib/components/button.d.ts +1 -4
- package/lib/components/button.d.ts.map +1 -1
- package/lib/components/button.props.json +42 -8
- package/lib/components/button.ws.d.ts +5 -0
- package/lib/components/button.ws.d.ts.map +1 -0
- package/lib/components/button.ws.js +15 -0
- package/lib/components/component-type.d.ts +17 -0
- package/lib/components/component-type.d.ts.map +1 -0
- package/lib/components/component-type.js +28 -0
- package/lib/components/form.props.json +37 -7
- package/lib/components/form.ws.d.ts +5 -0
- package/lib/components/form.ws.d.ts.map +1 -0
- package/lib/components/form.ws.js +26 -0
- package/lib/components/heading.d.ts +2 -2
- package/lib/components/heading.d.ts.map +1 -1
- package/lib/components/heading.js +1 -4
- package/lib/components/heading.props.json +45 -8
- package/lib/components/heading.stories.d.ts +2 -2
- package/lib/components/heading.ws.d.ts +5 -0
- package/lib/components/heading.ws.d.ts.map +1 -0
- package/lib/components/heading.ws.js +15 -0
- package/lib/components/index.d.ts +11 -10
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +25 -23
- package/lib/components/index.test.d.ts +2 -0
- package/lib/components/index.test.d.ts.map +1 -0
- package/lib/components/index.test.js +33 -0
- package/lib/components/input.props.json +46 -8
- package/lib/components/input.ws.d.ts +5 -0
- package/lib/components/input.ws.d.ts.map +1 -0
- package/lib/components/input.ws.js +14 -0
- package/lib/components/italic.props.json +37 -7
- package/lib/components/italic.ws.d.ts +5 -0
- package/lib/components/italic.ws.d.ts.map +1 -0
- package/lib/components/italic.ws.js +14 -0
- package/lib/components/link.d.ts +2 -2
- package/lib/components/link.d.ts.map +1 -1
- package/lib/components/link.props.json +37 -7
- package/lib/components/link.stories.d.ts +6 -2
- package/lib/components/link.stories.d.ts.map +1 -1
- package/lib/components/link.ws.d.ts +5 -0
- package/lib/components/link.ws.d.ts.map +1 -0
- package/lib/components/link.ws.js +27 -0
- package/lib/components/meta.d.ts +1 -0
- package/lib/components/meta.d.ts.map +1 -1
- package/lib/components/meta.js +3 -1
- package/lib/components/paragraph.props.json +37 -7
- package/lib/components/paragraph.ws.d.ts +5 -0
- package/lib/components/paragraph.ws.d.ts.map +1 -0
- package/lib/components/paragraph.ws.js +15 -0
- package/lib/components/text-block.props.json +37 -7
- package/lib/components/text-block.ws.d.ts +5 -0
- package/lib/components/text-block.ws.d.ts.map +1 -0
- package/lib/components/text-block.ws.js +23 -0
- package/lib/css/get-browser-style.js +1 -1
- package/lib/css/keyword-values.d.ts.map +1 -1
- package/lib/css/keyword-values.js +1149 -396
- package/lib/css/properties.d.ts.map +1 -1
- package/lib/css/properties.js +3194 -3194
- package/lib/css/units.js +1 -1
- package/lib/db/instance.d.ts +5 -2
- package/lib/db/instance.d.ts.map +1 -1
- package/lib/db/instance.js +9 -1
- package/lib/db/types.d.ts +1 -2
- package/lib/db/types.d.ts.map +1 -1
- package/lib/pubsub/publish.js +1 -1
- package/lib/pubsub/subscribe.d.ts.map +1 -1
- package/lib/pubsub/subscribe.js +1 -2
- package/lib/stitches/css.d.ts.map +1 -1
- package/lib/stitches/css.js +1 -0
- package/lib/stitches/to-css.js +2 -3
- package/lib/tree/create-elements-tree.d.ts.map +1 -1
- package/lib/tree/create-elements-tree.js +43 -12
- package/lib/tree/root.js +3 -3
- package/lib/tree/wrapper-component.js +2 -2
- package/lib/user-props/all-user-props.d.ts.map +1 -1
- package/lib/user-props/all-user-props.js +5 -4
- package/lib/user-props/use-user-props.js +1 -1
- package/package.json +7 -9
- package/lib/prisma.server.d.ts +0 -3
- package/lib/prisma.server.d.ts.map +0 -1
- package/lib/prisma.server.js +0 -8
- package/prisma/schema.prisma +0 -71
package/lib/arg-types/utils.d.ts
CHANGED
|
@@ -2,5 +2,23 @@ import type { ArgTypes } from "@storybook/csf";
|
|
|
2
2
|
import { PropItem } from "react-docgen-typescript";
|
|
3
3
|
export declare type FilterPredicate = (prop: PropItem) => boolean;
|
|
4
4
|
export declare const propsToArgTypes: (props: Record<string, PropItem>, filter?: FilterPredicate) => ArgTypes;
|
|
5
|
-
export declare const mapControlForType: (propItem: PropItem) =>
|
|
5
|
+
export declare const mapControlForType: (propItem: PropItem) => {
|
|
6
|
+
control: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
defaultValue: any;
|
|
10
|
+
options?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
control: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
defaultValue?: undefined;
|
|
16
|
+
options?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
control: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
options: any;
|
|
22
|
+
defaultValue?: undefined;
|
|
23
|
+
} | null | undefined;
|
|
6
24
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/arg-types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,oBAAY,eAAe,GAAG,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC;AAa1D,eAAO,MAAM,eAAe,UACnB,OAAO,MAAM,EAAE,QAAQ,CAAC,WACtB,eAAe,KACvB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/arg-types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,oBAAY,eAAe,GAAG,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC;AAa1D,eAAO,MAAM,eAAe,UACnB,OAAO,MAAM,EAAE,QAAQ,CAAC,WACtB,eAAe,KACvB,QAiBF,CAAC;AAOF,eAAO,MAAM,iBAAiB,aAAc,QAAQ;;;;;;;;;;;;;;;;;;oBAiDnD,CAAC"}
|
package/lib/arg-types/utils.js
CHANGED
|
@@ -12,9 +12,11 @@ const validAttributes = (prop) => {
|
|
|
12
12
|
return true;
|
|
13
13
|
};
|
|
14
14
|
const propsToArgTypes = (props, filter) => {
|
|
15
|
-
const filterFn = filter
|
|
15
|
+
const filterFn = filter ?? validAttributes;
|
|
16
16
|
const entries = Object.entries(props);
|
|
17
17
|
return entries.reduce((result, current) => {
|
|
18
|
+
// @todo need halp
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
20
|
const [propName, prop] = current;
|
|
19
21
|
// Filter out props
|
|
20
22
|
if (!filterFn(prop)) {
|
|
@@ -31,7 +33,6 @@ const matchers = {
|
|
|
31
33
|
date: /Date$/,
|
|
32
34
|
};
|
|
33
35
|
const mapControlForType = (propItem) => {
|
|
34
|
-
var _a;
|
|
35
36
|
const { type, name } = propItem;
|
|
36
37
|
if (!type) {
|
|
37
38
|
return undefined;
|
|
@@ -42,7 +43,7 @@ const mapControlForType = (propItem) => {
|
|
|
42
43
|
if (controlType === "string") {
|
|
43
44
|
return {
|
|
44
45
|
control: { type: "color" },
|
|
45
|
-
defaultValue:
|
|
46
|
+
defaultValue: propItem.defaultValue?.value,
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -50,7 +51,7 @@ const mapControlForType = (propItem) => {
|
|
|
50
51
|
if (matchers.date && matchers.date.test(name)) {
|
|
51
52
|
return { control: { type: "date" } };
|
|
52
53
|
}
|
|
53
|
-
switch (type
|
|
54
|
+
switch (type?.name) {
|
|
54
55
|
case "array":
|
|
55
56
|
return { control: { type: "object" } };
|
|
56
57
|
case "boolean":
|
|
@@ -64,9 +65,9 @@ const mapControlForType = (propItem) => {
|
|
|
64
65
|
const { value } = type;
|
|
65
66
|
// Remove additional quotes from enum values
|
|
66
67
|
// @ts-expect-error Original type has `any` type
|
|
67
|
-
const values = value.map((val) => val.value.replace(
|
|
68
|
+
const values = value.map((val) => val.value.replace(/^"(.+)"$/, "$1"));
|
|
68
69
|
return {
|
|
69
|
-
control: { type:
|
|
70
|
+
control: { type: values?.length <= 5 ? "radio" : "select" },
|
|
70
71
|
options: values,
|
|
71
72
|
};
|
|
72
73
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Body: import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>, "key" | keyof import("react").HTMLAttributes<HTMLBodyElement>> & import("react").RefAttributes<HTMLBodyElement>>;
|
|
3
|
+
//# sourceMappingURL=body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../src/components/body.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,IAAI,sQAG+B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Body = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const defaultTag = "body";
|
|
7
|
+
exports.Body = (0, react_1.forwardRef)((props, ref) => (0, jsx_runtime_1.jsx)("body", { ...props, ref: ref }));
|
|
8
|
+
exports.Body.displayName = "Body";
|