@weaverse/core 0.6.22 → 0.6.23

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 CHANGED
@@ -71,7 +71,7 @@ interface ElementCatalog {
71
71
  icon?: string;
72
72
  group?: CatalogGroup;
73
73
  }
74
- declare type FlagType = "draggable" | "resizable" | "sortable";
74
+ declare type FlagType = "draggable" | "resizable" | "sortable" | "droppable";
75
75
  declare type ElementFlags = Partial<Record<FlagType, boolean>>;
76
76
  declare type ToolbarAction = "duplicate" | "delete" | "edit-button" | "insert-link" | "select-template" | "copy-styles" | "paste-styles";
77
77
  interface ChildElement {
@@ -140,6 +140,7 @@ declare global {
140
140
  interface Window {
141
141
  WeaverseStudioBridge: TODO;
142
142
  weaverseShopifyProducts: TODO;
143
+ weaverseGlobalSettings: TODO;
143
144
  }
144
145
  }
145
146
 
@@ -209,13 +210,6 @@ declare class Weaverse {
209
210
  * @type {Map<string, (data: any) => void>}
210
211
  */
211
212
  listeners: Set<any>;
212
- /**
213
- * check whether the sdk is isDesignMode or not
214
- * if isDesignMode is true, it means the sdk is isDesignMode mode, render the editor UI
215
- * else render the preview UI, plain HTML + CSS + React hydrate
216
- * @type {boolean}
217
- */
218
- isDesignMode: boolean;
219
213
  /**
220
214
  * Use in element to optionally render special HTML for hydration
221
215
  * @type {boolean}
@@ -237,10 +231,9 @@ declare class Weaverse {
237
231
  * @param projectKey {string} Weaverse project key to access project data via API
238
232
  * @param projectData {ProjectDataType} Weaverse project data, by default, user can provide project data via React Component.
239
233
  * @param mediaBreakPoints {object} Pass down custom media query breakpoints or just use the default.
240
- * @param isDesignMode {boolean} check whether the sdk is isDesignMode or not
241
234
  * @param ssrMode {boolean} Use in element to optionally render special HTML for hydration
242
235
  */
243
- constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode }?: WeaverseType);
236
+ constructor({ appUrl, projectKey, projectData, mediaBreakPoints, ssrMode }?: WeaverseType);
244
237
  loadStudio(): void;
245
238
  /**
246
239
  * register the custom React Component to Weaverse, store it into Weaverse.elementInstances
package/dist/index.js CHANGED
@@ -142,7 +142,7 @@ var WeaverseItemStore = class {
142
142
  }
143
143
  };
144
144
  var _Weaverse = class {
145
- constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode } = {}) {
145
+ constructor({ appUrl, projectKey, projectData, mediaBreakPoints, ssrMode } = {}) {
146
146
  this.elementInstances = /* @__PURE__ */ new Map();
147
147
  this.itemInstances = /* @__PURE__ */ new Map();
148
148
  this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://weaverse.io";
@@ -153,7 +153,6 @@ var _Weaverse = class {
153
153
  script: { css: "", js: "" }
154
154
  };
155
155
  this.listeners = /* @__PURE__ */ new Set();
156
- this.isDesignMode = false;
157
156
  this.ssrMode = false;
158
157
  this.mediaBreakPoints = {
159
158
  desktop: "all",
@@ -169,27 +168,28 @@ var _Weaverse = class {
169
168
  this.appUrl = appUrl || this.appUrl;
170
169
  this.projectKey = projectKey || this.projectKey;
171
170
  this.mediaBreakPoints = mediaBreakPoints || this.mediaBreakPoints;
172
- this.isDesignMode = isDesignMode || this.isDesignMode;
173
171
  this.ssrMode = ssrMode || this.ssrMode;
174
172
  projectData && (this.projectData = projectData);
175
173
  this.init();
176
174
  }
177
175
  loadStudio() {
178
- if (this.isDesignMode && isIframe) {
179
- const initStudio = () => {
180
- this.studioBridge = new window.WeaverseStudioBridge(this);
181
- this.triggerUpdate();
182
- };
183
- if (!window.WeaverseStudioBridge) {
184
- const studioBridgeScript = document.createElement("script");
185
- studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js`;
186
- studioBridgeScript.type = "module";
187
- studioBridgeScript.onload = initStudio;
188
- document.body.appendChild(studioBridgeScript);
189
- } else {
190
- initStudio();
176
+ setTimeout(() => {
177
+ if (isIframe) {
178
+ const initStudio = () => {
179
+ this.studioBridge = new window.WeaverseStudioBridge(this);
180
+ this.triggerUpdate();
181
+ };
182
+ if (!window.WeaverseStudioBridge) {
183
+ const studioBridgeScript = document.createElement("script");
184
+ studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js`;
185
+ studioBridgeScript.type = "module";
186
+ studioBridgeScript.onload = initStudio;
187
+ document.body.appendChild(studioBridgeScript);
188
+ } else {
189
+ initStudio();
190
+ }
191
191
  }
192
- }
192
+ }, 2e3);
193
193
  }
194
194
  registerElement(element) {
195
195
  if (element == null ? void 0 : element.type) {
@@ -204,9 +204,6 @@ var _Weaverse = class {
204
204
  init() {
205
205
  this.initStitches();
206
206
  this.initProjectItemData();
207
- setTimeout(() => {
208
- this.loadStudio();
209
- }, 1e3);
210
207
  }
211
208
  subscribe(fn) {
212
209
  this.listeners.add(fn);
package/dist/index.mjs CHANGED
@@ -113,7 +113,7 @@ var WeaverseItemStore = class {
113
113
  }
114
114
  };
115
115
  var _Weaverse = class {
116
- constructor({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode } = {}) {
116
+ constructor({ appUrl, projectKey, projectData, mediaBreakPoints, ssrMode } = {}) {
117
117
  this.elementInstances = /* @__PURE__ */ new Map();
118
118
  this.itemInstances = /* @__PURE__ */ new Map();
119
119
  this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://weaverse.io";
@@ -124,7 +124,6 @@ var _Weaverse = class {
124
124
  script: { css: "", js: "" }
125
125
  };
126
126
  this.listeners = /* @__PURE__ */ new Set();
127
- this.isDesignMode = false;
128
127
  this.ssrMode = false;
129
128
  this.mediaBreakPoints = {
130
129
  desktop: "all",
@@ -140,27 +139,28 @@ var _Weaverse = class {
140
139
  this.appUrl = appUrl || this.appUrl;
141
140
  this.projectKey = projectKey || this.projectKey;
142
141
  this.mediaBreakPoints = mediaBreakPoints || this.mediaBreakPoints;
143
- this.isDesignMode = isDesignMode || this.isDesignMode;
144
142
  this.ssrMode = ssrMode || this.ssrMode;
145
143
  projectData && (this.projectData = projectData);
146
144
  this.init();
147
145
  }
148
146
  loadStudio() {
149
- if (this.isDesignMode && isIframe) {
150
- const initStudio = () => {
151
- this.studioBridge = new window.WeaverseStudioBridge(this);
152
- this.triggerUpdate();
153
- };
154
- if (!window.WeaverseStudioBridge) {
155
- const studioBridgeScript = document.createElement("script");
156
- studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js`;
157
- studioBridgeScript.type = "module";
158
- studioBridgeScript.onload = initStudio;
159
- document.body.appendChild(studioBridgeScript);
160
- } else {
161
- initStudio();
147
+ setTimeout(() => {
148
+ if (isIframe) {
149
+ const initStudio = () => {
150
+ this.studioBridge = new window.WeaverseStudioBridge(this);
151
+ this.triggerUpdate();
152
+ };
153
+ if (!window.WeaverseStudioBridge) {
154
+ const studioBridgeScript = document.createElement("script");
155
+ studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js`;
156
+ studioBridgeScript.type = "module";
157
+ studioBridgeScript.onload = initStudio;
158
+ document.body.appendChild(studioBridgeScript);
159
+ } else {
160
+ initStudio();
161
+ }
162
162
  }
163
- }
163
+ }, 2e3);
164
164
  }
165
165
  registerElement(element) {
166
166
  if (element == null ? void 0 : element.type) {
@@ -175,9 +175,6 @@ var _Weaverse = class {
175
175
  init() {
176
176
  this.initStitches();
177
177
  this.initProjectItemData();
178
- setTimeout(() => {
179
- this.loadStudio();
180
- }, 1e3);
181
178
  }
182
179
  subscribe(fn) {
183
180
  this.listeners.add(fn);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.22",
2
+ "version": "0.6.23",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",