@builder.io/sdk-svelte 2.0.2 → 2.0.3

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.
@@ -93,6 +93,7 @@ function getWidthForBreakpointSize(size) {
93
93
  return breakpointSizes[size].max;
94
94
  }
95
95
  function columnsStyles() {
96
+ const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
96
97
  return `
97
98
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
98
99
  .${builderBlock.id}-breakpoints {
@@ -100,7 +101,7 @@ function columnsStyles() {
100
101
  align-items: stretch;
101
102
  }
102
103
 
103
- .${builderBlock.id}-breakpoints > .builder-column {
104
+ ${childColumnDiv} {
104
105
  width: var(--column-width-tablet) !important;
105
106
  margin-left: var(--column-margin-left-tablet) !important;
106
107
  }
@@ -112,7 +113,7 @@ function columnsStyles() {
112
113
  align-items: stretch;
113
114
  }
114
115
 
115
- .${builderBlock.id}-breakpoints > .builder-column {
116
+ ${childColumnDiv} {
116
117
  width: var(--column-width-mobile) !important;
117
118
  margin-left: var(--column-margin-left-mobile) !important;
118
119
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.2";
1
+ export declare const SDK_VERSION = "2.0.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.2";
1
+ export const SDK_VERSION = "2.0.3";
@@ -1,6 +1,6 @@
1
1
  import type { ComponentInfo } from '../types/components';
2
2
  export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
3
3
  type: string;
4
- data: ComponentInfo;
4
+ data: any;
5
5
  };
6
- export declare const serializeComponentInfo: ({ inputs, ...info }: ComponentInfo) => ComponentInfo;
6
+ export declare function serializeComponentInfo(info: ComponentInfo): any;
@@ -1,4 +1,3 @@
1
- import { fastClone } from './fast-clone';
2
1
  export const createRegisterComponentMessage = (info) => ({
3
2
  type: 'builder.registerComponent',
4
3
  data: serializeComponentInfo(info)
@@ -13,11 +12,11 @@ const serializeFn = (fnValue) => {
13
12
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
14
13
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
15
14
  };
16
- const serializeValue = (value) => typeof value === 'function' ? serializeFn(value) : fastClone(value);
17
- export const serializeComponentInfo = ({ inputs, ...info }) => ({
18
- ...fastClone(info),
19
- inputs: inputs?.map(input => Object.entries(input).reduce((acc, [key, value]) => ({
20
- ...acc,
21
- [key]: serializeValue(value)
22
- }), {}))
23
- });
15
+ export function serializeComponentInfo(info) {
16
+ return JSON.parse(JSON.stringify(info, (key, value) => {
17
+ if (typeof value === 'function') {
18
+ return serializeFn(value);
19
+ }
20
+ return value;
21
+ }));
22
+ }
@@ -93,6 +93,7 @@ function getWidthForBreakpointSize(size) {
93
93
  return breakpointSizes[size].max;
94
94
  }
95
95
  function columnsStyles() {
96
+ const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
96
97
  return `
97
98
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
98
99
  .${builderBlock.id}-breakpoints {
@@ -100,7 +101,7 @@ function columnsStyles() {
100
101
  align-items: stretch;
101
102
  }
102
103
 
103
- .${builderBlock.id}-breakpoints > .builder-column {
104
+ ${childColumnDiv} {
104
105
  width: var(--column-width-tablet) !important;
105
106
  margin-left: var(--column-margin-left-tablet) !important;
106
107
  }
@@ -112,7 +113,7 @@ function columnsStyles() {
112
113
  align-items: stretch;
113
114
  }
114
115
 
115
- .${builderBlock.id}-breakpoints > .builder-column {
116
+ ${childColumnDiv} {
116
117
  width: var(--column-width-mobile) !important;
117
118
  margin-left: var(--column-margin-left-mobile) !important;
118
119
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.2";
1
+ export declare const SDK_VERSION = "2.0.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.2";
1
+ export const SDK_VERSION = "2.0.3";
@@ -1,6 +1,6 @@
1
1
  import type { ComponentInfo } from '../types/components';
2
2
  export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
3
3
  type: string;
4
- data: ComponentInfo;
4
+ data: any;
5
5
  };
6
- export declare const serializeComponentInfo: ({ inputs, ...info }: ComponentInfo) => ComponentInfo;
6
+ export declare function serializeComponentInfo(info: ComponentInfo): any;
@@ -1,4 +1,3 @@
1
- import { fastClone } from './fast-clone';
2
1
  export const createRegisterComponentMessage = (info) => ({
3
2
  type: 'builder.registerComponent',
4
3
  data: serializeComponentInfo(info)
@@ -13,11 +12,11 @@ const serializeFn = (fnValue) => {
13
12
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
14
13
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
15
14
  };
16
- const serializeValue = (value) => typeof value === 'function' ? serializeFn(value) : fastClone(value);
17
- export const serializeComponentInfo = ({ inputs, ...info }) => ({
18
- ...fastClone(info),
19
- inputs: inputs?.map(input => Object.entries(input).reduce((acc, [key, value]) => ({
20
- ...acc,
21
- [key]: serializeValue(value)
22
- }), {}))
23
- });
15
+ export function serializeComponentInfo(info) {
16
+ return JSON.parse(JSON.stringify(info, (key, value) => {
17
+ if (typeof value === 'function') {
18
+ return serializeFn(value);
19
+ }
20
+ return value;
21
+ }));
22
+ }
@@ -93,6 +93,7 @@ function getWidthForBreakpointSize(size) {
93
93
  return breakpointSizes[size].max;
94
94
  }
95
95
  function columnsStyles() {
96
+ const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
96
97
  return `
97
98
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
98
99
  .${builderBlock.id}-breakpoints {
@@ -100,7 +101,7 @@ function columnsStyles() {
100
101
  align-items: stretch;
101
102
  }
102
103
 
103
- .${builderBlock.id}-breakpoints > .builder-column {
104
+ ${childColumnDiv} {
104
105
  width: var(--column-width-tablet) !important;
105
106
  margin-left: var(--column-margin-left-tablet) !important;
106
107
  }
@@ -112,7 +113,7 @@ function columnsStyles() {
112
113
  align-items: stretch;
113
114
  }
114
115
 
115
- .${builderBlock.id}-breakpoints > .builder-column {
116
+ ${childColumnDiv} {
116
117
  width: var(--column-width-mobile) !important;
117
118
  margin-left: var(--column-margin-left-mobile) !important;
118
119
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.0.2";
1
+ export declare const SDK_VERSION = "2.0.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.2";
1
+ export const SDK_VERSION = "2.0.3";
@@ -1,6 +1,6 @@
1
1
  import type { ComponentInfo } from '../types/components';
2
2
  export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
3
3
  type: string;
4
- data: ComponentInfo;
4
+ data: any;
5
5
  };
6
- export declare const serializeComponentInfo: ({ inputs, ...info }: ComponentInfo) => ComponentInfo;
6
+ export declare function serializeComponentInfo(info: ComponentInfo): any;
@@ -1,4 +1,3 @@
1
- import { fastClone } from './fast-clone';
2
1
  export const createRegisterComponentMessage = (info) => ({
3
2
  type: 'builder.registerComponent',
4
3
  data: serializeComponentInfo(info)
@@ -13,11 +12,11 @@ const serializeFn = (fnValue) => {
13
12
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
14
13
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
15
14
  };
16
- const serializeValue = (value) => typeof value === 'function' ? serializeFn(value) : fastClone(value);
17
- export const serializeComponentInfo = ({ inputs, ...info }) => ({
18
- ...fastClone(info),
19
- inputs: inputs?.map(input => Object.entries(input).reduce((acc, [key, value]) => ({
20
- ...acc,
21
- [key]: serializeValue(value)
22
- }), {}))
23
- });
15
+ export function serializeComponentInfo(info) {
16
+ return JSON.parse(JSON.stringify(info, (key, value) => {
17
+ if (typeof value === 'function') {
18
+ return serializeFn(value);
19
+ }
20
+ return value;
21
+ }));
22
+ }
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.2",
4
+ "version": "2.0.3",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -117,6 +117,7 @@
117
117
  return breakpointSizes[size].max;
118
118
  }
119
119
  function columnsStyles() {
120
+ const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
120
121
  return `
121
122
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
122
123
  .${builderBlock.id}-breakpoints {
@@ -124,7 +125,7 @@
124
125
  align-items: stretch;
125
126
  }
126
127
 
127
- .${builderBlock.id}-breakpoints > .builder-column {
128
+ ${childColumnDiv} {
128
129
  width: var(--column-width-tablet) !important;
129
130
  margin-left: var(--column-margin-left-tablet) !important;
130
131
  }
@@ -136,7 +137,7 @@
136
137
  align-items: stretch;
137
138
  }
138
139
 
139
- .${builderBlock.id}-breakpoints > .builder-column {
140
+ ${childColumnDiv} {
140
141
  width: var(--column-width-mobile) !important;
141
142
  margin-left: var(--column-margin-left-mobile) !important;
142
143
  }
@@ -1 +1 @@
1
- export const SDK_VERSION = "2.0.2"
1
+ export const SDK_VERSION = "2.0.3"
@@ -1,6 +1,4 @@
1
1
  import type { ComponentInfo } from '../types/components';
2
- import type { Input } from '../types/input';
3
- import { fastClone } from './fast-clone';
4
2
  export const createRegisterComponentMessage = (info: ComponentInfo) => ({
5
3
  type: 'builder.registerComponent',
6
4
  data: serializeComponentInfo(info)
@@ -17,14 +15,11 @@ const serializeFn = (fnValue: Function) => {
17
15
  const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
18
16
  return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
19
17
  };
20
- const serializeValue = (value: object): any => typeof value === 'function' ? serializeFn(value) : fastClone(value);
21
- export const serializeComponentInfo = ({
22
- inputs,
23
- ...info
24
- }: ComponentInfo): ComponentInfo => ({
25
- ...fastClone(info),
26
- inputs: inputs?.map(input => Object.entries(input).reduce((acc, [key, value]) => ({
27
- ...acc,
28
- [key]: serializeValue(value)
29
- }), ({} as Input)))
30
- })
18
+ export function serializeComponentInfo(info: ComponentInfo) {
19
+ return JSON.parse(JSON.stringify(info, (key, value) => {
20
+ if (typeof value === 'function') {
21
+ return serializeFn(value);
22
+ }
23
+ return value;
24
+ }));
25
+ }