@weaverse/core 1.0.48 → 1.0.49

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +118 -118
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as Stitches from '@stitches/core';
2
- import { RefObject, ForwardRefExoticComponent } from 'react';
2
+ import { ForwardRefExoticComponent, RefObject } from 'react';
3
3
  import Stitches$1 from '@stitches/core/types/stitches';
4
4
 
5
5
  declare let stitchesUtils: {
@@ -40,119 +40,6 @@ declare let stitchesUtils: {
40
40
  };
41
41
  };
42
42
 
43
- declare class WeaverseItemStore {
44
- weaverse: Weaverse;
45
- listeners: Set<(_: ElementData) => void>;
46
- ref: RefObject<HTMLElement>;
47
- stitchesClass: string;
48
- private _store;
49
- constructor(itemData: ElementData, weaverse: Weaverse);
50
- get _id(): string;
51
- get _element(): HTMLElement | null;
52
- get _flags(): Partial<Record<FlagType, boolean>>;
53
- get Element(): WeaverseElement | undefined;
54
- set data(update: Omit<ElementData, "id" | "type">);
55
- get data(): ElementData;
56
- setData: (update: Omit<ElementData, "id" | "type">) => ElementData;
57
- subscribe: (fn: (_: ElementData) => void) => void;
58
- unsubscribe: (fn: (_: ElementData) => void) => void;
59
- triggerUpdate: () => void;
60
- }
61
- declare class Weaverse {
62
- /**
63
- * The `weaverse-content-root` element of Weaverse SDK
64
- */
65
- contentRootElement: HTMLElement | undefined;
66
- /**
67
- * For storing, registering element React component from Weaverse or created by user/developer
68
- */
69
- elementInstances: Map<string, WeaverseElement>;
70
- /**
71
- * list of element/items store to provide data, handle state update, state sharing, etc.
72
- */
73
- itemInstances: Map<string | number, WeaverseItemStore>;
74
- /**
75
- * Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
76
- */
77
- weaverseHost: string;
78
- /**
79
- * Weaverse version, it can be used to load the correct version of Weaverse SDK
80
- */
81
- weaverseVersion: string;
82
- /**
83
- * Weaverse project key to access project data via API
84
- */
85
- projectId: string;
86
- pageId: string;
87
- /**
88
- * Weaverse project data, by default, user can provide project data via React Component:
89
- * <WeaverseRoot data={data} /> it will be used to server-side rendering
90
- */
91
- data: WeaverseProjectDataType;
92
- /**
93
- * Storing subscribe callback function for any component that want to listen to the change of WeaverseRoot
94
- */
95
- listeners: Set<() => void>;
96
- /**
97
- * Check whether the sdk is in editor or not.
98
- * If isDesignMode is true, it means the sdk is isDesignMode mode, render the editor UI,
99
- * else render the preview UI, plain HTML + CSS + React hydrate
100
- */
101
- isDesignMode: boolean;
102
- /**
103
- * Check the platform, shopify-section or react-ssr(hydrogen)
104
- */
105
- platformType: PlatformTypeEnum;
106
- /**
107
- * Check whether the sdk is in preview mode or not
108
- */
109
- isPreviewMode: boolean;
110
- /**
111
- * Use in element to optionally render special HTML for hydration
112
- */
113
- ssrMode: boolean;
114
- /**
115
- * Stitches instance for handling CSS stylesheet, media, theme for Weaverse project
116
- */
117
- stitchesInstance: Stitches$1 | any;
118
- studioBridge?: any;
119
- elementSchemas: ElementSchema[];
120
- static WeaverseItemStore: typeof WeaverseItemStore;
121
- mediaBreakPoints: BreakPoints;
122
- /**
123
- * constructor
124
- * @param weaverseHost {string} Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
125
- * @param projectId {string} Weaverse project key to access project data via API
126
- * @param data {WeaverseProjectDataType} Weaverse project data, by default, user can provide project data via React Component.
127
- * @param mediaBreakPoints {object} Pass down custom media query breakpoints or just use the default.
128
- * @param isDesignMode {boolean} check whether the sdk is isDesignMode or not
129
- * @param ssrMode {boolean} Use in element to optionally render special HTML for hydration
130
- * @param elementSchemas {Array<ElementSchema>} List of element schemas
131
- * @param platformType {PlatformTypeEnum} Check the platform, shopify-section or react-ssr(hydrogen)
132
- */
133
- constructor(params?: WeaverseType);
134
- /**
135
- * Register the custom React Component to Weaverse, store it into Weaverse.elementInstances
136
- * @param element {WeaverseElement} custom React Component
137
- */
138
- registerElement(element: WeaverseElement): void;
139
- initStitches: (externalConfig?: {}) => void;
140
- subscribe(fn: any): void;
141
- unsubscribe(fn: any): void;
142
- triggerUpdate(): void;
143
- refreshAllItems(): void;
144
- /**
145
- * When applying new template,
146
- * we need to reset the project data and re-initialize the project item data
147
- * @param data {WeaverseProjectDataType}
148
- */
149
- setProjectData(data: WeaverseProjectDataType): void;
150
- /**
151
- * Create new WeaverseItemStore instance for each item in project data
152
- */
153
- initProject(): void;
154
- }
155
-
156
43
  interface WeaverseProjectDataType {
157
44
  items: ElementData[];
158
45
  rootId: string;
@@ -283,7 +170,7 @@ interface BasicInput<ConfigsType = AdditionalInputConfigs> {
283
170
  * `imagesPerRow.gt.1`
284
171
  */
285
172
  condition?: string;
286
- defaultValue?: string | number | boolean;
173
+ defaultValue: string | number | boolean;
287
174
  placeholder?: string;
288
175
  helpText?: string;
289
176
  }
@@ -322,16 +209,129 @@ interface DataSortInputConfigs {
322
209
  type InputType = "color" | "datepicker" | "image" | "range" | "select" | "children-sort" | "data-sort" | "switch" | "text" | "textarea" | "toggle-group" | "position" | "information" | "product" | "product-list" | "product-swatches" | "text-editor" | "custom.html" | "instagram" | "collection-list" | "collection" | "article-list" | "map-autocomplete";
323
210
  declare global {
324
211
  interface Window {
325
- createWeaverseStudioBridge: (weaverse: Weaverse) => Promise<any>;
326
212
  weaverseStudioInitialized: boolean;
327
213
  Blinkloader: any;
328
- __weaverse: Weaverse;
214
+ __weaverse: any;
329
215
  __weaverses: {
330
- [key: string]: Weaverse;
216
+ [key: string]: any;
331
217
  };
218
+ createWeaverseStudioBridge: (weaverse: any) => Promise<any>;
332
219
  }
333
220
  }
334
221
 
222
+ declare class WeaverseItemStore {
223
+ weaverse: Weaverse;
224
+ listeners: Set<(_: ElementData) => void>;
225
+ ref: RefObject<HTMLElement>;
226
+ stitchesClass: string;
227
+ private _store;
228
+ constructor(itemData: ElementData, weaverse: Weaverse);
229
+ get _id(): string;
230
+ get _element(): HTMLElement | null;
231
+ get _flags(): Partial<Record<FlagType, boolean>>;
232
+ get Element(): WeaverseElement | undefined;
233
+ set data(update: Omit<ElementData, "id" | "type">);
234
+ get data(): ElementData;
235
+ setData: (update: Omit<ElementData, "id" | "type">) => ElementData;
236
+ subscribe: (fn: (_: ElementData) => void) => void;
237
+ unsubscribe: (fn: (_: ElementData) => void) => void;
238
+ triggerUpdate: () => void;
239
+ }
240
+ declare class Weaverse {
241
+ /**
242
+ * The `weaverse-content-root` element of Weaverse SDK
243
+ */
244
+ contentRootElement: HTMLElement | undefined;
245
+ /**
246
+ * For storing, registering element React component from Weaverse or created by user/developer
247
+ */
248
+ elementInstances: Map<string, WeaverseElement>;
249
+ /**
250
+ * list of element/items store to provide data, handle state update, state sharing, etc.
251
+ */
252
+ itemInstances: Map<string | number, WeaverseItemStore>;
253
+ /**
254
+ * Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
255
+ */
256
+ weaverseHost: string;
257
+ /**
258
+ * Weaverse version, it can be used to load the correct version of Weaverse SDK
259
+ */
260
+ weaverseVersion: string;
261
+ /**
262
+ * Weaverse project key to access project data via API
263
+ */
264
+ projectId: string;
265
+ pageId: string;
266
+ /**
267
+ * Weaverse project data, by default, user can provide project data via React Component:
268
+ * <WeaverseRoot data={data} /> it will be used to server-side rendering
269
+ */
270
+ data: WeaverseProjectDataType;
271
+ /**
272
+ * Storing subscribe callback function for any component that want to listen to the change of WeaverseRoot
273
+ */
274
+ listeners: Set<() => void>;
275
+ /**
276
+ * Check whether the sdk is in editor or not.
277
+ * If isDesignMode is true, it means the sdk is isDesignMode mode, render the editor UI,
278
+ * else render the preview UI, plain HTML + CSS + React hydrate
279
+ */
280
+ isDesignMode: boolean;
281
+ /**
282
+ * Check the platform, shopify-section or react-ssr(hydrogen)
283
+ */
284
+ platformType: PlatformTypeEnum;
285
+ /**
286
+ * Check whether the sdk is in preview mode or not
287
+ */
288
+ isPreviewMode: boolean;
289
+ /**
290
+ * Use in element to optionally render special HTML for hydration
291
+ */
292
+ ssrMode: boolean;
293
+ /**
294
+ * Stitches instance for handling CSS stylesheet, media, theme for Weaverse project
295
+ */
296
+ stitchesInstance: Stitches$1 | any;
297
+ studioBridge?: any;
298
+ elementSchemas: ElementSchema[];
299
+ static WeaverseItemStore: typeof WeaverseItemStore;
300
+ mediaBreakPoints: BreakPoints;
301
+ /**
302
+ * constructor
303
+ * @param weaverseHost {string} Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
304
+ * @param projectId {string} Weaverse project key to access project data via API
305
+ * @param data {WeaverseProjectDataType} Weaverse project data, by default, user can provide project data via React Component.
306
+ * @param mediaBreakPoints {object} Pass down custom media query breakpoints or just use the default.
307
+ * @param isDesignMode {boolean} check whether the sdk is isDesignMode or not
308
+ * @param ssrMode {boolean} Use in element to optionally render special HTML for hydration
309
+ * @param elementSchemas {Array<ElementSchema>} List of element schemas
310
+ * @param platformType {PlatformTypeEnum} Check the platform, shopify-section or react-ssr(hydrogen)
311
+ */
312
+ constructor(params?: WeaverseType);
313
+ /**
314
+ * Register the custom React Component to Weaverse, store it into Weaverse.elementInstances
315
+ * @param element {WeaverseElement} custom React Component
316
+ */
317
+ registerElement(element: WeaverseElement): void;
318
+ initStitches: (externalConfig?: {}) => void;
319
+ subscribe(fn: any): void;
320
+ unsubscribe(fn: any): void;
321
+ triggerUpdate(): void;
322
+ refreshAllItems(): void;
323
+ /**
324
+ * When applying new template,
325
+ * we need to reset the project data and re-initialize the project item data
326
+ * @param data {WeaverseProjectDataType}
327
+ */
328
+ setProjectData(data: WeaverseProjectDataType): void;
329
+ /**
330
+ * Create new WeaverseItemStore instance for each item in project data
331
+ */
332
+ initProject(): void;
333
+ }
334
+
335
335
  declare let loadScript: (src: string) => Promise<unknown>;
336
336
 
337
337
  declare let isReactNative: boolean;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.48",
2
+ "version": "1.0.49",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",