@webstudio-is/react-sdk 0.8.0 → 0.9.0
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/app/custom-components/image.d.ts +9 -0
- package/lib/app/custom-components/image.d.ts.map +1 -0
- package/lib/app/custom-components/image.js +24 -0
- package/lib/app/custom-components/index.d.ts +2 -0
- package/lib/app/custom-components/index.d.ts.map +1 -0
- package/lib/app/custom-components/index.js +1 -0
- package/lib/{cjs/remix → app}/handle-request.server.d.ts +0 -0
- package/lib/app/handle-request.server.d.ts.map +1 -0
- package/lib/{remix → app}/handle-request.server.js +0 -0
- package/lib/{cjs/remix → app}/index.d.ts +1 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/{remix → app}/index.js +1 -0
- package/lib/app/params.d.ts +6 -0
- package/lib/app/params.d.ts.map +1 -0
- package/lib/app/params.js +6 -0
- package/lib/{cjs/remix → app}/root.d.ts +1 -0
- package/lib/app/root.d.ts.map +1 -0
- package/lib/{remix → app}/root.js +0 -0
- package/lib/cjs/app/custom-components/image.cjs +27 -0
- package/lib/cjs/app/custom-components/image.d.ts +9 -0
- package/lib/cjs/app/custom-components/image.d.ts.map +1 -0
- package/lib/cjs/app/custom-components/index.cjs +27 -0
- package/lib/cjs/app/custom-components/index.d.ts +2 -0
- package/lib/cjs/app/custom-components/index.d.ts.map +1 -0
- package/lib/cjs/{remix → app}/handle-request.server.cjs +0 -0
- package/lib/{remix → cjs/app}/handle-request.server.d.ts +0 -0
- package/lib/cjs/app/handle-request.server.d.ts.map +1 -0
- package/lib/cjs/{remix → app}/index.cjs +1 -0
- package/lib/{remix → cjs/app}/index.d.ts +1 -0
- package/lib/cjs/app/index.d.ts.map +1 -0
- package/lib/cjs/app/params.cjs +11 -0
- package/lib/cjs/app/params.d.ts +6 -0
- package/lib/cjs/app/params.d.ts.map +1 -0
- package/lib/cjs/{remix → app}/root.cjs +0 -0
- package/lib/{remix → cjs/app}/root.d.ts +1 -0
- package/lib/cjs/app/root.d.ts.map +1 -0
- package/lib/cjs/components/{body.props.json → __generated__/body.props.json} +0 -0
- package/lib/cjs/components/{bold.props.json → __generated__/bold.props.json} +0 -0
- package/lib/cjs/components/{box.props.json → __generated__/box.props.json} +0 -0
- package/lib/cjs/components/{button.props.json → __generated__/button.props.json} +0 -0
- package/lib/cjs/components/{form.props.json → __generated__/form.props.json} +0 -0
- package/lib/cjs/components/{heading.props.json → __generated__/heading.props.json} +0 -0
- package/lib/{components → cjs/components/__generated__}/image.props.json +0 -15
- package/lib/cjs/components/{input.props.json → __generated__/input.props.json} +0 -0
- package/lib/cjs/components/{italic.props.json → __generated__/italic.props.json} +0 -0
- package/lib/cjs/components/{link.props.json → __generated__/link.props.json} +0 -0
- package/lib/cjs/components/{paragraph.props.json → __generated__/paragraph.props.json} +0 -0
- package/lib/cjs/components/{span.props.json → __generated__/span.props.json} +0 -0
- package/lib/cjs/components/{subscript.props.json → __generated__/subscript.props.json} +0 -0
- package/lib/cjs/components/{superscript.props.json → __generated__/superscript.props.json} +0 -0
- package/lib/cjs/components/{text-block.props.json → __generated__/text-block.props.json} +0 -0
- package/lib/cjs/components/index.cjs +75 -31
- package/lib/cjs/components/index.d.ts +89 -15
- package/lib/cjs/components/index.d.ts.map +1 -1
- package/lib/cjs/components/index.test.cjs +3 -29
- package/lib/cjs/components/meta.cjs +20 -18
- package/lib/cjs/components/meta.d.ts +1 -16
- package/lib/cjs/components/meta.d.ts.map +1 -1
- package/lib/cjs/css/categories.d.ts +1 -0
- package/lib/cjs/css/categories.d.ts.map +1 -1
- package/lib/cjs/css/get-browser-style.cjs +2 -1
- package/lib/cjs/css/get-browser-style.d.ts.map +1 -1
- package/lib/cjs/db/instance.d.ts +2 -2
- package/lib/cjs/db/instance.d.ts.map +1 -1
- package/lib/cjs/index.cjs +4 -3
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/tree/root.cjs +28 -0
- package/lib/cjs/tree/root.d.ts +2 -0
- package/lib/cjs/tree/root.d.ts.map +1 -1
- package/lib/cjs/tree/session-storage-polyfill.d.ts +1 -0
- package/lib/cjs/tree/session-storage-polyfill.d.ts.map +1 -1
- package/lib/cjs/tree/wrapper-component.cjs +2 -25
- package/lib/cjs/tree/wrapper-component.d.ts +1 -0
- package/lib/cjs/tree/wrapper-component.d.ts.map +1 -1
- package/lib/cjs/user-props/use-user-props-asset.cjs +22 -0
- package/lib/cjs/user-props/use-user-props-asset.d.ts +8 -0
- package/lib/cjs/user-props/use-user-props-asset.d.ts.map +1 -0
- package/lib/cjs/user-props/use-user-props.cjs +2 -12
- package/lib/cjs/user-props/use-user-props.d.ts.map +1 -1
- package/lib/components/{body.props.json → __generated__/body.props.json} +0 -0
- package/lib/components/{bold.props.json → __generated__/bold.props.json} +0 -0
- package/lib/components/{box.props.json → __generated__/box.props.json} +0 -0
- package/lib/components/{button.props.json → __generated__/button.props.json} +0 -0
- package/lib/components/{form.props.json → __generated__/form.props.json} +0 -0
- package/lib/components/{heading.props.json → __generated__/heading.props.json} +0 -0
- package/lib/{cjs/components → components/__generated__}/image.props.json +0 -15
- package/lib/components/{input.props.json → __generated__/input.props.json} +0 -0
- package/lib/components/{italic.props.json → __generated__/italic.props.json} +0 -0
- package/lib/components/{link.props.json → __generated__/link.props.json} +0 -0
- package/lib/components/{paragraph.props.json → __generated__/paragraph.props.json} +0 -0
- package/lib/components/{span.props.json → __generated__/span.props.json} +0 -0
- package/lib/components/{subscript.props.json → __generated__/subscript.props.json} +0 -0
- package/lib/components/{superscript.props.json → __generated__/superscript.props.json} +0 -0
- package/lib/components/{text-block.props.json → __generated__/text-block.props.json} +0 -0
- package/lib/components/index.d.ts +89 -15
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +70 -15
- package/lib/components/index.test.js +3 -6
- package/lib/components/meta.d.ts +1 -16
- package/lib/components/meta.d.ts.map +1 -1
- package/lib/components/meta.js +18 -17
- package/lib/css/categories.d.ts +1 -0
- package/lib/css/categories.d.ts.map +1 -1
- package/lib/css/get-browser-style.d.ts.map +1 -1
- package/lib/css/get-browser-style.js +2 -1
- package/lib/db/instance.d.ts +2 -2
- package/lib/db/instance.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/tree/root.d.ts +2 -0
- package/lib/tree/root.d.ts.map +1 -1
- package/lib/tree/root.js +5 -0
- package/lib/tree/session-storage-polyfill.d.ts +1 -0
- package/lib/tree/session-storage-polyfill.d.ts.map +1 -1
- package/lib/tree/wrapper-component.d.ts +1 -0
- package/lib/tree/wrapper-component.d.ts.map +1 -1
- package/lib/tree/wrapper-component.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/user-props/use-user-props-asset.d.ts +8 -0
- package/lib/user-props/use-user-props-asset.d.ts.map +1 -0
- package/lib/user-props/use-user-props-asset.js +18 -0
- package/lib/user-props/use-user-props.d.ts.map +1 -1
- package/lib/user-props/use-user-props.js +3 -13
- package/package.json +5 -7
- package/lib/arg-types/utils.d.ts +0 -10
- package/lib/arg-types/utils.d.ts.map +0 -1
- package/lib/arg-types/utils.js +0 -83
- package/lib/cjs/arg-types/utils.cjs +0 -88
- package/lib/cjs/arg-types/utils.d.ts +0 -10
- package/lib/cjs/arg-types/utils.d.ts.map +0 -1
- package/lib/cjs/remix/handle-request.server.d.ts.map +0 -1
- package/lib/cjs/remix/index.d.ts.map +0 -1
- package/lib/cjs/remix/root.d.ts.map +0 -1
- package/lib/remix/handle-request.server.d.ts.map +0 -1
- package/lib/remix/index.d.ts.map +0 -1
- package/lib/remix/root.d.ts.map +0 -1
package/lib/tree/root.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import { WrapperComponent } from "./wrapper-component";
|
|
|
3
3
|
import type { Asset } from "@webstudio-is/asset-uploader";
|
|
4
4
|
import { type ComponentProps } from "react";
|
|
5
5
|
import type { Breakpoint } from "@webstudio-is/css-data";
|
|
6
|
+
import { type Params } from "../app/params";
|
|
6
7
|
export declare type Data = {
|
|
7
8
|
tree: Tree | null;
|
|
8
9
|
breakpoints: Array<Breakpoint>;
|
|
9
10
|
props: Array<InstanceProps>;
|
|
10
11
|
assets: Array<Asset>;
|
|
12
|
+
params?: Params;
|
|
11
13
|
};
|
|
12
14
|
declare type RootProps = {
|
|
13
15
|
data: Data;
|
package/lib/tree/root.d.ts.map
CHANGED
|
@@ -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;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;
|
|
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;AAGzD,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvD,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;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,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,IAa5B,CAAC"}
|
package/lib/tree/root.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { useAllUserProps } from "../user-props/";
|
|
2
2
|
import { createElementsTree } from "./create-elements-tree";
|
|
3
3
|
import { WrapperComponent } from "./wrapper-component";
|
|
4
|
+
import { registerComponents } from "../components";
|
|
5
|
+
import * as customComponents from "../app/custom-components";
|
|
6
|
+
import { setParams } from "../app/params";
|
|
4
7
|
export const InstanceRoot = ({ data, Component, }) => {
|
|
5
8
|
if (data.tree === null) {
|
|
6
9
|
throw new Error("Tree is null");
|
|
7
10
|
}
|
|
8
11
|
useAllUserProps(data.props);
|
|
12
|
+
setParams(data.params ?? null);
|
|
13
|
+
registerComponents(customComponents);
|
|
9
14
|
return createElementsTree({
|
|
10
15
|
instance: data.tree.root,
|
|
11
16
|
Component: Component ?? WrapperComponent,
|
|
@@ -1 +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"}
|
|
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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { Instance } from "../db";
|
|
2
3
|
import type { OnChangeChildren } from "./create-elements-tree";
|
|
3
4
|
export declare const renderWrapperComponentChildren: (children: Array<JSX.Element | string> | undefined) => Array<JSX.Element | string | Array<JSX.Element | string>> | undefined;
|
|
@@ -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,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"}
|
|
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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from "react";
|
|
3
|
-
import
|
|
3
|
+
import { getComponent } from "../components";
|
|
4
4
|
import { useUserProps } from "../user-props/use-user-props";
|
|
5
5
|
const renderText = (text) => {
|
|
6
6
|
const lines = text.split("\n");
|
|
@@ -17,7 +17,7 @@ export const renderWrapperComponentChildren = (children) => {
|
|
|
17
17
|
};
|
|
18
18
|
export const WrapperComponent = ({ instance, onChangeChildren, // prevent it from passing to sdk component
|
|
19
19
|
children, ...rest }) => {
|
|
20
|
-
const
|
|
20
|
+
const Component = getComponent(instance.component);
|
|
21
21
|
const userProps = useUserProps(instance.id);
|
|
22
22
|
const props = { ...userProps, ...rest, [idAttribute]: instance.id };
|
|
23
23
|
return (_jsx(Component, { ...props, children: renderWrapperComponentChildren(children) }));
|