@builder.io/sdk-vue 0.4.2 → 0.4.4
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/package.json +1 -1
- package/packages/_vue2/dist/{block-styles.cacb4849.cjs → block-styles.0037defd.cjs} +1 -1
- package/packages/_vue2/dist/{block-styles.6a1d7394.js → block-styles.bc8cdc9f.js} +4 -4
- package/packages/_vue2/dist/{css.49cc4003.js → css.5dc54b85.js} +2 -2
- package/packages/{_vue3/dist/css.627e21ae.cjs → _vue2/dist/css.91bb94e8.cjs} +1 -1
- package/packages/_vue2/dist/{evaluate.7d21bb04.cjs → evaluate.10e091b0.cjs} +1 -1
- package/packages/_vue2/dist/{evaluate.6ab6e7cb.js → evaluate.f654f563.js} +1 -1
- package/packages/_vue2/dist/{index.2473a355.js → index.a1dfdaec.js} +103 -103
- package/packages/_vue2/dist/{index.95d9006f.cjs → index.a4e21f82.cjs} +6 -6
- package/packages/_vue2/dist/render-block.55b40822.cjs +3 -0
- package/packages/_vue2/dist/{render-block.22052bd8.js → render-block.df744a97.js} +6 -6
- package/packages/_vue2/dist/{render-component.ec485884.js → render-component.9632b476.js} +3 -3
- package/packages/_vue2/dist/{render-component.f3cccaa9.cjs → render-component.baf2d372.cjs} +1 -1
- package/packages/_vue2/dist/{render-content.a6b17a6c.js → render-content.30c701ec.js} +5 -5
- package/packages/_vue2/dist/{render-content.d53085e5.cjs → render-content.d464cccb.cjs} +1 -1
- package/packages/_vue2/dist/{render-inlined-styles.2286ef7c.js → render-inlined-styles.36b7a3a4.js} +1 -1
- package/packages/_vue2/dist/{render-inlined-styles.b322c74a.cjs → render-inlined-styles.469ed053.cjs} +1 -1
- package/packages/_vue2/dist/{render-repeated-block.ac4f1559.js → render-repeated-block.7f4862b2.js} +2 -2
- package/packages/_vue2/dist/{render-repeated-block.253c96e6.cjs → render-repeated-block.e9bfa3cd.cjs} +1 -1
- package/packages/_vue2/dist/{render-styles.a148b748.js → render-styles.43e1e2a4.js} +2 -2
- package/packages/_vue2/dist/{render-styles.0cb949b0.cjs → render-styles.ad11935f.cjs} +2 -2
- package/packages/_vue2/dist/sdk.cjs +1 -1
- package/packages/_vue2/dist/sdk.js +1 -1
- package/packages/_vue2/dist/src/components/render-block/render-repeated-block.vue.d.ts +0 -9
- package/packages/_vue2/dist/src/constants/sdk-version.d.ts +1 -1
- package/packages/_vue3/dist/sdk.cjs +72 -1
- package/packages/_vue3/dist/sdk.js +3251 -22
- package/packages/_vue3/dist/src/components/render-block/render-repeated-block.vue.d.ts +0 -9
- package/packages/_vue3/dist/src/constants/sdk-version.d.ts +1 -1
- package/packages/_vue3/dist/style.css +1 -1
- package/packages/_vue2/dist/css.c26b7ab4.cjs +0 -6
- package/packages/_vue2/dist/render-block.9342f7b5.cjs +0 -3
- package/packages/_vue3/dist/block-styles.5b949efb.cjs +0 -1
- package/packages/_vue3/dist/block-styles.e91165b8.js +0 -72
- package/packages/_vue3/dist/css.41ed2294.js +0 -75
- package/packages/_vue3/dist/evaluate.0662f166.js +0 -63
- package/packages/_vue3/dist/evaluate.da45a33b.cjs +0 -4
- package/packages/_vue3/dist/index.3a561c6a.js +0 -1394
- package/packages/_vue3/dist/index.3e17c057.cjs +0 -32
- package/packages/_vue3/dist/render-block.20c07cb1.cjs +0 -3
- package/packages/_vue3/dist/render-block.e9a2cb71.js +0 -273
- package/packages/_vue3/dist/render-component.20ef18f7.cjs +0 -1
- package/packages/_vue3/dist/render-component.afa60a7b.js +0 -42
- package/packages/_vue3/dist/render-content.20bd0f8d.js +0 -1354
- package/packages/_vue3/dist/render-content.e790eee5.cjs +0 -1
- package/packages/_vue3/dist/render-inlined-styles.0444f4fe.js +0 -16
- package/packages/_vue3/dist/render-inlined-styles.14d9ba36.cjs +0 -1
- package/packages/_vue3/dist/render-repeated-block.5a245883.js +0 -32
- package/packages/_vue3/dist/render-repeated-block.75230844.cjs +0 -1
- package/packages/_vue3/dist/render-styles.73c7ba5a.js +0 -80
- package/packages/_vue3/dist/render-styles.bd7475f8.cjs +0 -31
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* We can't make this a generic `ProvideContext` function because Vue 2 won't support root slots, e.g.
|
|
3
|
-
*
|
|
4
|
-
* ```vue
|
|
5
|
-
* <template>
|
|
6
|
-
* <slot></slot>
|
|
7
|
-
* </template>
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
1
|
declare const _sfc_main: import("vue").DefineComponent<Readonly<{
|
|
11
2
|
block?: any;
|
|
12
3
|
repeatContext?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.4";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.button-361b1o6wv2k[data-v-
|
|
1
|
+
.button-361b1o6wv2k[data-v-e8a5e9df]{all:unset}.div-4o9pb21oca6[data-v-61bc5f3a]{display:flex;flex-direction:column;align-items:stretch}.div-1eih9th5ow6[data-v-df2fecd0]{display:flex;line-height:normal}.div-1eih9th5ow6-2[data-v-df2fecd0]{display:flex;flex-direction:column;align-items:stretch}.img-256wrwn33ry[data-v-f59f4313]{opacity:1;transition:opacity .2s ease-in-out}.div-256wrwn33ry[data-v-f59f4313]{width:100%;pointer-events:none;font-size:0}.div-256wrwn33ry-2[data-v-f59f4313]{display:flex;flex-direction:column;align-items:stretch;position:absolute;top:0;left:0;width:100%;height:100%}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";const f=require("./evaluate.7d21bb04.cjs"),a=require("./index.95d9006f.cjs"),p=(e,t,n)=>{if(Object(e)!==e)return e;const s=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return s.slice(0,-1).reduce((c,r,o)=>Object(c[r])===c[r]?c[r]:c[r]=Math.abs(Number(s[o+1]))>>0===+s[o+1]?[]:{},e)[s[s.length-1]]=n,e};const g=({block:e,context:t,localState:n,rootState:s,rootSetState:c})=>{if(!e.bindings)return e;const r=a.fastClone(e),o={...r,properties:{...r.properties},actions:{...r.actions}};for(const i in e.bindings){const l=e.bindings[i],d=f.evaluate({code:l,localState:n,rootState:s,rootSetState:c,context:t});p(o,i,d)}return o};function C({block:e,context:t,shouldEvaluateBindings:n,localState:s,rootState:c,rootSetState:r}){const o=e;return n?g({block:o,localState:s,rootState:c,rootSetState:r,context:t}):o}const S=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),u=e=>Object.entries(e).map(([n,s])=>{if(typeof s=="string")return`${S(n)}: ${s};`}).filter(a.checkIsDefined),v=e=>u(e).join(`
|
|
2
|
-
`),y=({mediaQuery:e,className:t,styles:n})=>{const s=`.${t} {
|
|
3
|
-
${v(n)}
|
|
4
|
-
}`;return e?`${e} {
|
|
5
|
-
${s}
|
|
6
|
-
}`:s};exports.convertStyleMapToCSSArray=u;exports.createCssClass=y;exports.getProcessedBlock=C;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),u=require("./evaluate.7d21bb04.cjs"),d=require("./index.95d9006f.cjs"),s=require("./css.c26b7ab4.cjs"),m=e=>`v-on:${e.toLowerCase()}`,h=(e,t)=>o=>u.evaluate({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:o,isExpression:!1});function k(e){var r;const t={},o=(r=e.block.actions)!=null?r:{};for(const n in o){if(!o.hasOwnProperty(n))continue;const c=o[n];t[m(n)]=h(c,e)}return t}function f(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}function S(e){const t={};if(typeof e!="string")return t;const o=e.trim().split(/\\s+/);for(const r of o)t[r]=!0;return t}function b(e){return e.class=S(e.class),e}const v=e=>({href:e.href});function y(e){var o;const t={...v(e),...e.properties,"builder-id":e.id,style:g(e.style),class:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return b(t)}function g(e){if(!!e)switch(d.TARGET){case"svelte":case"vue2":case"vue3":case"solid":return s.convertStyleMapToCSSArray(e).join(" ");case"qwik":case"reactNative":case"react":return e}}const x=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],B=e=>typeof e=="string"&&x.includes(e.toLowerCase()),_=({block:e,context:t})=>{var n;const o=(n=s.getProcessedBlock({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:n.name;if(!o)return null;const r=t.registeredComponents[o];if(r)return r;console.warn(`
|
|
2
|
-
Could not find a registered component named "${o}".
|
|
3
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`)},C=({block:e,context:t})=>{const{repeat:o,...r}=e;if(!(o!=null&&o.collection))return;const n=u.evaluate({code:o.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(n))return;const c=o.collection.split(".").pop(),a=o.itemName||(c?c+"Item":"item");return n.map((i,l)=>({context:{...t,localState:{...t.localState,$index:l,$item:i,[a]:i,[`$${a}Index`]:l}},block:r}))},w=()=>Promise.resolve().then(()=>require("./block-styles.cacb4849.cjs")).then(e=>e.default).catch(e=>{throw console.error("Error while attempting to dynamically import component BlockStyles at ./block-styles.vue",e),e}),P=()=>Promise.resolve().then(()=>require("./render-repeated-block.253c96e6.cjs")).then(e=>e.default).catch(e=>{throw console.error("Error while attempting to dynamically import component RenderRepeatedBlock at ./render-repeated-block.vue",e),e}),E=()=>Promise.resolve().then(()=>require("./render-component.f3cccaa9.cjs")).then(e=>e.default).catch(e=>{throw console.error("Error while attempting to dynamically import component RenderComponent at ./render-component.vue",e),e}),R=p.defineComponent({name:"render-block",components:{RenderComponent:E,RenderRepeatedBlock:P,BlockStyles:w},props:["block","context"],data(){return{component:_({block:this.block,context:this.context}),Tag:this.block.tagName||"div",childrenContext:this.context,isEmptyHtmlElement:B}},computed:{repeatItem(){return C({block:this.block,context:this.context})},useBlock(){return this.repeatItem?this.block:s.getProcessedBlock({block:this.block,localState:this.context.localState,rootState:this.context.rootState,rootSetState:this.context.rootSetState,context:this.context.context,shouldEvaluateBindings:!0})},canShowBlock(){return"hide"in this.useBlock?!this.useBlock.hide:"show"in this.useBlock?this.useBlock.show:!0},actions(){return k({block:this.useBlock,rootState:this.context.rootState,rootSetState:this.context.rootSetState,localState:this.context.localState,context:this.context.context})},attributes(){return{...y(this.useBlock)}},childrenWithoutParentComponent(){var t,o;return!((t=this.component)!=null&&t.component)&&!this.repeatItem?(o=this.useBlock.children)!=null?o:[]:[]},renderComponentProps(){var e,t,o;return{blockChildren:(e=this.useBlock.children)!=null?e:[],componentRef:(t=this.component)==null?void 0:t.component,componentOptions:{...f(this.useBlock),...(o=this.component)!=null&&o.noWrap?{attributes:{...this.attributes,...this.actions}}:{}},context:this.childrenContext}}},methods:{stripVOn:function(t={}){return Object.keys(t).reduce((o,r)=>({...o,[r.replace("v-on:","")]:t[r]}),{})}}});var T=function(){var r;var t=this,o=t._self._c;return t._self._setupProxy,!Boolean(!((r=t.component)!=null&&r.noWrap))&&t.canShowBlock?o("render-component",t._b({},"render-component",t.renderComponentProps,!1)):t.isEmptyHtmlElement(t.Tag)&&t.canShowBlock?o(t.Tag,t._g(t._b({tag:"component"},"component",t.attributes,!1),t.stripVOn(t.actions))):!t.isEmptyHtmlElement(t.Tag)&&t.repeatItem&&t.canShowBlock?o("div",{staticClass:"vue2-root-element-workaround"},t._l(t.repeatItem,function(n,c){return o("render-repeated-block",{key:c,attrs:{repeatContext:n.context,block:n.block}})}),1):t.canShowBlock?o(t.Tag,t._g(t._b({tag:"component"},"component",t.attributes,!1),t.stripVOn(t.actions)),[o("render-component",t._b({},"render-component",t.renderComponentProps,!1)),t._l(t.childrenWithoutParentComponent,function(n,c){return o("render-block",{key:"render-block-"+n.id,attrs:{block:n,context:t.childrenContext}})}),t._l(t.childrenWithoutParentComponent,function(n,c){return o("block-styles",{key:"block-style-"+n.id,attrs:{block:n,context:t.childrenContext}})})],2):t._e()},j=[],O=d.normalizeComponent(R,T,j,!1,null,null,null,null);const A=O.exports;exports.default=A;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),t=require("./index.3e17c057.cjs"),r=require("./css.627e21ae.cjs");require("./evaluate.da45a33b.cjs");const y=()=>Promise.resolve().then(()=>require("./render-inlined-styles.14d9ba36.cjs")).then(e=>e.default).catch(e=>{throw console.error("Error while attempting to dynamically import component RenderInlinedStyles at ../render-inlined-styles.vue",e),e}),S=o.defineComponent({name:"block-styles",components:{RenderInlinedStyles:o.defineAsyncComponent(y)},props:["block","context"],data(){return{TARGET:t.TARGET}},computed:{useBlock(){return r.getProcessedBlock({block:this.block,localState:this.context.localState,rootState:this.context.rootState,rootSetState:this.context.rootSetState,context:this.context.context,shouldEvaluateBindings:!0})},canShowBlock(){return t.checkIsDefined(this.useBlock.hide)?!this.useBlock.hide:t.checkIsDefined(this.useBlock.show)?this.useBlock.show:!0},css(){var d;const e=this.useBlock.responsiveStyles,n=this.context.content,c=t.getSizesForBreakpoints(((d=n==null?void 0:n.meta)==null?void 0:d.breakpoints)||{}),l=e==null?void 0:e.large,i=e==null?void 0:e.medium,a=e==null?void 0:e.small,s=this.useBlock.id;if(!s)return"";const u=l?r.createCssClass({className:s,styles:l}):"",m=i?r.createCssClass({className:s,styles:i,mediaQuery:t.getMaxWidthQueryForSize("medium",c)}):"",h=a?r.createCssClass({className:s,styles:a,mediaQuery:t.getMaxWidthQueryForSize("small",c)}):"";return[u,m,h].join(" ")}}});function k(e,n,c,l,i,a){const s=o.resolveComponent("render-inlined-styles");return e.TARGET!=="reactNative"&&e.css&&e.canShowBlock?(o.openBlock(),o.createBlock(s,{key:0,styles:e.css},null,8,["styles"])):o.createCommentVNode("",!0)}const p=t._export_sfc(S,[["render",k]]);exports.default=p;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { defineComponent as h, defineAsyncComponent as S, resolveComponent as k, openBlock as y, createBlock as f, createCommentVNode as B } from "vue";
|
|
2
|
-
import { T as g, c as i, g as C, a as d, _ } from "./index.3a561c6a.js";
|
|
3
|
-
import { g as x, c } from "./css.41ed2294.js";
|
|
4
|
-
import "./evaluate.0662f166.js";
|
|
5
|
-
const b = () => import("./render-inlined-styles.0444f4fe.js").then((e) => e.default).catch((e) => {
|
|
6
|
-
throw console.error(
|
|
7
|
-
"Error while attempting to dynamically import component RenderInlinedStyles at ../render-inlined-styles.vue",
|
|
8
|
-
e
|
|
9
|
-
), e;
|
|
10
|
-
}), w = h({
|
|
11
|
-
name: "block-styles",
|
|
12
|
-
components: {
|
|
13
|
-
RenderInlinedStyles: S(b)
|
|
14
|
-
},
|
|
15
|
-
props: ["block", "context"],
|
|
16
|
-
data() {
|
|
17
|
-
return { TARGET: g };
|
|
18
|
-
},
|
|
19
|
-
computed: {
|
|
20
|
-
useBlock() {
|
|
21
|
-
return x({
|
|
22
|
-
block: this.block,
|
|
23
|
-
localState: this.context.localState,
|
|
24
|
-
rootState: this.context.rootState,
|
|
25
|
-
rootSetState: this.context.rootSetState,
|
|
26
|
-
context: this.context.context,
|
|
27
|
-
shouldEvaluateBindings: !0
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
canShowBlock() {
|
|
31
|
-
return i(this.useBlock.hide) ? !this.useBlock.hide : i(this.useBlock.show) ? this.useBlock.show : !0;
|
|
32
|
-
},
|
|
33
|
-
css() {
|
|
34
|
-
var a;
|
|
35
|
-
const e = this.useBlock.responsiveStyles, s = this.context.content, o = C(
|
|
36
|
-
((a = s == null ? void 0 : s.meta) == null ? void 0 : a.breakpoints) || {}
|
|
37
|
-
), n = e == null ? void 0 : e.large, r = e == null ? void 0 : e.medium, l = e == null ? void 0 : e.small, t = this.useBlock.id;
|
|
38
|
-
if (!t)
|
|
39
|
-
return "";
|
|
40
|
-
const m = n ? c({
|
|
41
|
-
className: t,
|
|
42
|
-
styles: n
|
|
43
|
-
}) : "", u = r ? c({
|
|
44
|
-
className: t,
|
|
45
|
-
styles: r,
|
|
46
|
-
mediaQuery: d(
|
|
47
|
-
"medium",
|
|
48
|
-
o
|
|
49
|
-
)
|
|
50
|
-
}) : "", p = l ? c({
|
|
51
|
-
className: t,
|
|
52
|
-
styles: l,
|
|
53
|
-
mediaQuery: d(
|
|
54
|
-
"small",
|
|
55
|
-
o
|
|
56
|
-
)
|
|
57
|
-
}) : "";
|
|
58
|
-
return [m, u, p].join(" ");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
function v(e, s, o, n, r, l) {
|
|
63
|
-
const t = k("render-inlined-styles");
|
|
64
|
-
return e.TARGET !== "reactNative" && e.css && e.canShowBlock ? (y(), f(t, {
|
|
65
|
-
key: 0,
|
|
66
|
-
styles: e.css
|
|
67
|
-
}, null, 8, ["styles"])) : B("", !0);
|
|
68
|
-
}
|
|
69
|
-
const $ = /* @__PURE__ */ _(w, [["render", v]]);
|
|
70
|
-
export {
|
|
71
|
-
$ as default
|
|
72
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { e as u } from "./evaluate.0662f166.js";
|
|
2
|
-
import { f as p, c as l } from "./index.3a561c6a.js";
|
|
3
|
-
const g = (e, t, n) => {
|
|
4
|
-
if (Object(e) !== e)
|
|
5
|
-
return e;
|
|
6
|
-
const s = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
7
|
-
return s.slice(0, -1).reduce(
|
|
8
|
-
(o, r, c) => Object(o[r]) === o[r] ? o[r] : o[r] = Math.abs(Number(s[c + 1])) >> 0 === +s[c + 1] ? [] : {},
|
|
9
|
-
e
|
|
10
|
-
)[s[s.length - 1]] = n, e;
|
|
11
|
-
};
|
|
12
|
-
const d = ({
|
|
13
|
-
block: e,
|
|
14
|
-
context: t,
|
|
15
|
-
localState: n,
|
|
16
|
-
rootState: s,
|
|
17
|
-
rootSetState: o
|
|
18
|
-
}) => {
|
|
19
|
-
if (!e.bindings)
|
|
20
|
-
return e;
|
|
21
|
-
const r = p(e), c = {
|
|
22
|
-
...r,
|
|
23
|
-
properties: { ...r.properties },
|
|
24
|
-
actions: { ...r.actions }
|
|
25
|
-
};
|
|
26
|
-
for (const i in e.bindings) {
|
|
27
|
-
const a = e.bindings[i], f = u({
|
|
28
|
-
code: a,
|
|
29
|
-
localState: n,
|
|
30
|
-
rootState: s,
|
|
31
|
-
rootSetState: o,
|
|
32
|
-
context: t
|
|
33
|
-
});
|
|
34
|
-
g(c, i, f);
|
|
35
|
-
}
|
|
36
|
-
return c;
|
|
37
|
-
};
|
|
38
|
-
function v({
|
|
39
|
-
block: e,
|
|
40
|
-
context: t,
|
|
41
|
-
shouldEvaluateBindings: n,
|
|
42
|
-
localState: s,
|
|
43
|
-
rootState: o,
|
|
44
|
-
rootSetState: r
|
|
45
|
-
}) {
|
|
46
|
-
const c = e;
|
|
47
|
-
return n ? d({
|
|
48
|
-
block: c,
|
|
49
|
-
localState: s,
|
|
50
|
-
rootState: o,
|
|
51
|
-
rootSetState: r,
|
|
52
|
-
context: t
|
|
53
|
-
}) : c;
|
|
54
|
-
}
|
|
55
|
-
const m = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), C = (e) => Object.entries(e).map(([n, s]) => {
|
|
56
|
-
if (typeof s == "string")
|
|
57
|
-
return `${m(n)}: ${s};`;
|
|
58
|
-
}).filter(l), $ = (e) => C(e).join(`
|
|
59
|
-
`), A = ({
|
|
60
|
-
mediaQuery: e,
|
|
61
|
-
className: t,
|
|
62
|
-
styles: n
|
|
63
|
-
}) => {
|
|
64
|
-
const s = `.${t} {
|
|
65
|
-
${$(n)}
|
|
66
|
-
}`;
|
|
67
|
-
return e ? `${e} {
|
|
68
|
-
${s}
|
|
69
|
-
}` : s;
|
|
70
|
-
};
|
|
71
|
-
export {
|
|
72
|
-
C as a,
|
|
73
|
-
A as c,
|
|
74
|
-
v as g
|
|
75
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { i as d, b as w } from "./index.3a561c6a.js";
|
|
2
|
-
function h({
|
|
3
|
-
code: n,
|
|
4
|
-
context: r,
|
|
5
|
-
localState: e,
|
|
6
|
-
rootState: s,
|
|
7
|
-
rootSetState: i,
|
|
8
|
-
event: u,
|
|
9
|
-
isExpression: c = !0
|
|
10
|
-
}) {
|
|
11
|
-
if (n === "") {
|
|
12
|
-
console.warn("Skipping evaluation of empty code block.");
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const t = {
|
|
16
|
-
isEditing: d(),
|
|
17
|
-
isBrowser: w(),
|
|
18
|
-
isServer: !w()
|
|
19
|
-
}, l = c && !(n.includes(";") || n.includes(" return ") || n.trim().startsWith("return ")) ? `return (${n});` : n;
|
|
20
|
-
try {
|
|
21
|
-
return new Function(
|
|
22
|
-
"builder",
|
|
23
|
-
"Builder",
|
|
24
|
-
"state",
|
|
25
|
-
"context",
|
|
26
|
-
"event",
|
|
27
|
-
l
|
|
28
|
-
)(
|
|
29
|
-
t,
|
|
30
|
-
t,
|
|
31
|
-
o(s, e, i),
|
|
32
|
-
r,
|
|
33
|
-
u
|
|
34
|
-
);
|
|
35
|
-
} catch (f) {
|
|
36
|
-
console.warn(
|
|
37
|
-
`Builder custom code error:
|
|
38
|
-
While Evaluating:
|
|
39
|
-
`,
|
|
40
|
-
l,
|
|
41
|
-
`
|
|
42
|
-
`,
|
|
43
|
-
f
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function o(n, r, e) {
|
|
48
|
-
if (n === r)
|
|
49
|
-
throw new Error("rootState === localState");
|
|
50
|
-
return new Proxy(n, {
|
|
51
|
-
get: (s, i) => r && i in r ? r[i] : n[i],
|
|
52
|
-
set: (s, i, u) => {
|
|
53
|
-
if (r && i in r)
|
|
54
|
-
throw new Error(
|
|
55
|
-
"Writing to local state is not allowed as it is read-only."
|
|
56
|
-
);
|
|
57
|
-
return n[i] = u, e == null || e(n), !0;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
h as e
|
|
63
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./index.3e17c057.cjs");function f({code:n,context:r,localState:i,rootState:s,rootSetState:e,event:u,isExpression:w=!0}){if(n===""){console.warn("Skipping evaluation of empty code block.");return}const c={isEditing:t.isEditing(),isBrowser:t.isBrowser(),isServer:!t.isBrowser()},l=w&&!(n.includes(";")||n.includes(" return ")||n.trim().startsWith("return "))?`return (${n});`:n;try{return new Function("builder","Builder","state","context","event",l)(c,c,o(s,i,e),r,u)}catch(d){console.warn(`Builder custom code error:
|
|
2
|
-
While Evaluating:
|
|
3
|
-
`,l,`
|
|
4
|
-
`,d)}}function o(n,r,i){if(n===r)throw new Error("rootState === localState");return new Proxy(n,{get:(s,e)=>r&&e in r?r[e]:n[e],set:(s,e,u)=>{if(r&&e in r)throw new Error("Writing to local state is not allowed as it is read-only.");return n[e]=u,i==null||i(n),!0}})}exports.evaluate=f;
|