@weaverse/core 0.7.69 → 0.7.71
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 +3 -1
- package/dist/index.js +28 -24
- package/dist/index.mjs +28 -24
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -301,7 +301,9 @@ declare class Weaverse {
|
|
|
301
301
|
*/
|
|
302
302
|
constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode }?: WeaverseType);
|
|
303
303
|
init({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode }?: WeaverseType): void;
|
|
304
|
-
|
|
304
|
+
initialized: boolean;
|
|
305
|
+
initializeData: (data: any) => void;
|
|
306
|
+
loadStudio(version?: string): void;
|
|
305
307
|
/**
|
|
306
308
|
* Register the custom React Component to Weaverse, store it into Weaverse.elementInstances
|
|
307
309
|
* @param element {WeaverseElement} custom React Component
|
package/dist/index.js
CHANGED
|
@@ -218,6 +218,23 @@ var Weaverse = class {
|
|
|
218
218
|
// tablet: "(max-width: 1023.98px)", // to set css for tablet, {'@tablet' : { // css }},
|
|
219
219
|
mobile: "(max-width: 767.98px)"
|
|
220
220
|
};
|
|
221
|
+
this.initialized = false;
|
|
222
|
+
this.initializeData = (data) => {
|
|
223
|
+
if (!this.initialized) {
|
|
224
|
+
let { projectData, published, id, projectKey, studioUrl } = data;
|
|
225
|
+
this.projectKey = projectKey || this.projectKey;
|
|
226
|
+
this.appUrl = studioUrl || this.appUrl;
|
|
227
|
+
this.projectData = { ...projectData, pageId: id };
|
|
228
|
+
this.isDesignMode = !published;
|
|
229
|
+
this.initProjectItemData();
|
|
230
|
+
if (this.isDesignMode) {
|
|
231
|
+
this.initStitches();
|
|
232
|
+
this.triggerUpdate();
|
|
233
|
+
this.loadStudio();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
this.initialized = true;
|
|
237
|
+
};
|
|
221
238
|
this.initStitches = () => {
|
|
222
239
|
this.stitchesInstance = this.stitchesInstance || stitches.createStitches({
|
|
223
240
|
prefix: "weaverse",
|
|
@@ -237,29 +254,16 @@ var Weaverse = class {
|
|
|
237
254
|
this.initStitches();
|
|
238
255
|
this.initProjectItemData();
|
|
239
256
|
}
|
|
240
|
-
// initialized = false
|
|
241
|
-
// initializeData = (data: InitializeData) => {
|
|
242
|
-
// if (!this.initialized) {
|
|
243
|
-
// let { data: pageData, published, id, projectKey, studioUrl } = data
|
|
244
|
-
// this.projectKey = projectKey || this.projectKey
|
|
245
|
-
// this.appUrl = studioUrl || this.appUrl
|
|
246
|
-
// this.projectData = { ...pageData, pageId: id }
|
|
247
|
-
// this.isDesignMode = !published
|
|
248
|
-
// this.initProjectItemData()
|
|
249
|
-
// if (this.isDesignMode) {
|
|
250
|
-
// this.triggerUpdate()
|
|
251
|
-
// this.loadStudio()
|
|
252
|
-
// }
|
|
253
|
-
// }
|
|
254
|
-
// this.initialized = true
|
|
255
|
-
// }
|
|
256
257
|
loadStudio(version) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
console.log("load studio");
|
|
259
|
+
if (isIframe && this.isDesignMode && !this.studioBridge) {
|
|
260
|
+
const initStudio = () => {
|
|
261
|
+
this.studioBridge = new window.WeaverseStudioBridge(this);
|
|
262
|
+
this.triggerUpdate();
|
|
263
|
+
console.log("Studio loaded", this);
|
|
264
|
+
clearInterval(i);
|
|
265
|
+
};
|
|
266
|
+
let i = setInterval(() => {
|
|
263
267
|
if (!window.WeaverseStudioBridge) {
|
|
264
268
|
let studioBridgeScript = document.createElement("script");
|
|
265
269
|
studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js?v=${version}`;
|
|
@@ -269,8 +273,8 @@ var Weaverse = class {
|
|
|
269
273
|
} else {
|
|
270
274
|
initStudio();
|
|
271
275
|
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
276
|
+
}, 2e3);
|
|
277
|
+
}
|
|
274
278
|
}
|
|
275
279
|
/**
|
|
276
280
|
* Register the custom React Component to Weaverse, store it into Weaverse.elementInstances
|
package/dist/index.mjs
CHANGED
|
@@ -177,6 +177,23 @@ var Weaverse = class {
|
|
|
177
177
|
// tablet: "(max-width: 1023.98px)", // to set css for tablet, {'@tablet' : { // css }},
|
|
178
178
|
mobile: "(max-width: 767.98px)"
|
|
179
179
|
};
|
|
180
|
+
this.initialized = false;
|
|
181
|
+
this.initializeData = (data) => {
|
|
182
|
+
if (!this.initialized) {
|
|
183
|
+
let { projectData, published, id, projectKey, studioUrl } = data;
|
|
184
|
+
this.projectKey = projectKey || this.projectKey;
|
|
185
|
+
this.appUrl = studioUrl || this.appUrl;
|
|
186
|
+
this.projectData = { ...projectData, pageId: id };
|
|
187
|
+
this.isDesignMode = !published;
|
|
188
|
+
this.initProjectItemData();
|
|
189
|
+
if (this.isDesignMode) {
|
|
190
|
+
this.initStitches();
|
|
191
|
+
this.triggerUpdate();
|
|
192
|
+
this.loadStudio();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
this.initialized = true;
|
|
196
|
+
};
|
|
180
197
|
this.initStitches = () => {
|
|
181
198
|
this.stitchesInstance = this.stitchesInstance || stitches.createStitches({
|
|
182
199
|
prefix: "weaverse",
|
|
@@ -196,29 +213,16 @@ var Weaverse = class {
|
|
|
196
213
|
this.initStitches();
|
|
197
214
|
this.initProjectItemData();
|
|
198
215
|
}
|
|
199
|
-
// initialized = false
|
|
200
|
-
// initializeData = (data: InitializeData) => {
|
|
201
|
-
// if (!this.initialized) {
|
|
202
|
-
// let { data: pageData, published, id, projectKey, studioUrl } = data
|
|
203
|
-
// this.projectKey = projectKey || this.projectKey
|
|
204
|
-
// this.appUrl = studioUrl || this.appUrl
|
|
205
|
-
// this.projectData = { ...pageData, pageId: id }
|
|
206
|
-
// this.isDesignMode = !published
|
|
207
|
-
// this.initProjectItemData()
|
|
208
|
-
// if (this.isDesignMode) {
|
|
209
|
-
// this.triggerUpdate()
|
|
210
|
-
// this.loadStudio()
|
|
211
|
-
// }
|
|
212
|
-
// }
|
|
213
|
-
// this.initialized = true
|
|
214
|
-
// }
|
|
215
216
|
loadStudio(version) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
console.log("load studio");
|
|
218
|
+
if (isIframe && this.isDesignMode && !this.studioBridge) {
|
|
219
|
+
const initStudio = () => {
|
|
220
|
+
this.studioBridge = new window.WeaverseStudioBridge(this);
|
|
221
|
+
this.triggerUpdate();
|
|
222
|
+
console.log("Studio loaded", this);
|
|
223
|
+
clearInterval(i);
|
|
224
|
+
};
|
|
225
|
+
let i = setInterval(() => {
|
|
222
226
|
if (!window.WeaverseStudioBridge) {
|
|
223
227
|
let studioBridgeScript = document.createElement("script");
|
|
224
228
|
studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js?v=${version}`;
|
|
@@ -228,8 +232,8 @@ var Weaverse = class {
|
|
|
228
232
|
} else {
|
|
229
233
|
initStudio();
|
|
230
234
|
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
235
|
+
}, 2e3);
|
|
236
|
+
}
|
|
233
237
|
}
|
|
234
238
|
/**
|
|
235
239
|
* Register the custom React Component to Weaverse, store it into Weaverse.elementInstances
|
package/package.json
CHANGED