@builder.io/sdk-qwik 0.0.30 → 0.0.32

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.
@@ -374,6 +374,28 @@ function getBlockActions(options) {
374
374
  return obj;
375
375
  }
376
376
 
377
+ function getBlockBindings(state, block) {
378
+ const props = {};
379
+ const bindings = block.bindings;
380
+ if (bindings) for(const key in bindings){
381
+ if (key.startsWith('component.')) ;
382
+ else if (key.startsWith('style.')) {
383
+ const styleKey = key.substring(6);
384
+ const style = props.style || (props.style = {});
385
+ style[styleKey] = evaluate({
386
+ code: bindings[key],
387
+ state,
388
+ context: {}
389
+ });
390
+ } else props[key] = evaluate({
391
+ code: bindings[key],
392
+ state,
393
+ context: {}
394
+ });
395
+ }
396
+ return props;
397
+ }
398
+
377
399
  function getBlockComponentOptions(block) {
378
400
  return {
379
401
  ...block.component?.options,
@@ -580,6 +602,7 @@ const useBlock = function useBlock(props, state) {
580
602
  const attributes = function attributes(props, state) {
581
603
  return {
582
604
  ...getBlockProperties(useBlock(props)),
605
+ ...getBlockBindings(props.context.state, useBlock(props)),
583
606
  ...getBlockActions({
584
607
  block: useBlock(props),
585
608
  state: props.context.state,
@@ -370,6 +370,28 @@ function getBlockActions(options) {
370
370
  return obj;
371
371
  }
372
372
 
373
+ function getBlockBindings(state, block) {
374
+ const props = {};
375
+ const bindings = block.bindings;
376
+ if (bindings) for(const key in bindings){
377
+ if (key.startsWith('component.')) ;
378
+ else if (key.startsWith('style.')) {
379
+ const styleKey = key.substring(6);
380
+ const style = props.style || (props.style = {});
381
+ style[styleKey] = evaluate({
382
+ code: bindings[key],
383
+ state,
384
+ context: {}
385
+ });
386
+ } else props[key] = evaluate({
387
+ code: bindings[key],
388
+ state,
389
+ context: {}
390
+ });
391
+ }
392
+ return props;
393
+ }
394
+
373
395
  function getBlockComponentOptions(block) {
374
396
  return {
375
397
  ...block.component?.options,
@@ -576,6 +598,7 @@ const useBlock = function useBlock(props, state) {
576
598
  const attributes = function attributes(props, state) {
577
599
  return {
578
600
  ...getBlockProperties(useBlock(props)),
601
+ ...getBlockBindings(props.context.state, useBlock(props)),
579
602
  ...getBlockActions({
580
603
  block: useBlock(props),
581
604
  state: props.context.state,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -0,0 +1,2 @@
1
+ import type { BuilderBlock } from '../types/builder-block.js';
2
+ export declare function getBlockBindings(state: any, block: BuilderBlock): Record<string, any>;