@builder.io/sdk-qwik 0.0.13 → 0.0.14
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.
- package/.yarn/install-state.gz +0 -0
- package/README.md +1 -5
- package/lib/index.qwik.cjs +29 -20
- package/lib/index.qwik.mjs +30 -21
- package/package.json +1 -1
- package/src/blocks/columns/columns.jsx +3 -2
- package/src/blocks/embed/embed.jsx +1 -1
- package/src/blocks/form/form.jsx +2 -2
- package/src/blocks/select/select.jsx +1 -1
- package/src/blocks/symbol/symbol.jsx +7 -4
- package/src/components/render-block/render-block.jsx +26 -23
- package/src/components/render-block/render-component.jsx +4 -3
- package/src/components/render-blocks.jsx +2 -2
- package/src/components/render-content/render-content.jsx +5 -2
- package/src/functions/evaluate.js +1 -1
- package/src/functions/mark-mutable.js +14 -0
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -32,11 +32,7 @@ Add Qwik SDK code to a particular route (such as `src/routes/index.tsx`)
|
|
|
32
32
|
```typscript
|
|
33
33
|
import { component$, Resource, useResource$ } from "@builder.io/qwik";
|
|
34
34
|
import { useLocation } from "@builder.io/qwik-city";
|
|
35
|
-
import {
|
|
36
|
-
getContent,
|
|
37
|
-
RenderContent,
|
|
38
|
-
getBuilderSearchParams,
|
|
39
|
-
} from "@builder.io/sdk-qwik";
|
|
35
|
+
import { getContent, RenderContent, getBuilderSearchParams } from "@builder.io/sdk-qwik";
|
|
40
36
|
|
|
41
37
|
export const BUILDER_PUBLIC_API_KEY = "YOUR_API_KEY_GOES_HERE"; // ggignore
|
|
42
38
|
export default component$(() => {
|
package/lib/index.qwik.cjs
CHANGED
|
@@ -162,7 +162,7 @@ function evaluate({ code, context, state, event }) {
|
|
|
162
162
|
try {
|
|
163
163
|
return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
|
|
164
164
|
} catch (e) {
|
|
165
|
-
console.warn("Builder custom code error: ", e);
|
|
165
|
+
console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e.message || e);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
const set = (obj, _path, value) => {
|
|
@@ -426,18 +426,27 @@ const EMPTY_HTML_ELEMENTS = [
|
|
|
426
426
|
const isEmptyHtmlElement = (tagName4) => {
|
|
427
427
|
return typeof tagName4 === "string" && EMPTY_HTML_ELEMENTS.includes(tagName4.toLowerCase());
|
|
428
428
|
};
|
|
429
|
+
function markMutable(value) {
|
|
430
|
+
return qwik.mutable(value);
|
|
431
|
+
}
|
|
432
|
+
function markPropsMutable(props) {
|
|
433
|
+
Object.keys(props).forEach((key) => {
|
|
434
|
+
props[key] = qwik.mutable(props[key]);
|
|
435
|
+
});
|
|
436
|
+
return props;
|
|
437
|
+
}
|
|
429
438
|
const RenderComponent = (props) => {
|
|
430
439
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
431
440
|
children: props.componentRef ? /* @__PURE__ */ jsxRuntime.jsxs(props.componentRef, {
|
|
432
|
-
...props.componentOptions,
|
|
441
|
+
...markPropsMutable(props.componentOptions),
|
|
433
442
|
children: [
|
|
434
|
-
(props.blockChildren || []).map((child)
|
|
443
|
+
(props.blockChildren || []).map(function(child) {
|
|
435
444
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock$1, {
|
|
436
445
|
block: child,
|
|
437
446
|
context: props.context
|
|
438
447
|
}, "render-block-" + child.id);
|
|
439
448
|
}),
|
|
440
|
-
(props.blockChildren || []).map((child)
|
|
449
|
+
(props.blockChildren || []).map(function(child) {
|
|
441
450
|
return /* @__PURE__ */ jsxRuntime.jsx(BlockStyles$1, {
|
|
442
451
|
block: child,
|
|
443
452
|
context: props.context
|
|
@@ -583,7 +592,7 @@ const RenderBlock = (props) => {
|
|
|
583
592
|
children: shouldWrap(props) ? !isEmptyHtmlElement(tagName2(props)) ? /* @__PURE__ */ jsxRuntime.jsxs(state.tagName, {
|
|
584
593
|
...attributes(props),
|
|
585
594
|
children: [
|
|
586
|
-
repeatItemData(props) ? (repeatItemData(props) || []).map((data, index)
|
|
595
|
+
repeatItemData(props) ? (repeatItemData(props) || []).map(function(data, index) {
|
|
587
596
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderRepeatedBlock$1, {
|
|
588
597
|
repeatContext: data.context,
|
|
589
598
|
block: data.block
|
|
@@ -592,13 +601,13 @@ const RenderBlock = (props) => {
|
|
|
592
601
|
!repeatItemData(props) ? /* @__PURE__ */ jsxRuntime.jsx(RenderComponent$1, {
|
|
593
602
|
...renderComponentProps(props)
|
|
594
603
|
}) : null,
|
|
595
|
-
(childrenWithoutParentComponent(props) || []).map((child)
|
|
604
|
+
(childrenWithoutParentComponent(props) || []).map(function(child) {
|
|
596
605
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock, {
|
|
597
606
|
block: child,
|
|
598
607
|
context: props.context
|
|
599
608
|
}, "render-block-" + child.id);
|
|
600
609
|
}),
|
|
601
|
-
(childrenWithoutParentComponent(props) || []).map((child)
|
|
610
|
+
(childrenWithoutParentComponent(props) || []).map(function(child) {
|
|
602
611
|
return /* @__PURE__ */ jsxRuntime.jsx(BlockStyles$1, {
|
|
603
612
|
block: child,
|
|
604
613
|
context: props.context
|
|
@@ -665,13 +674,13 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
|
|
|
665
674
|
state
|
|
666
675
|
]),
|
|
667
676
|
children: [
|
|
668
|
-
props.blocks ? (props.blocks || []).map((block)
|
|
677
|
+
props.blocks ? (props.blocks || []).map(function(block) {
|
|
669
678
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderBlock$1, {
|
|
670
679
|
block,
|
|
671
680
|
context: builderContext
|
|
672
681
|
}, "render-block-" + block.id);
|
|
673
682
|
}) : null,
|
|
674
|
-
props.blocks ? (props.blocks || []).map((block)
|
|
683
|
+
props.blocks ? (props.blocks || []).map(function(block) {
|
|
675
684
|
return /* @__PURE__ */ jsxRuntime.jsx(BlockStyles$1, {
|
|
676
685
|
block,
|
|
677
686
|
context: builderContext
|
|
@@ -728,7 +737,7 @@ const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
728
737
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
729
738
|
class: "builder-columns div-Columns",
|
|
730
739
|
style: columnsCssVars(props, state),
|
|
731
|
-
children: (props.columns || []).map((column, index)
|
|
740
|
+
children: (props.columns || []).map(function(column, index) {
|
|
732
741
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
733
742
|
class: "builder-column div-Columns-2",
|
|
734
743
|
style: {
|
|
@@ -737,7 +746,7 @@ const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
737
746
|
...columnCssVars(props, state)
|
|
738
747
|
},
|
|
739
748
|
children: /* @__PURE__ */ jsxRuntime.jsx(RenderBlocks$1, {
|
|
740
|
-
blocks: column.blocks,
|
|
749
|
+
blocks: markMutable(column.blocks),
|
|
741
750
|
path: `component.options.columns.${index}.blocks`,
|
|
742
751
|
parent: props.builderBlock.id
|
|
743
752
|
})
|
|
@@ -1698,9 +1707,9 @@ const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
|
1698
1707
|
const Embed = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
1699
1708
|
const elem = qwik.useRef();
|
|
1700
1709
|
const state = qwik.useStore({
|
|
1710
|
+
ranInitFn: false,
|
|
1701
1711
|
scriptsInserted: [],
|
|
1702
|
-
scriptsRun: []
|
|
1703
|
-
ranInitFn: false
|
|
1712
|
+
scriptsRun: []
|
|
1704
1713
|
});
|
|
1705
1714
|
qwik.useWatchQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
1706
1715
|
const [elem2, props2, state2] = qwik.useLexicalScope();
|
|
@@ -2520,8 +2529,8 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2520
2529
|
const state = qwik.useStore({
|
|
2521
2530
|
forceReRenderCount: 0,
|
|
2522
2531
|
overrideContent: null,
|
|
2523
|
-
|
|
2524
|
-
|
|
2532
|
+
overrideState: {},
|
|
2533
|
+
update: 0
|
|
2525
2534
|
});
|
|
2526
2535
|
qwik.useContextProvider(stdin_default, qwik.useStore({
|
|
2527
2536
|
content: (() => {
|
|
@@ -2641,7 +2650,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2641
2650
|
customFonts: useContent(props, state)?.data?.customFonts
|
|
2642
2651
|
}) : null,
|
|
2643
2652
|
/* @__PURE__ */ jsxRuntime.jsx(RenderBlocks$1, {
|
|
2644
|
-
blocks: useContent(props, state)?.data?.blocks
|
|
2653
|
+
blocks: markMutable(useContent(props, state)?.data?.blocks)
|
|
2645
2654
|
}, state.forceReRenderCount)
|
|
2646
2655
|
]
|
|
2647
2656
|
}) : null
|
|
@@ -2690,14 +2699,14 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
2690
2699
|
children: /* @__PURE__ */ jsxRuntime.jsx(RenderContent$1, {
|
|
2691
2700
|
apiKey: builderContext.apiKey,
|
|
2692
2701
|
context: builderContext.context,
|
|
2693
|
-
customComponents: Object.values(builderContext.registeredComponents),
|
|
2694
|
-
data: {
|
|
2702
|
+
customComponents: markMutable(Object.values(builderContext.registeredComponents)),
|
|
2703
|
+
data: markMutable({
|
|
2695
2704
|
...props.symbol?.data,
|
|
2696
2705
|
...builderContext.state,
|
|
2697
2706
|
...props.symbol?.content?.data?.state
|
|
2698
|
-
},
|
|
2707
|
+
}),
|
|
2699
2708
|
model: props.symbol?.model,
|
|
2700
|
-
content: state.content
|
|
2709
|
+
content: markMutable(state.content)
|
|
2701
2710
|
})
|
|
2702
2711
|
});
|
|
2703
2712
|
}, "Symbol_component_Dn8mGpai87I"));
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
|
|
1
|
+
import { createContext, mutable, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
|
|
2
2
|
import { jsx, Fragment as Fragment$1, jsxs } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const TARGET = "qwik";
|
|
4
4
|
function isBrowser() {
|
|
@@ -160,7 +160,7 @@ function evaluate({ code, context, state, event }) {
|
|
|
160
160
|
try {
|
|
161
161
|
return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
|
|
162
162
|
} catch (e) {
|
|
163
|
-
console.warn("Builder custom code error: ", e);
|
|
163
|
+
console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e.message || e);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
const set = (obj, _path, value) => {
|
|
@@ -424,18 +424,27 @@ const EMPTY_HTML_ELEMENTS = [
|
|
|
424
424
|
const isEmptyHtmlElement = (tagName4) => {
|
|
425
425
|
return typeof tagName4 === "string" && EMPTY_HTML_ELEMENTS.includes(tagName4.toLowerCase());
|
|
426
426
|
};
|
|
427
|
+
function markMutable(value) {
|
|
428
|
+
return mutable(value);
|
|
429
|
+
}
|
|
430
|
+
function markPropsMutable(props) {
|
|
431
|
+
Object.keys(props).forEach((key) => {
|
|
432
|
+
props[key] = mutable(props[key]);
|
|
433
|
+
});
|
|
434
|
+
return props;
|
|
435
|
+
}
|
|
427
436
|
const RenderComponent = (props) => {
|
|
428
437
|
return /* @__PURE__ */ jsx(Fragment$1, {
|
|
429
438
|
children: props.componentRef ? /* @__PURE__ */ jsxs(props.componentRef, {
|
|
430
|
-
...props.componentOptions,
|
|
439
|
+
...markPropsMutable(props.componentOptions),
|
|
431
440
|
children: [
|
|
432
|
-
(props.blockChildren || []).map((child)
|
|
441
|
+
(props.blockChildren || []).map(function(child) {
|
|
433
442
|
return /* @__PURE__ */ jsx(RenderBlock$1, {
|
|
434
443
|
block: child,
|
|
435
444
|
context: props.context
|
|
436
445
|
}, "render-block-" + child.id);
|
|
437
446
|
}),
|
|
438
|
-
(props.blockChildren || []).map((child)
|
|
447
|
+
(props.blockChildren || []).map(function(child) {
|
|
439
448
|
return /* @__PURE__ */ jsx(BlockStyles$1, {
|
|
440
449
|
block: child,
|
|
441
450
|
context: props.context
|
|
@@ -581,7 +590,7 @@ const RenderBlock = (props) => {
|
|
|
581
590
|
children: shouldWrap(props) ? !isEmptyHtmlElement(tagName2(props)) ? /* @__PURE__ */ jsxs(state.tagName, {
|
|
582
591
|
...attributes(props),
|
|
583
592
|
children: [
|
|
584
|
-
repeatItemData(props) ? (repeatItemData(props) || []).map((data, index)
|
|
593
|
+
repeatItemData(props) ? (repeatItemData(props) || []).map(function(data, index) {
|
|
585
594
|
return /* @__PURE__ */ jsx(RenderRepeatedBlock$1, {
|
|
586
595
|
repeatContext: data.context,
|
|
587
596
|
block: data.block
|
|
@@ -590,13 +599,13 @@ const RenderBlock = (props) => {
|
|
|
590
599
|
!repeatItemData(props) ? /* @__PURE__ */ jsx(RenderComponent$1, {
|
|
591
600
|
...renderComponentProps(props)
|
|
592
601
|
}) : null,
|
|
593
|
-
(childrenWithoutParentComponent(props) || []).map((child)
|
|
602
|
+
(childrenWithoutParentComponent(props) || []).map(function(child) {
|
|
594
603
|
return /* @__PURE__ */ jsx(RenderBlock, {
|
|
595
604
|
block: child,
|
|
596
605
|
context: props.context
|
|
597
606
|
}, "render-block-" + child.id);
|
|
598
607
|
}),
|
|
599
|
-
(childrenWithoutParentComponent(props) || []).map((child)
|
|
608
|
+
(childrenWithoutParentComponent(props) || []).map(function(child) {
|
|
600
609
|
return /* @__PURE__ */ jsx(BlockStyles$1, {
|
|
601
610
|
block: child,
|
|
602
611
|
context: props.context
|
|
@@ -663,13 +672,13 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
663
672
|
state
|
|
664
673
|
]),
|
|
665
674
|
children: [
|
|
666
|
-
props.blocks ? (props.blocks || []).map((block)
|
|
675
|
+
props.blocks ? (props.blocks || []).map(function(block) {
|
|
667
676
|
return /* @__PURE__ */ jsx(RenderBlock$1, {
|
|
668
677
|
block,
|
|
669
678
|
context: builderContext
|
|
670
679
|
}, "render-block-" + block.id);
|
|
671
680
|
}) : null,
|
|
672
|
-
props.blocks ? (props.blocks || []).map((block)
|
|
681
|
+
props.blocks ? (props.blocks || []).map(function(block) {
|
|
673
682
|
return /* @__PURE__ */ jsx(BlockStyles$1, {
|
|
674
683
|
block,
|
|
675
684
|
context: builderContext
|
|
@@ -726,7 +735,7 @@ const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
726
735
|
return /* @__PURE__ */ jsx("div", {
|
|
727
736
|
class: "builder-columns div-Columns",
|
|
728
737
|
style: columnsCssVars(props, state),
|
|
729
|
-
children: (props.columns || []).map((column, index)
|
|
738
|
+
children: (props.columns || []).map(function(column, index) {
|
|
730
739
|
return /* @__PURE__ */ jsx("div", {
|
|
731
740
|
class: "builder-column div-Columns-2",
|
|
732
741
|
style: {
|
|
@@ -735,7 +744,7 @@ const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
735
744
|
...columnCssVars(props, state)
|
|
736
745
|
},
|
|
737
746
|
children: /* @__PURE__ */ jsx(RenderBlocks$1, {
|
|
738
|
-
blocks: column.blocks,
|
|
747
|
+
blocks: markMutable(column.blocks),
|
|
739
748
|
path: `component.options.columns.${index}.blocks`,
|
|
740
749
|
parent: props.builderBlock.id
|
|
741
750
|
})
|
|
@@ -1696,9 +1705,9 @@ const findAndRunScripts = function findAndRunScripts2(props, state, elem) {
|
|
|
1696
1705
|
const Embed = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
1697
1706
|
const elem = useRef();
|
|
1698
1707
|
const state = useStore({
|
|
1708
|
+
ranInitFn: false,
|
|
1699
1709
|
scriptsInserted: [],
|
|
1700
|
-
scriptsRun: []
|
|
1701
|
-
ranInitFn: false
|
|
1710
|
+
scriptsRun: []
|
|
1702
1711
|
});
|
|
1703
1712
|
useWatchQrl(inlinedQrl(({ track: track2 }) => {
|
|
1704
1713
|
const [elem2, props2, state2] = useLexicalScope();
|
|
@@ -2518,8 +2527,8 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2518
2527
|
const state = useStore({
|
|
2519
2528
|
forceReRenderCount: 0,
|
|
2520
2529
|
overrideContent: null,
|
|
2521
|
-
|
|
2522
|
-
|
|
2530
|
+
overrideState: {},
|
|
2531
|
+
update: 0
|
|
2523
2532
|
});
|
|
2524
2533
|
useContextProvider(stdin_default, useStore({
|
|
2525
2534
|
content: (() => {
|
|
@@ -2639,7 +2648,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2639
2648
|
customFonts: useContent(props, state)?.data?.customFonts
|
|
2640
2649
|
}) : null,
|
|
2641
2650
|
/* @__PURE__ */ jsx(RenderBlocks$1, {
|
|
2642
|
-
blocks: useContent(props, state)?.data?.blocks
|
|
2651
|
+
blocks: markMutable(useContent(props, state)?.data?.blocks)
|
|
2643
2652
|
}, state.forceReRenderCount)
|
|
2644
2653
|
]
|
|
2645
2654
|
}) : null
|
|
@@ -2688,14 +2697,14 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2688
2697
|
children: /* @__PURE__ */ jsx(RenderContent$1, {
|
|
2689
2698
|
apiKey: builderContext.apiKey,
|
|
2690
2699
|
context: builderContext.context,
|
|
2691
|
-
customComponents: Object.values(builderContext.registeredComponents),
|
|
2692
|
-
data: {
|
|
2700
|
+
customComponents: markMutable(Object.values(builderContext.registeredComponents)),
|
|
2701
|
+
data: markMutable({
|
|
2693
2702
|
...props.symbol?.data,
|
|
2694
2703
|
...builderContext.state,
|
|
2695
2704
|
...props.symbol?.content?.data?.state
|
|
2696
|
-
},
|
|
2705
|
+
}),
|
|
2697
2706
|
model: props.symbol?.model,
|
|
2698
|
-
content: state.content
|
|
2707
|
+
content: markMutable(state.content)
|
|
2699
2708
|
})
|
|
2700
2709
|
});
|
|
2701
2710
|
}, "Symbol_component_Dn8mGpai87I"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// GENERATED BY MITOSIS
|
|
2
2
|
|
|
3
3
|
import RenderBlocks from "../../components/render-blocks";
|
|
4
|
+
import { markMutable } from "../../functions/mark-mutable";
|
|
4
5
|
import { Fragment, component$, h, useStylesScoped$ } from "@builder.io/qwik";
|
|
5
6
|
export const getGutterSize = function getGutterSize(props, state) {
|
|
6
7
|
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
@@ -65,7 +66,7 @@ export const Columns = component$((props) => {
|
|
|
65
66
|
class="builder-columns div-Columns"
|
|
66
67
|
style={columnsCssVars(props, state)}
|
|
67
68
|
>
|
|
68
|
-
{(props.columns || []).map((column, index)
|
|
69
|
+
{(props.columns || []).map(function (column, index) {
|
|
69
70
|
return (
|
|
70
71
|
<div
|
|
71
72
|
class="builder-column div-Columns-2"
|
|
@@ -77,7 +78,7 @@ export const Columns = component$((props) => {
|
|
|
77
78
|
key={index}
|
|
78
79
|
>
|
|
79
80
|
<RenderBlocks
|
|
80
|
-
blocks={column.blocks}
|
|
81
|
+
blocks={markMutable(column.blocks)}
|
|
81
82
|
path={`component.options.columns.${index}.blocks`}
|
|
82
83
|
parent={props.builderBlock.id}
|
|
83
84
|
></RenderBlocks>
|
|
@@ -41,9 +41,9 @@ export const findAndRunScripts = function findAndRunScripts(
|
|
|
41
41
|
export const Embed = component$((props) => {
|
|
42
42
|
const elem = useRef();
|
|
43
43
|
const state = useStore({
|
|
44
|
+
ranInitFn: false,
|
|
44
45
|
scriptsInserted: [],
|
|
45
46
|
scriptsRun: [],
|
|
46
|
-
ranInitFn: false,
|
|
47
47
|
});
|
|
48
48
|
useWatch$(({ track }) => {
|
|
49
49
|
state && track(state, "ranInitFn");
|
package/src/blocks/form/form.jsx
CHANGED
|
@@ -244,9 +244,9 @@ export const FormComponent = component$((props) => {
|
|
|
244
244
|
const builderContext = useContext(BuilderContext);
|
|
245
245
|
const formRef = useRef();
|
|
246
246
|
const state = useStore({
|
|
247
|
+
formErrorMessage: "",
|
|
247
248
|
formState: "unsubmitted",
|
|
248
249
|
responseData: null,
|
|
249
|
-
formErrorMessage: "",
|
|
250
250
|
});
|
|
251
251
|
return (
|
|
252
252
|
<form
|
|
@@ -263,7 +263,7 @@ export const FormComponent = component$((props) => {
|
|
|
263
263
|
{...props.attributes}
|
|
264
264
|
>
|
|
265
265
|
{props.builderBlock && props.builderBlock.children
|
|
266
|
-
? (props.builderBlock?.children || []).map((block)
|
|
266
|
+
? (props.builderBlock?.children || []).map(function (block) {
|
|
267
267
|
return (
|
|
268
268
|
<RenderBlock block={block} context={builderContext}></RenderBlock>
|
|
269
269
|
);
|
|
@@ -13,7 +13,7 @@ export const SelectComponent = component$((props) => {
|
|
|
13
13
|
defaultValue={props.defaultValue}
|
|
14
14
|
name={props.name}
|
|
15
15
|
>
|
|
16
|
-
{(props.options || []).map((option)
|
|
16
|
+
{(props.options || []).map(function (option) {
|
|
17
17
|
return (
|
|
18
18
|
<option value={option.value}>{option.name || option.value}</option>
|
|
19
19
|
);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import RenderContent from "../../components/render-content/render-content";
|
|
4
4
|
import BuilderContext from "../../context/builder.context";
|
|
5
5
|
import { getContent } from "../../functions/get-content/index.js";
|
|
6
|
+
import { markMutable } from "../../functions/mark-mutable";
|
|
6
7
|
import {
|
|
7
8
|
Fragment,
|
|
8
9
|
component$,
|
|
@@ -60,14 +61,16 @@ export const Symbol = component$((props) => {
|
|
|
60
61
|
<RenderContent
|
|
61
62
|
apiKey={builderContext.apiKey}
|
|
62
63
|
context={builderContext.context}
|
|
63
|
-
customComponents={
|
|
64
|
-
|
|
64
|
+
customComponents={markMutable(
|
|
65
|
+
Object.values(builderContext.registeredComponents)
|
|
66
|
+
)}
|
|
67
|
+
data={markMutable({
|
|
65
68
|
...props.symbol?.data,
|
|
66
69
|
...builderContext.state,
|
|
67
70
|
...props.symbol?.content?.data?.state,
|
|
68
|
-
}}
|
|
71
|
+
})}
|
|
69
72
|
model={props.symbol?.model}
|
|
70
|
-
content={state.content}
|
|
73
|
+
content={markMutable(state.content)}
|
|
71
74
|
></RenderContent>
|
|
72
75
|
</div>
|
|
73
76
|
);
|
|
@@ -167,7 +167,10 @@ export const RenderBlock = (props) => {
|
|
|
167
167
|
!isEmptyHtmlElement(tagName(props, state)) ? (
|
|
168
168
|
<state.tagName {...attributes(props, state)}>
|
|
169
169
|
{repeatItemData(props, state)
|
|
170
|
-
? (repeatItemData(props, state) || []).map((
|
|
170
|
+
? (repeatItemData(props, state) || []).map(function (
|
|
171
|
+
data,
|
|
172
|
+
index
|
|
173
|
+
) {
|
|
171
174
|
return (
|
|
172
175
|
<RenderRepeatedBlock
|
|
173
176
|
key={index}
|
|
@@ -182,28 +185,28 @@ export const RenderBlock = (props) => {
|
|
|
182
185
|
{...renderComponentProps(props, state)}
|
|
183
186
|
></RenderComponent>
|
|
184
187
|
) : null}
|
|
185
|
-
{(childrenWithoutParentComponent(props, state) || []).map(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
)}
|
|
196
|
-
{(childrenWithoutParentComponent(props, state) || []).map(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
)}
|
|
188
|
+
{(childrenWithoutParentComponent(props, state) || []).map(function (
|
|
189
|
+
child
|
|
190
|
+
) {
|
|
191
|
+
return (
|
|
192
|
+
<RenderBlock
|
|
193
|
+
key={"render-block-" + child.id}
|
|
194
|
+
block={child}
|
|
195
|
+
context={props.context}
|
|
196
|
+
></RenderBlock>
|
|
197
|
+
);
|
|
198
|
+
})}
|
|
199
|
+
{(childrenWithoutParentComponent(props, state) || []).map(function (
|
|
200
|
+
child
|
|
201
|
+
) {
|
|
202
|
+
return (
|
|
203
|
+
<BlockStyles
|
|
204
|
+
key={"block-style-" + child.id}
|
|
205
|
+
block={child}
|
|
206
|
+
context={props.context}
|
|
207
|
+
></BlockStyles>
|
|
208
|
+
);
|
|
209
|
+
})}
|
|
207
210
|
</state.tagName>
|
|
208
211
|
) : (
|
|
209
212
|
<state.tagName {...attributes(props, state)}></state.tagName>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// GENERATED BY MITOSIS
|
|
2
2
|
|
|
3
|
+
import { markPropsMutable } from "../../functions/mark-mutable.js";
|
|
3
4
|
import BlockStyles from "./block-styles";
|
|
4
5
|
import RenderBlock from "./render-block";
|
|
5
6
|
import { Fragment, h } from "@builder.io/qwik";
|
|
@@ -7,8 +8,8 @@ export const RenderComponent = (props) => {
|
|
|
7
8
|
return (
|
|
8
9
|
<>
|
|
9
10
|
{props.componentRef ? (
|
|
10
|
-
<props.componentRef {...props.componentOptions}>
|
|
11
|
-
{(props.blockChildren || []).map((child)
|
|
11
|
+
<props.componentRef {...markPropsMutable(props.componentOptions)}>
|
|
12
|
+
{(props.blockChildren || []).map(function (child) {
|
|
12
13
|
return (
|
|
13
14
|
<RenderBlock
|
|
14
15
|
key={"render-block-" + child.id}
|
|
@@ -17,7 +18,7 @@ export const RenderComponent = (props) => {
|
|
|
17
18
|
></RenderBlock>
|
|
18
19
|
);
|
|
19
20
|
})}
|
|
20
|
-
{(props.blockChildren || []).map((child)
|
|
21
|
+
{(props.blockChildren || []).map(function (child) {
|
|
21
22
|
return (
|
|
22
23
|
<BlockStyles
|
|
23
24
|
key={"block-style-" + child.id}
|
|
@@ -62,7 +62,7 @@ export const RenderBlocks = component$((props) => {
|
|
|
62
62
|
onMouseEnter$={(event) => onMouseEnter(props, state, builderContext)}
|
|
63
63
|
>
|
|
64
64
|
{props.blocks
|
|
65
|
-
? (props.blocks || []).map((block)
|
|
65
|
+
? (props.blocks || []).map(function (block) {
|
|
66
66
|
return (
|
|
67
67
|
<RenderBlock
|
|
68
68
|
key={"render-block-" + block.id}
|
|
@@ -73,7 +73,7 @@ export const RenderBlocks = component$((props) => {
|
|
|
73
73
|
})
|
|
74
74
|
: null}
|
|
75
75
|
{props.blocks
|
|
76
|
-
? (props.blocks || []).map((block)
|
|
76
|
+
? (props.blocks || []).map(function (block) {
|
|
77
77
|
return (
|
|
78
78
|
<BlockStyles
|
|
79
79
|
key={"block-style-" + block.id}
|
|
@@ -9,6 +9,7 @@ import { getFetch } from "../../functions/get-fetch.js";
|
|
|
9
9
|
import { isBrowser } from "../../functions/is-browser.js";
|
|
10
10
|
import { isEditing } from "../../functions/is-editing.js";
|
|
11
11
|
import { isPreviewing } from "../../functions/is-previewing.js";
|
|
12
|
+
import { markMutable } from "../../functions/mark-mutable.js";
|
|
12
13
|
import {
|
|
13
14
|
components,
|
|
14
15
|
createRegisterComponentMessage,
|
|
@@ -224,8 +225,8 @@ export const RenderContent = component$((props) => {
|
|
|
224
225
|
const state = useStore({
|
|
225
226
|
forceReRenderCount: 0,
|
|
226
227
|
overrideContent: null,
|
|
227
|
-
update: 0,
|
|
228
228
|
overrideState: {},
|
|
229
|
+
update: 0,
|
|
229
230
|
});
|
|
230
231
|
useContextProvider(
|
|
231
232
|
BuilderContext,
|
|
@@ -349,7 +350,9 @@ export const RenderContent = component$((props) => {
|
|
|
349
350
|
></RenderContentStyles>
|
|
350
351
|
) : null}
|
|
351
352
|
<RenderBlocks
|
|
352
|
-
blocks={
|
|
353
|
+
blocks={markMutable(
|
|
354
|
+
useContent(props, state, elementRef)?.data?.blocks
|
|
355
|
+
)}
|
|
353
356
|
key={state.forceReRenderCount}
|
|
354
357
|
></RenderBlocks>
|
|
355
358
|
</div>
|
|
@@ -20,7 +20,7 @@ function evaluate({
|
|
|
20
20
|
try {
|
|
21
21
|
return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
|
|
22
22
|
} catch (e) {
|
|
23
|
-
console.warn("Builder custom code error: ", e);
|
|
23
|
+
console.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e.message || e);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
export {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mutable } from "@builder.io/qwik";
|
|
2
|
+
function markMutable(value) {
|
|
3
|
+
return mutable(value);
|
|
4
|
+
}
|
|
5
|
+
function markPropsMutable(props) {
|
|
6
|
+
Object.keys(props).forEach((key) => {
|
|
7
|
+
props[key] = mutable(props[key]);
|
|
8
|
+
});
|
|
9
|
+
return props;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
markMutable,
|
|
13
|
+
markPropsMutable
|
|
14
|
+
};
|