@builder.io/sdk-svelte 2.0.5 → 2.0.9

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 (53) hide show
  1. package/lib/browser/components/block/block.svelte +2 -1
  2. package/lib/browser/components/content/content.svelte +3 -3
  3. package/lib/browser/components/content-variants/content-variants.svelte +1 -0
  4. package/lib/browser/components/content-variants/content-variants.types.d.ts +2 -1
  5. package/lib/browser/components/content-variants/extra-framework-props-types.d.ts +2 -0
  6. package/lib/browser/components/content-variants/extra-framework-props-types.js +1 -0
  7. package/lib/browser/constants/sdk-version.d.ts +1 -1
  8. package/lib/browser/constants/sdk-version.js +1 -1
  9. package/lib/browser/context/extra-context-types.d.ts +6 -0
  10. package/lib/browser/context/extra-context-types.js +1 -0
  11. package/lib/browser/context/types.d.ts +2 -1
  12. package/lib/browser/functions/register-component.d.ts +1 -1
  13. package/lib/browser/functions/register-component.js +2 -2
  14. package/lib/browser/functions/register.js +4 -0
  15. package/lib/edge/components/block/block.svelte +2 -1
  16. package/lib/edge/components/content/content.svelte +3 -3
  17. package/lib/edge/components/content-variants/content-variants.svelte +1 -0
  18. package/lib/edge/components/content-variants/content-variants.types.d.ts +2 -1
  19. package/lib/edge/components/content-variants/extra-framework-props-types.d.ts +2 -0
  20. package/lib/edge/components/content-variants/extra-framework-props-types.js +1 -0
  21. package/lib/edge/constants/sdk-version.d.ts +1 -1
  22. package/lib/edge/constants/sdk-version.js +1 -1
  23. package/lib/edge/context/extra-context-types.d.ts +6 -0
  24. package/lib/edge/context/extra-context-types.js +1 -0
  25. package/lib/edge/context/types.d.ts +2 -1
  26. package/lib/edge/functions/register-component.d.ts +1 -1
  27. package/lib/edge/functions/register-component.js +2 -2
  28. package/lib/edge/functions/register.js +4 -0
  29. package/lib/node/components/block/block.svelte +2 -1
  30. package/lib/node/components/content/content.svelte +3 -3
  31. package/lib/node/components/content-variants/content-variants.svelte +1 -0
  32. package/lib/node/components/content-variants/content-variants.types.d.ts +2 -1
  33. package/lib/node/components/content-variants/extra-framework-props-types.d.ts +2 -0
  34. package/lib/node/components/content-variants/extra-framework-props-types.js +1 -0
  35. package/lib/node/constants/sdk-version.d.ts +1 -1
  36. package/lib/node/constants/sdk-version.js +1 -1
  37. package/lib/node/context/extra-context-types.d.ts +6 -0
  38. package/lib/node/context/extra-context-types.js +1 -0
  39. package/lib/node/context/types.d.ts +2 -1
  40. package/lib/node/functions/register-component.d.ts +1 -1
  41. package/lib/node/functions/register-component.js +2 -2
  42. package/lib/node/functions/register.js +4 -0
  43. package/package.json +1 -1
  44. package/src/components/block/block.svelte +2 -1
  45. package/src/components/content/content.svelte +3 -3
  46. package/src/components/content-variants/content-variants.svelte +1 -0
  47. package/src/components/content-variants/content-variants.types.ts +2 -1
  48. package/src/components/content-variants/extra-framework-props-types.ts +1 -0
  49. package/src/constants/sdk-version.ts +1 -1
  50. package/src/context/extra-context-types.ts +5 -0
  51. package/src/context/types.ts +2 -1
  52. package/src/functions/register-component.ts +2 -2
  53. package/src/functions/register.ts +4 -0
@@ -1,6 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>import { onMount } from "svelte";
4
+ import { TARGET } from "../../constants/target";
4
5
  import { getBlockComponentOptions } from "../../functions/get-block-component-options";
5
6
  import { getProcessedBlock } from "../../functions/get-processed-block";
6
7
  import "../dynamic-div.svelte";
@@ -86,7 +87,7 @@ $: componentRefProps = () => {
86
87
  registeredComponents: registeredComponents,
87
88
  builderBlock: processedBlock(),
88
89
  includeBlockProps: blockComponent?.()?.noWrap === true,
89
- isInteractive: !blockComponent?.()?.isRSC,
90
+ isInteractive: !(blockComponent?.()?.isRSC && TARGET === "rsc"),
90
91
  };
91
92
  };
92
93
  onMount(() => {
@@ -3,7 +3,7 @@ import { writable } from "svelte/store";
3
3
  import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components";
4
4
  import { TARGET } from "../../constants/target";
5
5
  import ComponentsContext from "../../context/components.context";
6
- import { serializeComponentInfo } from "../../functions/register-component";
6
+ import { serializeIncludingFunctions } from "../../functions/register-component";
7
7
  import Blocks from "../blocks/blocks.svelte";
8
8
  import { getUpdateVariantVisibilityScript } from "../content-variants/helpers";
9
9
  import "../dynamic-div.svelte";
@@ -54,7 +54,7 @@ let registeredComponents = [
54
54
  ...acc,
55
55
  [info.name]: {
56
56
  component: component,
57
- ...serializeComponentInfo(info),
57
+ ...serializeIncludingFunctions(info),
58
58
  },
59
59
  }), {});
60
60
  let builderContextSignal = writable({
@@ -84,7 +84,7 @@ let builderContextSignal = writable({
84
84
  }) || []),
85
85
  ].reduce((acc, { component: _, ...info }) => ({
86
86
  ...acc,
87
- [info.name]: serializeComponentInfo(info),
87
+ [info.name]: serializeIncludingFunctions(info),
88
88
  }), {}),
89
89
  inheritedStyles: {},
90
90
  BlocksWrapper: blocksWrapper || "div",
@@ -102,6 +102,7 @@ onMount(() => {
102
102
  {contentWrapper}
103
103
  {contentWrapperProps}
104
104
  {trustedHosts}
105
+ {...{}}
105
106
  />
106
107
  {/each}
107
108
  {/if}
@@ -2,7 +2,8 @@ import type { BuilderRenderContext, RegisteredComponent } from '../../context/ty
2
2
  import type { ApiVersion } from '../../types/api-version';
3
3
  import type { BuilderContent } from '../../types/builder-content';
4
4
  import type { Nullable } from '../../types/typescript';
5
- export interface ContentVariantsPrps {
5
+ import type { ExtraFrameworkProps } from './extra-framework-props-types';
6
+ export interface ContentVariantsPrps extends ExtraFrameworkProps {
6
7
  /**
7
8
  * The Builder content JSON to render (required).
8
9
  */
@@ -0,0 +1,2 @@
1
+ export interface ExtraFrameworkProps {
2
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.5";
1
+ export declare const SDK_VERSION = "2.0.9";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.5";
1
+ export const SDK_VERSION = "2.0.9";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * no-op type for extra context types on a per-SDK basis
3
+ * See `overrides/react-native/src/context/extra-context-types.ts` for an example
4
+ * */
5
+ export interface ExtraContextTypes {
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,13 +3,14 @@ import type { ApiVersion } from '../types/api-version';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
4
  import type { ComponentInfo } from '../types/components';
5
5
  import type { Dictionary, Nullable } from '../types/typescript';
6
+ import type { ExtraContextTypes } from './extra-context-types';
6
7
  export type RegisteredComponent = ComponentInfo & {
7
8
  component: any;
8
9
  };
9
10
  export type RegisteredComponents = Dictionary<RegisteredComponent>;
10
11
  export type BuilderRenderState = Record<string, unknown>;
11
12
  export type BuilderRenderContext = Record<string, unknown>;
12
- export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'> {
13
+ export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>, ExtraContextTypes {
13
14
  content: Nullable<BuilderContent>;
14
15
  context: BuilderRenderContext;
15
16
  /**
@@ -3,4 +3,4 @@ export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
3
3
  type: string;
4
4
  data: any;
5
5
  };
6
- export declare function serializeComponentInfo(info: ComponentInfo): any;
6
+ export declare function serializeIncludingFunctions(info: ComponentInfo): any;
@@ -1,6 +1,6 @@
1
1
  export const createRegisterComponentMessage = (info) => ({
2
2
  type: 'builder.registerComponent',
3
- data: serializeComponentInfo(info)
3
+ data: serializeIncludingFunctions(info)
4
4
  });
5
5
  // eslint-disable-next-line @typescript-eslint/ban-types
6
6
  const serializeFn = (fnValue) => {
@@ -12,7 +12,7 @@ const serializeFn = (fnValue) => {
12
12
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
13
13
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
14
14
  };
15
- export function serializeComponentInfo(info) {
15
+ export function serializeIncludingFunctions(info) {
16
16
  return JSON.parse(JSON.stringify(info, (key, value) => {
17
17
  if (typeof value === 'function') {
18
18
  return serializeFn(value);
@@ -1,6 +1,10 @@
1
1
  import { isBrowser } from './is-browser';
2
+ import { serializeIncludingFunctions } from './register-component';
2
3
  const registry = {};
3
4
  export function register(type, info) {
5
+ if (type === 'plugin') {
6
+ info = serializeIncludingFunctions(info);
7
+ }
4
8
  let typeList = registry[type];
5
9
  if (!typeList) {
6
10
  typeList = registry[type] = [];
@@ -1,6 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>import { onMount } from "svelte";
4
+ import { TARGET } from "../../constants/target";
4
5
  import { getBlockComponentOptions } from "../../functions/get-block-component-options";
5
6
  import { getProcessedBlock } from "../../functions/get-processed-block";
6
7
  import "../dynamic-div.svelte";
@@ -86,7 +87,7 @@ $: componentRefProps = () => {
86
87
  registeredComponents: registeredComponents,
87
88
  builderBlock: processedBlock(),
88
89
  includeBlockProps: blockComponent?.()?.noWrap === true,
89
- isInteractive: !blockComponent?.()?.isRSC,
90
+ isInteractive: !(blockComponent?.()?.isRSC && TARGET === "rsc"),
90
91
  };
91
92
  };
92
93
  onMount(() => {
@@ -3,7 +3,7 @@ import { writable } from "svelte/store";
3
3
  import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components";
4
4
  import { TARGET } from "../../constants/target";
5
5
  import ComponentsContext from "../../context/components.context";
6
- import { serializeComponentInfo } from "../../functions/register-component";
6
+ import { serializeIncludingFunctions } from "../../functions/register-component";
7
7
  import Blocks from "../blocks/blocks.svelte";
8
8
  import { getUpdateVariantVisibilityScript } from "../content-variants/helpers";
9
9
  import "../dynamic-div.svelte";
@@ -54,7 +54,7 @@ let registeredComponents = [
54
54
  ...acc,
55
55
  [info.name]: {
56
56
  component: component,
57
- ...serializeComponentInfo(info),
57
+ ...serializeIncludingFunctions(info),
58
58
  },
59
59
  }), {});
60
60
  let builderContextSignal = writable({
@@ -84,7 +84,7 @@ let builderContextSignal = writable({
84
84
  }) || []),
85
85
  ].reduce((acc, { component: _, ...info }) => ({
86
86
  ...acc,
87
- [info.name]: serializeComponentInfo(info),
87
+ [info.name]: serializeIncludingFunctions(info),
88
88
  }), {}),
89
89
  inheritedStyles: {},
90
90
  BlocksWrapper: blocksWrapper || "div",
@@ -102,6 +102,7 @@ onMount(() => {
102
102
  {contentWrapper}
103
103
  {contentWrapperProps}
104
104
  {trustedHosts}
105
+ {...{}}
105
106
  />
106
107
  {/each}
107
108
  {/if}
@@ -2,7 +2,8 @@ import type { BuilderRenderContext, RegisteredComponent } from '../../context/ty
2
2
  import type { ApiVersion } from '../../types/api-version';
3
3
  import type { BuilderContent } from '../../types/builder-content';
4
4
  import type { Nullable } from '../../types/typescript';
5
- export interface ContentVariantsPrps {
5
+ import type { ExtraFrameworkProps } from './extra-framework-props-types';
6
+ export interface ContentVariantsPrps extends ExtraFrameworkProps {
6
7
  /**
7
8
  * The Builder content JSON to render (required).
8
9
  */
@@ -0,0 +1,2 @@
1
+ export interface ExtraFrameworkProps {
2
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.5";
1
+ export declare const SDK_VERSION = "2.0.9";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.5";
1
+ export const SDK_VERSION = "2.0.9";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * no-op type for extra context types on a per-SDK basis
3
+ * See `overrides/react-native/src/context/extra-context-types.ts` for an example
4
+ * */
5
+ export interface ExtraContextTypes {
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,13 +3,14 @@ import type { ApiVersion } from '../types/api-version';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
4
  import type { ComponentInfo } from '../types/components';
5
5
  import type { Dictionary, Nullable } from '../types/typescript';
6
+ import type { ExtraContextTypes } from './extra-context-types';
6
7
  export type RegisteredComponent = ComponentInfo & {
7
8
  component: any;
8
9
  };
9
10
  export type RegisteredComponents = Dictionary<RegisteredComponent>;
10
11
  export type BuilderRenderState = Record<string, unknown>;
11
12
  export type BuilderRenderContext = Record<string, unknown>;
12
- export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'> {
13
+ export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>, ExtraContextTypes {
13
14
  content: Nullable<BuilderContent>;
14
15
  context: BuilderRenderContext;
15
16
  /**
@@ -3,4 +3,4 @@ export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
3
3
  type: string;
4
4
  data: any;
5
5
  };
6
- export declare function serializeComponentInfo(info: ComponentInfo): any;
6
+ export declare function serializeIncludingFunctions(info: ComponentInfo): any;
@@ -1,6 +1,6 @@
1
1
  export const createRegisterComponentMessage = (info) => ({
2
2
  type: 'builder.registerComponent',
3
- data: serializeComponentInfo(info)
3
+ data: serializeIncludingFunctions(info)
4
4
  });
5
5
  // eslint-disable-next-line @typescript-eslint/ban-types
6
6
  const serializeFn = (fnValue) => {
@@ -12,7 +12,7 @@ const serializeFn = (fnValue) => {
12
12
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
13
13
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
14
14
  };
15
- export function serializeComponentInfo(info) {
15
+ export function serializeIncludingFunctions(info) {
16
16
  return JSON.parse(JSON.stringify(info, (key, value) => {
17
17
  if (typeof value === 'function') {
18
18
  return serializeFn(value);
@@ -1,6 +1,10 @@
1
1
  import { isBrowser } from './is-browser';
2
+ import { serializeIncludingFunctions } from './register-component';
2
3
  const registry = {};
3
4
  export function register(type, info) {
5
+ if (type === 'plugin') {
6
+ info = serializeIncludingFunctions(info);
7
+ }
4
8
  let typeList = registry[type];
5
9
  if (!typeList) {
6
10
  typeList = registry[type] = [];
@@ -1,6 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>import { onMount } from "svelte";
4
+ import { TARGET } from "../../constants/target";
4
5
  import { getBlockComponentOptions } from "../../functions/get-block-component-options";
5
6
  import { getProcessedBlock } from "../../functions/get-processed-block";
6
7
  import "../dynamic-div.svelte";
@@ -86,7 +87,7 @@ $: componentRefProps = () => {
86
87
  registeredComponents: registeredComponents,
87
88
  builderBlock: processedBlock(),
88
89
  includeBlockProps: blockComponent?.()?.noWrap === true,
89
- isInteractive: !blockComponent?.()?.isRSC,
90
+ isInteractive: !(blockComponent?.()?.isRSC && TARGET === "rsc"),
90
91
  };
91
92
  };
92
93
  onMount(() => {
@@ -3,7 +3,7 @@ import { writable } from "svelte/store";
3
3
  import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components";
4
4
  import { TARGET } from "../../constants/target";
5
5
  import ComponentsContext from "../../context/components.context";
6
- import { serializeComponentInfo } from "../../functions/register-component";
6
+ import { serializeIncludingFunctions } from "../../functions/register-component";
7
7
  import Blocks from "../blocks/blocks.svelte";
8
8
  import { getUpdateVariantVisibilityScript } from "../content-variants/helpers";
9
9
  import "../dynamic-div.svelte";
@@ -54,7 +54,7 @@ let registeredComponents = [
54
54
  ...acc,
55
55
  [info.name]: {
56
56
  component: component,
57
- ...serializeComponentInfo(info),
57
+ ...serializeIncludingFunctions(info),
58
58
  },
59
59
  }), {});
60
60
  let builderContextSignal = writable({
@@ -84,7 +84,7 @@ let builderContextSignal = writable({
84
84
  }) || []),
85
85
  ].reduce((acc, { component: _, ...info }) => ({
86
86
  ...acc,
87
- [info.name]: serializeComponentInfo(info),
87
+ [info.name]: serializeIncludingFunctions(info),
88
88
  }), {}),
89
89
  inheritedStyles: {},
90
90
  BlocksWrapper: blocksWrapper || "div",
@@ -102,6 +102,7 @@ onMount(() => {
102
102
  {contentWrapper}
103
103
  {contentWrapperProps}
104
104
  {trustedHosts}
105
+ {...{}}
105
106
  />
106
107
  {/each}
107
108
  {/if}
@@ -2,7 +2,8 @@ import type { BuilderRenderContext, RegisteredComponent } from '../../context/ty
2
2
  import type { ApiVersion } from '../../types/api-version';
3
3
  import type { BuilderContent } from '../../types/builder-content';
4
4
  import type { Nullable } from '../../types/typescript';
5
- export interface ContentVariantsPrps {
5
+ import type { ExtraFrameworkProps } from './extra-framework-props-types';
6
+ export interface ContentVariantsPrps extends ExtraFrameworkProps {
6
7
  /**
7
8
  * The Builder content JSON to render (required).
8
9
  */
@@ -0,0 +1,2 @@
1
+ export interface ExtraFrameworkProps {
2
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.5";
1
+ export declare const SDK_VERSION = "2.0.9";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.5";
1
+ export const SDK_VERSION = "2.0.9";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * no-op type for extra context types on a per-SDK basis
3
+ * See `overrides/react-native/src/context/extra-context-types.ts` for an example
4
+ * */
5
+ export interface ExtraContextTypes {
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,13 +3,14 @@ import type { ApiVersion } from '../types/api-version';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
4
  import type { ComponentInfo } from '../types/components';
5
5
  import type { Dictionary, Nullable } from '../types/typescript';
6
+ import type { ExtraContextTypes } from './extra-context-types';
6
7
  export type RegisteredComponent = ComponentInfo & {
7
8
  component: any;
8
9
  };
9
10
  export type RegisteredComponents = Dictionary<RegisteredComponent>;
10
11
  export type BuilderRenderState = Record<string, unknown>;
11
12
  export type BuilderRenderContext = Record<string, unknown>;
12
- export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'> {
13
+ export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>, ExtraContextTypes {
13
14
  content: Nullable<BuilderContent>;
14
15
  context: BuilderRenderContext;
15
16
  /**
@@ -3,4 +3,4 @@ export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
3
3
  type: string;
4
4
  data: any;
5
5
  };
6
- export declare function serializeComponentInfo(info: ComponentInfo): any;
6
+ export declare function serializeIncludingFunctions(info: ComponentInfo): any;
@@ -1,6 +1,6 @@
1
1
  export const createRegisterComponentMessage = (info) => ({
2
2
  type: 'builder.registerComponent',
3
- data: serializeComponentInfo(info)
3
+ data: serializeIncludingFunctions(info)
4
4
  });
5
5
  // eslint-disable-next-line @typescript-eslint/ban-types
6
6
  const serializeFn = (fnValue) => {
@@ -12,7 +12,7 @@ const serializeFn = (fnValue) => {
12
12
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
13
13
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
14
14
  };
15
- export function serializeComponentInfo(info) {
15
+ export function serializeIncludingFunctions(info) {
16
16
  return JSON.parse(JSON.stringify(info, (key, value) => {
17
17
  if (typeof value === 'function') {
18
18
  return serializeFn(value);
@@ -1,6 +1,10 @@
1
1
  import { isBrowser } from './is-browser';
2
+ import { serializeIncludingFunctions } from './register-component';
2
3
  const registry = {};
3
4
  export function register(type, info) {
5
+ if (type === 'plugin') {
6
+ info = serializeIncludingFunctions(info);
7
+ }
4
8
  let typeList = registry[type];
5
9
  if (!typeList) {
6
10
  typeList = registry[type] = [];
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": "2.0.5",
4
+ "version": "2.0.9",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -10,6 +10,7 @@
10
10
  <script lang="ts">
11
11
  import { onMount } from "svelte";
12
12
 
13
+ import { TARGET } from "../../constants/target";
13
14
  import type {
14
15
  BuilderContextInterface,
15
16
  RegisteredComponents,
@@ -115,7 +116,7 @@
115
116
  registeredComponents: registeredComponents,
116
117
  builderBlock: processedBlock(),
117
118
  includeBlockProps: blockComponent?.()?.noWrap === true,
118
- isInteractive: !blockComponent?.()?.isRSC,
119
+ isInteractive: !(blockComponent?.()?.isRSC && TARGET === "rsc"),
119
120
  };
120
121
  };
121
122
 
@@ -10,7 +10,7 @@
10
10
  BuilderRenderState,
11
11
  RegisteredComponents,
12
12
  } from "../../context/types";
13
- import { serializeComponentInfo } from "../../functions/register-component";
13
+ import { serializeIncludingFunctions } from "../../functions/register-component";
14
14
  import type { ComponentInfo } from "../../types/components";
15
15
  import type { Dictionary } from "../../types/typescript";
16
16
  import Blocks from "../blocks/blocks.svelte";
@@ -70,7 +70,7 @@
70
70
  ...acc,
71
71
  [info.name]: {
72
72
  component: component,
73
- ...serializeComponentInfo(info),
73
+ ...serializeIncludingFunctions(info),
74
74
  },
75
75
  }),
76
76
  {}
@@ -101,7 +101,7 @@
101
101
  ].reduce<Dictionary<ComponentInfo>>(
102
102
  (acc, { component: _, ...info }) => ({
103
103
  ...acc,
104
- [info.name]: serializeComponentInfo(info),
104
+ [info.name]: serializeIncludingFunctions(info),
105
105
  }),
106
106
  {}
107
107
  ),
@@ -129,6 +129,7 @@
129
129
  {contentWrapper}
130
130
  {contentWrapperProps}
131
131
  {trustedHosts}
132
+ {...{}}
132
133
  />
133
134
  {/each}
134
135
  {/if}
@@ -2,7 +2,8 @@ import type { BuilderRenderContext, RegisteredComponent } from '../../context/ty
2
2
  import type { ApiVersion } from '../../types/api-version';
3
3
  import type { BuilderContent } from '../../types/builder-content';
4
4
  import type { Nullable } from '../../types/typescript';
5
- export interface ContentVariantsPrps {
5
+ import type { ExtraFrameworkProps } from './extra-framework-props-types';
6
+ export interface ContentVariantsPrps extends ExtraFrameworkProps {
6
7
  /**
7
8
  * The Builder content JSON to render (required).
8
9
  */
@@ -0,0 +1 @@
1
+ export interface ExtraFrameworkProps {}
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.5"
1
+ export const SDK_VERSION = "2.0.9"
@@ -0,0 +1,5 @@
1
+ /**
2
+ * no-op type for extra context types on a per-SDK basis
3
+ * See `overrides/react-native/src/context/extra-context-types.ts` for an example
4
+ * */
5
+ export interface ExtraContextTypes {}
@@ -3,13 +3,14 @@ import type { ApiVersion } from '../types/api-version';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
4
  import type { ComponentInfo } from '../types/components';
5
5
  import type { Dictionary, Nullable } from '../types/typescript';
6
+ import type { ExtraContextTypes } from './extra-context-types';
6
7
  export type RegisteredComponent = ComponentInfo & {
7
8
  component: any;
8
9
  };
9
10
  export type RegisteredComponents = Dictionary<RegisteredComponent>;
10
11
  export type BuilderRenderState = Record<string, unknown>;
11
12
  export type BuilderRenderContext = Record<string, unknown>;
12
- export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'> {
13
+ export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps'>, ExtraContextTypes {
13
14
  content: Nullable<BuilderContent>;
14
15
  context: BuilderRenderContext;
15
16
  /**
@@ -1,7 +1,7 @@
1
1
  import type { ComponentInfo } from '../types/components';
2
2
  export const createRegisterComponentMessage = (info: ComponentInfo) => ({
3
3
  type: 'builder.registerComponent',
4
- data: serializeComponentInfo(info)
4
+ data: serializeIncludingFunctions(info)
5
5
  });
6
6
 
7
7
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -15,7 +15,7 @@ const serializeFn = (fnValue: Function) => {
15
15
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
16
16
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
17
17
  };
18
- export function serializeComponentInfo(info: ComponentInfo) {
18
+ export function serializeIncludingFunctions(info: ComponentInfo) {
19
19
  return JSON.parse(JSON.stringify(info, (key, value) => {
20
20
  if (typeof value === 'function') {
21
21
  return serializeFn(value);
@@ -1,6 +1,7 @@
1
1
  import type { BuilderBlock } from '../types/builder-block';
2
2
  import type { DeepPartial } from '../types/deep-partial';
3
3
  import { isBrowser } from './is-browser';
4
+ import { serializeIncludingFunctions } from './register-component';
4
5
  export interface InsertMenuItem {
5
6
  name: string;
6
7
  icon?: string;
@@ -19,6 +20,9 @@ const registry: {
19
20
  export function register(type: 'insertMenu', info: InsertMenuConfig): void;
20
21
  export function register(type: string, info: any): void;
21
22
  export function register(type: string, info: any) {
23
+ if (type === 'plugin') {
24
+ info = serializeIncludingFunctions(info);
25
+ }
22
26
  let typeList = registry[type];
23
27
  if (!typeList) {
24
28
  typeList = registry[type] = [];