@weaverse/core 0.5.13 → 0.6.1
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 +15 -20
- package/dist/index.js +2 -8
- package/dist/index.mjs +2 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,31 +9,26 @@ declare type WeaverseElement = {
|
|
|
9
9
|
schema: WeaverseElementSchema;
|
|
10
10
|
};
|
|
11
11
|
declare type WeaverseElementSchema = {
|
|
12
|
-
title
|
|
12
|
+
title?: string;
|
|
13
13
|
type: string;
|
|
14
|
-
settings
|
|
14
|
+
settings?: WeaverseElementSettingInput[];
|
|
15
|
+
styles?: WeaverseElementStyleInput[];
|
|
15
16
|
toolbar?: TODO;
|
|
16
17
|
data?: TODO;
|
|
17
18
|
};
|
|
18
|
-
declare type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
declare type WeaverseElementInspector = {
|
|
24
|
-
binding?: "data" | "style";
|
|
25
|
-
key?: string;
|
|
26
|
-
label?: string;
|
|
27
|
-
placeholder?: string;
|
|
28
|
-
type: InspectorInputType;
|
|
29
|
-
options?: InspectorOption[];
|
|
30
|
-
default?: TODO;
|
|
19
|
+
declare type WeaverseElementStyleInput = {
|
|
20
|
+
name?: string;
|
|
21
|
+
type: 'alignment' | 'color' | 'dimensions' | 'flex' | 'grid' | 'input' | 'switch' | 'spacing' | 'textarea' | 'visibility' | 'border' | 'background' | 'typography' | 'shadow' | 'position' | 'overflow' | 'display' | 'other';
|
|
22
|
+
defaultValue?: string;
|
|
31
23
|
};
|
|
32
|
-
declare type
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
declare type WeaverseElementSettingInput = {
|
|
25
|
+
type: 'input' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'color' | 'range' | 'button' | 'image';
|
|
26
|
+
name: string;
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
helpText?: string;
|
|
29
|
+
options?: TODO[];
|
|
30
|
+
condition?: TODO;
|
|
35
31
|
};
|
|
36
|
-
declare type InspectorInputType = "alignment" | "color" | "dimensions" | "flex" | "grid" | "input" | "switch" | "spacing" | "textarea" | "select" | "visibility" | "border" | "image";
|
|
37
32
|
declare global {
|
|
38
33
|
interface Window {
|
|
39
34
|
WeaverseStudioBridge: TODO;
|
|
@@ -185,4 +180,4 @@ declare const isReactNative: boolean;
|
|
|
185
180
|
declare const isBrowser: boolean;
|
|
186
181
|
declare const isIframe: boolean;
|
|
187
182
|
|
|
188
|
-
export {
|
|
183
|
+
export { MediaBreakpoints, ProjectDataItemType, ProjectDataType, TODO, Weaverse, WeaverseElement, WeaverseElementMap, WeaverseElementSchema, WeaverseElementSettingInput, WeaverseElementStyleInput, 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