@webstudio-is/react-sdk 0.0.0-017f1bd
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/LICENSE +661 -0
- package/README.md +4 -0
- package/lib/index.js +845 -0
- package/lib/runtime.js +221 -0
- package/lib/types/__generated__/standard-attributes.d.ts +2 -0
- package/lib/types/component-generator.d.ts +47 -0
- package/lib/types/component-generator.test.d.ts +1 -0
- package/lib/types/components/components-utils.d.ts +8 -0
- package/lib/types/context.d.ts +33 -0
- package/lib/types/hook.d.ts +34 -0
- package/lib/types/hook.test.d.ts +1 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/page-settings-canonical-link.d.ts +17 -0
- package/lib/types/page-settings-meta.d.ts +11 -0
- package/lib/types/page-settings-title.d.ts +17 -0
- package/lib/types/props.d.ts +1435 -0
- package/lib/types/props.test.d.ts +1 -0
- package/lib/types/remix.d.ts +20 -0
- package/lib/types/remix.test.d.ts +1 -0
- package/lib/types/runtime.d.ts +11 -0
- package/lib/types/variable-state.d.ts +2 -0
- package/package.json +64 -0
- package/placeholder.d.ts +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* transforms url pattern subset to remix route format
|
|
3
|
+
*
|
|
4
|
+
* /:name/ -> .$name. - named dynamic segment
|
|
5
|
+
* /:name?/ -> .($name). - optional dynamic segment
|
|
6
|
+
* /* -> .$ - splat in the end of pattern
|
|
7
|
+
* /:name* -> .$ - named splat which gets specified name at runtime
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare const generateRemixRoute: (pathname: string) => string;
|
|
11
|
+
/**
|
|
12
|
+
* generates a function to convert remix params to compatible with url pattern groups
|
|
13
|
+
*
|
|
14
|
+
* for /:name* pattern
|
|
15
|
+
* params["*"] is replaced with params["name"]
|
|
16
|
+
*
|
|
17
|
+
* for /* pattern
|
|
18
|
+
* params["*"] is replaced with params[0]
|
|
19
|
+
*/
|
|
20
|
+
export declare const generateRemixParams: (pathname: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./context";
|
|
2
|
+
export * from "./hook";
|
|
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";
|
|
7
|
+
/**
|
|
8
|
+
* React has issues rendering certain elements, such as errors when a <link> element has children.
|
|
9
|
+
* To render XML, we wrap it with an <svg> tag and add a suffix to avoid React's default behavior on these elements.
|
|
10
|
+
*/
|
|
11
|
+
export declare const xmlNodeTagSuffix = "-ws-xml-node-fb77f896-8e96-40b9-b8f8-90a4e70d724a";
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webstudio-is/react-sdk",
|
|
3
|
+
"version": "0.0.0-017f1bd",
|
|
4
|
+
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
|
+
"author": "Webstudio <github@webstudio.is>",
|
|
6
|
+
"homepage": "https://webstudio.is",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@types/react": "^18.2.70",
|
|
10
|
+
"@types/react-dom": "^18.2.25",
|
|
11
|
+
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
12
|
+
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
13
|
+
"strip-indent": "^4.0.0",
|
|
14
|
+
"type-fest": "^4.37.0",
|
|
15
|
+
"vitest": "^3.1.2",
|
|
16
|
+
"zod": "^3.24.2",
|
|
17
|
+
"@webstudio-is/template": "0.0.0-017f1bd",
|
|
18
|
+
"@webstudio-is/tsconfig": "1.0.7"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
22
|
+
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
23
|
+
"zod": "^3.19.1"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"change-case": "^5.4.4",
|
|
27
|
+
"html-tags": "^4.0.0",
|
|
28
|
+
"nanoid": "^5.1.5",
|
|
29
|
+
"@webstudio-is/css-engine": "0.0.0-017f1bd",
|
|
30
|
+
"@webstudio-is/fonts": "0.0.0-017f1bd",
|
|
31
|
+
"@webstudio-is/image": "0.0.0-017f1bd",
|
|
32
|
+
"@webstudio-is/icons": "^0.0.0-017f1bd",
|
|
33
|
+
"@webstudio-is/sdk": "0.0.0-017f1bd"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"webstudio": "./src/index.ts",
|
|
38
|
+
"types": "./lib/types/index.d.ts",
|
|
39
|
+
"import": "./lib/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./runtime": {
|
|
42
|
+
"webstudio": "./src/runtime.ts",
|
|
43
|
+
"types": "./lib/types/runtime.d.ts",
|
|
44
|
+
"import": "./lib/runtime.js"
|
|
45
|
+
},
|
|
46
|
+
"./placeholder": {
|
|
47
|
+
"types": "./placeholder.d.ts"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"lib/*",
|
|
52
|
+
"./placeholder.d.ts",
|
|
53
|
+
"!*.{test,stories}.*"
|
|
54
|
+
],
|
|
55
|
+
"license": "AGPL-3.0-or-later",
|
|
56
|
+
"private": false,
|
|
57
|
+
"sideEffects": false,
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rm -rf lib && esbuild src/index.ts src/runtime.ts --outdir=lib --bundle --format=esm --packages=external",
|
|
60
|
+
"dts": "tsc --project tsconfig.dts.json",
|
|
61
|
+
"typecheck": "tsc",
|
|
62
|
+
"test": "vitest run"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/placeholder.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
declare module "__CONSTANTS__" {
|
|
2
|
+
import type { ImageLoader, VideoLoader } from "@webstudio-is/image";
|
|
3
|
+
export const assetBaseUrl: string;
|
|
4
|
+
export const imageLoader: ImageLoader;
|
|
5
|
+
export const videoLoader: undefined | VideoLoader;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare module "__CLIENT__" {
|
|
9
|
+
import type { ResourceRequest, System } from "@webstudio-is/sdk";
|
|
10
|
+
|
|
11
|
+
export const projectId: string;
|
|
12
|
+
|
|
13
|
+
export const lastPublished: string;
|
|
14
|
+
|
|
15
|
+
export const siteName: string;
|
|
16
|
+
|
|
17
|
+
export const favIconAsset: string | undefined;
|
|
18
|
+
|
|
19
|
+
export const breakpoints: {
|
|
20
|
+
id: string;
|
|
21
|
+
minWidth?: number;
|
|
22
|
+
maxWidth?: number;
|
|
23
|
+
}[];
|
|
24
|
+
|
|
25
|
+
// Font assets on current page (can be preloaded)
|
|
26
|
+
export const pageFontAssets: string[];
|
|
27
|
+
|
|
28
|
+
export const pageBackgroundImageAssets: string[];
|
|
29
|
+
|
|
30
|
+
export const CustomCode: () => ReactNode;
|
|
31
|
+
|
|
32
|
+
export const Page: (props: { system: System }) => ReactNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module "__SERVER__" {
|
|
36
|
+
import type { PageMeta, System, ResourceRequest } from "@webstudio-is/sdk";
|
|
37
|
+
|
|
38
|
+
export const getResources: (props: { system: System }) => {
|
|
39
|
+
data: Map<string, ResourceRequest>;
|
|
40
|
+
action: Map<string, ResourceRequest>;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const getPageMeta: (props: {
|
|
44
|
+
system: System;
|
|
45
|
+
resources: Record<string, any>;
|
|
46
|
+
}) => PageMeta;
|
|
47
|
+
|
|
48
|
+
type Params = Record<string, string | undefined>;
|
|
49
|
+
export const getRemixParams: ({ ...params }: Params) => Params;
|
|
50
|
+
|
|
51
|
+
export const contactEmail: undefined | string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module "__SITEMAP__" {
|
|
55
|
+
export const sitemap: Array<{
|
|
56
|
+
path: string;
|
|
57
|
+
lastModified: string;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare module "__REDIRECT__" {
|
|
62
|
+
export const url: string;
|
|
63
|
+
export const status: number;
|
|
64
|
+
}
|