@builder.io/sdk-qwik 0.1.7 → 0.1.8

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.
@@ -324,6 +324,13 @@ const useBlock$1 = function useBlock2(props, state) {
324
324
  shouldEvaluateBindings: true
325
325
  });
326
326
  };
327
+ const canShowBlock$1 = function canShowBlock2(props, state) {
328
+ if (checkIsDefined(useBlock$1(props).hide))
329
+ return !useBlock$1(props).hide;
330
+ if (checkIsDefined(useBlock$1(props).show))
331
+ return useBlock$1(props).show;
332
+ return true;
333
+ };
327
334
  const css = function css2(props, state) {
328
335
  const styles = useBlock$1(props).responsiveStyles;
329
336
  const content = props.context.content;
@@ -354,7 +361,7 @@ const css = function css2(props, state) {
354
361
  };
355
362
  const BlockStyles = (props) => {
356
363
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
357
- children: css(props) ? /* @__PURE__ */ jsxRuntime.jsx(RenderInlinedStyles, {
364
+ children: css(props) && canShowBlock$1(props) ? /* @__PURE__ */ jsxRuntime.jsx(RenderInlinedStyles, {
358
365
  styles: css(props)
359
366
  }, "LQ_0") : null,
360
367
  [qwik._IMMUTABLE]: {
@@ -572,6 +579,13 @@ const useBlock = function useBlock22(props, state) {
572
579
  shouldEvaluateBindings: true
573
580
  });
574
581
  };
582
+ const canShowBlock = function canShowBlock22(props, state) {
583
+ if (checkIsDefined(useBlock(props).hide))
584
+ return !useBlock(props).hide;
585
+ if (checkIsDefined(useBlock(props).show))
586
+ return useBlock(props).show;
587
+ return true;
588
+ };
575
589
  const proxyState = function proxyState2(props, state) {
576
590
  if (typeof Proxy === "undefined") {
577
591
  console.error("no Proxy available in this environment, cannot proxy state.");
@@ -644,7 +658,7 @@ const RenderBlock = (props) => {
644
658
  const state = {};
645
659
  state.tag = tag(props);
646
660
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
647
- children: !component(props)?.noWrap ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
661
+ children: canShowBlock(props) ? !component(props)?.noWrap ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
648
662
  children: [
649
663
  isEmptyHtmlElement(tag(props)) ? /* @__PURE__ */ jsxRuntime.jsx(state.tag, {
650
664
  ...attributes(props),
@@ -691,7 +705,7 @@ const RenderBlock = (props) => {
691
705
  }
692
706
  }, "9d_1") : /* @__PURE__ */ jsxRuntime.jsx(RenderComponent, {
693
707
  ...renderComponentProps(props)
694
- }, "9d_2"),
708
+ }, "9d_2") : null,
695
709
  [qwik._IMMUTABLE]: {
696
710
  children: false
697
711
  }
@@ -322,6 +322,13 @@ const useBlock$1 = function useBlock2(props, state) {
322
322
  shouldEvaluateBindings: true
323
323
  });
324
324
  };
325
+ const canShowBlock$1 = function canShowBlock2(props, state) {
326
+ if (checkIsDefined(useBlock$1(props).hide))
327
+ return !useBlock$1(props).hide;
328
+ if (checkIsDefined(useBlock$1(props).show))
329
+ return useBlock$1(props).show;
330
+ return true;
331
+ };
325
332
  const css = function css2(props, state) {
326
333
  const styles = useBlock$1(props).responsiveStyles;
327
334
  const content = props.context.content;
@@ -352,7 +359,7 @@ const css = function css2(props, state) {
352
359
  };
353
360
  const BlockStyles = (props) => {
354
361
  return /* @__PURE__ */ jsx(Fragment, {
355
- children: css(props) ? /* @__PURE__ */ jsx(RenderInlinedStyles, {
362
+ children: css(props) && canShowBlock$1(props) ? /* @__PURE__ */ jsx(RenderInlinedStyles, {
356
363
  styles: css(props)
357
364
  }, "LQ_0") : null,
358
365
  [_IMMUTABLE]: {
@@ -570,6 +577,13 @@ const useBlock = function useBlock22(props, state) {
570
577
  shouldEvaluateBindings: true
571
578
  });
572
579
  };
580
+ const canShowBlock = function canShowBlock22(props, state) {
581
+ if (checkIsDefined(useBlock(props).hide))
582
+ return !useBlock(props).hide;
583
+ if (checkIsDefined(useBlock(props).show))
584
+ return useBlock(props).show;
585
+ return true;
586
+ };
573
587
  const proxyState = function proxyState2(props, state) {
574
588
  if (typeof Proxy === "undefined") {
575
589
  console.error("no Proxy available in this environment, cannot proxy state.");
@@ -642,7 +656,7 @@ const RenderBlock = (props) => {
642
656
  const state = {};
643
657
  state.tag = tag(props);
644
658
  return /* @__PURE__ */ jsx(Fragment, {
645
- children: !component(props)?.noWrap ? /* @__PURE__ */ jsxs(Fragment, {
659
+ children: canShowBlock(props) ? !component(props)?.noWrap ? /* @__PURE__ */ jsxs(Fragment, {
646
660
  children: [
647
661
  isEmptyHtmlElement(tag(props)) ? /* @__PURE__ */ jsx(state.tag, {
648
662
  ...attributes(props),
@@ -689,7 +703,7 @@ const RenderBlock = (props) => {
689
703
  }
690
704
  }, "9d_1") : /* @__PURE__ */ jsx(RenderComponent, {
691
705
  ...renderComponentProps(props)
692
- }, "9d_2"),
706
+ }, "9d_2") : null,
693
707
  [_IMMUTABLE]: {
694
708
  children: false
695
709
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -5,6 +5,7 @@ export declare type BlockStylesProps = {
5
5
  context: BuilderContextInterface;
6
6
  };
7
7
  export declare const useBlock: (props: any, state: any) => BuilderBlock;
8
+ export declare const canShowBlock: (props: any, state: any) => boolean | undefined;
8
9
  export declare const css: (props: any, state: any) => string;
9
10
  export declare const BlockStyles: (props: BlockStylesProps & {
10
11
  key?: any;
@@ -7,6 +7,7 @@ export declare type RenderBlockProps = {
7
7
  export declare const component: (props: any, state: any) => import("../../context/types.js").RegisteredComponent | null | undefined;
8
8
  export declare const tag: (props: any, state: any) => string;
9
9
  export declare const useBlock: (props: any, state: any) => any;
10
+ export declare const canShowBlock: (props: any, state: any) => any;
10
11
  export declare const proxyState: (props: any, state: any) => any;
11
12
  export declare const actions: (props: any, state: any) => {
12
13
  [index: string]: (event: Event) => any;
@@ -54,5 +54,13 @@ export interface BuilderBlock {
54
54
  } | null;
55
55
  animations?: any[];
56
56
  style?: Partial<CSSStyleDeclaration>;
57
+ /**
58
+ * generated by the "Hide If" binding
59
+ */
60
+ hide?: boolean;
61
+ /**
62
+ * generated by the "Show If" binding
63
+ */
64
+ show?: boolean;
57
65
  }
58
66
  export {};