@weaverse/core 0.5.13 → 0.6.3

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
@@ -9,31 +9,23 @@ declare type WeaverseElement = {
9
9
  schema: WeaverseElementSchema;
10
10
  };
11
11
  declare type WeaverseElementSchema = {
12
- title: string;
12
+ title?: string;
13
13
  type: string;
14
- settings: WeaverseElementSetting[];
14
+ settings?: WeaverseElementInput[];
15
+ styles?: WeaverseElementInput[];
15
16
  toolbar?: TODO;
16
17
  data?: TODO;
17
18
  };
18
- declare type WeaverseElementSetting = {
19
- tab: string;
20
- label: string;
21
- inspectors: WeaverseElementInspector[];
22
- };
23
- declare type WeaverseElementInspector = {
24
- binding?: "data" | "style";
25
- key?: string;
19
+ declare type WeaverseElementInput = {
26
20
  label?: string;
27
- placeholder?: string;
28
- type: InspectorInputType;
29
- options?: InspectorOption[];
30
- default?: TODO;
31
- };
32
- declare type InspectorOption = {
33
- value: TODO;
34
- label: string;
21
+ type: 'select' | 'checkbox' | 'radio' | 'range' | 'button' | 'image' | 'file' | 'hidden' | 'alignment' | 'color' | 'dimensions' | 'flex' | 'grid' | 'input' | 'switch' | 'spacing' | 'textarea' | 'visibility' | 'border' | 'background' | 'typography' | 'shadow' | 'position' | 'overflow' | 'display' | 'other';
22
+ name?: string;
23
+ defaultValue?: string;
24
+ helpText?: string;
25
+ options?: TODO[];
26
+ conditions?: TODO[];
27
+ [key: string]: TODO;
35
28
  };
36
- declare type InspectorInputType = "alignment" | "color" | "dimensions" | "flex" | "grid" | "input" | "switch" | "spacing" | "textarea" | "select" | "visibility" | "border" | "image";
37
29
  declare global {
38
30
  interface Window {
39
31
  WeaverseStudioBridge: TODO;
@@ -185,4 +177,4 @@ declare const isReactNative: boolean;
185
177
  declare const isBrowser: boolean;
186
178
  declare const isIframe: boolean;
187
179
 
188
- export { InspectorInputType, InspectorOption, MediaBreakpoints, ProjectDataItemType, ProjectDataType, TODO, Weaverse, WeaverseElement, WeaverseElementInspector, WeaverseElementMap, WeaverseElementSchema, WeaverseElementSetting, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative };
180
+ export { MediaBreakpoints, ProjectDataItemType, ProjectDataType, TODO, Weaverse, WeaverseElement, WeaverseElementInput, WeaverseElementMap, WeaverseElementSchema, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative };
package/dist/index.js CHANGED
@@ -142,6 +142,7 @@ var _Weaverse = class {
142
142
  this.initStitches();
143
143
  this.loadStudio();
144
144
  this.initProjectItemData();
145
+ this.updateProjectData();
145
146
  }
146
147
  loadStudio() {
147
148
  if (this.isDesignMode && isIframe) {
@@ -168,13 +169,6 @@ var _Weaverse = class {
168
169
  }
169
170
  triggerUpdate() {
170
171
  this.listeners.forEach((fn) => fn());
171
- if (this.isDesignMode && this.studioBridge) {
172
- this.studioBridge.sendMessageToEditor("weaverse.editor.updateProject", {
173
- projectData: this.projectData,
174
- projectKey: this.projectKey,
175
- appUrl: this.appUrl
176
- });
177
- }
178
172
  }
179
173
  static fetchProjectData({
180
174
  fetch = globalThis.fetch,
@@ -184,7 +178,7 @@ var _Weaverse = class {
184
178
  return fetch(appUrl + `/api/public/${projectKey}`).then((r) => r.json()).catch(console.error);
185
179
  }
186
180
  updateProjectData() {
187
- if (this.projectKey) {
181
+ if (this.projectKey && !this.projectData.rootId) {
188
182
  _Weaverse.fetchProjectData({ appUrl: this.appUrl, projectKey: this.projectKey }).then((data) => {
189
183
  if (data) {
190
184
  this.projectData = data;
package/dist/index.mjs CHANGED
@@ -113,6 +113,7 @@ var _Weaverse = class {
113
113
  this.initStitches();
114
114
  this.loadStudio();
115
115
  this.initProjectItemData();
116
+ this.updateProjectData();
116
117
  }
117
118
  loadStudio() {
118
119
  if (this.isDesignMode && isIframe) {
@@ -139,13 +140,6 @@ var _Weaverse = class {
139
140
  }
140
141
  triggerUpdate() {
141
142
  this.listeners.forEach((fn) => fn());
142
- if (this.isDesignMode && this.studioBridge) {
143
- this.studioBridge.sendMessageToEditor("weaverse.editor.updateProject", {
144
- projectData: this.projectData,
145
- projectKey: this.projectKey,
146
- appUrl: this.appUrl
147
- });
148
- }
149
143
  }
150
144
  static fetchProjectData({
151
145
  fetch = globalThis.fetch,
@@ -155,7 +149,7 @@ var _Weaverse = class {
155
149
  return fetch(appUrl + `/api/public/${projectKey}`).then((r) => r.json()).catch(console.error);
156
150
  }
157
151
  updateProjectData() {
158
- if (this.projectKey) {
152
+ if (this.projectKey && !this.projectData.rootId) {
159
153
  _Weaverse.fetchProjectData({ appUrl: this.appUrl, projectKey: this.projectKey }).then((data) => {
160
154
  if (data) {
161
155
  this.projectData = data;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.13",
2
+ "version": "0.6.3",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -22,6 +22,6 @@
22
22
  "name": "@weaverse/core",
23
23
  "author": "Paul",
24
24
  "dependencies": {
25
- "@stitches/core": "^1.2.7"
25
+ "@stitches/core": "^1.2.8"
26
26
  }
27
27
  }