@webstudio-is/react-sdk 0.6.1 → 0.7.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 (155) hide show
  1. package/lib/arg-types/utils.d.ts +1 -8
  2. package/lib/arg-types/utils.d.ts.map +1 -1
  3. package/lib/arg-types/utils.js +18 -7
  4. package/lib/component-utils/image.d.ts +107 -0
  5. package/lib/component-utils/image.d.ts.map +1 -0
  6. package/lib/component-utils/image.js +198 -0
  7. package/lib/component-utils/image.test.d.ts +2 -0
  8. package/lib/component-utils/image.test.d.ts.map +1 -0
  9. package/lib/component-utils/image.test.js +132 -0
  10. package/lib/components/body.props.json +8 -37
  11. package/lib/components/bold.props.json +8 -37
  12. package/lib/components/box.props.json +9 -40
  13. package/lib/components/button.props.json +10 -45
  14. package/lib/components/component-type.d.ts +2 -2
  15. package/lib/components/component-type.d.ts.map +1 -1
  16. package/lib/components/component-type.js +2 -2
  17. package/lib/components/form.props.json +8 -37
  18. package/lib/components/heading.props.json +10 -48
  19. package/lib/components/image-dev.stories.d.ts +36 -0
  20. package/lib/components/image-dev.stories.d.ts.map +1 -0
  21. package/lib/components/image-dev.stories.js +102 -0
  22. package/lib/components/image.d.ts +11 -0
  23. package/lib/components/image.d.ts.map +1 -0
  24. package/lib/components/image.js +52 -0
  25. package/lib/components/image.props.json +2578 -0
  26. package/lib/components/image.stories.d.ts +14 -0
  27. package/lib/components/image.stories.d.ts.map +1 -0
  28. package/lib/components/image.stories.js +17 -0
  29. package/lib/components/image.ws.d.ts +5 -0
  30. package/lib/components/image.ws.d.ts.map +1 -0
  31. package/lib/components/image.ws.js +29 -0
  32. package/lib/components/index.d.ts +4 -0
  33. package/lib/components/index.d.ts.map +1 -1
  34. package/lib/components/index.js +9 -1
  35. package/lib/components/index.test.js +1 -1
  36. package/lib/components/input.props.json +9 -46
  37. package/lib/components/italic.props.json +8 -37
  38. package/lib/components/link.d.ts +1 -1
  39. package/lib/components/link.props.json +9 -40
  40. package/lib/components/link.stories.d.ts +2 -2
  41. package/lib/components/meta.d.ts +4 -0
  42. package/lib/components/meta.d.ts.map +1 -1
  43. package/lib/components/meta.js +9 -1
  44. package/lib/components/paragraph.props.json +8 -37
  45. package/lib/components/span.d.ts +3 -0
  46. package/lib/components/span.d.ts.map +1 -0
  47. package/lib/components/span.js +8 -0
  48. package/lib/components/span.props.json +2205 -0
  49. package/lib/components/span.stories.d.ts +6 -0
  50. package/lib/components/span.stories.d.ts.map +1 -0
  51. package/lib/components/span.stories.js +19 -0
  52. package/lib/components/span.ws.d.ts +5 -0
  53. package/lib/components/span.ws.d.ts.map +1 -0
  54. package/lib/components/span.ws.js +14 -0
  55. package/lib/components/subscript.d.ts +3 -0
  56. package/lib/components/subscript.d.ts.map +1 -0
  57. package/lib/components/subscript.js +8 -0
  58. package/lib/components/subscript.props.json +2205 -0
  59. package/lib/components/subscript.stories.d.ts +6 -0
  60. package/lib/components/subscript.stories.d.ts.map +1 -0
  61. package/lib/components/subscript.stories.js +19 -0
  62. package/lib/components/subscript.ws.d.ts +5 -0
  63. package/lib/components/subscript.ws.d.ts.map +1 -0
  64. package/lib/components/subscript.ws.js +14 -0
  65. package/lib/components/superscript.d.ts +3 -0
  66. package/lib/components/superscript.d.ts.map +1 -0
  67. package/lib/components/superscript.js +8 -0
  68. package/lib/components/superscript.props.json +2205 -0
  69. package/lib/components/superscript.stories.d.ts +6 -0
  70. package/lib/components/superscript.stories.d.ts.map +1 -0
  71. package/lib/components/superscript.stories.js +19 -0
  72. package/lib/components/superscript.ws.d.ts +5 -0
  73. package/lib/components/superscript.ws.d.ts.map +1 -0
  74. package/lib/components/superscript.ws.js +14 -0
  75. package/lib/components/text-block.props.json +8 -37
  76. package/lib/css/breakpoints.d.ts +1 -1
  77. package/lib/css/breakpoints.d.ts.map +1 -1
  78. package/lib/css/categories.d.ts +5 -5
  79. package/lib/css/get-browser-style.d.ts +1 -1
  80. package/lib/css/get-browser-style.d.ts.map +1 -1
  81. package/lib/css/get-browser-style.js +10 -5
  82. package/lib/css/index.d.ts +0 -5
  83. package/lib/css/index.d.ts.map +1 -1
  84. package/lib/css/index.js +0 -5
  85. package/lib/db/instance.d.ts +2 -2
  86. package/lib/db/instance.d.ts.map +1 -1
  87. package/lib/db/instance.js +5 -5
  88. package/lib/index.d.ts +1 -2
  89. package/lib/index.d.ts.map +1 -1
  90. package/lib/index.js +1 -2
  91. package/lib/pubsub/create.d.ts +1 -0
  92. package/lib/pubsub/create.d.ts.map +1 -1
  93. package/lib/pubsub/create.js +8 -0
  94. package/lib/remix/handle-request.server.d.ts +3 -0
  95. package/lib/remix/handle-request.server.d.ts.map +1 -0
  96. package/lib/remix/handle-request.server.js +15 -0
  97. package/lib/remix/index.d.ts +3 -0
  98. package/lib/remix/index.d.ts.map +1 -0
  99. package/lib/{canvas → remix}/index.js +2 -1
  100. package/lib/{canvas/canvas.d.ts → remix/root.d.ts} +1 -1
  101. package/lib/remix/root.d.ts.map +1 -0
  102. package/lib/{canvas/canvas.js → remix/root.js} +2 -2
  103. package/lib/tree/create-elements-tree.d.ts +7 -11
  104. package/lib/tree/create-elements-tree.d.ts.map +1 -1
  105. package/lib/tree/create-elements-tree.js +5 -10
  106. package/lib/tree/root.d.ts +6 -4
  107. package/lib/tree/root.d.ts.map +1 -1
  108. package/lib/tree/root.js +1 -10
  109. package/lib/tree/session-storage-polyfill.d.ts +2 -0
  110. package/lib/tree/session-storage-polyfill.d.ts.map +1 -0
  111. package/lib/tree/session-storage-polyfill.js +39 -0
  112. package/lib/tree/wrapper-component.d.ts +4 -4
  113. package/lib/tree/wrapper-component.d.ts.map +1 -1
  114. package/lib/tree/wrapper-component.js +5 -5
  115. package/lib/user-props/schema.d.ts +3 -2
  116. package/lib/user-props/schema.d.ts.map +1 -1
  117. package/lib/user-props/schema.js +3 -3
  118. package/lib/user-props/types.d.ts +1 -3
  119. package/lib/user-props/types.d.ts.map +1 -1
  120. package/lib/user-props/use-user-props.d.ts +1 -1
  121. package/lib/user-props/use-user-props.d.ts.map +1 -1
  122. package/package.json +23 -14
  123. package/lib/canvas/canvas.d.ts.map +0 -1
  124. package/lib/canvas/index.d.ts +0 -2
  125. package/lib/canvas/index.d.ts.map +0 -1
  126. package/lib/css/keyword-values.d.ts +0 -302
  127. package/lib/css/keyword-values.d.ts.map +0 -1
  128. package/lib/css/keyword-values.js +0 -7372
  129. package/lib/css/properties.d.ts +0 -3199
  130. package/lib/css/properties.d.ts.map +0 -1
  131. package/lib/css/properties.js +0 -3202
  132. package/lib/css/schema.d.ts +0 -151
  133. package/lib/css/schema.d.ts.map +0 -1
  134. package/lib/css/schema.js +0 -38
  135. package/lib/css/types.d.ts +0 -15
  136. package/lib/css/types.d.ts.map +0 -1
  137. package/lib/css/types.js +0 -2
  138. package/lib/css/units.d.ts +0 -2
  139. package/lib/css/units.d.ts.map +0 -1
  140. package/lib/css/units.js +0 -35
  141. package/lib/stitches/critical-css.d.ts +0 -4
  142. package/lib/stitches/critical-css.d.ts.map +0 -1
  143. package/lib/stitches/critical-css.js +0 -12
  144. package/lib/stitches/css.d.ts +0 -9
  145. package/lib/stitches/css.d.ts.map +0 -1
  146. package/lib/stitches/css.js +0 -33
  147. package/lib/stitches/index.d.ts +0 -4
  148. package/lib/stitches/index.d.ts.map +0 -1
  149. package/lib/stitches/index.js +0 -19
  150. package/lib/stitches/to-css.d.ts +0 -8
  151. package/lib/stitches/to-css.d.ts.map +0 -1
  152. package/lib/stitches/to-css.js +0 -43
  153. package/lib/stitches/to-css.test.d.ts +0 -2
  154. package/lib/stitches/to-css.test.d.ts.map +0 -1
  155. package/lib/stitches/to-css.test.js +0 -63
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/tree/root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAE7B,oBAAY,IAAI,GAAG;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,YAAY,cAIvB,CAAC;AAEH,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,GAAG,CAAC,OAAO,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,YAAY,yBAGtB,SAAS,KAAG,WAAW,GAAG,IAY5B,CAAC"}
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/tree/root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,oBAAY,IAAI,GAAG;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CACtB,CAAC;AAEF,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC;CAC7E,CAAC;AAEF,eAAO,MAAM,YAAY,yBAGtB,SAAS,KAAG,WAAW,GAAG,IAS5B,CAAC"}
package/lib/tree/root.js CHANGED
@@ -1,25 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InstanceRoot = exports.globalStyles = void 0;
3
+ exports.InstanceRoot = void 0;
4
4
  const user_props_1 = require("../user-props/");
5
- const stitches_1 = require("../stitches");
6
5
  const create_elements_tree_1 = require("./create-elements-tree");
7
6
  const wrapper_component_1 = require("./wrapper-component");
8
- exports.globalStyles = (0, stitches_1.globalCss)({
9
- html: {
10
- height: "100%",
11
- },
12
- });
13
7
  const InstanceRoot = ({ data, Component, }) => {
14
8
  if (data.tree === null) {
15
9
  throw new Error("Tree is null");
16
10
  }
17
- (0, stitches_1.setBreakpoints)(data.breakpoints);
18
- (0, exports.globalStyles)();
19
11
  (0, user_props_1.useAllUserProps)(data.props);
20
12
  return (0, create_elements_tree_1.createElementsTree)({
21
13
  instance: data.tree.root,
22
- breakpoints: data.breakpoints,
23
14
  Component: Component ?? wrapper_component_1.WrapperComponent,
24
15
  });
25
16
  };
@@ -0,0 +1,2 @@
1
+ export declare const SessionStoragePolyfill: () => JSX.Element;
2
+ //# sourceMappingURL=session-storage-polyfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-storage-polyfill.d.ts","sourceRoot":"","sources":["../../src/tree/session-storage-polyfill.tsx"],"names":[],"mappings":"AA4CA,eAAO,MAAM,sBAAsB,mBAKlC,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionStoragePolyfill = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ // This is a temporary work around for https://github.com/remix-run/remix/issues/3659
6
+ // The code is based on this discussion https://bugs.chromium.org/p/chromium/issues/detail?id=357625
7
+ const polyfill = function () {
8
+ try {
9
+ const key = "__session_storage_availability_test__";
10
+ sessionStorage.setItem(key, "test"); // test
11
+ sessionStorage.removeItem(key); // cleanup
12
+ }
13
+ catch (error) {
14
+ alert('It looks like you have disabled cookies in your browser. Webstudio designer may not work properly.\n\nTo enable cookies, go to "Setting" > "Privacy and security" > "Cookies and other site data", and make sure neither "Block all cookies" nor "Block third-party cookies" are selected.\n\nRead more at https://support.google.com/chrome/answer/95647');
15
+ const data = new Map();
16
+ Object.defineProperty(window, "sessionStorage", {
17
+ value: {
18
+ setItem: (key, val) => {
19
+ // eslint-disable-next-line no-console
20
+ console.warn(`Session storage is unavailable due to Error "${error.message}". A polyfill is used to set value of "${key}". The value will be lost when the page is reloaded.`);
21
+ data.set(key, String(val));
22
+ },
23
+ getItem: (key) => {
24
+ // eslint-disable-next-line no-console
25
+ console.warn(`Session storage is unavailable due to Error "${error.message}". A polyfill is used to get value of "${key}". The value will be undefined if the page was reloaded after it was set.`);
26
+ return data.get(key);
27
+ },
28
+ removeItem: (key) => {
29
+ data.delete(key);
30
+ },
31
+ clear: () => {
32
+ data.clear();
33
+ },
34
+ },
35
+ });
36
+ }
37
+ }.toString();
38
+ const SessionStoragePolyfill = () => ((0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: { __html: `(${polyfill})()` }, suppressHydrationWarning: true }));
39
+ exports.SessionStoragePolyfill = SessionStoragePolyfill;
@@ -1,12 +1,12 @@
1
1
  import type { Instance } from "../db";
2
- import { type CSS } from "../stitches";
3
2
  import type { OnChangeChildren } from "./create-elements-tree";
4
3
  export declare const renderWrapperComponentChildren: (children: Array<JSX.Element | string> | undefined) => Array<JSX.Element | string | Array<JSX.Element | string>> | undefined;
5
- export declare type WrapperComponentProps = {
4
+ declare type WrapperComponentProps = {
6
5
  instance: Instance;
7
- css: CSS;
8
6
  children: Array<JSX.Element | string>;
9
7
  onChangeChildren?: OnChangeChildren;
10
8
  };
11
- export declare const WrapperComponent: ({ instance, css, onChangeChildren, children, ...rest }: WrapperComponentProps) => JSX.Element;
9
+ export declare const WrapperComponent: ({ instance, onChangeChildren, children, ...rest }: WrapperComponentProps) => JSX.Element;
10
+ export declare const idAttribute = "data-ws-id";
11
+ export {};
12
12
  //# sourceMappingURL=wrapper-component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper-component.d.ts","sourceRoot":"","sources":["../../src/tree/wrapper-component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,KAAK,GAAG,EAAoB,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAY/D,eAAO,MAAM,8BAA8B,aAC/B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,SAAS,KAChD,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,GAAG,SAO9D,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,2DAM1B,qBAAqB,gBASvB,CAAC"}
1
+ {"version":3,"file":"wrapper-component.d.ts","sourceRoot":"","sources":["../../src/tree/wrapper-component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAY/D,eAAO,MAAM,8BAA8B,aAC/B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,SAAS,KAChD,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,GAAG,SAO9D,CAAC;AAEF,aAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAK1B,qBAAqB,gBAOvB,CAAC;AAEF,eAAO,MAAM,WAAW,eAAe,CAAC"}
@@ -23,12 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.WrapperComponent = exports.renderWrapperComponentChildren = void 0;
26
+ exports.idAttribute = exports.WrapperComponent = exports.renderWrapperComponentChildren = void 0;
27
27
  const jsx_runtime_1 = require("react/jsx-runtime");
28
28
  const react_1 = require("react");
29
29
  const components = __importStar(require("../components"));
30
30
  const use_user_props_1 = require("../user-props/use-user-props");
31
- const stitches_1 = require("../stitches");
32
31
  const renderText = (text) => {
33
32
  const lines = text.split("\n");
34
33
  return lines.map((line, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [line, index < lines.length - 1 ? (0, jsx_runtime_1.jsx)("br", {}) : null] }, index)));
@@ -43,11 +42,12 @@ const renderWrapperComponentChildren = (children) => {
43
42
  });
44
43
  };
45
44
  exports.renderWrapperComponentChildren = renderWrapperComponentChildren;
46
- const WrapperComponent = ({ instance, css, onChangeChildren, // prevent it from passing to sdk component
45
+ const WrapperComponent = ({ instance, onChangeChildren, // prevent it from passing to sdk component
47
46
  children, ...rest }) => {
48
- const className = (0, react_1.useMemo)(() => (0, stitches_1.css)(css)(), [css]);
49
47
  const { Component } = components[instance.component];
50
48
  const userProps = (0, use_user_props_1.useUserProps)(instance.id);
51
- return ((0, jsx_runtime_1.jsx)(Component, { ...userProps, ...rest, id: instance.id, className: className, children: (0, exports.renderWrapperComponentChildren)(children) }));
49
+ const props = { ...userProps, ...rest, [exports.idAttribute]: instance.id };
50
+ return ((0, jsx_runtime_1.jsx)(Component, { ...props, children: (0, exports.renderWrapperComponentChildren)(children) }));
52
51
  };
53
52
  exports.WrapperComponent = WrapperComponent;
53
+ exports.idAttribute = "data-ws-id";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const UserPropSchema: z.ZodObject<{
2
+ export declare const UserProp: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  prop: z.ZodString;
5
5
  value: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
@@ -15,7 +15,8 @@ export declare const UserPropSchema: z.ZodObject<{
15
15
  id: string;
16
16
  prop: string;
17
17
  }>;
18
- export declare const UserPropsSchema: z.ZodArray<z.ZodObject<{
18
+ export declare type UserProp = z.infer<typeof UserProp>;
19
+ export declare const UserProps: z.ZodArray<z.ZodObject<{
19
20
  id: z.ZodString;
20
21
  prop: z.ZodString;
21
22
  value: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/user-props/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;WAA0B,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/user-props/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;EAKnB,CAAC;AAEH,oBAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;WAAoB,CAAC"}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserPropsSchema = exports.UserPropSchema = void 0;
3
+ exports.UserProps = exports.UserProp = void 0;
4
4
  const zod_1 = require("zod");
5
- exports.UserPropSchema = zod_1.z.object({
5
+ exports.UserProp = zod_1.z.object({
6
6
  id: zod_1.z.string(),
7
7
  prop: zod_1.z.string(),
8
8
  value: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]),
9
9
  required: zod_1.z.optional(zod_1.z.boolean()),
10
10
  });
11
- exports.UserPropsSchema = zod_1.z.array(exports.UserPropSchema);
11
+ exports.UserProps = zod_1.z.array(exports.UserProp);
@@ -1,7 +1,5 @@
1
- import { z } from "zod";
2
1
  import type { InstanceProps, Instance } from "../db";
3
- import { UserPropSchema } from "./schema";
4
- export declare type UserProp = z.infer<typeof UserPropSchema>;
2
+ import { UserProp } from "./schema";
5
3
  export declare type UserPropsUpdates = {
6
4
  treeId: InstanceProps["treeId"];
7
5
  propsId: InstanceProps["id"];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/user-props/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,oBAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,oBAAY,gBAAgB,GAAG;IAC7B,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC1B,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/user-props/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,oBAAY,gBAAgB,GAAG;IAC7B,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC1B,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type Instance } from "../db";
2
- import { type UserProp } from "./types";
2
+ import { type UserProp } from "./schema";
3
3
  declare type UserProps = {
4
4
  [prop: UserProp["prop"]]: UserProp["value"];
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-user-props.d.ts","sourceRoot":"","sources":["../../src/user-props/use-user-props.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,aAAK,SAAS,GAAG;IAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,YAAY,eAAgB,QAAQ,CAAC,IAAI,CAAC,cAuBtD,CAAC"}
1
+ {"version":3,"file":"use-user-props.d.ts","sourceRoot":"","sources":["../../src/user-props/use-user-props.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,aAAK,SAAS,GAAG;IAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,YAAY,eAAgB,QAAQ,CAAC,IAAI,CAAC,cAuBtD,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
7
7
  "scripts": {
8
- "dev": "tsup src/index.ts --format esm,cjs --watch --out-dir=lib",
9
- "build": "yarn build:mdn-data && yarn build:args && yarn build:lib",
10
- "build:mdn-data": "tsx ./bin/mdn-data.ts ./src/css",
8
+ "dev": "tsup --watch",
9
+ "build": "yarn build:lib",
11
10
  "build:args": "tsx ./bin/generate-arg-types.ts './src/components/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx'",
12
11
  "typecheck": "tsc --noEmit",
13
- "build:lib": "rm -fr lib && tsc",
12
+ "build:lib": "rm -fr lib tsconfig.tsbuildinfo && tsc",
14
13
  "test": "jest",
15
14
  "lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
16
15
  "checks": "yarn typecheck && yarn lint && yarn test",
@@ -23,6 +22,7 @@
23
22
  "@esbuild-kit/esm-loader": "^2.4.2",
24
23
  "@remix-run/react": "^1.2.3",
25
24
  "@remix-run/server-runtime": "^1.2.3",
25
+ "remix-utils": "^4.1.0",
26
26
  "@storybook/addon-actions": "^6.5.6",
27
27
  "@storybook/addon-essentials": "^6.5.6",
28
28
  "@storybook/addon-interactions": "^6.5.6",
@@ -31,39 +31,40 @@
31
31
  "@storybook/manager-webpack4": "^6.5.6",
32
32
  "@storybook/react": "^6.5.6",
33
33
  "@storybook/testing-library": "^0.0.11",
34
- "@types/css-tree": "^1.0.7",
35
34
  "@types/fs-extra": "^9.0.13",
36
35
  "@types/node": "^17.0.21",
37
36
  "@webstudio-is/jest-config": "*",
38
37
  "@webstudio-is/prisma-client": "*",
39
38
  "babel-loader": "^8.2.5",
40
- "camelcase": "^6.3.0",
41
- "css-tree": "^2.1.0",
42
39
  "esbuild": "^0.14.25",
43
40
  "esbuild-node-externals": "^1.4.1",
44
- "mdn-data": "2.0.23",
45
41
  "react": "^17.0.2",
46
42
  "react-docgen-typescript": "^2.2.2",
47
43
  "react-dom": "^17.0.2",
48
44
  "tsup": "^6.1.3",
49
45
  "tsx": "^3.9.0",
50
- "typescript": "4.7.4"
46
+ "typescript": "4.7.4",
47
+ "zod": "^3.19.1"
51
48
  },
52
49
  "peerDependencies": {
53
50
  "@remix-run/react": "^1.2.3",
54
51
  "@remix-run/server-runtime": "^1.2.3",
52
+ "remix-utils": "^4.1.0",
55
53
  "@storybook/react": "^6.5.6",
56
54
  "react": "^17.0.2",
57
- "react-dom": "^17.0.2"
55
+ "react-dom": "^17.0.2",
56
+ "zod": "^3.19.1"
58
57
  },
59
58
  "dependencies": {
60
- "@stitches/core": "^1.2.7",
59
+ "@webstudio-is/asset-uploader": "^*",
60
+ "@webstudio-is/fonts": "*",
61
61
  "@webstudio-is/icons": "*",
62
+ "@webstudio-is/css-data": "*",
62
63
  "@webstudio-is/jest-config": "*",
63
64
  "immer": "^9.0.12",
64
65
  "mitt": "^3.0.0",
65
66
  "react-nano-state": "^0.4.0",
66
- "zod": "^3.17.3"
67
+ "warn-once": "^0.1.1"
67
68
  },
68
69
  "main": "lib/index.js",
69
70
  "types": "lib/index.d.ts",
@@ -73,5 +74,13 @@
73
74
  "!*.test.*"
74
75
  ],
75
76
  "license": "MIT",
76
- "private": false
77
+ "private": false,
78
+ "sideEffects": false,
79
+ "tsup": {
80
+ "entry": [
81
+ "src/index.ts"
82
+ ],
83
+ "format": "cjs",
84
+ "outDir": "lib"
85
+ }
77
86
  }
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export * from "./canvas";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canvas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}