@weaverse/core 0.7.11 → 0.7.13
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/dist/index.d.ts +20 -14
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ declare const isReactNative: boolean;
|
|
|
46
46
|
declare const isBrowser: boolean;
|
|
47
47
|
declare const isIframe: boolean;
|
|
48
48
|
|
|
49
|
-
declare type TODO = any;
|
|
50
49
|
interface ProjectDataType {
|
|
51
50
|
items: ElementData[];
|
|
52
51
|
rootId: string;
|
|
@@ -64,10 +63,10 @@ interface InitializeData {
|
|
|
64
63
|
projectKey?: string;
|
|
65
64
|
studioUrl?: string;
|
|
66
65
|
}
|
|
67
|
-
|
|
66
|
+
interface BreakPoints {
|
|
68
67
|
mobile: string;
|
|
69
68
|
desktop: string;
|
|
70
|
-
}
|
|
69
|
+
}
|
|
71
70
|
interface WeaverseType {
|
|
72
71
|
mediaBreakPoints?: BreakPoints;
|
|
73
72
|
appUrl?: string;
|
|
@@ -95,7 +94,6 @@ interface ElementCatalog {
|
|
|
95
94
|
}
|
|
96
95
|
declare type FlagType = "draggable" | "resizable" | "sortable" | "droppable" | "deletable" | "duplicable";
|
|
97
96
|
declare type ElementFlags = Partial<Record<FlagType, boolean>>;
|
|
98
|
-
declare type ToolbarAction = "duplicate" | "delete" | "copy-styles" | "paste-styles";
|
|
99
97
|
interface ChildElement {
|
|
100
98
|
label: string;
|
|
101
99
|
selector: string;
|
|
@@ -105,6 +103,7 @@ declare type GridSize = {
|
|
|
105
103
|
rowSpan: number;
|
|
106
104
|
colSpan: number;
|
|
107
105
|
};
|
|
106
|
+
declare type ToolbarAction = "duplicate" | "delete" | "copy-styles" | "paste-styles";
|
|
108
107
|
interface ElementSchema {
|
|
109
108
|
title: string;
|
|
110
109
|
type: string;
|
|
@@ -135,18 +134,21 @@ interface ElementInspector {
|
|
|
135
134
|
settings?: (AdvancedGroup | BasicGroup)[];
|
|
136
135
|
styles?: (AdvancedGroup | BasicGroup)[];
|
|
137
136
|
}
|
|
138
|
-
|
|
139
|
-
groupType:
|
|
140
|
-
}
|
|
141
|
-
|
|
137
|
+
interface AdvancedGroup {
|
|
138
|
+
groupType: AdvancedGroupType;
|
|
139
|
+
}
|
|
140
|
+
interface BasicGroup {
|
|
142
141
|
groupType: "basic";
|
|
143
142
|
groupHeader: string;
|
|
144
143
|
inputs: BasicInput[];
|
|
145
|
-
}
|
|
146
|
-
declare type
|
|
144
|
+
}
|
|
145
|
+
declare type AdvancedGroupType = "border" | "alignment" | "background" | "dimensions" | "spacing" | "typography" | "visibility";
|
|
147
146
|
interface BasicInput {
|
|
148
147
|
type: InputType;
|
|
149
148
|
label: string;
|
|
149
|
+
/**
|
|
150
|
+
* The key of the value in the element data or css
|
|
151
|
+
*/
|
|
150
152
|
name: string;
|
|
151
153
|
defaultValue?: string;
|
|
152
154
|
placeholder?: string;
|
|
@@ -166,6 +168,10 @@ interface BasicInput {
|
|
|
166
168
|
min?: number;
|
|
167
169
|
max?: number;
|
|
168
170
|
step?: number;
|
|
171
|
+
/**
|
|
172
|
+
* For `sortable` input
|
|
173
|
+
*/
|
|
174
|
+
visibleType?: boolean;
|
|
169
175
|
/**
|
|
170
176
|
* Only display if condition matches.
|
|
171
177
|
*
|
|
@@ -183,8 +189,8 @@ interface BasicInput {
|
|
|
183
189
|
declare type InputType = "color" | "datepicker" | "image" | "range" | "select" | "sortable" | "switch" | "text" | "textarea" | "toggle-group" | "form" | "product" | "custom.html" | "instagram";
|
|
184
190
|
declare global {
|
|
185
191
|
interface Window {
|
|
186
|
-
WeaverseStudioBridge:
|
|
187
|
-
weaverseShopifyProducts:
|
|
192
|
+
WeaverseStudioBridge: any;
|
|
193
|
+
weaverseShopifyProducts: any;
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
|
|
@@ -297,7 +303,7 @@ declare class Weaverse {
|
|
|
297
303
|
unsubscribe(fn: any): void;
|
|
298
304
|
triggerUpdate(): void;
|
|
299
305
|
/**
|
|
300
|
-
* fetch data from Weaverse API (https://weaverse.io/api/v1/
|
|
306
|
+
* fetch data from Weaverse API (https://weaverse.io/api/v1/project/:projectKey)
|
|
301
307
|
* @param fetch {fetch} custom fetch function, pass in custom fetch function if you want to use your own fetch function
|
|
302
308
|
* @param appUrl
|
|
303
309
|
* @param projectKey
|
|
@@ -314,4 +320,4 @@ declare class Weaverse {
|
|
|
314
320
|
initProjectItemData(): void;
|
|
315
321
|
}
|
|
316
322
|
|
|
317
|
-
export { AdvancedGroup,
|
|
323
|
+
export { AdvancedGroup, AdvancedGroupType, BasicGroup, BasicInput, BreakPoints, CatalogGroup, ChildElement, ChildElementCSS, ElementCSS, ElementCatalog, ElementData, ElementFlags, ElementInspector, ElementSchema, ElementsMap, FlagType, GridSize, InitializeData, InputType, ParentType, ProjectDataType, ToolbarAction, Weaverse, WeaverseCSSProperties, WeaverseElement, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative, loadScript, stichesUtils };
|
package/dist/index.js
CHANGED
|
@@ -151,7 +151,7 @@ var Weaverse = class {
|
|
|
151
151
|
constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode } = {}) {
|
|
152
152
|
this.elementInstances = /* @__PURE__ */ new Map();
|
|
153
153
|
this.itemInstances = /* @__PURE__ */ new Map();
|
|
154
|
-
this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://
|
|
154
|
+
this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://studio.weaverse.io";
|
|
155
155
|
this.projectKey = "";
|
|
156
156
|
this.projectData = {
|
|
157
157
|
rootId: "",
|
|
@@ -243,7 +243,7 @@ var Weaverse = class {
|
|
|
243
243
|
appUrl,
|
|
244
244
|
projectKey
|
|
245
245
|
}) {
|
|
246
|
-
return fetch(appUrl + `/api/public/${projectKey}`).then((r) => r.json()).catch(console.error);
|
|
246
|
+
return fetch(appUrl + `/api/public/project/${projectKey}`).then((r) => r.json()).catch(console.error);
|
|
247
247
|
}
|
|
248
248
|
setProjectData(projectData) {
|
|
249
249
|
this.projectData = projectData;
|
package/dist/index.mjs
CHANGED
|
@@ -113,7 +113,7 @@ var Weaverse = class {
|
|
|
113
113
|
constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode } = {}) {
|
|
114
114
|
this.elementInstances = /* @__PURE__ */ new Map();
|
|
115
115
|
this.itemInstances = /* @__PURE__ */ new Map();
|
|
116
|
-
this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://
|
|
116
|
+
this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://studio.weaverse.io";
|
|
117
117
|
this.projectKey = "";
|
|
118
118
|
this.projectData = {
|
|
119
119
|
rootId: "",
|
|
@@ -205,7 +205,7 @@ var Weaverse = class {
|
|
|
205
205
|
appUrl,
|
|
206
206
|
projectKey
|
|
207
207
|
}) {
|
|
208
|
-
return fetch(appUrl + `/api/public/${projectKey}`).then((r) => r.json()).catch(console.error);
|
|
208
|
+
return fetch(appUrl + `/api/public/project/${projectKey}`).then((r) => r.json()).catch(console.error);
|
|
209
209
|
}
|
|
210
210
|
setProjectData(projectData) {
|
|
211
211
|
this.projectData = projectData;
|
package/package.json
CHANGED