@webstudio-is/react-sdk 0.5.0 → 0.6.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.
Files changed (132) hide show
  1. package/lib/arg-types/utils.d.ts +19 -1
  2. package/lib/arg-types/utils.d.ts.map +1 -1
  3. package/lib/arg-types/utils.js +7 -6
  4. package/lib/canvas/canvas.d.ts +8 -0
  5. package/lib/canvas/canvas.d.ts.map +1 -0
  6. package/lib/canvas/canvas.js +13 -0
  7. package/lib/canvas/index.d.ts +2 -0
  8. package/lib/canvas/index.d.ts.map +1 -0
  9. package/lib/canvas/index.js +17 -0
  10. package/lib/components/body.d.ts +3 -0
  11. package/lib/components/body.d.ts.map +1 -0
  12. package/lib/components/body.js +8 -0
  13. package/lib/components/body.props.json +2234 -0
  14. package/lib/components/body.stories.d.ts +7 -0
  15. package/lib/components/body.stories.d.ts.map +1 -0
  16. package/lib/components/body.stories.js +16 -0
  17. package/lib/components/body.ws.d.ts +5 -0
  18. package/lib/components/body.ws.d.ts.map +1 -0
  19. package/lib/components/body.ws.js +64 -0
  20. package/lib/components/bold.props.json +37 -7
  21. package/lib/components/bold.ws.d.ts +5 -0
  22. package/lib/components/bold.ws.d.ts.map +1 -0
  23. package/lib/components/bold.ws.js +14 -0
  24. package/lib/components/box.d.ts +7 -2
  25. package/lib/components/box.d.ts.map +1 -1
  26. package/lib/components/box.js +3 -2
  27. package/lib/components/box.props.json +102 -7
  28. package/lib/components/box.stories.d.ts +6 -2
  29. package/lib/components/box.stories.d.ts.map +1 -1
  30. package/lib/components/box.ws.d.ts +5 -0
  31. package/lib/components/box.ws.d.ts.map +1 -0
  32. package/lib/components/box.ws.js +21 -0
  33. package/lib/components/button.d.ts +1 -4
  34. package/lib/components/button.d.ts.map +1 -1
  35. package/lib/components/button.props.json +42 -8
  36. package/lib/components/button.ws.d.ts +5 -0
  37. package/lib/components/button.ws.d.ts.map +1 -0
  38. package/lib/components/button.ws.js +15 -0
  39. package/lib/components/component-type.d.ts +17 -0
  40. package/lib/components/component-type.d.ts.map +1 -0
  41. package/lib/components/component-type.js +28 -0
  42. package/lib/components/form.props.json +37 -7
  43. package/lib/components/form.ws.d.ts +5 -0
  44. package/lib/components/form.ws.d.ts.map +1 -0
  45. package/lib/components/form.ws.js +26 -0
  46. package/lib/components/heading.d.ts +2 -2
  47. package/lib/components/heading.d.ts.map +1 -1
  48. package/lib/components/heading.js +1 -4
  49. package/lib/components/heading.props.json +45 -8
  50. package/lib/components/heading.stories.d.ts +2 -2
  51. package/lib/components/heading.ws.d.ts +5 -0
  52. package/lib/components/heading.ws.d.ts.map +1 -0
  53. package/lib/components/heading.ws.js +15 -0
  54. package/lib/components/index.d.ts +11 -10
  55. package/lib/components/index.d.ts.map +1 -1
  56. package/lib/components/index.js +25 -23
  57. package/lib/components/index.test.d.ts +2 -0
  58. package/lib/components/index.test.d.ts.map +1 -0
  59. package/lib/components/index.test.js +33 -0
  60. package/lib/components/input.props.json +46 -8
  61. package/lib/components/input.ws.d.ts +5 -0
  62. package/lib/components/input.ws.d.ts.map +1 -0
  63. package/lib/components/input.ws.js +14 -0
  64. package/lib/components/italic.props.json +37 -7
  65. package/lib/components/italic.ws.d.ts +5 -0
  66. package/lib/components/italic.ws.d.ts.map +1 -0
  67. package/lib/components/italic.ws.js +14 -0
  68. package/lib/components/link.d.ts +2 -2
  69. package/lib/components/link.d.ts.map +1 -1
  70. package/lib/components/link.props.json +37 -7
  71. package/lib/components/link.stories.d.ts +6 -2
  72. package/lib/components/link.stories.d.ts.map +1 -1
  73. package/lib/components/link.ws.d.ts +5 -0
  74. package/lib/components/link.ws.d.ts.map +1 -0
  75. package/lib/components/link.ws.js +27 -0
  76. package/lib/components/meta.d.ts +1 -0
  77. package/lib/components/meta.d.ts.map +1 -1
  78. package/lib/components/meta.js +3 -1
  79. package/lib/components/paragraph.props.json +37 -7
  80. package/lib/components/paragraph.ws.d.ts +5 -0
  81. package/lib/components/paragraph.ws.d.ts.map +1 -0
  82. package/lib/components/paragraph.ws.js +15 -0
  83. package/lib/components/text-block.props.json +37 -7
  84. package/lib/components/text-block.ws.d.ts +5 -0
  85. package/lib/components/text-block.ws.d.ts.map +1 -0
  86. package/lib/components/text-block.ws.js +23 -0
  87. package/lib/css/categories.d.ts +1 -1
  88. package/lib/css/categories.js +1 -1
  89. package/lib/css/get-browser-style.js +1 -1
  90. package/lib/css/keyword-values.d.ts.map +1 -1
  91. package/lib/css/keyword-values.js +1149 -396
  92. package/lib/css/properties.d.ts +6 -4
  93. package/lib/css/properties.d.ts.map +1 -1
  94. package/lib/css/properties.js +3196 -3194
  95. package/lib/css/units.js +1 -1
  96. package/lib/db/instance.d.ts +5 -2
  97. package/lib/db/instance.d.ts.map +1 -1
  98. package/lib/db/instance.js +9 -1
  99. package/lib/db/types.d.ts +1 -2
  100. package/lib/db/types.d.ts.map +1 -1
  101. package/lib/index.d.ts +1 -0
  102. package/lib/index.d.ts.map +1 -1
  103. package/lib/index.js +1 -0
  104. package/lib/pubsub/create.d.ts +28 -0
  105. package/lib/pubsub/create.d.ts.map +1 -0
  106. package/lib/pubsub/create.js +58 -0
  107. package/lib/pubsub/index.d.ts +1 -2
  108. package/lib/pubsub/index.d.ts.map +1 -1
  109. package/lib/pubsub/index.js +1 -2
  110. package/lib/stitches/css.d.ts.map +1 -1
  111. package/lib/stitches/css.js +1 -0
  112. package/lib/stitches/to-css.js +2 -3
  113. package/lib/tree/create-elements-tree.d.ts.map +1 -1
  114. package/lib/tree/create-elements-tree.js +43 -12
  115. package/lib/tree/root.d.ts +1 -1
  116. package/lib/tree/root.d.ts.map +1 -1
  117. package/lib/tree/root.js +6 -6
  118. package/lib/tree/wrapper-component.js +2 -2
  119. package/lib/user-props/all-user-props.d.ts.map +1 -1
  120. package/lib/user-props/all-user-props.js +5 -4
  121. package/lib/user-props/use-user-props.js +1 -1
  122. package/package.json +13 -14
  123. package/lib/prisma.server.d.ts +0 -3
  124. package/lib/prisma.server.d.ts.map +0 -1
  125. package/lib/prisma.server.js +0 -8
  126. package/lib/pubsub/publish.d.ts +0 -17
  127. package/lib/pubsub/publish.d.ts.map +0 -1
  128. package/lib/pubsub/publish.js +0 -27
  129. package/lib/pubsub/subscribe.d.ts +0 -8
  130. package/lib/pubsub/subscribe.d.ts.map +0 -1
  131. package/lib/pubsub/subscribe.js +0 -31
  132. package/prisma/schema.prisma +0 -71
@@ -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) => any;
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,QAeF,CAAC;AAOF,eAAO,MAAM,iBAAiB,aAAc,QAAQ,KAAG,GAiDtD,CAAC"}
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"}
@@ -12,9 +12,11 @@ const validAttributes = (prop) => {
12
12
  return true;
13
13
  };
14
14
  const propsToArgTypes = (props, filter) => {
15
- const filterFn = filter !== null && filter !== void 0 ? filter : validAttributes;
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: (_a = propItem.defaultValue) === null || _a === void 0 ? void 0 : _a.value,
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 === null || type === void 0 ? void 0 : type.name) {
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(/^\"(.+)\"$/, "$1"));
68
+ const values = value.map((val) => val.value.replace(/^"(.+)"$/, "$1"));
68
69
  return {
69
- control: { type: (values === null || values === void 0 ? void 0 : values.length) <= 5 ? "radio" : "select" },
70
+ control: { type: values?.length <= 5 ? "radio" : "select" },
70
71
  options: values,
71
72
  };
72
73
  }
@@ -0,0 +1,8 @@
1
+ import { Outlet as DefaultOutlet } from "@remix-run/react";
2
+ /**
3
+ * We are using Outlet prop from index layout when user renders site from a subdomain.
4
+ */
5
+ export declare const Root: ({ Outlet, }: {
6
+ Outlet: typeof DefaultOutlet;
7
+ }) => JSX.Element;
8
+ //# sourceMappingURL=canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/canvas/canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGxE;;GAEG;AACH,eAAO,MAAM,IAAI;YAGP,oBAAoB;iBAgB7B,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Root = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@remix-run/react");
6
+ const __1 = require("..");
7
+ /**
8
+ * We are using Outlet prop from index layout when user renders site from a subdomain.
9
+ */
10
+ const Root = ({ Outlet = react_1.Outlet, }) => {
11
+ return ((0, jsx_runtime_1.jsxs)("html", { lang: "en", children: [(0, jsx_runtime_1.jsxs)("head", { children: [(0, jsx_runtime_1.jsx)("meta", { charSet: "utf-8" }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width,initial-scale=1" }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", href: "/favicon.ico", type: "image/x-icon" }), (0, jsx_runtime_1.jsx)("link", { rel: "shortcut icon", href: "/favicon.ico", type: "image/x-icon" }), (0, jsx_runtime_1.jsx)(react_1.Meta, {}), (0, jsx_runtime_1.jsx)(react_1.Links, {}), (0, jsx_runtime_1.jsx)(__1.CriticalCss, {})] }), (0, jsx_runtime_1.jsx)(Outlet, {})] }));
12
+ };
13
+ exports.Root = Root;
@@ -0,0 +1,2 @@
1
+ export * from "./canvas";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canvas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./canvas"), exports);
@@ -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";