@builder.io/sdk-qwik 0.17.8 → 0.18.1
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/blocks/symbol/symbol.qwik.cjs +3 -3
- package/lib/browser/blocks/symbol/symbol.qwik.mjs +3 -3
- package/lib/browser/blocks/video/video.qwik.cjs +49 -14
- package/lib/browser/blocks/video/video.qwik.mjs +50 -15
- package/lib/browser/components/content/components/enable-editor.qwik.cjs +8 -3
- package/lib/browser/components/content/components/enable-editor.qwik.mjs +8 -3
- package/lib/browser/components/content/content.qwik.cjs +1 -1
- package/lib/browser/components/content/content.qwik.mjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/browser/helpers/subscribe-to-editor.qwik.cjs +16 -3
- package/lib/browser/helpers/subscribe-to-editor.qwik.mjs +16 -3
- package/lib/browser/scripts/init-editing.qwik.cjs +3 -1
- package/lib/browser/scripts/init-editing.qwik.mjs +3 -1
- package/lib/edge/blocks/symbol/symbol.qwik.cjs +3 -3
- package/lib/edge/blocks/symbol/symbol.qwik.mjs +3 -3
- package/lib/edge/blocks/video/video.qwik.cjs +49 -14
- package/lib/edge/blocks/video/video.qwik.mjs +50 -15
- package/lib/edge/components/content/components/enable-editor.qwik.cjs +8 -3
- package/lib/edge/components/content/components/enable-editor.qwik.mjs +8 -3
- package/lib/edge/components/content/content.qwik.cjs +1 -1
- package/lib/edge/components/content/content.qwik.mjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/helpers/subscribe-to-editor.qwik.cjs +16 -3
- package/lib/edge/helpers/subscribe-to-editor.qwik.mjs +16 -3
- package/lib/edge/scripts/init-editing.qwik.cjs +3 -1
- package/lib/edge/scripts/init-editing.qwik.mjs +3 -1
- package/lib/node/blocks/symbol/symbol.qwik.cjs +3 -3
- package/lib/node/blocks/symbol/symbol.qwik.mjs +3 -3
- package/lib/node/blocks/video/video.qwik.cjs +49 -14
- package/lib/node/blocks/video/video.qwik.mjs +50 -15
- package/lib/node/components/content/components/enable-editor.qwik.cjs +8 -3
- package/lib/node/components/content/components/enable-editor.qwik.mjs +8 -3
- package/lib/node/components/content/content.qwik.cjs +1 -1
- package/lib/node/components/content/content.qwik.mjs +1 -1
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/helpers/subscribe-to-editor.qwik.cjs +16 -3
- package/lib/node/helpers/subscribe-to-editor.qwik.mjs +16 -3
- package/lib/node/scripts/init-editing.qwik.cjs +3 -1
- package/lib/node/scripts/init-editing.qwik.mjs +3 -1
- package/package.json +1 -1
- package/types/src/components/content-variants/content-variants.types.d.ts +2 -2
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/helpers/subscribe-to-editor.d.ts +15 -13
- package/types/src/scripts/init-editing.d.ts +3 -1
|
@@ -85,7 +85,7 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQ
|
|
|
85
85
|
},
|
|
86
86
|
get model() {
|
|
87
87
|
var _a2;
|
|
88
|
-
return (_a2 = props.symbol) == null ? void 0 : _a2.model;
|
|
88
|
+
return ((_a2 = props.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
89
89
|
},
|
|
90
90
|
get content() {
|
|
91
91
|
return state.contentToUse;
|
|
@@ -147,10 +147,10 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQ
|
|
|
147
147
|
], "p0.builderLinkComponent"),
|
|
148
148
|
model: qwik._fnSignal((p0) => {
|
|
149
149
|
var _a2;
|
|
150
|
-
return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
|
|
150
|
+
return ((_a2 = p0.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
151
151
|
}, [
|
|
152
152
|
props
|
|
153
|
-
],
|
|
153
|
+
], 'p0.symbol?.model??""'),
|
|
154
154
|
nonce: qwik._fnSignal((p0) => p0.builderContext.nonce, [
|
|
155
155
|
props
|
|
156
156
|
], "p0.builderContext.nonce")
|
|
@@ -83,7 +83,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
83
83
|
},
|
|
84
84
|
get model() {
|
|
85
85
|
var _a2;
|
|
86
|
-
return (_a2 = props.symbol) == null ? void 0 : _a2.model;
|
|
86
|
+
return ((_a2 = props.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
87
87
|
},
|
|
88
88
|
get content() {
|
|
89
89
|
return state.contentToUse;
|
|
@@ -145,10 +145,10 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
145
145
|
], "p0.builderLinkComponent"),
|
|
146
146
|
model: _fnSignal((p0) => {
|
|
147
147
|
var _a2;
|
|
148
|
-
return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
|
|
148
|
+
return ((_a2 = p0.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
149
149
|
}, [
|
|
150
150
|
props
|
|
151
|
-
],
|
|
151
|
+
], 'p0.symbol?.model??""'),
|
|
152
152
|
nonce: _fnSignal((p0) => p0.builderContext.nonce, [
|
|
153
153
|
props
|
|
154
154
|
], "p0.builderContext.nonce")
|
|
@@ -34,6 +34,40 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
34
34
|
}, "Video_component_spreadProps_useComputed_ZdLsx18NYH4", [
|
|
35
35
|
videoProps
|
|
36
36
|
]));
|
|
37
|
+
const videoRef = qwik.useSignal();
|
|
38
|
+
const state = qwik.useStore({
|
|
39
|
+
lazyVideoObserver: void 0
|
|
40
|
+
});
|
|
41
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
42
|
+
const [props2, state2, videoRef2] = qwik.useLexicalScope();
|
|
43
|
+
if (props2.lazyLoad) {
|
|
44
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
45
|
+
entries.forEach(function(entry) {
|
|
46
|
+
if (!entry.isIntersecting)
|
|
47
|
+
return;
|
|
48
|
+
const videoElement = entry.target;
|
|
49
|
+
try {
|
|
50
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
51
|
+
const src = source.dataset.src;
|
|
52
|
+
if (src)
|
|
53
|
+
source.src = src;
|
|
54
|
+
});
|
|
55
|
+
videoElement.load();
|
|
56
|
+
oberver.unobserve(videoElement);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error("Error loading lazy video:", error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
if (videoRef2.value)
|
|
63
|
+
oberver.observe(videoRef2.value);
|
|
64
|
+
state2.lazyVideoObserver = oberver;
|
|
65
|
+
}
|
|
66
|
+
}, "Video_component_useVisibleTask_LdYTuni7vo4", [
|
|
67
|
+
props,
|
|
68
|
+
state,
|
|
69
|
+
videoRef
|
|
70
|
+
]));
|
|
37
71
|
return /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
38
72
|
style: {
|
|
39
73
|
position: "relative"
|
|
@@ -41,12 +75,16 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
41
75
|
}, [
|
|
42
76
|
/* @__PURE__ */ qwik._jsxS("video", {
|
|
43
77
|
...spreadProps.value,
|
|
44
|
-
children:
|
|
45
|
-
|
|
46
|
-
props
|
|
47
|
-
|
|
78
|
+
children: /* @__PURE__ */ qwik._jsxS("source", {
|
|
79
|
+
...props.lazyLoad ? {
|
|
80
|
+
"data-src": props.video
|
|
81
|
+
} : {
|
|
82
|
+
src: props.video
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
48
85
|
type: "video/mp4"
|
|
49
|
-
},
|
|
86
|
+
}, 0, null),
|
|
87
|
+
ref: videoRef,
|
|
50
88
|
style: {
|
|
51
89
|
width: "100%",
|
|
52
90
|
height: "100%",
|
|
@@ -65,12 +103,9 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
65
103
|
poster: qwik._fnSignal((p0) => p0.posterImage, [
|
|
66
104
|
props
|
|
67
105
|
], "p0.posterImage"),
|
|
68
|
-
preload: qwik._fnSignal((p0) => p0.preload || "metadata", [
|
|
69
|
-
props
|
|
70
|
-
], 'p0.preload||"metadata"'),
|
|
71
|
-
src: qwik._fnSignal((p0) => p0.video || "no-src", [
|
|
106
|
+
preload: qwik._fnSignal((p0) => p0.lazyLoad ? "none" : p0.preload || "metadata", [
|
|
72
107
|
props
|
|
73
|
-
], 'p0.
|
|
108
|
+
], 'p0.lazyLoad?"none":p0.preload||"metadata"')
|
|
74
109
|
}, 0, null),
|
|
75
110
|
props.aspectRatio && !(props.fitContent && ((_c = (_b = props.builderBlock) == null ? void 0 : _b.children) == null ? void 0 : _c.length)) ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
76
111
|
style: qwik._fnSignal((p0) => ({
|
|
@@ -81,14 +116,14 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
81
116
|
}), [
|
|
82
117
|
props
|
|
83
118
|
], '{width:"100%",paddingTop:p0.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}')
|
|
84
|
-
}, null, 3, "
|
|
119
|
+
}, null, 3, "j7_0") : null,
|
|
85
120
|
((_e = (_d = props.builderBlock) == null ? void 0 : _d.children) == null ? void 0 : _e.length) && props.fitContent ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
86
121
|
style: {
|
|
87
122
|
display: "flex",
|
|
88
123
|
flexDirection: "column",
|
|
89
124
|
alignItems: "stretch"
|
|
90
125
|
}
|
|
91
|
-
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "
|
|
126
|
+
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "j7_1"), 1, "j7_2") : null,
|
|
92
127
|
((_g = (_f = props.builderBlock) == null ? void 0 : _f.children) == null ? void 0 : _g.length) && !props.fitContent ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
93
128
|
style: {
|
|
94
129
|
pointerEvents: "none",
|
|
@@ -101,8 +136,8 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
101
136
|
width: "100%",
|
|
102
137
|
height: "100%"
|
|
103
138
|
}
|
|
104
|
-
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "
|
|
105
|
-
], 1, "
|
|
139
|
+
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "j7_3"), 1, "j7_4") : null
|
|
140
|
+
], 1, "j7_5");
|
|
106
141
|
}, "Video_component_qdcTZflYyoQ"));
|
|
107
142
|
exports.Video = Video;
|
|
108
143
|
exports.default = Video;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxBranch, useComputedQrl, useLexicalScope, _jsxQ, _jsxS, _fnSignal, _jsxC, Slot } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, _jsxBranch, useComputedQrl, useLexicalScope, useSignal, useStore, useVisibleTaskQrl, _jsxQ, _jsxS, _fnSignal, _jsxC, Slot } from "@builder.io/qwik";
|
|
2
2
|
const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3
3
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4
4
|
_jsxBranch();
|
|
@@ -32,6 +32,40 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
32
32
|
}, "Video_component_spreadProps_useComputed_ZdLsx18NYH4", [
|
|
33
33
|
videoProps
|
|
34
34
|
]));
|
|
35
|
+
const videoRef = useSignal();
|
|
36
|
+
const state = useStore({
|
|
37
|
+
lazyVideoObserver: void 0
|
|
38
|
+
});
|
|
39
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
40
|
+
const [props2, state2, videoRef2] = useLexicalScope();
|
|
41
|
+
if (props2.lazyLoad) {
|
|
42
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
43
|
+
entries.forEach(function(entry) {
|
|
44
|
+
if (!entry.isIntersecting)
|
|
45
|
+
return;
|
|
46
|
+
const videoElement = entry.target;
|
|
47
|
+
try {
|
|
48
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
49
|
+
const src = source.dataset.src;
|
|
50
|
+
if (src)
|
|
51
|
+
source.src = src;
|
|
52
|
+
});
|
|
53
|
+
videoElement.load();
|
|
54
|
+
oberver.unobserve(videoElement);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("Error loading lazy video:", error);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
if (videoRef2.value)
|
|
61
|
+
oberver.observe(videoRef2.value);
|
|
62
|
+
state2.lazyVideoObserver = oberver;
|
|
63
|
+
}
|
|
64
|
+
}, "Video_component_useVisibleTask_LdYTuni7vo4", [
|
|
65
|
+
props,
|
|
66
|
+
state,
|
|
67
|
+
videoRef
|
|
68
|
+
]));
|
|
35
69
|
return /* @__PURE__ */ _jsxQ("div", null, {
|
|
36
70
|
style: {
|
|
37
71
|
position: "relative"
|
|
@@ -39,12 +73,16 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
39
73
|
}, [
|
|
40
74
|
/* @__PURE__ */ _jsxS("video", {
|
|
41
75
|
...spreadProps.value,
|
|
42
|
-
children:
|
|
43
|
-
|
|
44
|
-
props
|
|
45
|
-
|
|
76
|
+
children: /* @__PURE__ */ _jsxS("source", {
|
|
77
|
+
...props.lazyLoad ? {
|
|
78
|
+
"data-src": props.video
|
|
79
|
+
} : {
|
|
80
|
+
src: props.video
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
46
83
|
type: "video/mp4"
|
|
47
|
-
},
|
|
84
|
+
}, 0, null),
|
|
85
|
+
ref: videoRef,
|
|
48
86
|
style: {
|
|
49
87
|
width: "100%",
|
|
50
88
|
height: "100%",
|
|
@@ -63,12 +101,9 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
63
101
|
poster: _fnSignal((p0) => p0.posterImage, [
|
|
64
102
|
props
|
|
65
103
|
], "p0.posterImage"),
|
|
66
|
-
preload: _fnSignal((p0) => p0.preload || "metadata", [
|
|
67
|
-
props
|
|
68
|
-
], 'p0.preload||"metadata"'),
|
|
69
|
-
src: _fnSignal((p0) => p0.video || "no-src", [
|
|
104
|
+
preload: _fnSignal((p0) => p0.lazyLoad ? "none" : p0.preload || "metadata", [
|
|
70
105
|
props
|
|
71
|
-
], 'p0.
|
|
106
|
+
], 'p0.lazyLoad?"none":p0.preload||"metadata"')
|
|
72
107
|
}, 0, null),
|
|
73
108
|
props.aspectRatio && !(props.fitContent && ((_c = (_b = props.builderBlock) == null ? void 0 : _b.children) == null ? void 0 : _c.length)) ? /* @__PURE__ */ _jsxQ("div", null, {
|
|
74
109
|
style: _fnSignal((p0) => ({
|
|
@@ -79,14 +114,14 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
79
114
|
}), [
|
|
80
115
|
props
|
|
81
116
|
], '{width:"100%",paddingTop:p0.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}')
|
|
82
|
-
}, null, 3, "
|
|
117
|
+
}, null, 3, "j7_0") : null,
|
|
83
118
|
((_e = (_d = props.builderBlock) == null ? void 0 : _d.children) == null ? void 0 : _e.length) && props.fitContent ? /* @__PURE__ */ _jsxQ("div", null, {
|
|
84
119
|
style: {
|
|
85
120
|
display: "flex",
|
|
86
121
|
flexDirection: "column",
|
|
87
122
|
alignItems: "stretch"
|
|
88
123
|
}
|
|
89
|
-
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "
|
|
124
|
+
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "j7_1"), 1, "j7_2") : null,
|
|
90
125
|
((_g = (_f = props.builderBlock) == null ? void 0 : _f.children) == null ? void 0 : _g.length) && !props.fitContent ? /* @__PURE__ */ _jsxQ("div", null, {
|
|
91
126
|
style: {
|
|
92
127
|
pointerEvents: "none",
|
|
@@ -99,8 +134,8 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
99
134
|
width: "100%",
|
|
100
135
|
height: "100%"
|
|
101
136
|
}
|
|
102
|
-
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "
|
|
103
|
-
], 1, "
|
|
137
|
+
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "j7_3"), 1, "j7_4") : null
|
|
138
|
+
], 1, "j7_5");
|
|
104
139
|
}, "Video_component_qdcTZflYyoQ"));
|
|
105
140
|
export {
|
|
106
141
|
Video,
|
|
@@ -69,6 +69,9 @@ const processMessage = function processMessage2(props, state, showContentProps,
|
|
|
69
69
|
},
|
|
70
70
|
contentUpdate: (newContent) => {
|
|
71
71
|
mergeNewContent(props, state, showContentProps, elementRef, newContent);
|
|
72
|
+
},
|
|
73
|
+
stateUpdate: (newState) => {
|
|
74
|
+
mergeNewRootState(props, state, showContentProps, elementRef, newState);
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
})(event);
|
|
@@ -168,11 +171,13 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
168
171
|
} : {},
|
|
169
172
|
...props2.trustedHosts ? {
|
|
170
173
|
trustedHosts: props2.trustedHosts
|
|
171
|
-
} : {}
|
|
174
|
+
} : {},
|
|
175
|
+
modelName: props2.model ?? "",
|
|
176
|
+
apiKey: props2.apiKey
|
|
172
177
|
});
|
|
173
178
|
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
174
179
|
var _a2, _b2;
|
|
175
|
-
if (!
|
|
180
|
+
if (!((_a2 = registeredComponent.models) == null ? void 0 : _a2.length) || registeredComponent.models.includes(props2.model)) {
|
|
176
181
|
const message = registerComponent.createRegisterComponentMessage(registeredComponent);
|
|
177
182
|
(_b2 = window.parent) == null ? void 0 : _b2.postMessage(message, "*");
|
|
178
183
|
}
|
|
@@ -193,7 +198,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
193
198
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
194
199
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
|
|
195
200
|
index.fetchOneEntry({
|
|
196
|
-
model: props2.model
|
|
201
|
+
model: props2.model,
|
|
197
202
|
apiKey: props2.apiKey,
|
|
198
203
|
apiVersion: props2.builderContextSignal.apiVersion,
|
|
199
204
|
...searchParamPreviewModel === "BUILDER_STUDIO" && ((_a2 = props2.context) == null ? void 0 : _a2.symbolId) ? {
|
|
@@ -67,6 +67,9 @@ const processMessage = function processMessage2(props, state, showContentProps,
|
|
|
67
67
|
},
|
|
68
68
|
contentUpdate: (newContent) => {
|
|
69
69
|
mergeNewContent(props, state, showContentProps, elementRef, newContent);
|
|
70
|
+
},
|
|
71
|
+
stateUpdate: (newState) => {
|
|
72
|
+
mergeNewRootState(props, state, showContentProps, elementRef, newState);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
})(event);
|
|
@@ -166,11 +169,13 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
166
169
|
} : {},
|
|
167
170
|
...props2.trustedHosts ? {
|
|
168
171
|
trustedHosts: props2.trustedHosts
|
|
169
|
-
} : {}
|
|
172
|
+
} : {},
|
|
173
|
+
modelName: props2.model ?? "",
|
|
174
|
+
apiKey: props2.apiKey
|
|
170
175
|
});
|
|
171
176
|
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
172
177
|
var _a2, _b2;
|
|
173
|
-
if (!
|
|
178
|
+
if (!((_a2 = registeredComponent.models) == null ? void 0 : _a2.length) || registeredComponent.models.includes(props2.model)) {
|
|
174
179
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
175
180
|
(_b2 = window.parent) == null ? void 0 : _b2.postMessage(message, "*");
|
|
176
181
|
}
|
|
@@ -191,7 +196,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
191
196
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
192
197
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
|
|
193
198
|
fetchOneEntry({
|
|
194
|
-
model: props2.model
|
|
199
|
+
model: props2.model,
|
|
195
200
|
apiKey: props2.apiKey,
|
|
196
201
|
apiVersion: props2.builderContextSignal.apiVersion,
|
|
197
202
|
...searchParamPreviewModel === "BUILDER_STUDIO" && ((_a2 = props2.context) == null ? void 0 : _a2.symbolId) ? {
|
|
@@ -43,7 +43,7 @@ const ContentComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.
|
|
|
43
43
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
44
44
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
45
45
|
nonce: props.nonce || "",
|
|
46
|
-
model: props.model
|
|
46
|
+
model: props.model
|
|
47
47
|
},
|
|
48
48
|
registeredComponents: [
|
|
49
49
|
...builderRegisteredComponents.getDefaultRegisteredComponents(),
|
|
@@ -41,7 +41,7 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
41
41
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
42
42
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
43
43
|
nonce: props.nonce || "",
|
|
44
|
-
model: props.model
|
|
44
|
+
model: props.model
|
|
45
45
|
},
|
|
46
46
|
registeredComponents: [
|
|
47
47
|
...getDefaultRegisteredComponents(),
|
|
@@ -17,6 +17,14 @@ const createEditorListener = ({ model, trustedHosts, callbacks }) => {
|
|
|
17
17
|
case "builder.triggerAnimation":
|
|
18
18
|
callbacks.animation(data.data);
|
|
19
19
|
break;
|
|
20
|
+
case "builder.resetState": {
|
|
21
|
+
const messageContent = data.data;
|
|
22
|
+
const modelName = messageContent.model;
|
|
23
|
+
const newState = messageContent == null ? void 0 : messageContent.state;
|
|
24
|
+
if (modelName === model && newState)
|
|
25
|
+
callbacks.stateUpdate(newState);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
20
28
|
case "builder.contentUpdate": {
|
|
21
29
|
const messageContent = data.data;
|
|
22
30
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -28,23 +36,28 @@ const createEditorListener = ({ model, trustedHosts, callbacks }) => {
|
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
};
|
|
31
|
-
const subscribeToEditor = (model, callback,
|
|
39
|
+
const subscribeToEditor = ({ model, apiKey, callback, trustedHosts }) => {
|
|
32
40
|
if (!isBrowser.isBrowser) {
|
|
33
41
|
logger.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
34
42
|
return () => {
|
|
35
43
|
};
|
|
36
44
|
}
|
|
37
|
-
initEditing.setupBrowserForEditing(
|
|
45
|
+
initEditing.setupBrowserForEditing({
|
|
46
|
+
modelName: model,
|
|
47
|
+
apiKey
|
|
48
|
+
});
|
|
38
49
|
const listener = createEditorListener({
|
|
39
50
|
callbacks: {
|
|
40
51
|
contentUpdate: callback,
|
|
41
52
|
animation: () => {
|
|
42
53
|
},
|
|
43
54
|
configureSdk: () => {
|
|
55
|
+
},
|
|
56
|
+
stateUpdate: () => {
|
|
44
57
|
}
|
|
45
58
|
},
|
|
46
59
|
model,
|
|
47
|
-
trustedHosts
|
|
60
|
+
trustedHosts
|
|
48
61
|
});
|
|
49
62
|
window.addEventListener("message", listener);
|
|
50
63
|
return () => {
|
|
@@ -15,6 +15,14 @@ const createEditorListener = ({ model, trustedHosts, callbacks }) => {
|
|
|
15
15
|
case "builder.triggerAnimation":
|
|
16
16
|
callbacks.animation(data.data);
|
|
17
17
|
break;
|
|
18
|
+
case "builder.resetState": {
|
|
19
|
+
const messageContent = data.data;
|
|
20
|
+
const modelName = messageContent.model;
|
|
21
|
+
const newState = messageContent == null ? void 0 : messageContent.state;
|
|
22
|
+
if (modelName === model && newState)
|
|
23
|
+
callbacks.stateUpdate(newState);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
18
26
|
case "builder.contentUpdate": {
|
|
19
27
|
const messageContent = data.data;
|
|
20
28
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -26,23 +34,28 @@ const createEditorListener = ({ model, trustedHosts, callbacks }) => {
|
|
|
26
34
|
}
|
|
27
35
|
};
|
|
28
36
|
};
|
|
29
|
-
const subscribeToEditor = (model, callback,
|
|
37
|
+
const subscribeToEditor = ({ model, apiKey, callback, trustedHosts }) => {
|
|
30
38
|
if (!isBrowser) {
|
|
31
39
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
32
40
|
return () => {
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
|
-
setupBrowserForEditing(
|
|
43
|
+
setupBrowserForEditing({
|
|
44
|
+
modelName: model,
|
|
45
|
+
apiKey
|
|
46
|
+
});
|
|
36
47
|
const listener = createEditorListener({
|
|
37
48
|
callbacks: {
|
|
38
49
|
contentUpdate: callback,
|
|
39
50
|
animation: () => {
|
|
40
51
|
},
|
|
41
52
|
configureSdk: () => {
|
|
53
|
+
},
|
|
54
|
+
stateUpdate: () => {
|
|
42
55
|
}
|
|
43
56
|
},
|
|
44
57
|
model,
|
|
45
|
-
trustedHosts
|
|
58
|
+
trustedHosts
|
|
46
59
|
});
|
|
47
60
|
window.addEventListener("message", listener);
|
|
48
61
|
return () => {
|
|
@@ -40,7 +40,7 @@ const registerInsertMenu = () => {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
let isSetupForEditing = false;
|
|
43
|
-
const setupBrowserForEditing = (options
|
|
43
|
+
const setupBrowserForEditing = (options) => {
|
|
44
44
|
var _a, _b;
|
|
45
45
|
if (isSetupForEditing)
|
|
46
46
|
return;
|
|
@@ -56,6 +56,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
56
56
|
// scope our '+ add block' button styling
|
|
57
57
|
supportsAddBlockScoping: true,
|
|
58
58
|
supportsCustomBreakpoints: true,
|
|
59
|
+
modelName: options.modelName,
|
|
60
|
+
apiKey: options.apiKey,
|
|
59
61
|
supportsXSmallBreakpoint: true,
|
|
60
62
|
blockLevelPersonalization: true
|
|
61
63
|
}
|
|
@@ -38,7 +38,7 @@ const registerInsertMenu = () => {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
let isSetupForEditing = false;
|
|
41
|
-
const setupBrowserForEditing = (options
|
|
41
|
+
const setupBrowserForEditing = (options) => {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
if (isSetupForEditing)
|
|
44
44
|
return;
|
|
@@ -54,6 +54,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
54
54
|
// scope our '+ add block' button styling
|
|
55
55
|
supportsAddBlockScoping: true,
|
|
56
56
|
supportsCustomBreakpoints: true,
|
|
57
|
+
modelName: options.modelName,
|
|
58
|
+
apiKey: options.apiKey,
|
|
57
59
|
supportsXSmallBreakpoint: true,
|
|
58
60
|
blockLevelPersonalization: true
|
|
59
61
|
}
|
|
@@ -85,7 +85,7 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQ
|
|
|
85
85
|
},
|
|
86
86
|
get model() {
|
|
87
87
|
var _a2;
|
|
88
|
-
return (_a2 = props.symbol) == null ? void 0 : _a2.model;
|
|
88
|
+
return ((_a2 = props.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
89
89
|
},
|
|
90
90
|
get content() {
|
|
91
91
|
return state.contentToUse;
|
|
@@ -147,10 +147,10 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQ
|
|
|
147
147
|
], "p0.builderLinkComponent"),
|
|
148
148
|
model: qwik._fnSignal((p0) => {
|
|
149
149
|
var _a2;
|
|
150
|
-
return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
|
|
150
|
+
return ((_a2 = p0.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
151
151
|
}, [
|
|
152
152
|
props
|
|
153
|
-
],
|
|
153
|
+
], 'p0.symbol?.model??""'),
|
|
154
154
|
nonce: qwik._fnSignal((p0) => p0.builderContext.nonce, [
|
|
155
155
|
props
|
|
156
156
|
], "p0.builderContext.nonce")
|
|
@@ -83,7 +83,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
83
83
|
},
|
|
84
84
|
get model() {
|
|
85
85
|
var _a2;
|
|
86
|
-
return (_a2 = props.symbol) == null ? void 0 : _a2.model;
|
|
86
|
+
return ((_a2 = props.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
87
87
|
},
|
|
88
88
|
get content() {
|
|
89
89
|
return state.contentToUse;
|
|
@@ -145,10 +145,10 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
145
145
|
], "p0.builderLinkComponent"),
|
|
146
146
|
model: _fnSignal((p0) => {
|
|
147
147
|
var _a2;
|
|
148
|
-
return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
|
|
148
|
+
return ((_a2 = p0.symbol) == null ? void 0 : _a2.model) ?? "";
|
|
149
149
|
}, [
|
|
150
150
|
props
|
|
151
|
-
],
|
|
151
|
+
], 'p0.symbol?.model??""'),
|
|
152
152
|
nonce: _fnSignal((p0) => p0.builderContext.nonce, [
|
|
153
153
|
props
|
|
154
154
|
], "p0.builderContext.nonce")
|
|
@@ -34,6 +34,40 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
34
34
|
}, "Video_component_spreadProps_useComputed_ZdLsx18NYH4", [
|
|
35
35
|
videoProps
|
|
36
36
|
]));
|
|
37
|
+
const videoRef = qwik.useSignal();
|
|
38
|
+
const state = qwik.useStore({
|
|
39
|
+
lazyVideoObserver: void 0
|
|
40
|
+
});
|
|
41
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
42
|
+
const [props2, state2, videoRef2] = qwik.useLexicalScope();
|
|
43
|
+
if (props2.lazyLoad) {
|
|
44
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
45
|
+
entries.forEach(function(entry) {
|
|
46
|
+
if (!entry.isIntersecting)
|
|
47
|
+
return;
|
|
48
|
+
const videoElement = entry.target;
|
|
49
|
+
try {
|
|
50
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
51
|
+
const src = source.dataset.src;
|
|
52
|
+
if (src)
|
|
53
|
+
source.src = src;
|
|
54
|
+
});
|
|
55
|
+
videoElement.load();
|
|
56
|
+
oberver.unobserve(videoElement);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error("Error loading lazy video:", error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
if (videoRef2.value)
|
|
63
|
+
oberver.observe(videoRef2.value);
|
|
64
|
+
state2.lazyVideoObserver = oberver;
|
|
65
|
+
}
|
|
66
|
+
}, "Video_component_useVisibleTask_LdYTuni7vo4", [
|
|
67
|
+
props,
|
|
68
|
+
state,
|
|
69
|
+
videoRef
|
|
70
|
+
]));
|
|
37
71
|
return /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
38
72
|
style: {
|
|
39
73
|
position: "relative"
|
|
@@ -41,12 +75,16 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
41
75
|
}, [
|
|
42
76
|
/* @__PURE__ */ qwik._jsxS("video", {
|
|
43
77
|
...spreadProps.value,
|
|
44
|
-
children:
|
|
45
|
-
|
|
46
|
-
props
|
|
47
|
-
|
|
78
|
+
children: /* @__PURE__ */ qwik._jsxS("source", {
|
|
79
|
+
...props.lazyLoad ? {
|
|
80
|
+
"data-src": props.video
|
|
81
|
+
} : {
|
|
82
|
+
src: props.video
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
48
85
|
type: "video/mp4"
|
|
49
|
-
},
|
|
86
|
+
}, 0, null),
|
|
87
|
+
ref: videoRef,
|
|
50
88
|
style: {
|
|
51
89
|
width: "100%",
|
|
52
90
|
height: "100%",
|
|
@@ -65,12 +103,9 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
65
103
|
poster: qwik._fnSignal((p0) => p0.posterImage, [
|
|
66
104
|
props
|
|
67
105
|
], "p0.posterImage"),
|
|
68
|
-
preload: qwik._fnSignal((p0) => p0.preload || "metadata", [
|
|
69
|
-
props
|
|
70
|
-
], 'p0.preload||"metadata"'),
|
|
71
|
-
src: qwik._fnSignal((p0) => p0.video || "no-src", [
|
|
106
|
+
preload: qwik._fnSignal((p0) => p0.lazyLoad ? "none" : p0.preload || "metadata", [
|
|
72
107
|
props
|
|
73
|
-
], 'p0.
|
|
108
|
+
], 'p0.lazyLoad?"none":p0.preload||"metadata"')
|
|
74
109
|
}, 0, null),
|
|
75
110
|
props.aspectRatio && !(props.fitContent && ((_c = (_b = props.builderBlock) == null ? void 0 : _b.children) == null ? void 0 : _c.length)) ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
76
111
|
style: qwik._fnSignal((p0) => ({
|
|
@@ -81,14 +116,14 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
81
116
|
}), [
|
|
82
117
|
props
|
|
83
118
|
], '{width:"100%",paddingTop:p0.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}')
|
|
84
|
-
}, null, 3, "
|
|
119
|
+
}, null, 3, "j7_0") : null,
|
|
85
120
|
((_e = (_d = props.builderBlock) == null ? void 0 : _d.children) == null ? void 0 : _e.length) && props.fitContent ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
86
121
|
style: {
|
|
87
122
|
display: "flex",
|
|
88
123
|
flexDirection: "column",
|
|
89
124
|
alignItems: "stretch"
|
|
90
125
|
}
|
|
91
|
-
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "
|
|
126
|
+
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "j7_1"), 1, "j7_2") : null,
|
|
92
127
|
((_g = (_f = props.builderBlock) == null ? void 0 : _f.children) == null ? void 0 : _g.length) && !props.fitContent ? /* @__PURE__ */ qwik._jsxQ("div", null, {
|
|
93
128
|
style: {
|
|
94
129
|
pointerEvents: "none",
|
|
@@ -101,8 +136,8 @@ const Video = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
101
136
|
width: "100%",
|
|
102
137
|
height: "100%"
|
|
103
138
|
}
|
|
104
|
-
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "
|
|
105
|
-
], 1, "
|
|
139
|
+
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "j7_3"), 1, "j7_4") : null
|
|
140
|
+
], 1, "j7_5");
|
|
106
141
|
}, "Video_component_qdcTZflYyoQ"));
|
|
107
142
|
exports.Video = Video;
|
|
108
143
|
exports.default = Video;
|