@webstudio-is/react-sdk 0.0.0-c575b54 → 0.0.0-ca00e2a
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 +185 -553
- package/lib/runtime.js +5 -5
- package/lib/types/__generated__/standard-attributes.d.ts +2 -0
- package/lib/types/component-generator.d.ts +7 -6
- package/lib/types/context.d.ts +6 -0
- package/lib/types/hook.d.ts +1 -2
- package/lib/types/index.d.ts +1 -3
- package/lib/types/props.d.ts +1337 -8
- package/lib/types/runtime.d.ts +0 -1
- package/package.json +12 -12
- package/placeholder.d.ts +14 -11
- 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/instance-utils.d.ts +0 -3
- package/lib/types/instance-utils.test.d.ts +0 -1
package/lib/runtime.js
CHANGED
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
var ReactSdkContext = createContext({
|
|
8
8
|
assetBaseUrl: "/",
|
|
9
9
|
imageLoader: ({ src }) => src,
|
|
10
|
-
resources: {}
|
|
10
|
+
resources: {},
|
|
11
|
+
breakpoints: [],
|
|
12
|
+
onError: (error) => {
|
|
13
|
+
console.error(error);
|
|
14
|
+
}
|
|
11
15
|
});
|
|
12
16
|
var useResource = (name) => {
|
|
13
17
|
const { resources } = useContext(ReactSdkContext);
|
|
@@ -197,16 +201,12 @@ var PageSettingsCanonicalLink = (props) => {
|
|
|
197
201
|
|
|
198
202
|
// src/runtime.ts
|
|
199
203
|
var xmlNodeTagSuffix = "-ws-xml-node-fb77f896-8e96-40b9-b8f8-90a4e70d724a";
|
|
200
|
-
var getIndexWithinAncestorFromComponentProps = (props) => {
|
|
201
|
-
return props["data-ws-index"];
|
|
202
|
-
};
|
|
203
204
|
export {
|
|
204
205
|
PageSettingsCanonicalLink,
|
|
205
206
|
PageSettingsMeta,
|
|
206
207
|
PageSettingsTitle,
|
|
207
208
|
ReactSdkContext,
|
|
208
209
|
getClosestInstance,
|
|
209
|
-
getIndexWithinAncestorFromComponentProps,
|
|
210
210
|
useResource,
|
|
211
211
|
useVariableState,
|
|
212
212
|
xmlNodeTagSuffix
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Instances, Instance, Props, Scope, DataSources, Prop } from "@webstudio-is/sdk";
|
|
2
|
-
|
|
3
|
-
export declare const generateJsxElement: ({ context, scope, instance, props, dataSources, usedDataSources, indexesWithinAncestors, children, classesMap, }: {
|
|
1
|
+
import type { Instances, Instance, Props, Scope, DataSources, Prop, WsComponentMeta, IndexesWithinAncestors } from "@webstudio-is/sdk";
|
|
2
|
+
export declare const generateJsxElement: ({ context, scope, metas, instance, props, dataSources, usedDataSources, indexesWithinAncestors, children, classesMap, }: {
|
|
4
3
|
context?: "expression" | "jsx";
|
|
5
4
|
scope: Scope;
|
|
5
|
+
metas: Map<Instance["component"], WsComponentMeta>;
|
|
6
6
|
instance: Instance;
|
|
7
7
|
props: Props;
|
|
8
8
|
dataSources: DataSources;
|
|
@@ -11,8 +11,9 @@ export declare const generateJsxElement: ({ context, scope, instance, props, dat
|
|
|
11
11
|
children: string;
|
|
12
12
|
classesMap?: Map<string, Array<string>>;
|
|
13
13
|
}) => string;
|
|
14
|
-
export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
|
|
14
|
+
export declare const generateJsxChildren: ({ scope, metas, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
|
|
15
15
|
scope: Scope;
|
|
16
|
+
metas: Map<Instance["component"], WsComponentMeta>;
|
|
16
17
|
children: Instance["children"];
|
|
17
18
|
instances: Instances;
|
|
18
19
|
props: Props;
|
|
@@ -22,7 +23,7 @@ export declare const generateJsxChildren: ({ scope, children, instances, props,
|
|
|
22
23
|
classesMap?: Map<string, Array<string>>;
|
|
23
24
|
excludePlaceholders?: boolean;
|
|
24
25
|
}) => string;
|
|
25
|
-
export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources,
|
|
26
|
+
export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, metas, classesMap, }: {
|
|
26
27
|
scope: Scope;
|
|
27
28
|
name: string;
|
|
28
29
|
rootInstanceId: Instance["id"];
|
|
@@ -32,6 +33,6 @@ export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId,
|
|
|
32
33
|
instances: Instances;
|
|
33
34
|
props: Props;
|
|
34
35
|
dataSources: DataSources;
|
|
35
|
-
indexesWithinAncestors: IndexesWithinAncestors;
|
|
36
36
|
classesMap: Map<string, Array<string>>;
|
|
37
|
+
metas: Map<Instance["component"], WsComponentMeta>;
|
|
37
38
|
}) => string;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -22,5 +22,11 @@ export type Params = {
|
|
|
22
22
|
export declare const ReactSdkContext: import("react").Context<Params & {
|
|
23
23
|
imageLoader: ImageLoader;
|
|
24
24
|
resources: Record<string, any>;
|
|
25
|
+
breakpoints: {
|
|
26
|
+
id: string;
|
|
27
|
+
minWidth?: number;
|
|
28
|
+
maxWidth?: number;
|
|
29
|
+
}[];
|
|
30
|
+
onError: (error: unknown) => void;
|
|
25
31
|
}>;
|
|
26
32
|
export declare const useResource: (name: string) => any;
|
package/lib/types/hook.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Instance, Prop } from "@webstudio-is/sdk";
|
|
2
|
-
import type { IndexesWithinAncestors } from "./instance-utils";
|
|
1
|
+
import type { IndexesWithinAncestors, Instance, Prop } from "@webstudio-is/sdk";
|
|
3
2
|
export type InstanceData = {
|
|
4
3
|
id: Instance["id"];
|
|
5
4
|
instanceKey: string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export * from "./remix";
|
|
2
|
-
export * from "./css/index";
|
|
3
2
|
export * from "./components/components-utils";
|
|
4
|
-
export * from "./embed-template";
|
|
5
3
|
export * from "./props";
|
|
6
4
|
export type * from "./context";
|
|
7
|
-
export { getIndexesWithinAncestors } from "./instance-utils";
|
|
8
5
|
export type * from "./hook";
|
|
9
6
|
export { generateWebstudioComponent, generateJsxElement, generateJsxChildren, } from "./component-generator";
|
|
7
|
+
export * from "./__generated__/standard-attributes";
|