@weaverse/core 0.7.16 → 0.7.18
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 +24 -17
- package/dist/index.js +34 -0
- package/dist/index.mjs +33 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Stitches$1 from '@stitches/core/types/stitches';
|
|
|
4
4
|
|
|
5
5
|
declare function loadScript(url: string): Promise<unknown>;
|
|
6
6
|
|
|
7
|
-
declare
|
|
7
|
+
declare let stichesUtils: {
|
|
8
8
|
m: (value: string) => {
|
|
9
9
|
margin: string;
|
|
10
10
|
};
|
|
@@ -41,6 +41,7 @@ declare const stichesUtils: {
|
|
|
41
41
|
paddingBottom: string;
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
+
declare function createGlobalStyles(stitches: Stitches$1): void;
|
|
44
45
|
|
|
45
46
|
declare const isReactNative: boolean;
|
|
46
47
|
declare const isBrowser: boolean;
|
|
@@ -82,28 +83,28 @@ interface WeaverseElement {
|
|
|
82
83
|
defaultCss?: ElementCSS;
|
|
83
84
|
permanentCss?: ElementCSS;
|
|
84
85
|
}
|
|
85
|
-
interface ElementsMap {
|
|
86
|
-
[key: string]: WeaverseElement;
|
|
87
|
-
}
|
|
88
86
|
declare type CatalogGroup = "essential" | "composition" | "shopify";
|
|
89
87
|
interface ElementCatalog {
|
|
90
88
|
name: string;
|
|
91
89
|
icon?: string;
|
|
92
90
|
group?: CatalogGroup;
|
|
93
|
-
data?:
|
|
91
|
+
data?: ElementDataInCatalog[];
|
|
92
|
+
}
|
|
93
|
+
interface ElementDataInCatalog extends Omit<ElementData, "id"> {
|
|
94
|
+
id: string | number;
|
|
94
95
|
}
|
|
95
|
-
declare type FlagType = "draggable" | "resizable" | "sortable" | "
|
|
96
|
+
declare type FlagType = "draggable" | "resizable" | "sortable" | "ignoreShortcutKeys" | "hasContextMenu";
|
|
96
97
|
declare type ElementFlags = Partial<Record<FlagType, boolean>>;
|
|
97
98
|
interface ChildElement {
|
|
98
99
|
label: string;
|
|
99
100
|
selector: string;
|
|
100
101
|
}
|
|
101
|
-
declare type ParentType =
|
|
102
|
+
declare type ParentType = 'container' | 'layout' | 'root' | 'product-details' | 'product-info' | 'collection.box' | 'collection-box' | 'article-box' | 'article-list' | 'slider' | 'tab' | 'accordion' | 'accordion.wrapper';
|
|
102
103
|
declare type GridSize = {
|
|
103
104
|
rowSpan: number;
|
|
104
105
|
colSpan: number;
|
|
105
106
|
};
|
|
106
|
-
declare type ToolbarAction = "duplicate" | "delete" | "copy-styles" | "paste-styles";
|
|
107
|
+
declare type ToolbarAction = "general-settings" | "edit-text" | "duplicate" | "delete" | "copy-styles" | "paste-styles" | "move-up" | "move-down" | "toggle-visibility";
|
|
107
108
|
interface ElementSchema {
|
|
108
109
|
title: string;
|
|
109
110
|
type: string;
|
|
@@ -136,21 +137,23 @@ interface ElementInspector {
|
|
|
136
137
|
}
|
|
137
138
|
interface AdvancedGroup {
|
|
138
139
|
groupType: AdvancedGroupType;
|
|
140
|
+
useData?: boolean;
|
|
139
141
|
}
|
|
140
142
|
interface BasicGroup {
|
|
141
143
|
groupType: "basic";
|
|
142
144
|
groupHeader: string;
|
|
143
145
|
inputs: BasicInput[];
|
|
144
146
|
}
|
|
145
|
-
declare type AdvancedGroupType = "border" | "alignment" | "background" | "dimensions" | "spacing" | "typography" | "visibility";
|
|
147
|
+
declare type AdvancedGroupType = "border" | "alignment" | "background" | "dimensions" | "spacing" | "typography" | "visibility" | "shadows-and-effects";
|
|
146
148
|
interface BasicInput {
|
|
147
149
|
type: InputType;
|
|
148
|
-
label
|
|
150
|
+
label?: string;
|
|
151
|
+
binding?: "style" | "data";
|
|
149
152
|
/**
|
|
150
153
|
* The key of the value in the element data or css
|
|
151
154
|
*/
|
|
152
|
-
name
|
|
153
|
-
defaultValue?: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
defaultValue?: string | number | boolean;
|
|
154
157
|
placeholder?: string;
|
|
155
158
|
helpText?: string;
|
|
156
159
|
/**
|
|
@@ -185,12 +188,19 @@ interface BasicInput {
|
|
|
185
188
|
* `imagesPerRow.gt.1`
|
|
186
189
|
*/
|
|
187
190
|
condition?: string;
|
|
191
|
+
default?: string | number | boolean;
|
|
188
192
|
}
|
|
189
|
-
declare type InputType =
|
|
193
|
+
declare type InputType = 'color' | 'datepicker' | 'image' | 'range' | 'select' | 'sortable' | 'switch' | 'text' | 'textarea' | 'toggle-group' | 'form' | 'product' | 'product-swatches' | 'custom.html' | 'instagram' | 'collection-list' | 'collection' | 'article-list';
|
|
190
194
|
declare global {
|
|
191
195
|
interface Window {
|
|
192
196
|
WeaverseStudioBridge: any;
|
|
197
|
+
weaverseShopifyConfigs: any;
|
|
193
198
|
weaverseShopifyProducts: any;
|
|
199
|
+
weaverseShopifyProductsByCollection: any;
|
|
200
|
+
weaverseShopifyCollections: any;
|
|
201
|
+
weaverseShopifyArticles: any;
|
|
202
|
+
weaverseShopifyBlogs: any;
|
|
203
|
+
weaverseCartHelpers: any;
|
|
194
204
|
Blinkloader: any;
|
|
195
205
|
}
|
|
196
206
|
}
|
|
@@ -315,10 +325,7 @@ declare class Weaverse {
|
|
|
315
325
|
projectKey?: string;
|
|
316
326
|
}): any;
|
|
317
327
|
setProjectData(projectData: ProjectDataType): void;
|
|
318
|
-
/**
|
|
319
|
-
* fetch and update the project data, then trigger update to re-render the WeaverseRoot
|
|
320
|
-
*/
|
|
321
328
|
initProjectItemData(): void;
|
|
322
329
|
}
|
|
323
330
|
|
|
324
|
-
export { AdvancedGroup, AdvancedGroupType, BasicGroup, BasicInput, BreakPoints, CatalogGroup, ChildElement, ChildElementCSS, ElementCSS, ElementCatalog, ElementData, ElementFlags, ElementInspector, ElementSchema,
|
|
331
|
+
export { AdvancedGroup, AdvancedGroupType, BasicGroup, BasicInput, BreakPoints, CatalogGroup, ChildElement, ChildElementCSS, ElementCSS, ElementCatalog, ElementData, ElementDataInCatalog, ElementFlags, ElementInspector, ElementSchema, FlagType, GridSize, InitializeData, InputType, ParentType, ProjectDataType, ToolbarAction, Weaverse, WeaverseCSSProperties, WeaverseElement, WeaverseItemStore, WeaverseType, createGlobalStyles, isBrowser, isIframe, isReactNative, loadScript, stichesUtils };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var src_exports = {};
|
|
|
28
28
|
__export(src_exports, {
|
|
29
29
|
Weaverse: () => Weaverse,
|
|
30
30
|
WeaverseItemStore: () => WeaverseItemStore,
|
|
31
|
+
createGlobalStyles: () => createGlobalStyles,
|
|
31
32
|
isBrowser: () => isBrowser,
|
|
32
33
|
isIframe: () => isIframe,
|
|
33
34
|
isReactNative: () => isReactNative,
|
|
@@ -89,6 +90,37 @@ var stichesUtils = {
|
|
|
89
90
|
paddingBottom: value
|
|
90
91
|
})
|
|
91
92
|
};
|
|
93
|
+
function createGlobalStyles(stitches2) {
|
|
94
|
+
let globalStyles = stitches2.globalCss({
|
|
95
|
+
"@keyframes spin": {
|
|
96
|
+
from: { transform: "rotate(0deg)" },
|
|
97
|
+
to: { transform: "rotate(360deg)" }
|
|
98
|
+
},
|
|
99
|
+
input: {
|
|
100
|
+
"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button": {
|
|
101
|
+
"-webkit-appearance": "none",
|
|
102
|
+
margin: 0
|
|
103
|
+
},
|
|
104
|
+
"&[type=number]": {
|
|
105
|
+
"-moz-appearance": "textfield"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
".wv-spinner-wrapper": {
|
|
109
|
+
position: "absolute",
|
|
110
|
+
inset: "0px",
|
|
111
|
+
display: "flex",
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
justifyContent: "center",
|
|
114
|
+
backgroundColor: "inherit",
|
|
115
|
+
".wv-spinner": {
|
|
116
|
+
width: "20px",
|
|
117
|
+
height: "20px",
|
|
118
|
+
animation: "spin .75s linear infinite"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
globalStyles();
|
|
123
|
+
}
|
|
92
124
|
|
|
93
125
|
// src/utils/index.ts
|
|
94
126
|
var isReactNative = typeof navigator === "object" && navigator.product === "ReactNative";
|
|
@@ -187,6 +219,7 @@ var Weaverse = class {
|
|
|
187
219
|
media: this.mediaBreakPoints,
|
|
188
220
|
utils: stichesUtils
|
|
189
221
|
});
|
|
222
|
+
createGlobalStyles(this.stitchesInstance);
|
|
190
223
|
};
|
|
191
224
|
this.init({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode });
|
|
192
225
|
}
|
|
@@ -266,6 +299,7 @@ Weaverse.WeaverseItemStore = WeaverseItemStore;
|
|
|
266
299
|
0 && (module.exports = {
|
|
267
300
|
Weaverse,
|
|
268
301
|
WeaverseItemStore,
|
|
302
|
+
createGlobalStyles,
|
|
269
303
|
isBrowser,
|
|
270
304
|
isIframe,
|
|
271
305
|
isReactNative,
|
package/dist/index.mjs
CHANGED
|
@@ -51,6 +51,37 @@ var stichesUtils = {
|
|
|
51
51
|
paddingBottom: value
|
|
52
52
|
})
|
|
53
53
|
};
|
|
54
|
+
function createGlobalStyles(stitches2) {
|
|
55
|
+
let globalStyles = stitches2.globalCss({
|
|
56
|
+
"@keyframes spin": {
|
|
57
|
+
from: { transform: "rotate(0deg)" },
|
|
58
|
+
to: { transform: "rotate(360deg)" }
|
|
59
|
+
},
|
|
60
|
+
input: {
|
|
61
|
+
"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button": {
|
|
62
|
+
"-webkit-appearance": "none",
|
|
63
|
+
margin: 0
|
|
64
|
+
},
|
|
65
|
+
"&[type=number]": {
|
|
66
|
+
"-moz-appearance": "textfield"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
".wv-spinner-wrapper": {
|
|
70
|
+
position: "absolute",
|
|
71
|
+
inset: "0px",
|
|
72
|
+
display: "flex",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
backgroundColor: "inherit",
|
|
76
|
+
".wv-spinner": {
|
|
77
|
+
width: "20px",
|
|
78
|
+
height: "20px",
|
|
79
|
+
animation: "spin .75s linear infinite"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
globalStyles();
|
|
84
|
+
}
|
|
54
85
|
|
|
55
86
|
// src/utils/index.ts
|
|
56
87
|
var isReactNative = typeof navigator === "object" && navigator.product === "ReactNative";
|
|
@@ -149,6 +180,7 @@ var Weaverse = class {
|
|
|
149
180
|
media: this.mediaBreakPoints,
|
|
150
181
|
utils: stichesUtils
|
|
151
182
|
});
|
|
183
|
+
createGlobalStyles(this.stitchesInstance);
|
|
152
184
|
};
|
|
153
185
|
this.init({ appUrl, projectKey, projectData, mediaBreakPoints, isDesignMode, ssrMode });
|
|
154
186
|
}
|
|
@@ -227,6 +259,7 @@ Weaverse.WeaverseItemStore = WeaverseItemStore;
|
|
|
227
259
|
export {
|
|
228
260
|
Weaverse,
|
|
229
261
|
WeaverseItemStore,
|
|
262
|
+
createGlobalStyles,
|
|
230
263
|
isBrowser,
|
|
231
264
|
isIframe,
|
|
232
265
|
isReactNative,
|
package/package.json
CHANGED