@webstudio-is/react-sdk 0.65.0 → 0.67.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/form.ws.js +2 -2
- package/lib/app/custom-components/image.js +7 -13
- package/lib/app/custom-components/index.js +4 -1
- package/lib/app/params.js +1 -0
- package/lib/cjs/app/custom-components/form.ws.js +2 -2
- package/lib/cjs/app/custom-components/image.js +3 -12
- package/lib/cjs/app/custom-components/index.js +4 -1
- package/lib/cjs/app/params.js +1 -0
- package/lib/cjs/components/__generated__/{code.props.js → code-text.props.js} +3 -3
- package/lib/cjs/components/__generated__/html-embed.props.js +31 -0
- package/lib/cjs/components/blockquote.ws.js +2 -2
- package/lib/cjs/components/body.ws.js +2 -2
- package/lib/cjs/components/bold.ws.js +2 -2
- package/lib/cjs/components/box.ws.js +2 -2
- package/lib/cjs/components/button.ws.js +2 -2
- package/lib/cjs/components/checkbox-field.ws.js +2 -2
- package/lib/cjs/components/checkbox.ws.js +2 -2
- package/lib/cjs/components/{code.js → code-text.js} +6 -6
- package/lib/cjs/components/{code.ws.js → code-text.ws.js} +10 -10
- package/lib/cjs/components/component-meta.js +2 -2
- package/lib/cjs/components/components-utils.js +1 -43
- package/lib/cjs/components/components.js +4 -2
- package/lib/cjs/components/error-message.ws.js +2 -2
- package/lib/cjs/components/form.ws.js +2 -2
- package/lib/cjs/components/fragment.ws.js +1 -1
- package/lib/cjs/components/heading.ws.js +2 -2
- package/lib/cjs/components/html-embed.js +80 -0
- package/lib/cjs/components/html-embed.ws.js +43 -0
- package/lib/cjs/components/image.ws.js +2 -2
- package/lib/cjs/components/index.js +11 -57
- package/lib/cjs/components/input.ws.js +2 -2
- package/lib/cjs/components/italic.ws.js +2 -2
- package/lib/cjs/components/label.ws.js +2 -2
- package/lib/cjs/components/link-block.ws.js +2 -2
- package/lib/cjs/components/link.ws.js +2 -2
- package/lib/cjs/components/list-item.ws.js +2 -2
- package/lib/cjs/components/list.ws.js +2 -2
- package/lib/cjs/components/paragraph.ws.js +2 -2
- package/lib/cjs/components/radio-button-field.ws.js +2 -2
- package/lib/cjs/components/radio-button.ws.js +2 -2
- package/lib/cjs/components/separator.ws.js +2 -2
- package/lib/cjs/components/slot.ws.js +2 -2
- package/lib/cjs/components/span.ws.js +2 -2
- package/lib/cjs/components/subscript.ws.js +2 -2
- package/lib/cjs/components/success-message.ws.js +2 -2
- package/lib/cjs/components/superscript.ws.js +2 -2
- package/lib/cjs/components/text-block.ws.js +2 -2
- package/lib/cjs/components/textarea.ws.js +2 -2
- package/lib/cjs/css/css.js +2 -5
- package/lib/cjs/css/normalize.js +1 -1
- package/lib/cjs/css/presets.js +8 -1
- package/lib/cjs/tree/create-elements-tree.js +2 -4
- package/lib/components/__generated__/html-embed.props.js +11 -0
- package/lib/components/blockquote.ws.js +2 -2
- package/lib/components/body.ws.js +2 -2
- package/lib/components/bold.ws.js +2 -2
- package/lib/components/box.ws.js +2 -2
- package/lib/components/button.ws.js +2 -2
- package/lib/components/checkbox-field.ws.js +2 -2
- package/lib/components/checkbox.ws.js +2 -2
- package/lib/components/{code.js → code-text.js} +3 -3
- package/lib/components/{code.ws.js → code-text.ws.js} +5 -5
- package/lib/components/component-meta.js +3 -3
- package/lib/components/components-utils.js +1 -43
- package/lib/components/components.js +4 -2
- package/lib/components/error-message.ws.js +2 -2
- package/lib/components/form.ws.js +2 -2
- package/lib/components/fragment.ws.js +1 -1
- package/lib/components/heading.ws.js +2 -2
- package/lib/components/html-embed.js +65 -0
- package/lib/components/html-embed.ws.js +23 -0
- package/lib/components/image.ws.js +2 -2
- package/lib/components/index.js +11 -57
- package/lib/components/input.ws.js +2 -2
- package/lib/components/italic.ws.js +2 -2
- package/lib/components/label.ws.js +2 -2
- package/lib/components/link-block.ws.js +2 -2
- package/lib/components/link.ws.js +2 -2
- package/lib/components/list-item.ws.js +2 -2
- package/lib/components/list.ws.js +2 -2
- package/lib/components/paragraph.ws.js +2 -2
- package/lib/components/radio-button-field.ws.js +2 -2
- package/lib/components/radio-button.ws.js +2 -2
- package/lib/components/separator.ws.js +2 -2
- package/lib/components/slot.ws.js +2 -2
- package/lib/components/span.ws.js +2 -2
- package/lib/components/subscript.ws.js +2 -2
- package/lib/components/success-message.ws.js +2 -2
- package/lib/components/superscript.ws.js +2 -2
- package/lib/components/text-block.ws.js +2 -2
- package/lib/components/textarea.ws.js +2 -2
- package/lib/css/css.js +2 -5
- package/lib/css/normalize.js +2 -2
- package/lib/css/presets.js +8 -1
- package/lib/tree/create-elements-tree.js +2 -4
- package/lib/types/app/params.d.ts +22 -1
- package/lib/types/components/__generated__/html-embed.props.d.ts +2 -0
- package/lib/types/components/{code.d.ts → code-text.d.ts} +1 -1
- package/lib/types/components/{code.stories.d.ts → code-text.stories.d.ts} +1 -1
- package/lib/types/components/component-meta.d.ts +1785 -10
- package/lib/types/components/components-utils.d.ts +6 -3
- package/lib/types/components/components.d.ts +2 -1
- package/lib/types/components/html-embed.d.ts +7 -0
- package/lib/types/components/html-embed.stories.d.ts +11 -0
- package/lib/types/components/html-embed.ws.d.ts +3 -0
- package/lib/types/components/index.d.ts +2 -2
- package/lib/types/context.d.ts +1 -0
- package/lib/types/css/css.d.ts +2 -0
- package/lib/types/css/presets.d.ts +1 -0
- package/lib/types/css/style-rules.d.ts +1 -1
- package/lib/types/embed-template.d.ts +1 -1
- package/lib/types/tree/create-elements-tree.d.ts +2 -2
- package/package.json +14 -13
- package/src/app/custom-components/form.ws.tsx +2 -2
- package/src/app/custom-components/image.tsx +7 -13
- package/src/app/custom-components/index.ts +4 -1
- package/src/app/params.ts +23 -1
- package/src/components/__generated__/html-embed.props.ts +10 -0
- package/src/components/blockquote.ws.tsx +2 -2
- package/src/components/body.ws.tsx +2 -2
- package/src/components/bold.ws.tsx +2 -2
- package/src/components/box.ws.ts +2 -2
- package/src/components/button.ws.tsx +2 -2
- package/src/components/checkbox-field.ws.tsx +2 -2
- package/src/components/checkbox.ws.tsx +2 -2
- package/src/components/code-text.stories.tsx +16 -0
- package/src/components/{code.tsx → code-text.tsx} +2 -2
- package/src/components/{code.ws.tsx → code-text.ws.tsx} +5 -5
- package/src/components/component-meta.ts +3 -6
- package/src/components/components-utils.ts +14 -58
- package/src/components/components.ts +2 -1
- package/src/components/error-message.ws.tsx +2 -2
- package/src/components/form.ws.tsx +2 -2
- package/src/components/fragment.ws.ts +1 -1
- package/src/components/heading.ws.tsx +2 -2
- package/src/components/html-embed.stories.tsx +16 -0
- package/src/components/html-embed.tsx +96 -0
- package/src/components/html-embed.ws.ts +22 -0
- package/src/components/image.ws.tsx +2 -2
- package/src/components/index.ts +10 -87
- package/src/components/input.ws.tsx +2 -2
- package/src/components/italic.ws.tsx +2 -2
- package/src/components/label.ws.tsx +2 -2
- package/src/components/link-block.ws.tsx +2 -2
- package/src/components/link.ws.tsx +2 -2
- package/src/components/list-item.ws.tsx +2 -2
- package/src/components/list.ws.tsx +2 -2
- package/src/components/paragraph.ws.tsx +2 -2
- package/src/components/radio-button-field.ws.tsx +2 -2
- package/src/components/radio-button.ws.tsx +2 -2
- package/src/components/separator.ws.tsx +2 -2
- package/src/components/slot.ws.ts +2 -2
- package/src/components/span.ws.tsx +2 -2
- package/src/components/subscript.ws.tsx +2 -2
- package/src/components/success-message.ws.tsx +2 -2
- package/src/components/superscript.ws.tsx +2 -2
- package/src/components/text-block.ws.tsx +2 -2
- package/src/components/textarea.ws.tsx +2 -2
- package/src/context.tsx +1 -0
- package/src/css/css.ts +4 -5
- package/src/css/normalize.ts +2 -2
- package/src/css/presets.ts +7 -0
- package/src/tree/create-elements-tree.tsx +3 -5
- package/lib/cjs/tree/session-storage-polyfill.js +0 -65
- package/lib/tree/session-storage-polyfill.js +0 -45
- package/lib/types/tree/session-storage-polyfill.d.ts +0 -2
- package/src/components/code.stories.tsx +0 -16
- package/src/tree/session-storage-polyfill.tsx +0 -50
- /package/lib/components/__generated__/{code.props.js → code-text.props.js} +0 -0
- /package/lib/types/components/__generated__/{code.props.d.ts → code-text.props.d.ts} +0 -0
- /package/lib/types/components/{code.ws.d.ts → code-text.ws.d.ts} +0 -0
- /package/src/components/__generated__/{code.props.ts → code-text.props.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RadioCheckedIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { RadioCheckedIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates
|
|
4
4
|
} from "./component-meta";
|
|
@@ -14,7 +14,7 @@ const meta = {
|
|
|
14
14
|
category: "forms",
|
|
15
15
|
type: "container",
|
|
16
16
|
label: "Radio",
|
|
17
|
-
|
|
17
|
+
icon: RadioCheckedIcon,
|
|
18
18
|
states: defaultStates,
|
|
19
19
|
presetStyle,
|
|
20
20
|
children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RadioCheckedIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { RadioCheckedIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates
|
|
4
4
|
} from "./component-meta";
|
|
@@ -16,7 +16,7 @@ const presetStyle = {
|
|
|
16
16
|
const meta = {
|
|
17
17
|
type: "control",
|
|
18
18
|
label: "Radio Input",
|
|
19
|
-
|
|
19
|
+
icon: RadioCheckedIcon,
|
|
20
20
|
presetStyle,
|
|
21
21
|
states: [
|
|
22
22
|
...defaultStates,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DashIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { DashIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates
|
|
4
4
|
} from "./component-meta";
|
|
@@ -37,7 +37,7 @@ const meta = {
|
|
|
37
37
|
category: "general",
|
|
38
38
|
type: "embed",
|
|
39
39
|
label: "Separator",
|
|
40
|
-
|
|
40
|
+
icon: DashIcon,
|
|
41
41
|
states: defaultStates,
|
|
42
42
|
presetStyle,
|
|
43
43
|
children: []
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SlotComponentIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { SlotComponentIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
const meta = {
|
|
3
3
|
category: "general",
|
|
4
4
|
type: "container",
|
|
5
5
|
label: "Slot",
|
|
6
|
-
|
|
6
|
+
icon: SlotComponentIcon
|
|
7
7
|
};
|
|
8
8
|
const propsMeta = {
|
|
9
9
|
props: {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaintBrushIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { PaintBrushIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import { span } from "../css/normalize";
|
|
3
3
|
import {
|
|
4
4
|
defaultStates
|
|
@@ -10,7 +10,7 @@ const presetStyle = {
|
|
|
10
10
|
const meta = {
|
|
11
11
|
type: "rich-text-child",
|
|
12
12
|
label: "Styled Text",
|
|
13
|
-
|
|
13
|
+
icon: PaintBrushIcon,
|
|
14
14
|
states: defaultStates,
|
|
15
15
|
presetStyle
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SubscriptIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { SubscriptIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import { sub } from "../css/normalize";
|
|
3
3
|
import {
|
|
4
4
|
defaultStates
|
|
@@ -10,7 +10,7 @@ const presetStyle = {
|
|
|
10
10
|
const meta = {
|
|
11
11
|
type: "rich-text-child",
|
|
12
12
|
label: "Subscript Text",
|
|
13
|
-
|
|
13
|
+
icon: SubscriptIcon,
|
|
14
14
|
states: defaultStates,
|
|
15
15
|
presetStyle
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoxIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { BoxIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import { props } from "./__generated__/success-message.props";
|
|
3
3
|
import { div } from "../css/normalize";
|
|
4
4
|
const presetStyle = {
|
|
@@ -7,7 +7,7 @@ const presetStyle = {
|
|
|
7
7
|
const meta = {
|
|
8
8
|
type: "container",
|
|
9
9
|
label: "Success Message",
|
|
10
|
-
|
|
10
|
+
icon: BoxIcon,
|
|
11
11
|
presetStyle
|
|
12
12
|
};
|
|
13
13
|
const propsMeta = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SuperscriptIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { SuperscriptIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import { sup } from "../css/normalize";
|
|
3
3
|
import {
|
|
4
4
|
defaultStates
|
|
@@ -10,7 +10,7 @@ const presetStyle = {
|
|
|
10
10
|
const meta = {
|
|
11
11
|
type: "rich-text-child",
|
|
12
12
|
label: "Superscript Text",
|
|
13
|
-
|
|
13
|
+
icon: SuperscriptIcon,
|
|
14
14
|
states: defaultStates,
|
|
15
15
|
presetStyle
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextBlockIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { TextBlockIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import {
|
|
3
3
|
defaultStates
|
|
4
4
|
} from "./component-meta";
|
|
@@ -17,7 +17,7 @@ const meta = {
|
|
|
17
17
|
category: "typography",
|
|
18
18
|
type: "rich-text",
|
|
19
19
|
label: "Text Block",
|
|
20
|
-
|
|
20
|
+
icon: TextBlockIcon,
|
|
21
21
|
states: defaultStates,
|
|
22
22
|
presetStyle,
|
|
23
23
|
children: [{ type: "text", value: "Block of text you can edit" }]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormTextAreaIcon } from "@webstudio-is/icons";
|
|
1
|
+
import { FormTextAreaIcon } from "@webstudio-is/icons/svg";
|
|
2
2
|
import { textarea } from "../css/normalize";
|
|
3
3
|
import {
|
|
4
4
|
defaultStates
|
|
@@ -15,7 +15,7 @@ const meta = {
|
|
|
15
15
|
category: "forms",
|
|
16
16
|
type: "control",
|
|
17
17
|
label: "Text Area",
|
|
18
|
-
|
|
18
|
+
icon: FormTextAreaIcon,
|
|
19
19
|
presetStyle,
|
|
20
20
|
states: [
|
|
21
21
|
...defaultStates,
|
package/lib/css/css.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { createCssEngine } from "@webstudio-is/css-engine";
|
|
2
|
-
import { getComponentNames } from "../components/components-utils";
|
|
3
|
-
import { getComponentMeta } from "../components";
|
|
4
2
|
import { idAttribute } from "../tree";
|
|
5
3
|
import { addGlobalRules } from "./global-rules";
|
|
6
4
|
import { getPresetStyleRules, getStyleRules } from "./style-rules";
|
|
@@ -37,9 +35,8 @@ const generateCssText = (data, options) => {
|
|
|
37
35
|
for (const breakpoint of breakpoints.values()) {
|
|
38
36
|
engine.addMediaRule(breakpoint.id, breakpoint);
|
|
39
37
|
}
|
|
40
|
-
for (const component of
|
|
41
|
-
const
|
|
42
|
-
const presetStyle = meta?.presetStyle;
|
|
38
|
+
for (const [component, meta] of data.componentMetas) {
|
|
39
|
+
const presetStyle = meta.presetStyle;
|
|
43
40
|
if (presetStyle === void 0) {
|
|
44
41
|
continue;
|
|
45
42
|
}
|
package/lib/css/normalize.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { borders } from "./presets";
|
|
1
|
+
import { borders, outline } from "./presets";
|
|
2
2
|
const boxSizing = {
|
|
3
3
|
property: "boxSizing",
|
|
4
4
|
value: { type: "keyword", value: "border-box" }
|
|
5
5
|
};
|
|
6
|
-
const baseStyle = [boxSizing, ...borders];
|
|
6
|
+
const baseStyle = [boxSizing, ...borders, ...outline];
|
|
7
7
|
const div = baseStyle;
|
|
8
8
|
const address = baseStyle;
|
|
9
9
|
const article = baseStyle;
|
package/lib/css/presets.js
CHANGED
|
@@ -2,11 +2,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Fragment } from "react";
|
|
3
3
|
import { Scripts, ScrollRestoration } from "@remix-run/react";
|
|
4
4
|
import { ReactSdkContext } from "../context";
|
|
5
|
-
import { SessionStoragePolyfill } from "./session-storage-polyfill";
|
|
6
5
|
const createElementsTree = ({
|
|
6
|
+
renderer,
|
|
7
7
|
instances,
|
|
8
8
|
rootInstanceId,
|
|
9
|
-
sandbox,
|
|
10
9
|
propsByInstanceIdStore,
|
|
11
10
|
assetsStore,
|
|
12
11
|
pagesStore,
|
|
@@ -32,7 +31,6 @@ const createElementsTree = ({
|
|
|
32
31
|
children: [
|
|
33
32
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
33
|
children,
|
|
35
|
-
sandbox && /* @__PURE__ */ jsx(SessionStoragePolyfill, {}),
|
|
36
34
|
/* @__PURE__ */ jsx(ScrollRestoration, {}),
|
|
37
35
|
/* @__PURE__ */ jsx(Scripts, {})
|
|
38
36
|
] }, "children")
|
|
@@ -42,7 +40,7 @@ const createElementsTree = ({
|
|
|
42
40
|
return /* @__PURE__ */ jsx(
|
|
43
41
|
ReactSdkContext.Provider,
|
|
44
42
|
{
|
|
45
|
-
value: { propsByInstanceIdStore, assetsStore, pagesStore },
|
|
43
|
+
value: { propsByInstanceIdStore, assetsStore, pagesStore, renderer },
|
|
46
44
|
children: root
|
|
47
45
|
}
|
|
48
46
|
);
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
export type Params = {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Base url ir base path for images with ending slash.
|
|
4
|
+
* Used for configuring image with different sizes.
|
|
5
|
+
* Concatinated with "name?width=&quality=&format=".
|
|
6
|
+
*
|
|
7
|
+
* For example
|
|
8
|
+
* /asset/image/ used by default in builder
|
|
9
|
+
* https://image-transform.wstd.io/cdn-cgi/image/
|
|
10
|
+
* https://webstudio.is/cdn-cgi/image/
|
|
11
|
+
*/
|
|
12
|
+
imageBaseUrl: string;
|
|
13
|
+
/**
|
|
14
|
+
* Base url or base path for any asset with ending slash.
|
|
15
|
+
* Used to load assets like fonts or images in styles
|
|
16
|
+
* Concatinated with "name".
|
|
17
|
+
*
|
|
18
|
+
* For example
|
|
19
|
+
* /s/uploads/
|
|
20
|
+
* /asset/file/
|
|
21
|
+
* https://assets-dev.webstudio.is/
|
|
22
|
+
* https://assets.webstudio.is/
|
|
23
|
+
*/
|
|
3
24
|
assetBaseUrl: string;
|
|
4
25
|
};
|
|
5
26
|
export declare const getParams: () => Params;
|
|
@@ -5,5 +5,5 @@ type Props = Omit<ComponentProps<typeof defaultTag>, "inline"> & {
|
|
|
5
5
|
inline?: boolean;
|
|
6
6
|
meta?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const CodeText: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
9
9
|
export {};
|
|
@@ -5,7 +5,7 @@ declare const _default: ComponentMeta<import("react").ForwardRefExoticComponent<
|
|
|
5
5
|
meta?: string | undefined;
|
|
6
6
|
}, "ref"> & import("react").RefAttributes<HTMLElement>>>;
|
|
7
7
|
export default _default;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const CodeText: ComponentStory<import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "inline"> & {
|
|
9
9
|
inline?: boolean | undefined;
|
|
10
10
|
meta?: string | undefined;
|
|
11
11
|
}, "ref"> & import("react").RefAttributes<HTMLElement>>>;
|