@webstudio-is/react-sdk 0.102.0 → 0.104.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
CHANGED
|
@@ -20,17 +20,12 @@ import {
|
|
|
20
20
|
} from "react";
|
|
21
21
|
|
|
22
22
|
// src/context.tsx
|
|
23
|
-
import { atom } from "nanostores";
|
|
24
23
|
import { createContext } from "react";
|
|
25
24
|
var ReactSdkContext = createContext({
|
|
26
25
|
assetBaseUrl: "/",
|
|
27
26
|
imageBaseUrl: "/",
|
|
28
27
|
imageLoader: ({ src }) => src,
|
|
29
|
-
pagesPaths: /* @__PURE__ */ new Set()
|
|
30
|
-
propsByInstanceIdStore: atom(/* @__PURE__ */ new Map()),
|
|
31
|
-
assetsStore: atom(/* @__PURE__ */ new Map()),
|
|
32
|
-
dataSourcesLogicStore: atom(/* @__PURE__ */ new Map()),
|
|
33
|
-
indexesWithinAncestors: /* @__PURE__ */ new Map()
|
|
28
|
+
pagesPaths: /* @__PURE__ */ new Set()
|
|
34
29
|
});
|
|
35
30
|
|
|
36
31
|
// src/tree/create-elements-tree.tsx
|
|
@@ -42,10 +37,6 @@ var createElementsTree = ({
|
|
|
42
37
|
imageLoader,
|
|
43
38
|
instances,
|
|
44
39
|
rootInstanceId,
|
|
45
|
-
propsByInstanceIdStore,
|
|
46
|
-
assetsStore,
|
|
47
|
-
dataSourcesLogicStore,
|
|
48
|
-
indexesWithinAncestors,
|
|
49
40
|
Component,
|
|
50
41
|
components,
|
|
51
42
|
scripts
|
|
@@ -78,15 +69,11 @@ var createElementsTree = ({
|
|
|
78
69
|
ReactSdkContext.Provider,
|
|
79
70
|
{
|
|
80
71
|
value: {
|
|
81
|
-
propsByInstanceIdStore,
|
|
82
|
-
assetsStore,
|
|
83
|
-
dataSourcesLogicStore,
|
|
84
72
|
renderer,
|
|
85
73
|
imageLoader,
|
|
86
74
|
pagesPaths: /* @__PURE__ */ new Set(),
|
|
87
75
|
assetBaseUrl,
|
|
88
|
-
imageBaseUrl
|
|
89
|
-
indexesWithinAncestors
|
|
76
|
+
imageBaseUrl
|
|
90
77
|
},
|
|
91
78
|
children: root
|
|
92
79
|
}
|
|
@@ -1542,6 +1529,7 @@ var generatePageComponent = ({
|
|
|
1542
1529
|
};
|
|
1543
1530
|
export {
|
|
1544
1531
|
EmbedTemplateInstance,
|
|
1532
|
+
EmbedTemplateProp,
|
|
1545
1533
|
EmbedTemplateStyleDecl,
|
|
1546
1534
|
PropMeta,
|
|
1547
1535
|
ReactSdkContext,
|
package/lib/types/context.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import type { Assets, Page } from "@webstudio-is/sdk";
|
|
4
|
-
import type { PropsByInstanceId } from "./props";
|
|
5
|
-
import type { IndexesWithinAncestors } from "./instance-utils";
|
|
2
|
+
import type { Page } from "@webstudio-is/sdk";
|
|
6
3
|
import type { ImageLoader } from "@webstudio-is/image";
|
|
7
4
|
export type Params = {
|
|
8
5
|
renderer?: "canvas" | "preview";
|
|
@@ -38,8 +35,4 @@ export declare const ReactSdkContext: import("react").Context<Params & {
|
|
|
38
35
|
* always empty for builder which handle anchor clicks globally
|
|
39
36
|
*/
|
|
40
37
|
pagesPaths: Set<Page["path"]>;
|
|
41
|
-
propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
|
|
42
|
-
assetsStore: ReadableAtom<Assets>;
|
|
43
|
-
dataSourcesLogicStore: ReadableAtom<Map<string, unknown>>;
|
|
44
|
-
indexesWithinAncestors: IndexesWithinAncestors;
|
|
45
38
|
}>;
|
|
@@ -34,7 +34,7 @@ declare const EmbedTemplateDataSource: z.ZodUnion<[z.ZodObject<{
|
|
|
34
34
|
type: "expression";
|
|
35
35
|
}>]>;
|
|
36
36
|
type EmbedTemplateDataSource = z.infer<typeof EmbedTemplateDataSource>;
|
|
37
|
-
declare const EmbedTemplateProp: z.ZodUnion<[z.ZodObject<{
|
|
37
|
+
export declare const EmbedTemplateProp: z.ZodUnion<[z.ZodObject<{
|
|
38
38
|
type: z.ZodLiteral<"dataSource">;
|
|
39
39
|
name: z.ZodString;
|
|
40
40
|
dataSourceName: z.ZodString;
|
|
@@ -127,7 +127,7 @@ declare const EmbedTemplateProp: z.ZodUnion<[z.ZodObject<{
|
|
|
127
127
|
type: "action";
|
|
128
128
|
name: string;
|
|
129
129
|
}>]>;
|
|
130
|
-
type EmbedTemplateProp = z.infer<typeof EmbedTemplateProp>;
|
|
130
|
+
export type EmbedTemplateProp = z.infer<typeof EmbedTemplateProp>;
|
|
131
131
|
declare const EmbedTemplateStyleDeclRaw: z.ZodObject<{
|
|
132
132
|
state: z.ZodOptional<z.ZodString>;
|
|
133
133
|
property: z.ZodString;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { type ForwardRefExoticComponent, type RefAttributes, type ReactNode } from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { Instance, Instances, Assets } from "@webstudio-is/sdk";
|
|
2
|
+
import type { Instance, Instances } from "@webstudio-is/sdk";
|
|
4
3
|
import type { Components } from "../components/components-utils";
|
|
5
4
|
import { type Params } from "../context";
|
|
6
|
-
import type { PropsByInstanceId } from "../props";
|
|
7
5
|
import type { WebstudioComponentProps } from "./webstudio-component";
|
|
8
|
-
import type { IndexesWithinAncestors } from "../instance-utils";
|
|
9
6
|
import type { ImageLoader } from "@webstudio-is/image";
|
|
10
|
-
export declare const createElementsTree: ({ renderer, assetBaseUrl, imageBaseUrl, imageLoader, instances, rootInstanceId,
|
|
7
|
+
export declare const createElementsTree: ({ renderer, assetBaseUrl, imageBaseUrl, imageLoader, instances, rootInstanceId, Component, components, scripts, }: Params & {
|
|
11
8
|
instances: Map<string, {
|
|
12
9
|
type: "instance";
|
|
13
10
|
id: string;
|
|
@@ -23,10 +20,6 @@ export declare const createElementsTree: ({ renderer, assetBaseUrl, imageBaseUrl
|
|
|
23
20
|
}>;
|
|
24
21
|
imageLoader: ImageLoader;
|
|
25
22
|
rootInstanceId: Instance["id"];
|
|
26
|
-
propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
|
|
27
|
-
assetsStore: ReadableAtom<Assets>;
|
|
28
|
-
dataSourcesLogicStore: ReadableAtom<Map<string, unknown>>;
|
|
29
|
-
indexesWithinAncestors: IndexesWithinAncestors;
|
|
30
23
|
Component: ForwardRefExoticComponent<WebstudioComponentProps & RefAttributes<HTMLElement>>;
|
|
31
24
|
components: Components;
|
|
32
25
|
scripts?: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.0",
|
|
4
4
|
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -28,17 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@jsep-plugin/assignment": "^1.2.1",
|
|
31
|
-
"@nanostores/react": "^0.7.1",
|
|
32
31
|
"html-tags": "^3.3.1",
|
|
33
32
|
"jsep": "^1.3.8",
|
|
34
33
|
"nanoid": "^4.0.2",
|
|
35
|
-
"nanostores": "^0.9.3",
|
|
36
34
|
"no-case": "^3.0.4",
|
|
37
35
|
"title-case": "^3.0.3",
|
|
38
|
-
"@webstudio-is/css-engine": "0.
|
|
39
|
-
"@webstudio-is/fonts": "0.
|
|
40
|
-
"@webstudio-is/image": "0.
|
|
41
|
-
"@webstudio-is/sdk": "0.
|
|
36
|
+
"@webstudio-is/css-engine": "0.104.0",
|
|
37
|
+
"@webstudio-is/fonts": "0.104.0",
|
|
38
|
+
"@webstudio-is/image": "0.104.0",
|
|
39
|
+
"@webstudio-is/sdk": "0.104.0"
|
|
42
40
|
},
|
|
43
41
|
"exports": {
|
|
44
42
|
".": {
|