@builder.io/sdk-qwik 0.16.13 → 0.16.15
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/lib/browser/components/awaiter.qwik.cjs +13 -0
- package/lib/browser/components/awaiter.qwik.mjs +13 -0
- package/lib/browser/components/block/components/interactive-element.qwik.cjs +13 -4
- package/lib/browser/components/block/components/interactive-element.qwik.mjs +14 -5
- package/lib/browser/components/content/components/enable-editor.qwik.cjs +2 -40
- package/lib/browser/components/content/components/enable-editor.qwik.mjs +1 -39
- package/lib/browser/components/content/content.qwik.cjs +26 -0
- package/lib/browser/components/content/content.qwik.mjs +27 -1
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/browser/functions/evaluate/browser-runtime/browser.qwik.cjs +1 -31
- package/lib/browser/functions/evaluate/browser-runtime/browser.qwik.mjs +1 -31
- package/lib/browser/functions/evaluate/helpers.qwik.cjs +30 -0
- package/lib/browser/functions/evaluate/helpers.qwik.mjs +30 -0
- package/lib/edge/components/awaiter.qwik.cjs +13 -0
- package/lib/edge/components/awaiter.qwik.mjs +13 -0
- package/lib/edge/components/block/components/interactive-element.qwik.cjs +13 -4
- package/lib/edge/components/block/components/interactive-element.qwik.mjs +14 -5
- package/lib/edge/components/content/components/enable-editor.qwik.cjs +2 -40
- package/lib/edge/components/content/components/enable-editor.qwik.mjs +1 -39
- package/lib/edge/components/content/content.qwik.cjs +26 -0
- package/lib/edge/components/content/content.qwik.mjs +27 -1
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/functions/evaluate/browser-runtime/browser.qwik.cjs +1 -31
- package/lib/edge/functions/evaluate/browser-runtime/browser.qwik.mjs +1 -31
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.qwik.cjs +63 -27
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.qwik.mjs +64 -28
- package/lib/edge/functions/evaluate/helpers.qwik.cjs +30 -0
- package/lib/edge/functions/evaluate/helpers.qwik.mjs +30 -0
- package/lib/node/components/awaiter.qwik.cjs +13 -0
- package/lib/node/components/awaiter.qwik.mjs +13 -0
- package/lib/node/components/block/components/interactive-element.qwik.cjs +13 -4
- package/lib/node/components/block/components/interactive-element.qwik.mjs +14 -5
- package/lib/node/components/content/components/enable-editor.qwik.cjs +2 -40
- package/lib/node/components/content/components/enable-editor.qwik.mjs +1 -39
- package/lib/node/components/content/content.qwik.cjs +26 -0
- package/lib/node/components/content/content.qwik.mjs +27 -1
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/functions/evaluate/browser-runtime/browser.qwik.cjs +1 -31
- package/lib/node/functions/evaluate/browser-runtime/browser.qwik.mjs +1 -31
- package/lib/node/functions/evaluate/helpers.qwik.cjs +30 -0
- package/lib/node/functions/evaluate/helpers.qwik.mjs +30 -0
- package/lib/node/functions/evaluate/node-runtime/node-runtime.qwik.cjs +1 -1
- package/lib/node/functions/evaluate/node-runtime/node-runtime.qwik.mjs +1 -1
- package/package.json +1 -1
- package/types/src/components/awaiter.d.ts +13 -0
- package/types/src/components/content/components/enable-editor.d.ts +0 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/context/component-reference-types.d.ts +4 -0
- package/types/src/context/types.d.ts +2 -1
- package/types/src/functions/evaluate/browser-runtime/browser.d.ts +0 -6
- package/types/src/functions/evaluate/helpers.d.ts +5 -0
- package/types/src/types/input.d.ts +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const Awaiter = qwik.component$((props) => {
|
|
6
|
+
qwik.useVisibleTask$(() => {
|
|
7
|
+
});
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(qwik.Fragment, {
|
|
9
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
exports.Awaiter = Awaiter;
|
|
13
|
+
exports.default = Awaiter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$, useVisibleTask$, Fragment, Slot } from "@builder.io/qwik";
|
|
3
|
+
const Awaiter = component$((props) => {
|
|
4
|
+
useVisibleTask$(() => {
|
|
5
|
+
});
|
|
6
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
7
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
Awaiter,
|
|
12
|
+
Awaiter as default
|
|
13
|
+
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
4
|
const getBlockActions = require("../../../functions/get-block-actions.qwik.cjs");
|
|
5
5
|
const getBlockProperties = require("../../../functions/get-block-properties.qwik.cjs");
|
|
6
|
+
const awaiter = require("../../awaiter.qwik.cjs");
|
|
6
7
|
const qwik = require("@builder.io/qwik");
|
|
7
8
|
const InteractiveElement = qwik.component$((props) => {
|
|
8
9
|
const attributes = qwik.useComputed$(() => {
|
|
@@ -20,10 +21,18 @@ const InteractiveElement = qwik.component$((props) => {
|
|
|
20
21
|
})
|
|
21
22
|
} : {};
|
|
22
23
|
});
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
25
|
+
children: props.Wrapper.load ? /* @__PURE__ */ jsxRuntime.jsx(awaiter.Awaiter, {
|
|
26
|
+
load: props.Wrapper.load,
|
|
27
|
+
fallback: props.Wrapper.fallback,
|
|
28
|
+
props: props.wrapperProps,
|
|
29
|
+
attributes: attributes.value,
|
|
30
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
31
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(props.Wrapper, {
|
|
32
|
+
...props.wrapperProps,
|
|
33
|
+
attributes: attributes.value,
|
|
34
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
35
|
+
})
|
|
27
36
|
});
|
|
28
37
|
});
|
|
29
38
|
exports.InteractiveElement = InteractiveElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
1
|
+
import { jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { getBlockActions } from "../../../functions/get-block-actions.qwik.mjs";
|
|
3
3
|
import { getBlockProperties } from "../../../functions/get-block-properties.qwik.mjs";
|
|
4
|
+
import { Awaiter } from "../../awaiter.qwik.mjs";
|
|
4
5
|
import { component$, useComputed$, Slot } from "@builder.io/qwik";
|
|
5
6
|
const InteractiveElement = component$((props) => {
|
|
6
7
|
const attributes = useComputed$(() => {
|
|
@@ -18,10 +19,18 @@ const InteractiveElement = component$((props) => {
|
|
|
18
19
|
})
|
|
19
20
|
} : {};
|
|
20
21
|
});
|
|
21
|
-
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
23
|
+
children: props.Wrapper.load ? /* @__PURE__ */ jsx(Awaiter, {
|
|
24
|
+
load: props.Wrapper.load,
|
|
25
|
+
fallback: props.Wrapper.fallback,
|
|
26
|
+
props: props.wrapperProps,
|
|
27
|
+
attributes: attributes.value,
|
|
28
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
29
|
+
}) : /* @__PURE__ */ jsx(props.Wrapper, {
|
|
30
|
+
...props.wrapperProps,
|
|
31
|
+
attributes: attributes.value,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
33
|
+
})
|
|
25
34
|
});
|
|
26
35
|
});
|
|
27
36
|
export {
|
|
@@ -5,7 +5,6 @@ const builder_context = require("../../../context/builder.context.qwik.cjs");
|
|
|
5
5
|
const evaluate = require("../../../functions/evaluate/evaluate.qwik.cjs");
|
|
6
6
|
const fastClone = require("../../../functions/fast-clone.qwik.cjs");
|
|
7
7
|
const index = require("../../../functions/get-content/index.qwik.cjs");
|
|
8
|
-
const getFetch = require("../../../functions/get-fetch.qwik.cjs");
|
|
9
8
|
const isBrowser = require("../../../functions/is-browser.qwik.cjs");
|
|
10
9
|
const isEditing = require("../../../functions/is-editing.qwik.cjs");
|
|
11
10
|
const isPreviewing = require("../../../functions/is-previewing.qwik.cjs");
|
|
@@ -13,7 +12,6 @@ const registerComponent = require("../../../functions/register-component.qwik.cj
|
|
|
13
12
|
const index$1 = require("../../../functions/track/index.qwik.cjs");
|
|
14
13
|
const interaction = require("../../../functions/track/interaction.qwik.cjs");
|
|
15
14
|
const canTrack = require("../../../helpers/canTrack.qwik.cjs");
|
|
16
|
-
const logger = require("../../../helpers/logger.qwik.cjs");
|
|
17
15
|
const subscribeToEditor = require("../../../helpers/subscribe-to-editor.qwik.cjs");
|
|
18
16
|
const initEditing = require("../../../scripts/init-editing.qwik.cjs");
|
|
19
17
|
const animator = require("../../block/animator.qwik.cjs");
|
|
@@ -76,23 +74,6 @@ const processMessage = function processMessage2(props, state, showContentProps,
|
|
|
76
74
|
}
|
|
77
75
|
})(event);
|
|
78
76
|
};
|
|
79
|
-
const evaluateJsCode = function evaluateJsCode2(props, state, showContentProps, elementRef) {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
const jsCode = (_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
|
|
82
|
-
if (jsCode) {
|
|
83
|
-
evaluate.evaluate({
|
|
84
|
-
code: jsCode,
|
|
85
|
-
context: props.context || {},
|
|
86
|
-
localState: void 0,
|
|
87
|
-
rootState: props.builderContextSignal.rootState,
|
|
88
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
89
|
-
/**
|
|
90
|
-
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
91
|
-
*/
|
|
92
|
-
enableCache: false
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
77
|
const onClick = function onClick2(props, state, showContentProps, elementRef, event) {
|
|
97
78
|
var _a, _b;
|
|
98
79
|
if (props.builderContextSignal.content) {
|
|
@@ -131,7 +112,7 @@ const runHttpRequests = function runHttpRequests2(props, state, showContentProps
|
|
|
131
112
|
rootSetState: props.builderContextSignal.rootSetState,
|
|
132
113
|
enableCache: true
|
|
133
114
|
})));
|
|
134
|
-
|
|
115
|
+
fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
135
116
|
mergeNewRootState(props, state, showContentProps, elementRef, {
|
|
136
117
|
[key]: json
|
|
137
118
|
});
|
|
@@ -240,10 +221,6 @@ const EnableEditor = qwik.component$((props) => {
|
|
|
240
221
|
}));
|
|
241
222
|
qwik.useContextProvider(builder_context, props.builderContextSignal);
|
|
242
223
|
qwik.useTask$(() => {
|
|
243
|
-
if (!props.apiKey) {
|
|
244
|
-
logger.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
245
|
-
}
|
|
246
|
-
evaluateJsCode(props);
|
|
247
224
|
runHttpRequests(props, state, showContentProps, elementRef);
|
|
248
225
|
emitStateUpdate(props);
|
|
249
226
|
});
|
|
@@ -253,20 +230,6 @@ const EnableEditor = qwik.component$((props) => {
|
|
|
253
230
|
mergeNewContent(props, state, showContentProps, elementRef, props.content);
|
|
254
231
|
}
|
|
255
232
|
});
|
|
256
|
-
qwik.useTask$(({ track }) => {
|
|
257
|
-
track(() => {
|
|
258
|
-
var _a2, _b2;
|
|
259
|
-
return (_b2 = (_a2 = props.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
260
|
-
});
|
|
261
|
-
evaluateJsCode(props);
|
|
262
|
-
});
|
|
263
|
-
qwik.useTask$(({ track }) => {
|
|
264
|
-
track(() => {
|
|
265
|
-
var _a2, _b2;
|
|
266
|
-
return (_b2 = (_a2 = props.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
|
|
267
|
-
});
|
|
268
|
-
runHttpRequests(props, state, showContentProps, elementRef);
|
|
269
|
-
});
|
|
270
233
|
qwik.useTask$(({ track }) => {
|
|
271
234
|
track(() => props.builderContextSignal.rootState);
|
|
272
235
|
emitStateUpdate(props);
|
|
@@ -295,9 +258,9 @@ const EnableEditor = qwik.component$((props) => {
|
|
|
295
258
|
onClick$: qwik.$((event) => onClick(props, state, showContentProps, elementRef, event)),
|
|
296
259
|
"builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
|
|
297
260
|
"builder-model": props.model,
|
|
261
|
+
className: styles_helpers.getWrapperClassName(((_d = props.content) == null ? void 0 : _d.testVariationId) || ((_e = props.content) == null ? void 0 : _e.id)),
|
|
298
262
|
...showContentProps.value,
|
|
299
263
|
...props.contentWrapperProps,
|
|
300
|
-
class: styles_helpers.getWrapperClassName(((_d = props.content) == null ? void 0 : _d.testVariationId) || ((_e = props.content) == null ? void 0 : _e.id)),
|
|
301
264
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
302
265
|
}) : null
|
|
303
266
|
});
|
|
@@ -305,7 +268,6 @@ const EnableEditor = qwik.component$((props) => {
|
|
|
305
268
|
exports.EnableEditor = EnableEditor;
|
|
306
269
|
exports.default = EnableEditor;
|
|
307
270
|
exports.emitStateUpdate = emitStateUpdate;
|
|
308
|
-
exports.evaluateJsCode = evaluateJsCode;
|
|
309
271
|
exports.mergeNewContent = mergeNewContent;
|
|
310
272
|
exports.mergeNewRootState = mergeNewRootState;
|
|
311
273
|
exports.onClick = onClick;
|
|
@@ -3,7 +3,6 @@ import builderContext from "../../../context/builder.context.qwik.mjs";
|
|
|
3
3
|
import { evaluate } from "../../../functions/evaluate/evaluate.qwik.mjs";
|
|
4
4
|
import { fastClone } from "../../../functions/fast-clone.qwik.mjs";
|
|
5
5
|
import { fetchOneEntry } from "../../../functions/get-content/index.qwik.mjs";
|
|
6
|
-
import { fetch } from "../../../functions/get-fetch.qwik.mjs";
|
|
7
6
|
import { isBrowser } from "../../../functions/is-browser.qwik.mjs";
|
|
8
7
|
import { isEditing } from "../../../functions/is-editing.qwik.mjs";
|
|
9
8
|
import { isPreviewing } from "../../../functions/is-previewing.qwik.mjs";
|
|
@@ -11,7 +10,6 @@ import { createRegisterComponentMessage } from "../../../functions/register-comp
|
|
|
11
10
|
import { _track } from "../../../functions/track/index.qwik.mjs";
|
|
12
11
|
import { getInteractionPropertiesForEvent } from "../../../functions/track/interaction.qwik.mjs";
|
|
13
12
|
import { getDefaultCanTrack } from "../../../helpers/canTrack.qwik.mjs";
|
|
14
|
-
import { logger } from "../../../helpers/logger.qwik.mjs";
|
|
15
13
|
import { createEditorListener } from "../../../helpers/subscribe-to-editor.qwik.mjs";
|
|
16
14
|
import { registerInsertMenu, setupBrowserForEditing } from "../../../scripts/init-editing.qwik.mjs";
|
|
17
15
|
import { triggerAnimation } from "../../block/animator.qwik.mjs";
|
|
@@ -74,23 +72,6 @@ const processMessage = function processMessage2(props, state, showContentProps,
|
|
|
74
72
|
}
|
|
75
73
|
})(event);
|
|
76
74
|
};
|
|
77
|
-
const evaluateJsCode = function evaluateJsCode2(props, state, showContentProps, elementRef) {
|
|
78
|
-
var _a, _b;
|
|
79
|
-
const jsCode = (_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
|
|
80
|
-
if (jsCode) {
|
|
81
|
-
evaluate({
|
|
82
|
-
code: jsCode,
|
|
83
|
-
context: props.context || {},
|
|
84
|
-
localState: void 0,
|
|
85
|
-
rootState: props.builderContextSignal.rootState,
|
|
86
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
87
|
-
/**
|
|
88
|
-
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
89
|
-
*/
|
|
90
|
-
enableCache: false
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
75
|
const onClick = function onClick2(props, state, showContentProps, elementRef, event) {
|
|
95
76
|
var _a, _b;
|
|
96
77
|
if (props.builderContextSignal.content) {
|
|
@@ -238,10 +219,6 @@ const EnableEditor = component$((props) => {
|
|
|
238
219
|
}));
|
|
239
220
|
useContextProvider(builderContext, props.builderContextSignal);
|
|
240
221
|
useTask$(() => {
|
|
241
|
-
if (!props.apiKey) {
|
|
242
|
-
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
243
|
-
}
|
|
244
|
-
evaluateJsCode(props);
|
|
245
222
|
runHttpRequests(props, state, showContentProps, elementRef);
|
|
246
223
|
emitStateUpdate(props);
|
|
247
224
|
});
|
|
@@ -251,20 +228,6 @@ const EnableEditor = component$((props) => {
|
|
|
251
228
|
mergeNewContent(props, state, showContentProps, elementRef, props.content);
|
|
252
229
|
}
|
|
253
230
|
});
|
|
254
|
-
useTask$(({ track }) => {
|
|
255
|
-
track(() => {
|
|
256
|
-
var _a2, _b2;
|
|
257
|
-
return (_b2 = (_a2 = props.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
258
|
-
});
|
|
259
|
-
evaluateJsCode(props);
|
|
260
|
-
});
|
|
261
|
-
useTask$(({ track }) => {
|
|
262
|
-
track(() => {
|
|
263
|
-
var _a2, _b2;
|
|
264
|
-
return (_b2 = (_a2 = props.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
|
|
265
|
-
});
|
|
266
|
-
runHttpRequests(props, state, showContentProps, elementRef);
|
|
267
|
-
});
|
|
268
231
|
useTask$(({ track }) => {
|
|
269
232
|
track(() => props.builderContextSignal.rootState);
|
|
270
233
|
emitStateUpdate(props);
|
|
@@ -293,9 +256,9 @@ const EnableEditor = component$((props) => {
|
|
|
293
256
|
onClick$: $((event) => onClick(props, state, showContentProps, elementRef, event)),
|
|
294
257
|
"builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
|
|
295
258
|
"builder-model": props.model,
|
|
259
|
+
className: getWrapperClassName(((_d = props.content) == null ? void 0 : _d.testVariationId) || ((_e = props.content) == null ? void 0 : _e.id)),
|
|
296
260
|
...showContentProps.value,
|
|
297
261
|
...props.contentWrapperProps,
|
|
298
|
-
class: getWrapperClassName(((_d = props.content) == null ? void 0 : _d.testVariationId) || ((_e = props.content) == null ? void 0 : _e.id)),
|
|
299
262
|
children: /* @__PURE__ */ jsx(Slot, {})
|
|
300
263
|
}) : null
|
|
301
264
|
});
|
|
@@ -304,7 +267,6 @@ export {
|
|
|
304
267
|
EnableEditor,
|
|
305
268
|
EnableEditor as default,
|
|
306
269
|
emitStateUpdate,
|
|
307
|
-
evaluateJsCode,
|
|
308
270
|
mergeNewContent,
|
|
309
271
|
mergeNewRootState,
|
|
310
272
|
onClick,
|
|
@@ -3,7 +3,9 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
4
|
const builderRegisteredComponents = require("../../constants/builder-registered-components.qwik.cjs");
|
|
5
5
|
const components_context = require("../../context/components.context.qwik.cjs");
|
|
6
|
+
const evaluate = require("../../functions/evaluate/evaluate.qwik.cjs");
|
|
6
7
|
const registerComponent = require("../../functions/register-component.qwik.cjs");
|
|
8
|
+
const logger = require("../../helpers/logger.qwik.cjs");
|
|
7
9
|
const blocks = require("../blocks/blocks.qwik.cjs");
|
|
8
10
|
const helpers = require("../content-variants/helpers.qwik.cjs");
|
|
9
11
|
const inlinedScript = require("../inlined-script.qwik.cjs");
|
|
@@ -76,6 +78,30 @@ const ContentComponent = qwik.component$((props) => {
|
|
|
76
78
|
qwik.useContextProvider(components_context, qwik.useStore({
|
|
77
79
|
registeredComponents: state.registeredComponents
|
|
78
80
|
}));
|
|
81
|
+
qwik.useTask$(() => {
|
|
82
|
+
var _a2, _b2;
|
|
83
|
+
if (!props.apiKey) {
|
|
84
|
+
logger.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
85
|
+
}
|
|
86
|
+
const jsCode = (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
87
|
+
if (jsCode) {
|
|
88
|
+
evaluate.evaluate({
|
|
89
|
+
code: jsCode,
|
|
90
|
+
context: props.context || {},
|
|
91
|
+
localState: void 0,
|
|
92
|
+
rootState: state.builderContextSignal.rootState,
|
|
93
|
+
rootSetState: (newState) => {
|
|
94
|
+
var _a3, _b3;
|
|
95
|
+
(_b3 = (_a3 = state.builderContextSignal).rootSetState) == null ? void 0 : _b3.call(_a3, newState);
|
|
96
|
+
},
|
|
97
|
+
isExpression: false,
|
|
98
|
+
/**
|
|
99
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
100
|
+
*/
|
|
101
|
+
enableCache: false
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
79
105
|
return /* @__PURE__ */ jsxRuntime.jsxs(enableEditor.EnableEditor, {
|
|
80
106
|
nonce: props.nonce,
|
|
81
107
|
content: props.content,
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.qwik.mjs";
|
|
3
3
|
import ComponentsContext from "../../context/components.context.qwik.mjs";
|
|
4
|
+
import { evaluate } from "../../functions/evaluate/evaluate.qwik.mjs";
|
|
4
5
|
import { serializeIncludingFunctions } from "../../functions/register-component.qwik.mjs";
|
|
6
|
+
import { logger } from "../../helpers/logger.qwik.mjs";
|
|
5
7
|
import { Blocks } from "../blocks/blocks.qwik.mjs";
|
|
6
8
|
import { getUpdateVariantVisibilityScript } from "../content-variants/helpers.qwik.mjs";
|
|
7
9
|
import { InlinedScript } from "../inlined-script.qwik.mjs";
|
|
8
10
|
import { EnableEditor } from "./components/enable-editor.qwik.mjs";
|
|
9
11
|
import { ContentStyles } from "./components/styles.qwik.mjs";
|
|
10
12
|
import { getContentInitialValue, getRootStateInitialValue } from "./content.helpers.qwik.mjs";
|
|
11
|
-
import { component$, useStore, useContextProvider } from "@builder.io/qwik";
|
|
13
|
+
import { component$, useStore, useContextProvider, useTask$ } from "@builder.io/qwik";
|
|
12
14
|
const ContentComponent = component$((props) => {
|
|
13
15
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
14
16
|
const state = useStore({
|
|
@@ -74,6 +76,30 @@ const ContentComponent = component$((props) => {
|
|
|
74
76
|
useContextProvider(ComponentsContext, useStore({
|
|
75
77
|
registeredComponents: state.registeredComponents
|
|
76
78
|
}));
|
|
79
|
+
useTask$(() => {
|
|
80
|
+
var _a2, _b2;
|
|
81
|
+
if (!props.apiKey) {
|
|
82
|
+
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
83
|
+
}
|
|
84
|
+
const jsCode = (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
85
|
+
if (jsCode) {
|
|
86
|
+
evaluate({
|
|
87
|
+
code: jsCode,
|
|
88
|
+
context: props.context || {},
|
|
89
|
+
localState: void 0,
|
|
90
|
+
rootState: state.builderContextSignal.rootState,
|
|
91
|
+
rootSetState: (newState) => {
|
|
92
|
+
var _a3, _b3;
|
|
93
|
+
(_b3 = (_a3 = state.builderContextSignal).rootSetState) == null ? void 0 : _b3.call(_a3, newState);
|
|
94
|
+
},
|
|
95
|
+
isExpression: false,
|
|
96
|
+
/**
|
|
97
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
98
|
+
*/
|
|
99
|
+
enableCache: false
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
});
|
|
77
103
|
return /* @__PURE__ */ jsxs(EnableEditor, {
|
|
78
104
|
nonce: props.nonce,
|
|
79
105
|
content: props.content,
|
|
@@ -6,7 +6,7 @@ const runInBrowser = ({ code, builder, context, event, localState, rootSetState,
|
|
|
6
6
|
builder,
|
|
7
7
|
context,
|
|
8
8
|
event,
|
|
9
|
-
state: flattenState({
|
|
9
|
+
state: helpers.flattenState({
|
|
10
10
|
rootState,
|
|
11
11
|
localState,
|
|
12
12
|
rootSetState
|
|
@@ -14,34 +14,4 @@ const runInBrowser = ({ code, builder, context, event, localState, rootSetState,
|
|
|
14
14
|
});
|
|
15
15
|
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
16
16
|
};
|
|
17
|
-
function flattenState({ rootState, localState, rootSetState }) {
|
|
18
|
-
return new Proxy(rootState, {
|
|
19
|
-
get: (target, prop) => {
|
|
20
|
-
if (localState && prop in localState) {
|
|
21
|
-
return localState[prop];
|
|
22
|
-
}
|
|
23
|
-
const val = target[prop];
|
|
24
|
-
if (typeof val === "object" && val !== null) {
|
|
25
|
-
return flattenState({
|
|
26
|
-
rootState: val,
|
|
27
|
-
localState: void 0,
|
|
28
|
-
rootSetState: rootSetState ? (subState) => {
|
|
29
|
-
target[prop] = subState;
|
|
30
|
-
rootSetState(target);
|
|
31
|
-
} : void 0
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return val;
|
|
35
|
-
},
|
|
36
|
-
set: (target, prop, value) => {
|
|
37
|
-
if (localState && prop in localState) {
|
|
38
|
-
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
39
|
-
}
|
|
40
|
-
target[prop] = value;
|
|
41
|
-
rootSetState == null ? void 0 : rootSetState(target);
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
exports.flattenState = flattenState;
|
|
47
17
|
exports.runInBrowser = runInBrowser;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getFunctionArguments } from "../helpers.qwik.mjs";
|
|
1
|
+
import { getFunctionArguments, flattenState } from "../helpers.qwik.mjs";
|
|
2
2
|
const runInBrowser = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
|
|
3
3
|
const functionArgs = getFunctionArguments({
|
|
4
4
|
builder,
|
|
@@ -12,36 +12,6 @@ const runInBrowser = ({ code, builder, context, event, localState, rootSetState,
|
|
|
12
12
|
});
|
|
13
13
|
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
14
14
|
};
|
|
15
|
-
function flattenState({ rootState, localState, rootSetState }) {
|
|
16
|
-
return new Proxy(rootState, {
|
|
17
|
-
get: (target, prop) => {
|
|
18
|
-
if (localState && prop in localState) {
|
|
19
|
-
return localState[prop];
|
|
20
|
-
}
|
|
21
|
-
const val = target[prop];
|
|
22
|
-
if (typeof val === "object" && val !== null) {
|
|
23
|
-
return flattenState({
|
|
24
|
-
rootState: val,
|
|
25
|
-
localState: void 0,
|
|
26
|
-
rootSetState: rootSetState ? (subState) => {
|
|
27
|
-
target[prop] = subState;
|
|
28
|
-
rootSetState(target);
|
|
29
|
-
} : void 0
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return val;
|
|
33
|
-
},
|
|
34
|
-
set: (target, prop, value) => {
|
|
35
|
-
if (localState && prop in localState) {
|
|
36
|
-
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
37
|
-
}
|
|
38
|
-
target[prop] = value;
|
|
39
|
-
rootSetState == null ? void 0 : rootSetState(target);
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
15
|
export {
|
|
45
|
-
flattenState,
|
|
46
16
|
runInBrowser
|
|
47
17
|
};
|
|
@@ -27,6 +27,36 @@ const parseCode = (code, { isExpression = true }) => {
|
|
|
27
27
|
const useCode = useReturn ? `return (${code});` : code;
|
|
28
28
|
return useCode;
|
|
29
29
|
};
|
|
30
|
+
function flattenState({ rootState, localState, rootSetState }) {
|
|
31
|
+
return new Proxy(rootState, {
|
|
32
|
+
get: (target, prop) => {
|
|
33
|
+
if (localState && prop in localState) {
|
|
34
|
+
return localState[prop];
|
|
35
|
+
}
|
|
36
|
+
const val = target[prop];
|
|
37
|
+
if (typeof val === "object" && val !== null) {
|
|
38
|
+
return flattenState({
|
|
39
|
+
rootState: val,
|
|
40
|
+
localState: void 0,
|
|
41
|
+
rootSetState: rootSetState ? (subState) => {
|
|
42
|
+
target[prop] = subState;
|
|
43
|
+
rootSetState(target);
|
|
44
|
+
} : void 0
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return val;
|
|
48
|
+
},
|
|
49
|
+
set: (target, prop, value) => {
|
|
50
|
+
if (localState && prop in localState) {
|
|
51
|
+
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
52
|
+
}
|
|
53
|
+
target[prop] = value;
|
|
54
|
+
rootSetState == null ? void 0 : rootSetState(target);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.flattenState = flattenState;
|
|
30
60
|
exports.getBuilderGlobals = getBuilderGlobals;
|
|
31
61
|
exports.getFunctionArguments = getFunctionArguments;
|
|
32
62
|
exports.parseCode = parseCode;
|
|
@@ -25,7 +25,37 @@ const parseCode = (code, { isExpression = true }) => {
|
|
|
25
25
|
const useCode = useReturn ? `return (${code});` : code;
|
|
26
26
|
return useCode;
|
|
27
27
|
};
|
|
28
|
+
function flattenState({ rootState, localState, rootSetState }) {
|
|
29
|
+
return new Proxy(rootState, {
|
|
30
|
+
get: (target, prop) => {
|
|
31
|
+
if (localState && prop in localState) {
|
|
32
|
+
return localState[prop];
|
|
33
|
+
}
|
|
34
|
+
const val = target[prop];
|
|
35
|
+
if (typeof val === "object" && val !== null) {
|
|
36
|
+
return flattenState({
|
|
37
|
+
rootState: val,
|
|
38
|
+
localState: void 0,
|
|
39
|
+
rootSetState: rootSetState ? (subState) => {
|
|
40
|
+
target[prop] = subState;
|
|
41
|
+
rootSetState(target);
|
|
42
|
+
} : void 0
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return val;
|
|
46
|
+
},
|
|
47
|
+
set: (target, prop, value) => {
|
|
48
|
+
if (localState && prop in localState) {
|
|
49
|
+
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
50
|
+
}
|
|
51
|
+
target[prop] = value;
|
|
52
|
+
rootSetState == null ? void 0 : rootSetState(target);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
28
57
|
export {
|
|
58
|
+
flattenState,
|
|
29
59
|
getBuilderGlobals,
|
|
30
60
|
getFunctionArguments,
|
|
31
61
|
parseCode
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
|
+
const qwik = require("@builder.io/qwik");
|
|
5
|
+
const Awaiter = qwik.component$((props) => {
|
|
6
|
+
qwik.useVisibleTask$(() => {
|
|
7
|
+
});
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(qwik.Fragment, {
|
|
9
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
exports.Awaiter = Awaiter;
|
|
13
|
+
exports.default = Awaiter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
2
|
+
import { component$, useVisibleTask$, Fragment, Slot } from "@builder.io/qwik";
|
|
3
|
+
const Awaiter = component$((props) => {
|
|
4
|
+
useVisibleTask$(() => {
|
|
5
|
+
});
|
|
6
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
7
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
Awaiter,
|
|
12
|
+
Awaiter as default
|
|
13
|
+
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
|
|
4
4
|
const getBlockActions = require("../../../functions/get-block-actions.qwik.cjs");
|
|
5
5
|
const getBlockProperties = require("../../../functions/get-block-properties.qwik.cjs");
|
|
6
|
+
const awaiter = require("../../awaiter.qwik.cjs");
|
|
6
7
|
const qwik = require("@builder.io/qwik");
|
|
7
8
|
const InteractiveElement = qwik.component$((props) => {
|
|
8
9
|
const attributes = qwik.useComputed$(() => {
|
|
@@ -20,10 +21,18 @@ const InteractiveElement = qwik.component$((props) => {
|
|
|
20
21
|
})
|
|
21
22
|
} : {};
|
|
22
23
|
});
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
25
|
+
children: props.Wrapper.load ? /* @__PURE__ */ jsxRuntime.jsx(awaiter.Awaiter, {
|
|
26
|
+
load: props.Wrapper.load,
|
|
27
|
+
fallback: props.Wrapper.fallback,
|
|
28
|
+
props: props.wrapperProps,
|
|
29
|
+
attributes: attributes.value,
|
|
30
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
31
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(props.Wrapper, {
|
|
32
|
+
...props.wrapperProps,
|
|
33
|
+
attributes: attributes.value,
|
|
34
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {})
|
|
35
|
+
})
|
|
27
36
|
});
|
|
28
37
|
});
|
|
29
38
|
exports.InteractiveElement = InteractiveElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx } from "@builder.io/qwik/jsx-runtime";
|
|
1
|
+
import { jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
2
2
|
import { getBlockActions } from "../../../functions/get-block-actions.qwik.mjs";
|
|
3
3
|
import { getBlockProperties } from "../../../functions/get-block-properties.qwik.mjs";
|
|
4
|
+
import { Awaiter } from "../../awaiter.qwik.mjs";
|
|
4
5
|
import { component$, useComputed$, Slot } from "@builder.io/qwik";
|
|
5
6
|
const InteractiveElement = component$((props) => {
|
|
6
7
|
const attributes = useComputed$(() => {
|
|
@@ -18,10 +19,18 @@ const InteractiveElement = component$((props) => {
|
|
|
18
19
|
})
|
|
19
20
|
} : {};
|
|
20
21
|
});
|
|
21
|
-
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
23
|
+
children: props.Wrapper.load ? /* @__PURE__ */ jsx(Awaiter, {
|
|
24
|
+
load: props.Wrapper.load,
|
|
25
|
+
fallback: props.Wrapper.fallback,
|
|
26
|
+
props: props.wrapperProps,
|
|
27
|
+
attributes: attributes.value,
|
|
28
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
29
|
+
}) : /* @__PURE__ */ jsx(props.Wrapper, {
|
|
30
|
+
...props.wrapperProps,
|
|
31
|
+
attributes: attributes.value,
|
|
32
|
+
children: /* @__PURE__ */ jsx(Slot, {})
|
|
33
|
+
})
|
|
25
34
|
});
|
|
26
35
|
});
|
|
27
36
|
export {
|