@builder.io/sdk-qwik 0.1.6 → 0.1.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.
@@ -611,8 +611,7 @@ const renderComponentProps = function renderComponentProps2(props, state) {
611
611
  ...attributes(props),
612
612
  ...actions(props)
613
613
  }
614
- },
615
- customBreakpoints: childrenContext(props)?.content?.meta?.breakpoints
614
+ }
616
615
  },
617
616
  context: childrenContext(props)
618
617
  };
@@ -781,48 +780,48 @@ const STYLES$2 = `
781
780
  flex-direction: column;
782
781
  align-items: stretch;
783
782
  }`;
784
- const getGutterSize = function getGutterSize2(props, state) {
783
+ const getGutterSize = function getGutterSize2(props, state, builderContext2) {
785
784
  return typeof props.space === "number" ? props.space || 0 : 20;
786
785
  };
787
- const getColumns = function getColumns2(props, state) {
786
+ const getColumns = function getColumns2(props, state, builderContext2) {
788
787
  return props.columns || [];
789
788
  };
790
- const getWidth = function getWidth2(props, state, index) {
789
+ const getWidth = function getWidth2(props, state, builderContext2, index) {
791
790
  const columns = getColumns(props);
792
791
  return columns[index]?.width || 100 / columns.length;
793
792
  };
794
- const getColumnCssWidth = function getColumnCssWidth2(props, state, index) {
793
+ const getColumnCssWidth = function getColumnCssWidth2(props, state, builderContext2, index) {
795
794
  const columns = getColumns(props);
796
795
  const gutterSize = getGutterSize(props);
797
796
  const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
798
- return `calc(${getWidth(props, state, index)}% - ${subtractWidth}px)`;
797
+ return `calc(${getWidth(props, state, builderContext2, index)}% - ${subtractWidth}px)`;
799
798
  };
800
- const maybeApplyForTablet = function maybeApplyForTablet2(props, state, prop) {
799
+ const maybeApplyForTablet = function maybeApplyForTablet2(props, state, builderContext2, prop) {
801
800
  const _stackColumnsAt = props.stackColumnsAt || "tablet";
802
801
  return _stackColumnsAt === "tablet" ? prop : "inherit";
803
802
  };
804
- const columnsCssVars = function columnsCssVars2(props, state) {
803
+ const columnsCssVars = function columnsCssVars2(props, state, builderContext2) {
805
804
  const flexDir = props.stackColumnsAt === "never" ? "inherit" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
806
805
  return {
807
806
  "--flex-dir": flexDir,
808
- "--flex-dir-tablet": maybeApplyForTablet(props, state, flexDir)
807
+ "--flex-dir-tablet": maybeApplyForTablet(props, state, builderContext2, flexDir)
809
808
  };
810
809
  };
811
- const columnCssVars = function columnCssVars2(props, state) {
810
+ const columnCssVars = function columnCssVars2(props, state, builderContext2) {
812
811
  const width = "100%";
813
812
  const marginLeft = "0";
814
813
  return {
815
814
  "--column-width": width,
816
815
  "--column-margin-left": marginLeft,
817
- "--column-width-tablet": maybeApplyForTablet(props, state, width),
818
- "--column-margin-left-tablet": maybeApplyForTablet(props, state, marginLeft)
816
+ "--column-width-tablet": maybeApplyForTablet(props, state, builderContext2, width),
817
+ "--column-margin-left-tablet": maybeApplyForTablet(props, state, builderContext2, marginLeft)
819
818
  };
820
819
  };
821
- const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, size) {
822
- const breakpointSizes = getSizesForBreakpoints(props.customBreakpoints || {});
820
+ const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, builderContext2, size) {
821
+ const breakpointSizes = getSizesForBreakpoints(builderContext2.content?.meta?.breakpoints || {});
823
822
  return breakpointSizes[size].max;
824
823
  };
825
- const columnStyleObjects = function columnStyleObjects2(props, state) {
824
+ const columnStyleObjects = function columnStyleObjects2(props, state, builderContext2) {
826
825
  return {
827
826
  columns: {
828
827
  small: {
@@ -846,9 +845,9 @@ const columnStyleObjects = function columnStyleObjects2(props, state) {
846
845
  }
847
846
  };
848
847
  };
849
- const columnsStyles = function columnsStyles2(props, state) {
848
+ const columnsStyles = function columnsStyles2(props, state, builderContext2) {
850
849
  return `
851
- @media (max-width: ${getWidthForBreakpointSize(props, state, "medium")}px) {
850
+ @media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "medium")}px) {
852
851
  .${props.builderBlock.id}-breakpoints {
853
852
  ${convertStyleMapToCSS(columnStyleObjects().columns.medium)}
854
853
  }
@@ -858,7 +857,7 @@ const columnsStyles = function columnsStyles2(props, state) {
858
857
  }
859
858
  }
860
859
 
861
- @media (max-width: ${getWidthForBreakpointSize(props, state, "small")}px) {
860
+ @media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "small")}px) {
862
861
  .${props.builderBlock.id}-breakpoints {
863
862
  ${convertStyleMapToCSS(columnStyleObjects().columns.small)}
864
863
  }
@@ -871,25 +870,26 @@ const columnsStyles = function columnsStyles2(props, state) {
871
870
  };
872
871
  const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
873
872
  qwik.useStylesScopedQrl(qwik.inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
873
+ const builderContext$1 = qwik.useContext(builderContext);
874
874
  const state = {};
875
875
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
876
876
  class: `builder-columns ${props.builderBlock.id}-breakpoints div-Columns`,
877
877
  style: {
878
878
  ...{},
879
- ...columnsCssVars(props, state)
879
+ ...columnsCssVars(props, state, builderContext$1)
880
880
  },
881
881
  children: [
882
882
  /* @__PURE__ */ jsxRuntime.jsx(RenderInlinedStyles, {
883
- styles: columnsStyles(props, state)
883
+ styles: columnsStyles(props, state, builderContext$1)
884
884
  }, "c0_0"),
885
885
  (props.columns || []).map(function(column, index) {
886
886
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
887
887
  class: "builder-column div-Columns-2",
888
888
  style: {
889
- width: getColumnCssWidth(props, state, index),
889
+ width: getColumnCssWidth(props, state, builderContext$1, index),
890
890
  marginLeft: `${index === 0 ? 0 : getGutterSize(props)}px`,
891
891
  ...{},
892
- ...columnCssVars(props, state)
892
+ ...columnCssVars(props, state, builderContext$1)
893
893
  },
894
894
  children: /* @__PURE__ */ jsxRuntime.jsx(RenderBlocks, {
895
895
  get blocks() {
@@ -609,8 +609,7 @@ const renderComponentProps = function renderComponentProps2(props, state) {
609
609
  ...attributes(props),
610
610
  ...actions(props)
611
611
  }
612
- },
613
- customBreakpoints: childrenContext(props)?.content?.meta?.breakpoints
612
+ }
614
613
  },
615
614
  context: childrenContext(props)
616
615
  };
@@ -779,48 +778,48 @@ const STYLES$2 = `
779
778
  flex-direction: column;
780
779
  align-items: stretch;
781
780
  }`;
782
- const getGutterSize = function getGutterSize2(props, state) {
781
+ const getGutterSize = function getGutterSize2(props, state, builderContext2) {
783
782
  return typeof props.space === "number" ? props.space || 0 : 20;
784
783
  };
785
- const getColumns = function getColumns2(props, state) {
784
+ const getColumns = function getColumns2(props, state, builderContext2) {
786
785
  return props.columns || [];
787
786
  };
788
- const getWidth = function getWidth2(props, state, index) {
787
+ const getWidth = function getWidth2(props, state, builderContext2, index) {
789
788
  const columns = getColumns(props);
790
789
  return columns[index]?.width || 100 / columns.length;
791
790
  };
792
- const getColumnCssWidth = function getColumnCssWidth2(props, state, index) {
791
+ const getColumnCssWidth = function getColumnCssWidth2(props, state, builderContext2, index) {
793
792
  const columns = getColumns(props);
794
793
  const gutterSize = getGutterSize(props);
795
794
  const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
796
- return `calc(${getWidth(props, state, index)}% - ${subtractWidth}px)`;
795
+ return `calc(${getWidth(props, state, builderContext2, index)}% - ${subtractWidth}px)`;
797
796
  };
798
- const maybeApplyForTablet = function maybeApplyForTablet2(props, state, prop) {
797
+ const maybeApplyForTablet = function maybeApplyForTablet2(props, state, builderContext2, prop) {
799
798
  const _stackColumnsAt = props.stackColumnsAt || "tablet";
800
799
  return _stackColumnsAt === "tablet" ? prop : "inherit";
801
800
  };
802
- const columnsCssVars = function columnsCssVars2(props, state) {
801
+ const columnsCssVars = function columnsCssVars2(props, state, builderContext2) {
803
802
  const flexDir = props.stackColumnsAt === "never" ? "inherit" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
804
803
  return {
805
804
  "--flex-dir": flexDir,
806
- "--flex-dir-tablet": maybeApplyForTablet(props, state, flexDir)
805
+ "--flex-dir-tablet": maybeApplyForTablet(props, state, builderContext2, flexDir)
807
806
  };
808
807
  };
809
- const columnCssVars = function columnCssVars2(props, state) {
808
+ const columnCssVars = function columnCssVars2(props, state, builderContext2) {
810
809
  const width = "100%";
811
810
  const marginLeft = "0";
812
811
  return {
813
812
  "--column-width": width,
814
813
  "--column-margin-left": marginLeft,
815
- "--column-width-tablet": maybeApplyForTablet(props, state, width),
816
- "--column-margin-left-tablet": maybeApplyForTablet(props, state, marginLeft)
814
+ "--column-width-tablet": maybeApplyForTablet(props, state, builderContext2, width),
815
+ "--column-margin-left-tablet": maybeApplyForTablet(props, state, builderContext2, marginLeft)
817
816
  };
818
817
  };
819
- const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, size) {
820
- const breakpointSizes = getSizesForBreakpoints(props.customBreakpoints || {});
818
+ const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, builderContext2, size) {
819
+ const breakpointSizes = getSizesForBreakpoints(builderContext2.content?.meta?.breakpoints || {});
821
820
  return breakpointSizes[size].max;
822
821
  };
823
- const columnStyleObjects = function columnStyleObjects2(props, state) {
822
+ const columnStyleObjects = function columnStyleObjects2(props, state, builderContext2) {
824
823
  return {
825
824
  columns: {
826
825
  small: {
@@ -844,9 +843,9 @@ const columnStyleObjects = function columnStyleObjects2(props, state) {
844
843
  }
845
844
  };
846
845
  };
847
- const columnsStyles = function columnsStyles2(props, state) {
846
+ const columnsStyles = function columnsStyles2(props, state, builderContext2) {
848
847
  return `
849
- @media (max-width: ${getWidthForBreakpointSize(props, state, "medium")}px) {
848
+ @media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "medium")}px) {
850
849
  .${props.builderBlock.id}-breakpoints {
851
850
  ${convertStyleMapToCSS(columnStyleObjects().columns.medium)}
852
851
  }
@@ -856,7 +855,7 @@ const columnsStyles = function columnsStyles2(props, state) {
856
855
  }
857
856
  }
858
857
 
859
- @media (max-width: ${getWidthForBreakpointSize(props, state, "small")}px) {
858
+ @media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "small")}px) {
860
859
  .${props.builderBlock.id}-breakpoints {
861
860
  ${convertStyleMapToCSS(columnStyleObjects().columns.small)}
862
861
  }
@@ -869,25 +868,26 @@ const columnsStyles = function columnsStyles2(props, state) {
869
868
  };
870
869
  const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
871
870
  useStylesScopedQrl(inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
871
+ const builderContext$1 = useContext(builderContext);
872
872
  const state = {};
873
873
  return /* @__PURE__ */ jsxs("div", {
874
874
  class: `builder-columns ${props.builderBlock.id}-breakpoints div-Columns`,
875
875
  style: {
876
876
  ...{},
877
- ...columnsCssVars(props, state)
877
+ ...columnsCssVars(props, state, builderContext$1)
878
878
  },
879
879
  children: [
880
880
  /* @__PURE__ */ jsx(RenderInlinedStyles, {
881
- styles: columnsStyles(props, state)
881
+ styles: columnsStyles(props, state, builderContext$1)
882
882
  }, "c0_0"),
883
883
  (props.columns || []).map(function(column, index) {
884
884
  return /* @__PURE__ */ jsx("div", {
885
885
  class: "builder-column div-Columns-2",
886
886
  style: {
887
- width: getColumnCssWidth(props, state, index),
887
+ width: getColumnCssWidth(props, state, builderContext$1, index),
888
888
  marginLeft: `${index === 0 ? 0 : getGutterSize(props)}px`,
889
889
  ...{},
890
- ...columnCssVars(props, state)
890
+ ...columnCssVars(props, state, builderContext$1)
891
891
  },
892
892
  children: /* @__PURE__ */ jsx(RenderBlocks, {
893
893
  get blocks() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -1,6 +1,5 @@
1
1
  import type { BuilderBlock } from "../../types/builder-block";
2
2
  import type { SizeName } from "../../constants/device-sizes";
3
- import type { Breakpoints } from "../../types/builder-content";
4
3
  declare type Column = {
5
4
  blocks: any;
6
5
  width?: number;
@@ -12,25 +11,24 @@ export interface ColumnProps {
12
11
  space?: number;
13
12
  stackColumnsAt?: StackColumnsAt;
14
13
  reverseColumnsWhenStacked?: boolean;
15
- customBreakpoints?: Breakpoints;
16
14
  }
17
- export declare const getGutterSize: (props: any, state: any) => any;
18
- export declare const getColumns: (props: any, state: any) => any;
19
- export declare const getWidth: (props: any, state: any, index: number) => any;
20
- export declare const getColumnCssWidth: (props: any, state: any, index: number) => string;
21
- export declare const maybeApplyForTablet: (props: any, state: any, prop: string | undefined) => string | undefined;
22
- export declare const columnsCssVars: (props: any, state: any) => {
15
+ export declare const getGutterSize: (props: any, state: any, builderContext: any) => any;
16
+ export declare const getColumns: (props: any, state: any, builderContext: any) => any;
17
+ export declare const getWidth: (props: any, state: any, builderContext: any, index: number) => any;
18
+ export declare const getColumnCssWidth: (props: any, state: any, builderContext: any, index: number) => string;
19
+ export declare const maybeApplyForTablet: (props: any, state: any, builderContext: any, prop: string | undefined) => string | undefined;
20
+ export declare const columnsCssVars: (props: any, state: any, builderContext: any) => {
23
21
  "--flex-dir": string;
24
22
  "--flex-dir-tablet": string | undefined;
25
23
  };
26
- export declare const columnCssVars: (props: any, state: any) => {
24
+ export declare const columnCssVars: (props: any, state: any, builderContext: any) => {
27
25
  "--column-width": string;
28
26
  "--column-margin-left": string;
29
27
  "--column-width-tablet": string | undefined;
30
28
  "--column-margin-left-tablet": string | undefined;
31
29
  };
32
- export declare const getWidthForBreakpointSize: (props: any, state: any, size: SizeName) => number;
33
- export declare const columnStyleObjects: (props: any, state: any) => {
30
+ export declare const getWidthForBreakpointSize: (props: any, state: any, builderContext: any, size: SizeName) => number;
31
+ export declare const columnStyleObjects: (props: any, state: any, builderContext: any) => {
34
32
  columns: {
35
33
  small: {
36
34
  flexDirection: string;
@@ -52,12 +50,12 @@ export declare const columnStyleObjects: (props: any, state: any) => {
52
50
  };
53
51
  };
54
52
  };
55
- export declare const columnsStyles: (props: any, state: any) => string;
56
- export declare const reactNativeColumnsStyles: (props: any, state: any) => {
53
+ export declare const columnsStyles: (props: any, state: any, builderContext: any) => string;
54
+ export declare const reactNativeColumnsStyles: (props: any, state: any, builderContext: any) => {
57
55
  flexDirection: string;
58
56
  alignItems: string;
59
57
  };
60
- export declare const reactNativeColumnStyles: (props: any, state: any) => {
58
+ export declare const reactNativeColumnStyles: (props: any, state: any, builderContext: any) => {
61
59
  width: string;
62
60
  marginLeft: string;
63
61
  };
@@ -1,9 +1,7 @@
1
1
  import type { BuilderBlock } from "../../types/builder-block.js";
2
2
  import type { BuilderContextInterface } from "../../context/types.js";
3
- import type { Breakpoints } from "../../types/builder-content.js";
4
3
  declare type ComponentOptions = {
5
4
  [index: string]: any;
6
- customBreakpoints?: Breakpoints;
7
5
  attributes?: {
8
6
  [index: string]: any;
9
7
  };
@@ -13,7 +11,6 @@ export interface RenderComponentProps {
13
11
  componentOptions: ComponentOptions;
14
12
  blockChildren: BuilderBlock[];
15
13
  context: BuilderContextInterface;
16
- customBreakpoints?: Breakpoints;
17
14
  }
18
15
  export declare const RenderComponent: (props: RenderComponentProps & {
19
16
  key?: any;