@weaverse/core 0.7.59 → 0.7.61
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 +13 -18
- package/dist/index.js +1 -16
- package/dist/index.mjs +1 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -61,14 +61,6 @@ interface ProjectDataType {
|
|
|
61
61
|
};
|
|
62
62
|
pageId?: string;
|
|
63
63
|
}
|
|
64
|
-
interface InitializeData {
|
|
65
|
-
id: string;
|
|
66
|
-
handle: string;
|
|
67
|
-
data: ProjectDataType;
|
|
68
|
-
published: boolean;
|
|
69
|
-
projectKey?: string;
|
|
70
|
-
studioUrl?: string;
|
|
71
|
-
}
|
|
72
64
|
interface BreakPoints {
|
|
73
65
|
mobile: string;
|
|
74
66
|
desktop: string;
|
|
@@ -110,7 +102,7 @@ type GridSize = {
|
|
|
110
102
|
rowSpan: number;
|
|
111
103
|
colSpan: number;
|
|
112
104
|
};
|
|
113
|
-
type ToolbarAction = "general-settings" | "edit-text" | "duplicate" | "delete" | "copy-styles" | "paste-styles" | "move-up" | "move-down" | "toggle-visibility" | "more-actions";
|
|
105
|
+
type ToolbarAction = "general-settings" | "settings-level-2" | "edit-text" | "duplicate" | "delete" | "copy-styles" | "paste-styles" | "move-up" | "move-down" | "toggle-visibility" | "more-actions";
|
|
114
106
|
interface ElementSchema {
|
|
115
107
|
title: string;
|
|
116
108
|
type: string;
|
|
@@ -282,24 +274,29 @@ declare class Weaverse {
|
|
|
282
274
|
*/
|
|
283
275
|
projectData: ProjectDataType;
|
|
284
276
|
/**
|
|
285
|
-
*
|
|
277
|
+
* Storing subscribe callback function for any component that want to listen to the change of WeaverseRoot
|
|
286
278
|
* @type {Map<string, (data: any) => void>}
|
|
287
279
|
*/
|
|
288
280
|
listeners: Set<any>;
|
|
289
281
|
/**
|
|
290
|
-
*
|
|
291
|
-
*
|
|
282
|
+
* Check whether the sdk is in editor or not.
|
|
283
|
+
* If isDesignMode is true, it means the sdk is isDesignMode mode, render the editor UI,
|
|
292
284
|
* else render the preview UI, plain HTML + CSS + React hydrate
|
|
293
285
|
* @type {boolean}
|
|
294
286
|
*/
|
|
295
287
|
isDesignMode: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Check whether the sdk is in preview mode or not
|
|
290
|
+
* @type {boolean}
|
|
291
|
+
*/
|
|
292
|
+
isPreviewMode: boolean;
|
|
296
293
|
/**
|
|
297
294
|
* Use in element to optionally render special HTML for hydration
|
|
298
295
|
* @type {boolean}
|
|
299
296
|
*/
|
|
300
297
|
ssrMode: boolean;
|
|
301
298
|
/**
|
|
302
|
-
*
|
|
299
|
+
* Stitches instance for handling CSS stylesheet, media, theme for Weaverse project
|
|
303
300
|
*/
|
|
304
301
|
stitchesInstance: Stitches$1 | any;
|
|
305
302
|
studioBridge?: any;
|
|
@@ -316,11 +313,9 @@ declare class Weaverse {
|
|
|
316
313
|
*/
|
|
317
314
|
constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode }?: WeaverseType);
|
|
318
315
|
init({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode }?: WeaverseType): void;
|
|
319
|
-
initialized: boolean;
|
|
320
|
-
initializeData: (data: InitializeData) => void;
|
|
321
316
|
loadStudio(): void;
|
|
322
317
|
/**
|
|
323
|
-
*
|
|
318
|
+
* Register the custom React Component to Weaverse, store it into Weaverse.elementInstances
|
|
324
319
|
* @param element {WeaverseElement} custom React Component
|
|
325
320
|
*/
|
|
326
321
|
registerElement(element: WeaverseElement): void;
|
|
@@ -329,7 +324,7 @@ declare class Weaverse {
|
|
|
329
324
|
unsubscribe(fn: any): void;
|
|
330
325
|
triggerUpdate(): void;
|
|
331
326
|
/**
|
|
332
|
-
*
|
|
327
|
+
* Fetch data from Weaverse API (https://weaverse.io/api/v1/project/:projectKey)
|
|
333
328
|
* @param fetch {fetch} custom fetch function, pass in custom fetch function if you want to use your own fetch function
|
|
334
329
|
* @param appUrl
|
|
335
330
|
* @param projectKey
|
|
@@ -343,4 +338,4 @@ declare class Weaverse {
|
|
|
343
338
|
initProjectItemData(): void;
|
|
344
339
|
}
|
|
345
340
|
|
|
346
|
-
export { AdditionalInputConfigs, AdvancedGroup, AdvancedGroupType, BasicGroup, BasicInput, BreakPoints, CatalogGroup, ChildElement, ChildElementCSS, ChildElementSelector, ElementCSS, ElementCatalog, ElementData, ElementDataInCatalog, ElementFlags, ElementInspector, ElementSchema, FlagType, GridSize,
|
|
341
|
+
export { AdditionalInputConfigs, AdvancedGroup, AdvancedGroupType, BasicGroup, BasicInput, BreakPoints, CatalogGroup, ChildElement, ChildElementCSS, ChildElementSelector, ElementCSS, ElementCatalog, ElementData, ElementDataInCatalog, ElementFlags, ElementInspector, ElementSchema, FlagType, GridSize, InputType, ParentType, ProjectDataType, RangeInputConfigs, SelectInputConfigs, SortableInputConfigs, SortableItemAction, ToggleGroupConfigs, ToolbarAction, Weaverse, WeaverseCSSProperties, WeaverseElement, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative, merge, stichesUtils };
|
package/dist/index.js
CHANGED
|
@@ -159,27 +159,12 @@ var Weaverse = class {
|
|
|
159
159
|
};
|
|
160
160
|
this.listeners = /* @__PURE__ */ new Set();
|
|
161
161
|
this.isDesignMode = false;
|
|
162
|
+
this.isPreviewMode = false;
|
|
162
163
|
this.ssrMode = false;
|
|
163
164
|
this.mediaBreakPoints = {
|
|
164
165
|
desktop: "all",
|
|
165
166
|
mobile: "(max-width: 767.98px)"
|
|
166
167
|
};
|
|
167
|
-
this.initialized = false;
|
|
168
|
-
this.initializeData = (data) => {
|
|
169
|
-
if (!this.initialized) {
|
|
170
|
-
let { data: pageData, published, id, projectKey, studioUrl } = data;
|
|
171
|
-
this.projectKey = projectKey || this.projectKey;
|
|
172
|
-
this.appUrl = studioUrl || this.appUrl;
|
|
173
|
-
this.projectData = { ...pageData, pageId: id };
|
|
174
|
-
this.isDesignMode = !published;
|
|
175
|
-
this.initProjectItemData();
|
|
176
|
-
if (this.isDesignMode) {
|
|
177
|
-
this.triggerUpdate();
|
|
178
|
-
this.loadStudio();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
this.initialized = true;
|
|
182
|
-
};
|
|
183
168
|
this.initStitches = () => {
|
|
184
169
|
this.stitchesInstance = this.stitchesInstance || stitches.createStitches({
|
|
185
170
|
prefix: "weaverse",
|
package/dist/index.mjs
CHANGED
|
@@ -121,27 +121,12 @@ var Weaverse = class {
|
|
|
121
121
|
};
|
|
122
122
|
this.listeners = /* @__PURE__ */ new Set();
|
|
123
123
|
this.isDesignMode = false;
|
|
124
|
+
this.isPreviewMode = false;
|
|
124
125
|
this.ssrMode = false;
|
|
125
126
|
this.mediaBreakPoints = {
|
|
126
127
|
desktop: "all",
|
|
127
128
|
mobile: "(max-width: 767.98px)"
|
|
128
129
|
};
|
|
129
|
-
this.initialized = false;
|
|
130
|
-
this.initializeData = (data) => {
|
|
131
|
-
if (!this.initialized) {
|
|
132
|
-
let { data: pageData, published, id, projectKey, studioUrl } = data;
|
|
133
|
-
this.projectKey = projectKey || this.projectKey;
|
|
134
|
-
this.appUrl = studioUrl || this.appUrl;
|
|
135
|
-
this.projectData = { ...pageData, pageId: id };
|
|
136
|
-
this.isDesignMode = !published;
|
|
137
|
-
this.initProjectItemData();
|
|
138
|
-
if (this.isDesignMode) {
|
|
139
|
-
this.triggerUpdate();
|
|
140
|
-
this.loadStudio();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
this.initialized = true;
|
|
144
|
-
};
|
|
145
130
|
this.initStitches = () => {
|
|
146
131
|
this.stitchesInstance = this.stitchesInstance || stitches.createStitches({
|
|
147
132
|
prefix: "weaverse",
|
package/package.json
CHANGED