@builder.io/sdk-svelte 1.0.13 → 1.0.15

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.
@@ -76,7 +76,6 @@ function processMessage(event) {
76
76
  breakpoints,
77
77
  },
78
78
  });
79
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
80
79
  }
81
80
  },
82
81
  animation: (animation) => {
@@ -84,7 +83,6 @@ function processMessage(event) {
84
83
  },
85
84
  contentUpdate: (newContent) => {
86
85
  mergeNewContent(newContent);
87
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
88
86
  },
89
87
  },
90
88
  })(event);
@@ -174,7 +172,6 @@ function emitStateUpdate() {
174
172
  }
175
173
  }
176
174
  function elementRef_onIniteditingbldr(event) {
177
- forceReRenderCount = forceReRenderCount + 1;
178
175
  window.addEventListener("message", processMessage);
179
176
  registerInsertMenu();
180
177
  setupBrowserForEditing({
@@ -229,10 +226,6 @@ function elementRef_onInitpreviewingbldr(event) {
229
226
  }
230
227
  }
231
228
  let elementRef;
232
- let forceReRenderCount = 0;
233
- let firstRender = true;
234
- let lastUpdated = 0;
235
- let shouldSendResetCookie = false;
236
229
  let ContentWrapper = contentWrapper || "div";
237
230
  let httpReqsData = {};
238
231
  let clicked = false;
@@ -278,40 +271,38 @@ function onUpdateFn_0(..._args) {
278
271
  }
279
272
  }
280
273
  $: onUpdateFn_0(...[content]);
281
- function onUpdateFn_1(..._args) { }
282
- $: onUpdateFn_1(...[shouldSendResetCookie]);
283
- function onUpdateFn_2(..._args) {
274
+ function onUpdateFn_1(..._args) {
284
275
  evaluateJsCode();
285
276
  }
286
- $: onUpdateFn_2_builderContextSignal_content__data__jsCode =
277
+ $: onUpdateFn_1_builderContextSignal_content__data__jsCode =
287
278
  $builderContextSignal.content?.data?.jsCode;
288
- $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__jsCode]);
289
- function onUpdateFn_3(..._args) {
279
+ $: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
280
+ function onUpdateFn_2(..._args) {
290
281
  runHttpRequests();
291
282
  }
292
- $: onUpdateFn_3_builderContextSignal_content__data__httpRequests =
283
+ $: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
293
284
  $builderContextSignal.content?.data?.httpRequests;
294
- $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_content__data__httpRequests]);
295
- function onUpdateFn_4(..._args) {
285
+ $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]);
286
+ function onUpdateFn_3(..._args) {
296
287
  emitStateUpdate();
297
288
  }
298
- $: onUpdateFn_4_builderContextSignal_rootState =
289
+ $: onUpdateFn_3_builderContextSignal_rootState =
299
290
  $builderContextSignal.rootState;
300
- $: onUpdateFn_4(...[onUpdateFn_4_builderContextSignal_rootState]);
301
- function onUpdateFn_5(..._args) {
291
+ $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
292
+ function onUpdateFn_4(..._args) {
302
293
  if (data) {
303
294
  mergeNewRootState(data);
304
295
  }
305
296
  }
306
- $: onUpdateFn_5(...[data]);
307
- function onUpdateFn_6(..._args) {
297
+ $: onUpdateFn_4(...[data]);
298
+ function onUpdateFn_5(..._args) {
308
299
  if (locale) {
309
300
  mergeNewRootState({
310
301
  locale: locale,
311
302
  });
312
303
  }
313
304
  }
314
- $: onUpdateFn_6(...[locale]);
305
+ $: onUpdateFn_5(...[locale]);
315
306
  setContext(builderContext.key, builderContextSignal);
316
307
  onDestroy(() => {
317
308
  if (isBrowser()) {
@@ -325,7 +316,6 @@ onDestroy(() => {
325
316
  <svelte:element
326
317
  this={ContentWrapper}
327
318
  {...{}}
328
- key={forceReRenderCount}
329
319
  bind:this={elementRef}
330
320
  on:click={(event) => {
331
321
  onClick(event);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.13";
1
+ export declare const SDK_VERSION = "1.0.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.13";
1
+ export const SDK_VERSION = "1.0.15";
@@ -22,7 +22,8 @@ export async function fetchOneEntry(options) {
22
22
  }
23
23
  const _fetchContent = async (options) => {
24
24
  const url = generateContentUrl(options);
25
- const res = await fetch(url.href);
25
+ const _fetch = options.fetch ?? fetch;
26
+ const res = await _fetch(url.href, options.fetchOptions);
26
27
  const content = await res.json();
27
28
  return content;
28
29
  };
@@ -128,4 +128,12 @@ export interface GetContentOptions {
128
128
  * draft mode and un-archived. Default is false.
129
129
  */
130
130
  includeUnpublished?: boolean;
131
+ /**
132
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
+ */
134
+ fetch?: typeof global.fetch;
135
+ /**
136
+ * Optional fetch options to be passed to the `fetch` function.
137
+ */
138
+ fetchOptions?: RequestInit;
131
139
  }
@@ -76,7 +76,6 @@ function processMessage(event) {
76
76
  breakpoints,
77
77
  },
78
78
  });
79
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
80
79
  }
81
80
  },
82
81
  animation: (animation) => {
@@ -84,7 +83,6 @@ function processMessage(event) {
84
83
  },
85
84
  contentUpdate: (newContent) => {
86
85
  mergeNewContent(newContent);
87
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
88
86
  },
89
87
  },
90
88
  })(event);
@@ -174,7 +172,6 @@ function emitStateUpdate() {
174
172
  }
175
173
  }
176
174
  function elementRef_onIniteditingbldr(event) {
177
- forceReRenderCount = forceReRenderCount + 1;
178
175
  window.addEventListener("message", processMessage);
179
176
  registerInsertMenu();
180
177
  setupBrowserForEditing({
@@ -229,10 +226,6 @@ function elementRef_onInitpreviewingbldr(event) {
229
226
  }
230
227
  }
231
228
  let elementRef;
232
- let forceReRenderCount = 0;
233
- let firstRender = true;
234
- let lastUpdated = 0;
235
- let shouldSendResetCookie = false;
236
229
  let ContentWrapper = contentWrapper || "div";
237
230
  let httpReqsData = {};
238
231
  let clicked = false;
@@ -278,40 +271,38 @@ function onUpdateFn_0(..._args) {
278
271
  }
279
272
  }
280
273
  $: onUpdateFn_0(...[content]);
281
- function onUpdateFn_1(..._args) { }
282
- $: onUpdateFn_1(...[shouldSendResetCookie]);
283
- function onUpdateFn_2(..._args) {
274
+ function onUpdateFn_1(..._args) {
284
275
  evaluateJsCode();
285
276
  }
286
- $: onUpdateFn_2_builderContextSignal_content__data__jsCode =
277
+ $: onUpdateFn_1_builderContextSignal_content__data__jsCode =
287
278
  $builderContextSignal.content?.data?.jsCode;
288
- $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__jsCode]);
289
- function onUpdateFn_3(..._args) {
279
+ $: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
280
+ function onUpdateFn_2(..._args) {
290
281
  runHttpRequests();
291
282
  }
292
- $: onUpdateFn_3_builderContextSignal_content__data__httpRequests =
283
+ $: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
293
284
  $builderContextSignal.content?.data?.httpRequests;
294
- $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_content__data__httpRequests]);
295
- function onUpdateFn_4(..._args) {
285
+ $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]);
286
+ function onUpdateFn_3(..._args) {
296
287
  emitStateUpdate();
297
288
  }
298
- $: onUpdateFn_4_builderContextSignal_rootState =
289
+ $: onUpdateFn_3_builderContextSignal_rootState =
299
290
  $builderContextSignal.rootState;
300
- $: onUpdateFn_4(...[onUpdateFn_4_builderContextSignal_rootState]);
301
- function onUpdateFn_5(..._args) {
291
+ $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
292
+ function onUpdateFn_4(..._args) {
302
293
  if (data) {
303
294
  mergeNewRootState(data);
304
295
  }
305
296
  }
306
- $: onUpdateFn_5(...[data]);
307
- function onUpdateFn_6(..._args) {
297
+ $: onUpdateFn_4(...[data]);
298
+ function onUpdateFn_5(..._args) {
308
299
  if (locale) {
309
300
  mergeNewRootState({
310
301
  locale: locale,
311
302
  });
312
303
  }
313
304
  }
314
- $: onUpdateFn_6(...[locale]);
305
+ $: onUpdateFn_5(...[locale]);
315
306
  setContext(builderContext.key, builderContextSignal);
316
307
  onDestroy(() => {
317
308
  if (isBrowser()) {
@@ -325,7 +316,6 @@ onDestroy(() => {
325
316
  <svelte:element
326
317
  this={ContentWrapper}
327
318
  {...{}}
328
- key={forceReRenderCount}
329
319
  bind:this={elementRef}
330
320
  on:click={(event) => {
331
321
  onClick(event);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.13";
1
+ export declare const SDK_VERSION = "1.0.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.13";
1
+ export const SDK_VERSION = "1.0.15";
@@ -22,7 +22,8 @@ export async function fetchOneEntry(options) {
22
22
  }
23
23
  const _fetchContent = async (options) => {
24
24
  const url = generateContentUrl(options);
25
- const res = await fetch(url.href);
25
+ const _fetch = options.fetch ?? fetch;
26
+ const res = await _fetch(url.href, options.fetchOptions);
26
27
  const content = await res.json();
27
28
  return content;
28
29
  };
@@ -128,4 +128,12 @@ export interface GetContentOptions {
128
128
  * draft mode and un-archived. Default is false.
129
129
  */
130
130
  includeUnpublished?: boolean;
131
+ /**
132
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
+ */
134
+ fetch?: typeof global.fetch;
135
+ /**
136
+ * Optional fetch options to be passed to the `fetch` function.
137
+ */
138
+ fetchOptions?: RequestInit;
131
139
  }
@@ -76,7 +76,6 @@ function processMessage(event) {
76
76
  breakpoints,
77
77
  },
78
78
  });
79
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
80
79
  }
81
80
  },
82
81
  animation: (animation) => {
@@ -84,7 +83,6 @@ function processMessage(event) {
84
83
  },
85
84
  contentUpdate: (newContent) => {
86
85
  mergeNewContent(newContent);
87
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
88
86
  },
89
87
  },
90
88
  })(event);
@@ -174,7 +172,6 @@ function emitStateUpdate() {
174
172
  }
175
173
  }
176
174
  function elementRef_onIniteditingbldr(event) {
177
- forceReRenderCount = forceReRenderCount + 1;
178
175
  window.addEventListener("message", processMessage);
179
176
  registerInsertMenu();
180
177
  setupBrowserForEditing({
@@ -229,10 +226,6 @@ function elementRef_onInitpreviewingbldr(event) {
229
226
  }
230
227
  }
231
228
  let elementRef;
232
- let forceReRenderCount = 0;
233
- let firstRender = true;
234
- let lastUpdated = 0;
235
- let shouldSendResetCookie = false;
236
229
  let ContentWrapper = contentWrapper || "div";
237
230
  let httpReqsData = {};
238
231
  let clicked = false;
@@ -278,40 +271,38 @@ function onUpdateFn_0(..._args) {
278
271
  }
279
272
  }
280
273
  $: onUpdateFn_0(...[content]);
281
- function onUpdateFn_1(..._args) { }
282
- $: onUpdateFn_1(...[shouldSendResetCookie]);
283
- function onUpdateFn_2(..._args) {
274
+ function onUpdateFn_1(..._args) {
284
275
  evaluateJsCode();
285
276
  }
286
- $: onUpdateFn_2_builderContextSignal_content__data__jsCode =
277
+ $: onUpdateFn_1_builderContextSignal_content__data__jsCode =
287
278
  $builderContextSignal.content?.data?.jsCode;
288
- $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__jsCode]);
289
- function onUpdateFn_3(..._args) {
279
+ $: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
280
+ function onUpdateFn_2(..._args) {
290
281
  runHttpRequests();
291
282
  }
292
- $: onUpdateFn_3_builderContextSignal_content__data__httpRequests =
283
+ $: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
293
284
  $builderContextSignal.content?.data?.httpRequests;
294
- $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_content__data__httpRequests]);
295
- function onUpdateFn_4(..._args) {
285
+ $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]);
286
+ function onUpdateFn_3(..._args) {
296
287
  emitStateUpdate();
297
288
  }
298
- $: onUpdateFn_4_builderContextSignal_rootState =
289
+ $: onUpdateFn_3_builderContextSignal_rootState =
299
290
  $builderContextSignal.rootState;
300
- $: onUpdateFn_4(...[onUpdateFn_4_builderContextSignal_rootState]);
301
- function onUpdateFn_5(..._args) {
291
+ $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
292
+ function onUpdateFn_4(..._args) {
302
293
  if (data) {
303
294
  mergeNewRootState(data);
304
295
  }
305
296
  }
306
- $: onUpdateFn_5(...[data]);
307
- function onUpdateFn_6(..._args) {
297
+ $: onUpdateFn_4(...[data]);
298
+ function onUpdateFn_5(..._args) {
308
299
  if (locale) {
309
300
  mergeNewRootState({
310
301
  locale: locale,
311
302
  });
312
303
  }
313
304
  }
314
- $: onUpdateFn_6(...[locale]);
305
+ $: onUpdateFn_5(...[locale]);
315
306
  setContext(builderContext.key, builderContextSignal);
316
307
  onDestroy(() => {
317
308
  if (isBrowser()) {
@@ -325,7 +316,6 @@ onDestroy(() => {
325
316
  <svelte:element
326
317
  this={ContentWrapper}
327
318
  {...{}}
328
- key={forceReRenderCount}
329
319
  bind:this={elementRef}
330
320
  on:click={(event) => {
331
321
  onClick(event);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.13";
1
+ export declare const SDK_VERSION = "1.0.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.13";
1
+ export const SDK_VERSION = "1.0.15";
@@ -22,7 +22,8 @@ export async function fetchOneEntry(options) {
22
22
  }
23
23
  const _fetchContent = async (options) => {
24
24
  const url = generateContentUrl(options);
25
- const res = await fetch(url.href);
25
+ const _fetch = options.fetch ?? fetch;
26
+ const res = await _fetch(url.href, options.fetchOptions);
26
27
  const content = await res.json();
27
28
  return content;
28
29
  };
@@ -128,4 +128,12 @@ export interface GetContentOptions {
128
128
  * draft mode and un-archived. Default is false.
129
129
  */
130
130
  includeUnpublished?: boolean;
131
+ /**
132
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
+ */
134
+ fetch?: typeof global.fetch;
135
+ /**
136
+ * Optional fetch options to be passed to the `fetch` function.
137
+ */
138
+ fetchOptions?: RequestInit;
131
139
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "1.0.13",
4
+ "version": "1.0.15",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -108,7 +108,6 @@
108
108
  breakpoints,
109
109
  },
110
110
  });
111
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
112
111
  }
113
112
  },
114
113
  animation: (animation) => {
@@ -116,7 +115,6 @@
116
115
  },
117
116
  contentUpdate: (newContent) => {
118
117
  mergeNewContent(newContent);
119
- forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
120
118
  },
121
119
  },
122
120
  })(event);
@@ -217,7 +215,6 @@
217
215
  }
218
216
  }
219
217
  function elementRef_onIniteditingbldr(event) {
220
- forceReRenderCount = forceReRenderCount + 1;
221
218
  window.addEventListener("message", processMessage);
222
219
  registerInsertMenu();
223
220
  setupBrowserForEditing({
@@ -285,10 +282,6 @@
285
282
 
286
283
  let elementRef;
287
284
 
288
- let forceReRenderCount = 0;
289
- let firstRender = true;
290
- let lastUpdated = 0;
291
- let shouldSendResetCookie = false;
292
285
  let ContentWrapper = contentWrapper || "div";
293
286
  let httpReqsData = {};
294
287
  let clicked = false;
@@ -342,42 +335,38 @@
342
335
 
343
336
  $: onUpdateFn_0(...[content]);
344
337
 
345
- function onUpdateFn_1(..._args: any[]) {}
346
-
347
- $: onUpdateFn_1(...[shouldSendResetCookie]);
348
-
349
- function onUpdateFn_2(..._args: any[]) {
338
+ function onUpdateFn_1(..._args: any[]) {
350
339
  evaluateJsCode();
351
340
  }
352
- $: onUpdateFn_2_builderContextSignal_content__data__jsCode =
341
+ $: onUpdateFn_1_builderContextSignal_content__data__jsCode =
353
342
  $builderContextSignal.content?.data?.jsCode;
354
- $: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__jsCode]);
343
+ $: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
355
344
 
356
- function onUpdateFn_3(..._args: any[]) {
345
+ function onUpdateFn_2(..._args: any[]) {
357
346
  runHttpRequests();
358
347
  }
359
- $: onUpdateFn_3_builderContextSignal_content__data__httpRequests =
348
+ $: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
360
349
  $builderContextSignal.content?.data?.httpRequests;
361
- $: onUpdateFn_3(
362
- ...[onUpdateFn_3_builderContextSignal_content__data__httpRequests]
350
+ $: onUpdateFn_2(
351
+ ...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]
363
352
  );
364
353
 
365
- function onUpdateFn_4(..._args: any[]) {
354
+ function onUpdateFn_3(..._args: any[]) {
366
355
  emitStateUpdate();
367
356
  }
368
- $: onUpdateFn_4_builderContextSignal_rootState =
357
+ $: onUpdateFn_3_builderContextSignal_rootState =
369
358
  $builderContextSignal.rootState;
370
- $: onUpdateFn_4(...[onUpdateFn_4_builderContextSignal_rootState]);
359
+ $: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
371
360
 
372
- function onUpdateFn_5(..._args: any[]) {
361
+ function onUpdateFn_4(..._args: any[]) {
373
362
  if (data) {
374
363
  mergeNewRootState(data);
375
364
  }
376
365
  }
377
366
 
378
- $: onUpdateFn_5(...[data]);
367
+ $: onUpdateFn_4(...[data]);
379
368
 
380
- function onUpdateFn_6(..._args: any[]) {
369
+ function onUpdateFn_5(..._args: any[]) {
381
370
  if (locale) {
382
371
  mergeNewRootState({
383
372
  locale: locale,
@@ -385,7 +374,7 @@
385
374
  }
386
375
  }
387
376
 
388
- $: onUpdateFn_6(...[locale]);
377
+ $: onUpdateFn_5(...[locale]);
389
378
 
390
379
  setContext(builderContext.key, builderContextSignal);
391
380
 
@@ -404,7 +393,6 @@
404
393
  <svelte:element
405
394
  this={ContentWrapper}
406
395
  {...{}}
407
- key={forceReRenderCount}
408
396
  bind:this={elementRef}
409
397
  on:click={(event) => {
410
398
  onClick(event);
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.13"
1
+ export const SDK_VERSION = "1.0.15"
@@ -32,7 +32,8 @@ type ContentResponse = ContentResults | {
32
32
  };
33
33
  const _fetchContent = async (options: GetContentOptions) => {
34
34
  const url = generateContentUrl(options);
35
- const res = await fetch(url.href);
35
+ const _fetch = options.fetch ?? fetch;
36
+ const res = await _fetch(url.href, options.fetchOptions);
36
37
  const content = await (res.json() as Promise<ContentResponse>);
37
38
  return content;
38
39
  };
@@ -144,4 +144,14 @@ export interface GetContentOptions {
144
144
  * draft mode and un-archived. Default is false.
145
145
  */
146
146
  includeUnpublished?: boolean;
147
+
148
+ /**
149
+ * Optional override of the `fetch` function. (Defaults to global `fetch`)
150
+ */
151
+ fetch?: typeof global.fetch;
152
+
153
+ /**
154
+ * Optional fetch options to be passed to the `fetch` function.
155
+ */
156
+ fetchOptions?: RequestInit;
147
157
  }