@weaverse/core 0.7.3 → 0.7.7
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 -16
- package/dist/index.js +22 -6
- package/dist/index.mjs +19 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefObject } from 'react';
|
|
2
1
|
import * as Stitches from '@stitches/core';
|
|
2
|
+
import { ForwardRefExoticComponent, RefObject } from 'react';
|
|
3
3
|
import Stitches$1 from '@stitches/core/types/stitches';
|
|
4
4
|
|
|
5
|
+
declare function loadScript(url: string): Promise<unknown>;
|
|
6
|
+
|
|
5
7
|
declare const stichesUtils: {
|
|
6
8
|
m: (value: string) => {
|
|
7
9
|
margin: string;
|
|
@@ -40,6 +42,10 @@ declare const stichesUtils: {
|
|
|
40
42
|
};
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
declare const isReactNative: boolean;
|
|
46
|
+
declare const isBrowser: boolean;
|
|
47
|
+
declare const isIframe: boolean;
|
|
48
|
+
|
|
43
49
|
declare type TODO = any;
|
|
44
50
|
interface ProjectDataType {
|
|
45
51
|
items: ElementData[];
|
|
@@ -58,19 +64,27 @@ interface InitializeData {
|
|
|
58
64
|
projectKey?: string;
|
|
59
65
|
studioUrl?: string;
|
|
60
66
|
}
|
|
67
|
+
declare type BreakPoints = {
|
|
68
|
+
mobile: string;
|
|
69
|
+
desktop: string;
|
|
70
|
+
};
|
|
61
71
|
interface WeaverseType {
|
|
62
|
-
mediaBreakPoints?:
|
|
72
|
+
mediaBreakPoints?: BreakPoints;
|
|
63
73
|
appUrl?: string;
|
|
64
74
|
projectKey?: string;
|
|
65
75
|
projectData?: ProjectDataType;
|
|
66
76
|
isDesignMode?: boolean;
|
|
67
77
|
ssrMode?: boolean;
|
|
68
78
|
}
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
interface ElementComponentProps extends ElementData {
|
|
80
|
+
css: ElementCSS;
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}
|
|
83
|
+
interface WeaverseElement {
|
|
84
|
+
Component: ForwardRefExoticComponent<ElementComponentProps>;
|
|
71
85
|
type: string;
|
|
72
86
|
schema?: ElementSchema;
|
|
73
|
-
}
|
|
87
|
+
}
|
|
74
88
|
interface ElementsMap {
|
|
75
89
|
[key: string]: WeaverseElement;
|
|
76
90
|
}
|
|
@@ -131,7 +145,7 @@ declare type BasicGroup = {
|
|
|
131
145
|
label: string;
|
|
132
146
|
inputs: BasicInput[];
|
|
133
147
|
};
|
|
134
|
-
declare type AdvancedInput = "alignment" | "background" | "border" | "countdown" | "dimensions" | "
|
|
148
|
+
declare type AdvancedInput = "alignment" | "background" | "border" | "countdown" | "dimensions" | "visibility" | "spacing" | "form" | "product";
|
|
135
149
|
interface BasicInput {
|
|
136
150
|
type: InputType;
|
|
137
151
|
label: string;
|
|
@@ -143,13 +157,14 @@ interface BasicInput {
|
|
|
143
157
|
value: string;
|
|
144
158
|
label: string;
|
|
145
159
|
icon?: string;
|
|
160
|
+
weight?: string;
|
|
146
161
|
}[];
|
|
147
162
|
min?: number;
|
|
148
163
|
max?: number;
|
|
149
164
|
step?: number;
|
|
150
165
|
conditions?: TODO[];
|
|
151
166
|
}
|
|
152
|
-
declare type InputType = "color" | "image" | "instagram" | "range" | "select" | "switch" | "text" | "textarea" | "toggle-group";
|
|
167
|
+
declare type InputType = "color" | "image" | "instagram" | "range" | "select" | "sortable" | "switch" | "text" | "textarea" | "toggle-group";
|
|
153
168
|
declare global {
|
|
154
169
|
interface Window {
|
|
155
170
|
WeaverseStudioBridge: TODO;
|
|
@@ -242,10 +257,7 @@ declare class Weaverse {
|
|
|
242
257
|
stitchesInstance: Stitches$1 | any;
|
|
243
258
|
studioBridge?: any;
|
|
244
259
|
static WeaverseItemStore: typeof WeaverseItemStore;
|
|
245
|
-
mediaBreakPoints:
|
|
246
|
-
desktop: string;
|
|
247
|
-
mobile: string;
|
|
248
|
-
};
|
|
260
|
+
mediaBreakPoints: BreakPoints;
|
|
249
261
|
/**
|
|
250
262
|
* constructor
|
|
251
263
|
* @param appUrl {string} Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
|
|
@@ -287,8 +299,4 @@ declare class Weaverse {
|
|
|
287
299
|
initProjectItemData(): void;
|
|
288
300
|
}
|
|
289
301
|
|
|
290
|
-
|
|
291
|
-
declare const isBrowser: boolean;
|
|
292
|
-
declare const isIframe: boolean;
|
|
293
|
-
|
|
294
|
-
export { AdvancedGroup, AdvancedInput, BasicGroup, BasicInput, CatalogGroup, ChildElement, ChildElementCSS, ElementCSS, ElementCatalog, ElementData, ElementFlags, ElementInspector, ElementSchema, ElementsMap, FlagType, GridSize, InitializeData, InputType, ParentType, ProjectDataType, TODO, ToolbarAction, Weaverse, WeaverseCSSProperties, WeaverseElement, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative };
|
|
302
|
+
export { AdvancedGroup, AdvancedInput, BasicGroup, BasicInput, BreakPoints, CatalogGroup, ChildElement, ChildElementCSS, ElementCSS, ElementCatalog, ElementComponentProps, ElementData, ElementFlags, ElementInspector, ElementSchema, ElementsMap, FlagType, GridSize, InitializeData, InputType, ParentType, ProjectDataType, TODO, ToolbarAction, Weaverse, WeaverseCSSProperties, WeaverseElement, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative, loadScript, stichesUtils };
|
package/dist/index.js
CHANGED
|
@@ -30,17 +30,26 @@ __export(src_exports, {
|
|
|
30
30
|
WeaverseItemStore: () => WeaverseItemStore,
|
|
31
31
|
isBrowser: () => isBrowser,
|
|
32
32
|
isIframe: () => isIframe,
|
|
33
|
-
isReactNative: () => isReactNative
|
|
33
|
+
isReactNative: () => isReactNative,
|
|
34
|
+
loadScript: () => loadScript,
|
|
35
|
+
stichesUtils: () => stichesUtils
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(src_exports);
|
|
36
38
|
|
|
37
39
|
// src/core.ts
|
|
38
40
|
var stitches = __toESM(require("@stitches/core"));
|
|
39
41
|
|
|
40
|
-
// src/utils/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// src/utils/load-script.ts
|
|
43
|
+
function loadScript(url) {
|
|
44
|
+
return new Promise(function(resolve) {
|
|
45
|
+
const script = document.createElement("script");
|
|
46
|
+
script.src = url;
|
|
47
|
+
script.addEventListener("load", function() {
|
|
48
|
+
resolve(true);
|
|
49
|
+
});
|
|
50
|
+
document.head.appendChild(script);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
44
53
|
|
|
45
54
|
// src/utils/styles.ts
|
|
46
55
|
var stichesUtils = {
|
|
@@ -81,6 +90,11 @@ var stichesUtils = {
|
|
|
81
90
|
})
|
|
82
91
|
};
|
|
83
92
|
|
|
93
|
+
// src/utils/index.ts
|
|
94
|
+
var isReactNative = typeof navigator === "object" && navigator.product === "ReactNative";
|
|
95
|
+
var isBrowser = typeof window !== "undefined" && !isReactNative;
|
|
96
|
+
var isIframe = isBrowser && window.top !== window.self;
|
|
97
|
+
|
|
84
98
|
// src/core.ts
|
|
85
99
|
var WeaverseItemStore = class {
|
|
86
100
|
constructor(itemData, weaverse) {
|
|
@@ -252,5 +266,7 @@ Weaverse.WeaverseItemStore = WeaverseItemStore;
|
|
|
252
266
|
WeaverseItemStore,
|
|
253
267
|
isBrowser,
|
|
254
268
|
isIframe,
|
|
255
|
-
isReactNative
|
|
269
|
+
isReactNative,
|
|
270
|
+
loadScript,
|
|
271
|
+
stichesUtils
|
|
256
272
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
// src/core.ts
|
|
2
2
|
import * as stitches from "@stitches/core";
|
|
3
3
|
|
|
4
|
-
// src/utils/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
// src/utils/load-script.ts
|
|
5
|
+
function loadScript(url) {
|
|
6
|
+
return new Promise(function(resolve) {
|
|
7
|
+
const script = document.createElement("script");
|
|
8
|
+
script.src = url;
|
|
9
|
+
script.addEventListener("load", function() {
|
|
10
|
+
resolve(true);
|
|
11
|
+
});
|
|
12
|
+
document.head.appendChild(script);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
8
15
|
|
|
9
16
|
// src/utils/styles.ts
|
|
10
17
|
var stichesUtils = {
|
|
@@ -45,6 +52,11 @@ var stichesUtils = {
|
|
|
45
52
|
})
|
|
46
53
|
};
|
|
47
54
|
|
|
55
|
+
// src/utils/index.ts
|
|
56
|
+
var isReactNative = typeof navigator === "object" && navigator.product === "ReactNative";
|
|
57
|
+
var isBrowser = typeof window !== "undefined" && !isReactNative;
|
|
58
|
+
var isIframe = isBrowser && window.top !== window.self;
|
|
59
|
+
|
|
48
60
|
// src/core.ts
|
|
49
61
|
var WeaverseItemStore = class {
|
|
50
62
|
constructor(itemData, weaverse) {
|
|
@@ -215,5 +227,7 @@ export {
|
|
|
215
227
|
WeaverseItemStore,
|
|
216
228
|
isBrowser,
|
|
217
229
|
isIframe,
|
|
218
|
-
isReactNative
|
|
230
|
+
isReactNative,
|
|
231
|
+
loadScript,
|
|
232
|
+
stichesUtils
|
|
219
233
|
};
|
package/package.json
CHANGED