@builder.io/sdk-qwik 0.0.9 → 0.0.12

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 (31) hide show
  1. package/README.md +13 -14
  2. package/lib/index.qwik.cjs +212 -229
  3. package/lib/index.qwik.mjs +213 -230
  4. package/package.json +4 -4
  5. package/src/blocks/button/button.jsx +0 -175
  6. package/src/blocks/columns/columns.jsx +27 -197
  7. package/src/blocks/custom-code/custom-code.jsx +16 -75
  8. package/src/blocks/embed/embed.jsx +20 -87
  9. package/src/blocks/form/builder-blocks.jsx +0 -75
  10. package/src/blocks/form/form.jsx +57 -536
  11. package/src/blocks/fragment/fragment.jsx +8 -56
  12. package/src/blocks/image/image.jsx +49 -493
  13. package/src/blocks/img/img.jsx +15 -72
  14. package/src/blocks/input/input.jsx +17 -83
  15. package/src/blocks/raw-text/raw-text.jsx +9 -50
  16. package/src/blocks/section/section.jsx +17 -94
  17. package/src/blocks/select/select.jsx +20 -145
  18. package/src/blocks/submit-button/submit-button.jsx +8 -84
  19. package/src/blocks/symbol/symbol.jsx +60 -194
  20. package/src/blocks/text/text.jsx +4 -43
  21. package/src/blocks/textarea/textarea.jsx +12 -62
  22. package/src/blocks/video/video.jsx +21 -71
  23. package/src/components/render-block/block-styles.jsx +0 -114
  24. package/src/components/render-block/render-block.jsx +2 -514
  25. package/src/components/render-block/render-component.jsx +0 -211
  26. package/src/components/render-block/render-repeated-block.jsx +0 -67
  27. package/src/components/render-blocks.jsx +40 -334
  28. package/src/components/render-content/components/render-styles.jsx +0 -50
  29. package/src/components/render-content/render-content.jsx +86 -385
  30. package/src/components/render-inlined-styles.jsx +0 -116
  31. package/src/constants/builder-registered-components.js +3 -0
@@ -97,6 +97,7 @@ export const renderComponentProps = function renderComponentProps(
97
97
  blockChildren: children(props, state),
98
98
  componentRef: componentRef(props, state),
99
99
  componentOptions: componentOptions(props, state),
100
+ context: props.context,
100
101
  };
101
102
  };
102
103
  export const children = function children(props, state) {
@@ -172,6 +173,7 @@ export const RenderBlock = (props) => {
172
173
  key={index}
173
174
  repeatContext={data.context}
174
175
  block={data.block}
176
+ context={props.context}
175
177
  ></RenderRepeatedBlock>
176
178
  );
177
179
  })
@@ -217,517 +219,3 @@ export const RenderBlock = (props) => {
217
219
  );
218
220
  };
219
221
  export default RenderBlock;
220
- export const COMPONENT = {
221
- "@type": "@builder.io/mitosis/component",
222
- imports: [
223
- {
224
- imports: {
225
- getBlockActions: "getBlockActions",
226
- },
227
- path: "../../functions/get-block-actions.js",
228
- },
229
- {
230
- imports: {
231
- getBlockComponentOptions: "getBlockComponentOptions",
232
- },
233
- path: "../../functions/get-block-component-options.js",
234
- },
235
- {
236
- imports: {
237
- getBlockProperties: "getBlockProperties",
238
- },
239
- path: "../../functions/get-block-properties.js",
240
- },
241
- {
242
- imports: {
243
- getBlockStyles: "getBlockStyles",
244
- },
245
- path: "../../functions/get-block-styles.js",
246
- },
247
- {
248
- imports: {
249
- getBlockTag: "getBlockTag",
250
- },
251
- path: "../../functions/get-block-tag.js",
252
- },
253
- {
254
- imports: {
255
- getProcessedBlock: "getProcessedBlock",
256
- },
257
- path: "../../functions/get-processed-block.js",
258
- },
259
- {
260
- imports: {
261
- evaluate: "evaluate",
262
- },
263
- path: "../../functions/evaluate.js",
264
- },
265
- {
266
- imports: {
267
- BlockStyles: "default",
268
- },
269
- path: "./block-styles.lite",
270
- },
271
- {
272
- imports: {
273
- isEmptyHtmlElement: "isEmptyHtmlElement",
274
- },
275
- path: "./render-block.helpers.js",
276
- },
277
- {
278
- imports: {
279
- RenderComponent: "default",
280
- },
281
- path: "./render-component.lite",
282
- },
283
- {
284
- imports: {
285
- RenderRepeatedBlock: "default",
286
- },
287
- path: "./render-repeated-block.lite",
288
- },
289
- ],
290
- exports: {},
291
- inputs: [],
292
- meta: {
293
- useMetadata: {
294
- qwik: {
295
- component: {
296
- isLight: true,
297
- },
298
- },
299
- elementTag: "state.tagName",
300
- },
301
- },
302
- refs: {},
303
- state: {
304
- component:
305
- '@builder.io/mitosis/method:get component() {\n const componentName = getProcessedBlock({\n block: props.block,\n state: props.context.state,\n context: props.context.context,\n evaluateBindings: false\n }).component?.name;\n\n if (!componentName) {\n return null;\n }\n\n const ref = props.context.registeredComponents[componentName];\n\n if (!ref) {\n // TODO: Public doc page with more info about this message\n console.warn(`\n Could not find a registered component named "${componentName}". \n If you registered it, is the file that registered it imported by the file that needs to render it?`);\n return undefined;\n } else {\n return ref;\n }\n}',
306
- componentInfo:
307
- "@builder.io/mitosis/method:get componentInfo() {\n if (component(props,state)) {\n const {\n component: _,\n ...info\n } = component(props,state);\n return info;\n } else {\n return undefined;\n }\n}",
308
- componentRef:
309
- "@builder.io/mitosis/method:get componentRef() {\n return component(props,state)?.component;\n}",
310
- tagName:
311
- "@builder.io/mitosis/method:get tagName() {\n return getBlockTag(useBlock(props,state));\n}",
312
- useBlock:
313
- "@builder.io/mitosis/method:get useBlock() {\n return repeatItemData(props,state) ? props.block : getProcessedBlock({\n block: props.block,\n state: props.context.state,\n context: props.context.context,\n evaluateBindings: true\n });\n}",
314
- attributes:
315
- "@builder.io/mitosis/method:get attributes() {\n return { ...getBlockProperties(useBlock(props,state)),\n ...getBlockActions({\n block: useBlock(props,state),\n state: props.context.state,\n context: props.context.context\n }),\n style: getBlockStyles(useBlock(props,state))\n };\n}",
316
- shouldWrap:
317
- "@builder.io/mitosis/method:get shouldWrap() {\n return !componentInfo(props,state)?.noWrap;\n}",
318
- componentOptions:
319
- "@builder.io/mitosis/method:get componentOptions() {\n return { ...getBlockComponentOptions(useBlock(props,state)),\n\n /**\n * These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then\n * they are provided to the component itself directly.\n */\n ...(shouldWrap(props,state) ? {} : {\n attributes: attributes(props,state)\n })\n };\n}",
320
- renderComponentProps:
321
- "@builder.io/mitosis/method:get renderComponentProps() {\n return {\n blockChildren: children(props,state),\n componentRef: componentRef(props,state),\n componentOptions: componentOptions(props,state)\n };\n}",
322
- children:
323
- "@builder.io/mitosis/method:get children() {\n // TO-DO: When should `canHaveChildren` dictate rendering?\n // This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,\n // but still receive and need to render children.\n // return state.componentInfo?.canHaveChildren ? state.useBlock.children : [];\n return useBlock(props,state).children ?? [];\n}",
324
- childrenWithoutParentComponent:
325
- "@builder.io/mitosis/method:get childrenWithoutParentComponent() {\n /**\n * When there is no `componentRef`, there might still be children that need to be rendered. In this case,\n * we render them outside of `componentRef`.\n * NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of\n * blocks, and the children will be repeated within those blocks.\n */\n const shouldRenderChildrenOutsideRef = !componentRef(props,state) && !repeatItemData(props,state);\n return shouldRenderChildrenOutsideRef ? children(props,state) : [];\n}",
326
- repeatItemData:
327
- "@builder.io/mitosis/method:get repeatItemData() {\n /**\n * we don't use `state.useBlock` here because the processing done within its logic includes evaluating the block's bindings,\n * which will not work if there is a repeat.\n */\n const {\n repeat,\n ...blockWithoutRepeat\n } = props.block;\n\n if (!repeat?.collection) {\n return undefined;\n }\n\n const itemsArray = evaluate({\n code: repeat.collection,\n state: props.context.state,\n context: props.context.context\n });\n\n if (!Array.isArray(itemsArray)) {\n return undefined;\n }\n\n const collectionName = repeat.collection.split('.').pop();\n const itemNameToUse = repeat.itemName || (collectionName ? collectionName + 'Item' : 'item');\n const repeatArray = itemsArray.map<RepeatData>((item, index) => ({\n context: { ...props.context,\n state: { ...props.context.state,\n $index: index,\n $item: item,\n [itemNameToUse]: item,\n [`$${itemNameToUse}Index`]: index\n }\n },\n block: blockWithoutRepeat\n }));\n return repeatArray;\n}",
328
- },
329
- children: [
330
- {
331
- "@type": "@builder.io/mitosis/node",
332
- name: "Show",
333
- meta: {
334
- else: {
335
- "@type": "@builder.io/mitosis/node",
336
- name: "RenderComponent",
337
- meta: {},
338
- scope: {},
339
- properties: {},
340
- bindings: {
341
- _spread: {
342
- code: "renderComponentProps(props,state)",
343
- },
344
- context: {
345
- code: "props.context",
346
- },
347
- },
348
- children: [],
349
- },
350
- },
351
- scope: {},
352
- properties: {},
353
- bindings: {
354
- when: {
355
- code: "shouldWrap(props,state)",
356
- },
357
- },
358
- children: [
359
- {
360
- "@type": "@builder.io/mitosis/node",
361
- name: "div",
362
- meta: {},
363
- scope: {},
364
- properties: {
365
- _text: "\n ",
366
- },
367
- bindings: {},
368
- children: [],
369
- },
370
- {
371
- "@type": "@builder.io/mitosis/node",
372
- name: "Show",
373
- meta: {
374
- else: {
375
- "@type": "@builder.io/mitosis/node",
376
- name: "state.tagName",
377
- meta: {},
378
- scope: {},
379
- properties: {},
380
- bindings: {
381
- _spread: {
382
- code: "attributes(props,state)",
383
- },
384
- },
385
- children: [],
386
- },
387
- },
388
- scope: {},
389
- properties: {},
390
- bindings: {
391
- when: {
392
- code: "!isEmptyHtmlElement(tagName(props,state))",
393
- },
394
- },
395
- children: [
396
- {
397
- "@type": "@builder.io/mitosis/node",
398
- name: "div",
399
- meta: {},
400
- scope: {},
401
- properties: {
402
- _text: "\n ",
403
- },
404
- bindings: {},
405
- children: [],
406
- },
407
- {
408
- "@type": "@builder.io/mitosis/node",
409
- name: "state.tagName",
410
- meta: {},
411
- scope: {},
412
- properties: {},
413
- bindings: {
414
- _spread: {
415
- code: "attributes(props,state)",
416
- },
417
- },
418
- children: [
419
- {
420
- "@type": "@builder.io/mitosis/node",
421
- name: "div",
422
- meta: {},
423
- scope: {},
424
- properties: {
425
- _text: "\n ",
426
- },
427
- bindings: {},
428
- children: [],
429
- },
430
- {
431
- "@type": "@builder.io/mitosis/node",
432
- name: "div",
433
- meta: {},
434
- scope: {},
435
- properties: {
436
- _text: "\n ",
437
- },
438
- bindings: {},
439
- children: [],
440
- },
441
- {
442
- "@type": "@builder.io/mitosis/node",
443
- name: "Show",
444
- meta: {},
445
- scope: {},
446
- properties: {},
447
- bindings: {
448
- when: {
449
- code: "repeatItemData(props,state)",
450
- },
451
- },
452
- children: [
453
- {
454
- "@type": "@builder.io/mitosis/node",
455
- name: "div",
456
- meta: {},
457
- scope: {},
458
- properties: {
459
- _text: "\n ",
460
- },
461
- bindings: {},
462
- children: [],
463
- },
464
- {
465
- "@type": "@builder.io/mitosis/node",
466
- name: "For",
467
- meta: {},
468
- scope: {
469
- For: ["data", "index"],
470
- },
471
- properties: {
472
- _forName: "data",
473
- _indexName: "index",
474
- },
475
- bindings: {
476
- each: {
477
- code: "repeatItemData(props,state)",
478
- },
479
- },
480
- children: [
481
- {
482
- "@type": "@builder.io/mitosis/node",
483
- name: "RenderRepeatedBlock",
484
- meta: {},
485
- scope: {},
486
- properties: {},
487
- bindings: {
488
- key: {
489
- code: "index",
490
- },
491
- repeatContext: {
492
- code: "data.context",
493
- },
494
- block: {
495
- code: "data.block",
496
- },
497
- },
498
- children: [],
499
- },
500
- ],
501
- },
502
- {
503
- "@type": "@builder.io/mitosis/node",
504
- name: "div",
505
- meta: {},
506
- scope: {},
507
- properties: {
508
- _text: "\n ",
509
- },
510
- bindings: {},
511
- children: [],
512
- },
513
- ],
514
- },
515
- {
516
- "@type": "@builder.io/mitosis/node",
517
- name: "div",
518
- meta: {},
519
- scope: {},
520
- properties: {
521
- _text: "\n ",
522
- },
523
- bindings: {},
524
- children: [],
525
- },
526
- {
527
- "@type": "@builder.io/mitosis/node",
528
- name: "Show",
529
- meta: {},
530
- scope: {},
531
- properties: {},
532
- bindings: {
533
- when: {
534
- code: "!repeatItemData(props,state)",
535
- },
536
- },
537
- children: [
538
- {
539
- "@type": "@builder.io/mitosis/node",
540
- name: "div",
541
- meta: {},
542
- scope: {},
543
- properties: {
544
- _text: "\n ",
545
- },
546
- bindings: {},
547
- children: [],
548
- },
549
- {
550
- "@type": "@builder.io/mitosis/node",
551
- name: "RenderComponent",
552
- meta: {},
553
- scope: {},
554
- properties: {},
555
- bindings: {
556
- _spread: {
557
- code: "renderComponentProps(props,state)",
558
- },
559
- },
560
- children: [],
561
- },
562
- {
563
- "@type": "@builder.io/mitosis/node",
564
- name: "div",
565
- meta: {},
566
- scope: {},
567
- properties: {
568
- _text: "\n ",
569
- },
570
- bindings: {},
571
- children: [],
572
- },
573
- ],
574
- },
575
- {
576
- "@type": "@builder.io/mitosis/node",
577
- name: "div",
578
- meta: {},
579
- scope: {},
580
- properties: {
581
- _text: "\n ",
582
- },
583
- bindings: {},
584
- children: [],
585
- },
586
- {
587
- "@type": "@builder.io/mitosis/node",
588
- name: "div",
589
- meta: {},
590
- scope: {},
591
- properties: {
592
- _text: "\n ",
593
- },
594
- bindings: {},
595
- children: [],
596
- },
597
- {
598
- "@type": "@builder.io/mitosis/node",
599
- name: "For",
600
- meta: {},
601
- scope: {
602
- For: ["child"],
603
- },
604
- properties: {
605
- _forName: "child",
606
- },
607
- bindings: {
608
- each: {
609
- code: "childrenWithoutParentComponent(props,state)",
610
- },
611
- },
612
- children: [
613
- {
614
- "@type": "@builder.io/mitosis/node",
615
- name: "RenderBlock",
616
- meta: {},
617
- scope: {},
618
- properties: {},
619
- bindings: {
620
- key: {
621
- code: "'render-block-' + child.id",
622
- },
623
- block: {
624
- code: "child",
625
- },
626
- context: {
627
- code: "props.context",
628
- },
629
- },
630
- children: [],
631
- },
632
- ],
633
- },
634
- {
635
- "@type": "@builder.io/mitosis/node",
636
- name: "div",
637
- meta: {},
638
- scope: {},
639
- properties: {
640
- _text: "\n ",
641
- },
642
- bindings: {},
643
- children: [],
644
- },
645
- {
646
- "@type": "@builder.io/mitosis/node",
647
- name: "For",
648
- meta: {},
649
- scope: {
650
- For: ["child"],
651
- },
652
- properties: {
653
- _forName: "child",
654
- },
655
- bindings: {
656
- each: {
657
- code: "childrenWithoutParentComponent(props,state)",
658
- },
659
- },
660
- children: [
661
- {
662
- "@type": "@builder.io/mitosis/node",
663
- name: "BlockStyles",
664
- meta: {},
665
- scope: {},
666
- properties: {},
667
- bindings: {
668
- key: {
669
- code: "'block-style-' + child.id",
670
- },
671
- block: {
672
- code: "child",
673
- },
674
- context: {
675
- code: "props.context",
676
- },
677
- },
678
- children: [],
679
- },
680
- ],
681
- },
682
- {
683
- "@type": "@builder.io/mitosis/node",
684
- name: "div",
685
- meta: {},
686
- scope: {},
687
- properties: {
688
- _text: "\n ",
689
- },
690
- bindings: {},
691
- children: [],
692
- },
693
- ],
694
- },
695
- {
696
- "@type": "@builder.io/mitosis/node",
697
- name: "div",
698
- meta: {},
699
- scope: {},
700
- properties: {
701
- _text: "\n ",
702
- },
703
- bindings: {},
704
- children: [],
705
- },
706
- ],
707
- },
708
- {
709
- "@type": "@builder.io/mitosis/node",
710
- name: "div",
711
- meta: {},
712
- scope: {},
713
- properties: {
714
- _text: "\n ",
715
- },
716
- bindings: {},
717
- children: [],
718
- },
719
- ],
720
- },
721
- ],
722
- hooks: {},
723
- context: {
724
- get: {},
725
- set: {},
726
- },
727
- name: "RenderBlock",
728
- subComponents: [],
729
- types: [
730
- "export type RenderBlockProps = {\n block: BuilderBlock;\n context: BuilderContextInterface;\n}; // eslint-disable-next-line @builder.io/mitosis/only-default-function-and-imports",
731
- ],
732
- propsTypeRef: "RenderBlockProps",
733
- };