@webstudio-is/react-sdk 0.198.0 → 0.200.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/index.js +21 -449
- package/lib/runtime.js +151 -0
- package/lib/types/index.d.ts +0 -1
- package/lib/types/page-settings-canonical-link.d.ts +17 -0
- package/lib/types/page-settings-meta.d.ts +10 -0
- package/lib/types/page-settings-title.d.ts +17 -0
- package/lib/types/runtime.d.ts +3 -0
- package/package.json +10 -10
- package/placeholder.d.ts +0 -1
- package/lib/types/core-components.d.ts +0 -748
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImageLoader } from "@webstudio-is/image";
|
|
2
|
+
import type { PageMeta } from "@webstudio-is/sdk";
|
|
3
|
+
export declare const isElementRenderedWithReact: (element: Element) => boolean;
|
|
4
|
+
export declare const PageSettingsMeta: ({ url, host, siteName, pageMeta, imageLoader, }: {
|
|
5
|
+
url?: string;
|
|
6
|
+
host: string;
|
|
7
|
+
siteName: string;
|
|
8
|
+
pageMeta: PageMeta;
|
|
9
|
+
imageLoader: ImageLoader;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type PageSettingsTitleProps = {
|
|
2
|
+
children: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Title tags are deduplicated on the server using the HTMLRewriter interface.
|
|
6
|
+
* This is not full deduplication. We simply skip rendering Page Setting title
|
|
7
|
+
* if it has already been rendered using HeadSlot/HeadTitle.
|
|
8
|
+
* To prevent React on the client from re-adding the removed title tag, we skip rendering them client-side.
|
|
9
|
+
* This approach works because React retains server-rendered title tag as long as they are not re-rendered by the client.
|
|
10
|
+
*
|
|
11
|
+
* The following component behavior ensures this:
|
|
12
|
+
* 1. On the server: Render title tag as usual.
|
|
13
|
+
* 2. On the client: Before rendering, remove any title tag with the same `name` or `property` that were not rendered by Client React,
|
|
14
|
+
* and then proceed with rendering as usual.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PageSettingsTitle: (props: PageSettingsTitleProps) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
17
|
+
export {};
|
package/lib/types/runtime.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from "./context";
|
|
2
2
|
export * from "./hook";
|
|
3
3
|
export * from "./variable-state";
|
|
4
|
+
export { PageSettingsMeta } from "./page-settings-meta";
|
|
5
|
+
export { PageSettingsTitle } from "./page-settings-title";
|
|
6
|
+
export { PageSettingsCanonicalLink } from "./page-settings-canonical-link";
|
|
4
7
|
/**
|
|
5
8
|
* React has issues rendering certain elements, such as errors when a <link> element has children.
|
|
6
9
|
* To render XML, we wrap it with an <svg> tag and add a suffix to avoid React's default behavior on these elements.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.200.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
12
12
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
13
13
|
"strip-indent": "^4.0.0",
|
|
14
|
-
"type-fest": "^4.
|
|
15
|
-
"vitest": "^
|
|
14
|
+
"type-fest": "^4.32.0",
|
|
15
|
+
"vitest": "^3.0.2",
|
|
16
16
|
"zod": "^3.22.4",
|
|
17
|
-
"@webstudio-is/
|
|
18
|
-
"@webstudio-is/
|
|
17
|
+
"@webstudio-is/tsconfig": "1.0.7",
|
|
18
|
+
"@webstudio-is/template": "0.200.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"change-case": "^5.4.4",
|
|
27
27
|
"html-tags": "^4.0.0",
|
|
28
28
|
"nanoid": "^5.0.9",
|
|
29
|
-
"@webstudio-is/css-engine": "0.
|
|
30
|
-
"@webstudio-is/
|
|
31
|
-
"@webstudio-is/
|
|
32
|
-
"@webstudio-is/image": "0.
|
|
33
|
-
"@webstudio-is/
|
|
29
|
+
"@webstudio-is/css-engine": "0.200.0",
|
|
30
|
+
"@webstudio-is/icons": "^0.200.0",
|
|
31
|
+
"@webstudio-is/sdk": "0.200.0",
|
|
32
|
+
"@webstudio-is/image": "0.200.0",
|
|
33
|
+
"@webstudio-is/fonts": "0.200.0"
|
|
34
34
|
},
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|