@webstudio-is/react-sdk 0.0.0-588fe22 → 0.0.0-7a19155
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 +328 -574
- package/lib/runtime.js +21 -8
- package/lib/standard-attributes.js +13 -0
- package/lib/types/collection-utils.d.ts +24 -0
- package/lib/types/component-generator.d.ts +36 -6
- package/lib/types/context.d.ts +17 -1
- package/lib/types/hook.d.ts +2 -2
- package/lib/types/index.d.ts +3 -4
- package/lib/types/page-settings-meta.d.ts +4 -3
- package/lib/types/props.d.ts +1397 -44
- package/lib/types/runtime.d.ts +0 -1
- package/lib/types/standard-attributes.d.ts +1 -0
- package/package.json +22 -16
- package/placeholder.d.ts +37 -15
- package/lib/types/component-generator.test.d.ts +0 -1
- package/lib/types/css/css.d.ts +0 -20
- package/lib/types/css/css.test.d.ts +0 -1
- package/lib/types/css/global-rules.d.ts +0 -6
- package/lib/types/css/index.d.ts +0 -2
- package/lib/types/embed-template.d.ts +0 -54
- package/lib/types/embed-template.test.d.ts +0 -1
- package/lib/types/hook.test.d.ts +0 -1
- package/lib/types/instance-utils.d.ts +0 -3
- package/lib/types/instance-utils.test.d.ts +0 -1
- package/lib/types/props.test.d.ts +0 -1
- package/lib/types/remix.test.d.ts +0 -1
package/lib/types/runtime.d.ts
CHANGED
|
@@ -9,4 +9,3 @@ export { PageSettingsCanonicalLink } from "./page-settings-canonical-link";
|
|
|
9
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
10
|
*/
|
|
11
11
|
export declare const xmlNodeTagSuffix = "-ws-xml-node-fb77f896-8e96-40b9-b8f8-90a4e70d724a";
|
|
12
|
-
export declare const getIndexWithinAncestorFromComponentProps: (props: Record<string, unknown>) => string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getInstancePropName, getJsxPropName, reactPropsToStandardAttributes, standardAttributesToReactProps, } from "@webstudio-is/content-engine/jsx-attributes";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-7a19155",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -11,26 +11,27 @@
|
|
|
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
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"@webstudio-is/tsconfig": "1.0.7"
|
|
14
|
+
"type-fest": "^4.37.0",
|
|
15
|
+
"typescript": "7.0.2",
|
|
16
|
+
"vitest": "^3.1.2",
|
|
17
|
+
"zod": "^4.4.3",
|
|
18
|
+
"@webstudio-is/tsconfig": "1.0.7",
|
|
19
|
+
"@webstudio-is/template": "0.0.0-7a19155"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
22
23
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
23
|
-
"zod": "^
|
|
24
|
+
"zod": "^4.4.3"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"change-case": "^5.4.4",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"@webstudio-is/
|
|
30
|
-
"@webstudio-is/
|
|
31
|
-
"@webstudio-is/
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/sdk": "0.0.0-
|
|
28
|
+
"@webstudio-is/content-engine": "0.0.0-7a19155",
|
|
29
|
+
"@webstudio-is/css-engine": "0.0.0-7a19155",
|
|
30
|
+
"@webstudio-is/fonts": "0.0.0-7a19155",
|
|
31
|
+
"@webstudio-is/icons": "^0.0.0-7a19155",
|
|
32
|
+
"@webstudio-is/expression": "0.0.0-7a19155",
|
|
33
|
+
"@webstudio-is/image": "0.0.0-7a19155",
|
|
34
|
+
"@webstudio-is/sdk": "0.0.0-7a19155"
|
|
34
35
|
},
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
@@ -43,6 +44,11 @@
|
|
|
43
44
|
"types": "./lib/types/runtime.d.ts",
|
|
44
45
|
"import": "./lib/runtime.js"
|
|
45
46
|
},
|
|
47
|
+
"./standard-attributes": {
|
|
48
|
+
"webstudio": "./src/standard-attributes.ts",
|
|
49
|
+
"types": "./lib/types/standard-attributes.d.ts",
|
|
50
|
+
"import": "./lib/standard-attributes.js"
|
|
51
|
+
},
|
|
46
52
|
"./placeholder": {
|
|
47
53
|
"types": "./placeholder.d.ts"
|
|
48
54
|
}
|
|
@@ -56,9 +62,9 @@
|
|
|
56
62
|
"private": false,
|
|
57
63
|
"sideEffects": false,
|
|
58
64
|
"scripts": {
|
|
59
|
-
"build": "rm -rf lib && esbuild src/index.ts src/runtime.ts --outdir=lib --bundle --format=esm --packages=external",
|
|
65
|
+
"build": "rm -rf lib && esbuild src/index.ts src/runtime.ts src/standard-attributes.ts --outdir=lib --bundle --format=esm --packages=external",
|
|
60
66
|
"dts": "tsc --project tsconfig.dts.json",
|
|
61
|
-
"typecheck": "tsc",
|
|
67
|
+
"typecheck": "tsc --noEmit",
|
|
62
68
|
"test": "vitest run"
|
|
63
69
|
}
|
|
64
70
|
}
|
package/placeholder.d.ts
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
declare module "__CONSTANTS__" {
|
|
2
|
-
import type { ImageLoader } from "@webstudio-is/image";
|
|
2
|
+
import type { ImageLoader, VideoLoader } from "@webstudio-is/image";
|
|
3
3
|
export const assetBaseUrl: string;
|
|
4
4
|
export const imageLoader: ImageLoader;
|
|
5
|
+
export const videoLoader: undefined | VideoLoader;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
declare module "__CLIENT__" {
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import type { ResourceRequest, System } from "@webstudio-is/sdk";
|
|
10
|
+
|
|
11
|
+
export const projectId: string;
|
|
12
|
+
|
|
13
|
+
export const projectDomain: string | undefined;
|
|
14
|
+
|
|
15
|
+
export const lastPublished: string;
|
|
14
16
|
|
|
15
17
|
export const siteName: string;
|
|
16
18
|
|
|
17
|
-
export const favIconAsset:
|
|
19
|
+
export const favIconAsset: string | undefined;
|
|
20
|
+
|
|
21
|
+
export const breakpoints: {
|
|
22
|
+
id: string;
|
|
23
|
+
minWidth?: number;
|
|
24
|
+
maxWidth?: number;
|
|
25
|
+
}[];
|
|
18
26
|
|
|
19
27
|
// Font assets on current page (can be preloaded)
|
|
20
|
-
export const pageFontAssets:
|
|
28
|
+
export const pageFontAssets: string[];
|
|
21
29
|
|
|
22
|
-
export const pageBackgroundImageAssets:
|
|
30
|
+
export const pageBackgroundImageAssets: string[];
|
|
23
31
|
|
|
24
32
|
export const CustomCode: () => ReactNode;
|
|
25
33
|
|
|
@@ -28,10 +36,15 @@ declare module "__CLIENT__" {
|
|
|
28
36
|
|
|
29
37
|
declare module "__SERVER__" {
|
|
30
38
|
import type { PageMeta, System, ResourceRequest } from "@webstudio-is/sdk";
|
|
39
|
+
import type { ResourceRequestGraph } from "@webstudio-is/sdk/runtime";
|
|
31
40
|
|
|
32
|
-
export const getResources: (props: {
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
export const getResources: (props: {
|
|
42
|
+
system: System;
|
|
43
|
+
resources?: Record<string, any>;
|
|
44
|
+
}) => {
|
|
45
|
+
data: ResourceRequestGraph;
|
|
46
|
+
action: Map<string, { id: string; outputName: string }>;
|
|
47
|
+
contentData?: Map<string, ResourceRequest>;
|
|
35
48
|
};
|
|
36
49
|
|
|
37
50
|
export const getPageMeta: (props: {
|
|
@@ -42,11 +55,14 @@ declare module "__SERVER__" {
|
|
|
42
55
|
type Params = Record<string, string | undefined>;
|
|
43
56
|
export const getRemixParams: ({ ...params }: Params) => Params;
|
|
44
57
|
|
|
45
|
-
export const projectId: string;
|
|
46
|
-
|
|
47
58
|
export const contactEmail: undefined | string;
|
|
48
59
|
}
|
|
49
60
|
|
|
61
|
+
declare module "__AUTH__" {
|
|
62
|
+
import type { WsAuthRoute } from "@webstudio-is/wsauth";
|
|
63
|
+
export const authRoutes: WsAuthRoute[];
|
|
64
|
+
}
|
|
65
|
+
|
|
50
66
|
declare module "__SITEMAP__" {
|
|
51
67
|
export const sitemap: Array<{
|
|
52
68
|
path: string;
|
|
@@ -54,6 +70,12 @@ declare module "__SITEMAP__" {
|
|
|
54
70
|
}>;
|
|
55
71
|
}
|
|
56
72
|
|
|
73
|
+
declare module "__ASSETS__" {
|
|
74
|
+
import type { RuntimeAsset } from "@webstudio-is/sdk";
|
|
75
|
+
export const assets: Record<string, RuntimeAsset>;
|
|
76
|
+
export const assetUrlsByPath: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
|
|
57
79
|
declare module "__REDIRECT__" {
|
|
58
80
|
export const url: string;
|
|
59
81
|
export const status: number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/css/css.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type TransformValue } from "@webstudio-is/css-engine";
|
|
2
|
-
import { type Assets, type Breakpoints, type Instances, type Props, type StyleSourceSelections, type Styles, type WsComponentMeta } from "@webstudio-is/sdk";
|
|
3
|
-
export type CssConfig = {
|
|
4
|
-
assets: Assets;
|
|
5
|
-
instances: Instances;
|
|
6
|
-
props: Props;
|
|
7
|
-
breakpoints: Breakpoints;
|
|
8
|
-
styles: Styles;
|
|
9
|
-
styleSourceSelections: StyleSourceSelections;
|
|
10
|
-
componentMetas: Map<string, WsComponentMeta>;
|
|
11
|
-
assetBaseUrl: string;
|
|
12
|
-
atomic: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare const createImageValueTransformer: (assets: Assets, { assetBaseUrl }: {
|
|
15
|
-
assetBaseUrl: string;
|
|
16
|
-
}) => TransformValue;
|
|
17
|
-
export declare const generateCss: ({ assets, instances, props, breakpoints, styles, styleSourceSelections, componentMetas, assetBaseUrl, atomic, }: CssConfig) => {
|
|
18
|
-
cssText: string;
|
|
19
|
-
classes: Map<string, string[]>;
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/css/index.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { Instance, WebstudioFragment, WsEmbedTemplate, EmbedTemplateInstance, WsComponentMeta } from "@webstudio-is/sdk";
|
|
2
|
-
export declare const generateDataFromEmbedTemplate: (treeTemplate: WsEmbedTemplate, metas: Map<Instance["component"], WsComponentMeta>, generateId?: () => string) => WebstudioFragment;
|
|
3
|
-
export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, components: Set<EmbedTemplateInstance["component"]>) => {
|
|
4
|
-
type: "control" | "embed" | "container" | "rich-text-child";
|
|
5
|
-
description?: string | undefined;
|
|
6
|
-
category?: "data" | "xml" | "hidden" | "media" | "general" | "typography" | "forms" | "localization" | "radix" | "internal" | undefined;
|
|
7
|
-
label?: string | undefined;
|
|
8
|
-
order?: number | undefined;
|
|
9
|
-
template?: ({
|
|
10
|
-
value: string;
|
|
11
|
-
type: "text";
|
|
12
|
-
placeholder?: boolean | undefined;
|
|
13
|
-
} | {
|
|
14
|
-
value: string;
|
|
15
|
-
type: "expression";
|
|
16
|
-
} | EmbedTemplateInstance)[] | undefined;
|
|
17
|
-
states?: {
|
|
18
|
-
label: string;
|
|
19
|
-
selector: string;
|
|
20
|
-
category?: "states" | "component-states" | undefined;
|
|
21
|
-
}[] | undefined;
|
|
22
|
-
constraints?: {
|
|
23
|
-
relation: "ancestor" | "parent" | "self" | "child" | "descendant";
|
|
24
|
-
component?: {
|
|
25
|
-
$eq?: string | undefined;
|
|
26
|
-
$neq?: string | undefined;
|
|
27
|
-
$in?: string[] | undefined;
|
|
28
|
-
$nin?: string[] | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
tag?: {
|
|
31
|
-
$eq?: string | undefined;
|
|
32
|
-
$neq?: string | undefined;
|
|
33
|
-
$in?: string[] | undefined;
|
|
34
|
-
$nin?: string[] | undefined;
|
|
35
|
-
} | undefined;
|
|
36
|
-
} | {
|
|
37
|
-
relation: "ancestor" | "parent" | "self" | "child" | "descendant";
|
|
38
|
-
component?: {
|
|
39
|
-
$eq?: string | undefined;
|
|
40
|
-
$neq?: string | undefined;
|
|
41
|
-
$in?: string[] | undefined;
|
|
42
|
-
$nin?: string[] | undefined;
|
|
43
|
-
} | undefined;
|
|
44
|
-
tag?: {
|
|
45
|
-
$eq?: string | undefined;
|
|
46
|
-
$neq?: string | undefined;
|
|
47
|
-
$in?: string[] | undefined;
|
|
48
|
-
$nin?: string[] | undefined;
|
|
49
|
-
} | undefined;
|
|
50
|
-
}[] | undefined;
|
|
51
|
-
indexWithinAncestor?: string | undefined;
|
|
52
|
-
icon: string;
|
|
53
|
-
presetStyle?: import("@webstudio-is/sdk").PresetStyle;
|
|
54
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/hook.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Instance, Instances, WsComponentMeta } from "@webstudio-is/sdk";
|
|
2
|
-
export type IndexesWithinAncestors = Map<Instance["id"], number>;
|
|
3
|
-
export declare const getIndexesWithinAncestors: (metas: Map<Instance["component"], WsComponentMeta>, instances: Instances, rootIds: Instance["id"][]) => IndexesWithinAncestors;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|