@builder.io/sdk-qwik 0.16.24 → 0.17.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/image/component-info.qwik.cjs +2 -7
- package/lib/browser/blocks/image/component-info.qwik.mjs +2 -7
- package/lib/browser/blocks/image/image.qwik.cjs +1 -1
- package/lib/browser/blocks/image/image.qwik.mjs +1 -1
- package/lib/browser/blocks/img/component-info.qwik.cjs +2 -8
- package/lib/browser/blocks/img/component-info.qwik.mjs +2 -8
- package/lib/browser/blocks/video/component-info.qwik.cjs +3 -7
- package/lib/browser/blocks/video/component-info.qwik.mjs +3 -7
- package/lib/browser/components/block/block.helpers.qwik.cjs +16 -5
- package/lib/browser/components/block/block.helpers.qwik.mjs +16 -5
- package/lib/browser/components/block/block.qwik.cjs +3 -2
- package/lib/browser/components/block/block.qwik.mjs +3 -2
- package/lib/browser/components/content/components/enable-editor.helpers.qwik.cjs +15 -0
- package/lib/browser/components/content/components/enable-editor.helpers.qwik.mjs +15 -0
- package/lib/browser/components/content/components/enable-editor.qwik.cjs +10 -4
- package/lib/browser/components/content/components/enable-editor.qwik.mjs +10 -4
- package/lib/browser/components/content/content.qwik.cjs +7 -18
- package/lib/browser/components/content/content.qwik.mjs +7 -18
- package/lib/browser/constants/file-types.qwik.cjs +72 -0
- package/lib/browser/constants/file-types.qwik.mjs +72 -0
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/browser/functions/extract-localized-values.qwik.cjs +37 -0
- package/lib/browser/functions/extract-localized-values.qwik.mjs +37 -0
- package/lib/browser/functions/get-content/index.qwik.cjs +10 -15
- package/lib/browser/functions/get-content/index.qwik.mjs +10 -15
- package/lib/browser/functions/get-processed-block.qwik.cjs +3 -1
- package/lib/browser/functions/get-processed-block.qwik.mjs +3 -1
- package/lib/browser/functions/register-component.qwik.cjs +1 -1
- package/lib/browser/functions/register-component.qwik.mjs +1 -1
- package/lib/browser/functions/traverse.qwik.cjs +31 -0
- package/lib/browser/functions/traverse.qwik.mjs +31 -0
- package/lib/edge/blocks/image/component-info.qwik.cjs +2 -7
- package/lib/edge/blocks/image/component-info.qwik.mjs +2 -7
- package/lib/edge/blocks/image/image.qwik.cjs +1 -1
- package/lib/edge/blocks/image/image.qwik.mjs +1 -1
- package/lib/edge/blocks/img/component-info.qwik.cjs +2 -8
- package/lib/edge/blocks/img/component-info.qwik.mjs +2 -8
- package/lib/edge/blocks/video/component-info.qwik.cjs +3 -7
- package/lib/edge/blocks/video/component-info.qwik.mjs +3 -7
- package/lib/edge/components/block/block.helpers.qwik.cjs +16 -5
- package/lib/edge/components/block/block.helpers.qwik.mjs +16 -5
- package/lib/edge/components/block/block.qwik.cjs +3 -2
- package/lib/edge/components/block/block.qwik.mjs +3 -2
- package/lib/edge/components/content/components/enable-editor.helpers.qwik.cjs +15 -0
- package/lib/edge/components/content/components/enable-editor.helpers.qwik.mjs +15 -0
- package/lib/edge/components/content/components/enable-editor.qwik.cjs +10 -4
- package/lib/edge/components/content/components/enable-editor.qwik.mjs +10 -4
- package/lib/edge/components/content/content.qwik.cjs +7 -18
- package/lib/edge/components/content/content.qwik.mjs +7 -18
- package/lib/edge/constants/file-types.qwik.cjs +72 -0
- package/lib/edge/constants/file-types.qwik.mjs +72 -0
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/functions/extract-localized-values.qwik.cjs +37 -0
- package/lib/edge/functions/extract-localized-values.qwik.mjs +37 -0
- package/lib/edge/functions/get-content/index.qwik.cjs +10 -15
- package/lib/edge/functions/get-content/index.qwik.mjs +10 -15
- package/lib/edge/functions/get-processed-block.qwik.cjs +3 -1
- package/lib/edge/functions/get-processed-block.qwik.mjs +3 -1
- package/lib/edge/functions/register-component.qwik.cjs +1 -1
- package/lib/edge/functions/register-component.qwik.mjs +1 -1
- package/lib/edge/functions/traverse.qwik.cjs +31 -0
- package/lib/edge/functions/traverse.qwik.mjs +31 -0
- package/lib/node/blocks/image/component-info.qwik.cjs +2 -7
- package/lib/node/blocks/image/component-info.qwik.mjs +2 -7
- package/lib/node/blocks/image/image.qwik.cjs +1 -1
- package/lib/node/blocks/image/image.qwik.mjs +1 -1
- package/lib/node/blocks/img/component-info.qwik.cjs +2 -8
- package/lib/node/blocks/img/component-info.qwik.mjs +2 -8
- package/lib/node/blocks/video/component-info.qwik.cjs +3 -7
- package/lib/node/blocks/video/component-info.qwik.mjs +3 -7
- package/lib/node/components/block/block.helpers.qwik.cjs +16 -5
- package/lib/node/components/block/block.helpers.qwik.mjs +16 -5
- package/lib/node/components/block/block.qwik.cjs +3 -2
- package/lib/node/components/block/block.qwik.mjs +3 -2
- package/lib/node/components/content/components/enable-editor.helpers.qwik.cjs +15 -0
- package/lib/node/components/content/components/enable-editor.helpers.qwik.mjs +15 -0
- package/lib/node/components/content/components/enable-editor.qwik.cjs +10 -4
- package/lib/node/components/content/components/enable-editor.qwik.mjs +10 -4
- package/lib/node/components/content/content.qwik.cjs +7 -18
- package/lib/node/components/content/content.qwik.mjs +7 -18
- package/lib/node/constants/file-types.qwik.cjs +72 -0
- package/lib/node/constants/file-types.qwik.mjs +72 -0
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/functions/extract-localized-values.qwik.cjs +37 -0
- package/lib/node/functions/extract-localized-values.qwik.mjs +37 -0
- package/lib/node/functions/get-content/index.qwik.cjs +10 -15
- package/lib/node/functions/get-content/index.qwik.mjs +10 -15
- package/lib/node/functions/get-processed-block.qwik.cjs +3 -1
- package/lib/node/functions/get-processed-block.qwik.mjs +3 -1
- package/lib/node/functions/register-component.qwik.cjs +1 -1
- package/lib/node/functions/register-component.qwik.mjs +1 -1
- package/lib/node/functions/traverse.qwik.cjs +31 -0
- package/lib/node/functions/traverse.qwik.mjs +31 -0
- package/package.json +1 -1
- package/types/src/components/block/block.helpers.d.ts +6 -3
- package/types/src/components/content/components/enable-editor.helpers.d.ts +11 -0
- package/types/src/constants/file-types.d.ts +2 -0
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/context/types.d.ts +1 -0
- package/types/src/functions/extract-localized-values.d.ts +2 -0
- package/types/src/functions/get-content/index.d.ts +1 -1
- package/types/src/functions/traverse.d.ts +34 -0
- package/types/src/types/components.d.ts +3 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fileTypes = require("../../constants/file-types.qwik.cjs");
|
|
3
4
|
const componentInfo = {
|
|
4
5
|
name: "Image",
|
|
5
6
|
static: true,
|
|
@@ -16,13 +17,7 @@ const componentInfo = {
|
|
|
16
17
|
name: "image",
|
|
17
18
|
type: "file",
|
|
18
19
|
bubble: true,
|
|
19
|
-
allowedFileTypes:
|
|
20
|
-
"jpeg",
|
|
21
|
-
"jpg",
|
|
22
|
-
"png",
|
|
23
|
-
"svg",
|
|
24
|
-
"webp"
|
|
25
|
-
],
|
|
20
|
+
allowedFileTypes: fileTypes.IMAGE_FILE_TYPES,
|
|
26
21
|
required: true,
|
|
27
22
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
28
23
|
onChange: (options) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IMAGE_FILE_TYPES } from "../../constants/file-types.qwik.mjs";
|
|
1
2
|
const componentInfo = {
|
|
2
3
|
name: "Image",
|
|
3
4
|
static: true,
|
|
@@ -14,13 +15,7 @@ const componentInfo = {
|
|
|
14
15
|
name: "image",
|
|
15
16
|
type: "file",
|
|
16
17
|
bubble: true,
|
|
17
|
-
allowedFileTypes:
|
|
18
|
-
"jpeg",
|
|
19
|
-
"jpg",
|
|
20
|
-
"png",
|
|
21
|
-
"svg",
|
|
22
|
-
"webp"
|
|
23
|
-
],
|
|
18
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
24
19
|
required: true,
|
|
25
20
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
26
21
|
onChange: (options) => {
|
|
@@ -13,7 +13,7 @@ const Image = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
13
13
|
const url = imageToUse;
|
|
14
14
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
15
15
|
// images, otherwise you can supply this prop manually
|
|
16
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))
|
|
16
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))))
|
|
17
17
|
return props2.srcset;
|
|
18
18
|
if (props2.noWebp)
|
|
19
19
|
return void 0;
|
|
@@ -11,7 +11,7 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
11
11
|
const url = imageToUse;
|
|
12
12
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
13
13
|
// images, otherwise you can supply this prop manually
|
|
14
|
-
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))
|
|
14
|
+
!(typeof url === "string" && (url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))))
|
|
15
15
|
return props2.srcset;
|
|
16
16
|
if (props2.noWebp)
|
|
17
17
|
return void 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fileTypes = require("../../constants/file-types.qwik.cjs");
|
|
3
4
|
const componentInfo = {
|
|
4
5
|
// friendlyName?
|
|
5
6
|
name: "Raw:Img",
|
|
@@ -10,14 +11,7 @@ const componentInfo = {
|
|
|
10
11
|
name: "image",
|
|
11
12
|
bubble: true,
|
|
12
13
|
type: "file",
|
|
13
|
-
allowedFileTypes:
|
|
14
|
-
"jpeg",
|
|
15
|
-
"jpg",
|
|
16
|
-
"png",
|
|
17
|
-
"svg",
|
|
18
|
-
"gif",
|
|
19
|
-
"webp"
|
|
20
|
-
],
|
|
14
|
+
allowedFileTypes: fileTypes.IMAGE_FILE_TYPES,
|
|
21
15
|
required: true
|
|
22
16
|
}
|
|
23
17
|
],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IMAGE_FILE_TYPES } from "../../constants/file-types.qwik.mjs";
|
|
1
2
|
const componentInfo = {
|
|
2
3
|
// friendlyName?
|
|
3
4
|
name: "Raw:Img",
|
|
@@ -8,14 +9,7 @@ const componentInfo = {
|
|
|
8
9
|
name: "image",
|
|
9
10
|
bubble: true,
|
|
10
11
|
type: "file",
|
|
11
|
-
allowedFileTypes:
|
|
12
|
-
"jpeg",
|
|
13
|
-
"jpg",
|
|
14
|
-
"png",
|
|
15
|
-
"svg",
|
|
16
|
-
"gif",
|
|
17
|
-
"webp"
|
|
18
|
-
],
|
|
12
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
19
13
|
required: true
|
|
20
14
|
}
|
|
21
15
|
],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fileTypes = require("../../constants/file-types.qwik.cjs");
|
|
3
4
|
const componentInfo = {
|
|
4
5
|
name: "Video",
|
|
5
6
|
canHaveChildren: true,
|
|
@@ -12,9 +13,7 @@ const componentInfo = {
|
|
|
12
13
|
{
|
|
13
14
|
name: "video",
|
|
14
15
|
type: "file",
|
|
15
|
-
allowedFileTypes:
|
|
16
|
-
"mp4"
|
|
17
|
-
],
|
|
16
|
+
allowedFileTypes: fileTypes.VIDEO_FILE_TYPES,
|
|
18
17
|
bubble: true,
|
|
19
18
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
20
19
|
required: true
|
|
@@ -22,10 +21,7 @@ const componentInfo = {
|
|
|
22
21
|
{
|
|
23
22
|
name: "posterImage",
|
|
24
23
|
type: "file",
|
|
25
|
-
allowedFileTypes:
|
|
26
|
-
"jpeg",
|
|
27
|
-
"png"
|
|
28
|
-
],
|
|
24
|
+
allowedFileTypes: fileTypes.IMAGE_FILE_TYPES,
|
|
29
25
|
helperText: "Image to show before the video plays"
|
|
30
26
|
},
|
|
31
27
|
{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VIDEO_FILE_TYPES, IMAGE_FILE_TYPES } from "../../constants/file-types.qwik.mjs";
|
|
1
2
|
const componentInfo = {
|
|
2
3
|
name: "Video",
|
|
3
4
|
canHaveChildren: true,
|
|
@@ -10,9 +11,7 @@ const componentInfo = {
|
|
|
10
11
|
{
|
|
11
12
|
name: "video",
|
|
12
13
|
type: "file",
|
|
13
|
-
allowedFileTypes:
|
|
14
|
-
"mp4"
|
|
15
|
-
],
|
|
14
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
16
15
|
bubble: true,
|
|
17
16
|
defaultValue: "https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",
|
|
18
17
|
required: true
|
|
@@ -20,10 +19,7 @@ const componentInfo = {
|
|
|
20
19
|
{
|
|
21
20
|
name: "posterImage",
|
|
22
21
|
type: "file",
|
|
23
|
-
allowedFileTypes:
|
|
24
|
-
"jpeg",
|
|
25
|
-
"png"
|
|
26
|
-
],
|
|
22
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
27
23
|
helperText: "Image to show before the video plays"
|
|
28
24
|
},
|
|
29
25
|
{
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const evaluate = require("../../functions/evaluate/evaluate.qwik.cjs");
|
|
4
|
-
const
|
|
4
|
+
const checkIsComponentRestricted = (component, model) => {
|
|
5
|
+
if (!component)
|
|
6
|
+
return true;
|
|
7
|
+
if (!model)
|
|
8
|
+
return false;
|
|
9
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
10
|
+
};
|
|
11
|
+
const getComponent = ({ block, registeredComponents, model }) => {
|
|
5
12
|
var _a;
|
|
6
13
|
const componentName = (_a = block.component) == null ? void 0 : _a.name;
|
|
7
14
|
if (!componentName)
|
|
8
15
|
return null;
|
|
9
16
|
const ref = registeredComponents[componentName];
|
|
10
|
-
if (!ref) {
|
|
17
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
11
18
|
console.warn(`
|
|
12
19
|
Could not find a registered component named "${componentName}".
|
|
13
20
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
@@ -53,12 +60,16 @@ const provideLinkComponent = (block, linkComponent) => {
|
|
|
53
60
|
};
|
|
54
61
|
return {};
|
|
55
62
|
};
|
|
56
|
-
const provideRegisteredComponents = (block, registeredComponents) => {
|
|
63
|
+
const provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
57
64
|
var _a;
|
|
58
|
-
if ((_a = block == null ? void 0 : block.shouldReceiveBuilderProps) == null ? void 0 : _a.builderComponents)
|
|
65
|
+
if ((_a = block == null ? void 0 : block.shouldReceiveBuilderProps) == null ? void 0 : _a.builderComponents) {
|
|
66
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
67
|
+
return !checkIsComponentRestricted(component, model);
|
|
68
|
+
}));
|
|
59
69
|
return {
|
|
60
|
-
builderComponents:
|
|
70
|
+
builderComponents: filteredRegisteredComponents
|
|
61
71
|
};
|
|
72
|
+
}
|
|
62
73
|
return {};
|
|
63
74
|
};
|
|
64
75
|
const provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { evaluate } from "../../functions/evaluate/evaluate.qwik.mjs";
|
|
2
|
-
const
|
|
2
|
+
const checkIsComponentRestricted = (component, model) => {
|
|
3
|
+
if (!component)
|
|
4
|
+
return true;
|
|
5
|
+
if (!model)
|
|
6
|
+
return false;
|
|
7
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
8
|
+
};
|
|
9
|
+
const getComponent = ({ block, registeredComponents, model }) => {
|
|
3
10
|
var _a;
|
|
4
11
|
const componentName = (_a = block.component) == null ? void 0 : _a.name;
|
|
5
12
|
if (!componentName)
|
|
6
13
|
return null;
|
|
7
14
|
const ref = registeredComponents[componentName];
|
|
8
|
-
if (!ref) {
|
|
15
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
9
16
|
console.warn(`
|
|
10
17
|
Could not find a registered component named "${componentName}".
|
|
11
18
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
@@ -51,12 +58,16 @@ const provideLinkComponent = (block, linkComponent) => {
|
|
|
51
58
|
};
|
|
52
59
|
return {};
|
|
53
60
|
};
|
|
54
|
-
const provideRegisteredComponents = (block, registeredComponents) => {
|
|
61
|
+
const provideRegisteredComponents = (block, registeredComponents, model) => {
|
|
55
62
|
var _a;
|
|
56
|
-
if ((_a = block == null ? void 0 : block.shouldReceiveBuilderProps) == null ? void 0 : _a.builderComponents)
|
|
63
|
+
if ((_a = block == null ? void 0 : block.shouldReceiveBuilderProps) == null ? void 0 : _a.builderComponents) {
|
|
64
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
65
|
+
return !checkIsComponentRestricted(component, model);
|
|
66
|
+
}));
|
|
57
67
|
return {
|
|
58
|
-
builderComponents:
|
|
68
|
+
builderComponents: filteredRegisteredComponents
|
|
59
69
|
};
|
|
70
|
+
}
|
|
60
71
|
return {};
|
|
61
72
|
};
|
|
62
73
|
const provideBuilderBlock = (block, builderBlock) => {
|
|
@@ -48,7 +48,8 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
48
48
|
const [processedBlock2, props2] = qwik.useLexicalScope();
|
|
49
49
|
return block_helpers.getComponent({
|
|
50
50
|
block: processedBlock2.value,
|
|
51
|
-
registeredComponents: props2.registeredComponents
|
|
51
|
+
registeredComponents: props2.registeredComponents,
|
|
52
|
+
model: props2.context.model
|
|
52
53
|
});
|
|
53
54
|
}, "Block_component_blockComponent_useComputed_83sGy9Xlsi0", [
|
|
54
55
|
processedBlock,
|
|
@@ -102,7 +103,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
102
103
|
...block_helpers.provideBuilderBlock(blockComponent2.value, processedBlock2.value),
|
|
103
104
|
...block_helpers.provideBuilderContext(blockComponent2.value, props2.context),
|
|
104
105
|
...block_helpers.provideLinkComponent(blockComponent2.value, props2.linkComponent),
|
|
105
|
-
...block_helpers.provideRegisteredComponents(blockComponent2.value, props2.registeredComponents)
|
|
106
|
+
...block_helpers.provideRegisteredComponents(blockComponent2.value, props2.registeredComponents, props2.context.model)
|
|
106
107
|
},
|
|
107
108
|
context: props2.context,
|
|
108
109
|
linkComponent: props2.linkComponent,
|
|
@@ -46,7 +46,8 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
46
46
|
const [processedBlock2, props2] = useLexicalScope();
|
|
47
47
|
return getComponent({
|
|
48
48
|
block: processedBlock2.value,
|
|
49
|
-
registeredComponents: props2.registeredComponents
|
|
49
|
+
registeredComponents: props2.registeredComponents,
|
|
50
|
+
model: props2.context.model
|
|
50
51
|
});
|
|
51
52
|
}, "Block_component_blockComponent_useComputed_83sGy9Xlsi0", [
|
|
52
53
|
processedBlock,
|
|
@@ -100,7 +101,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
100
101
|
...provideBuilderBlock(blockComponent2.value, processedBlock2.value),
|
|
101
102
|
...provideBuilderContext(blockComponent2.value, props2.context),
|
|
102
103
|
...provideLinkComponent(blockComponent2.value, props2.linkComponent),
|
|
103
|
-
...provideRegisteredComponents(blockComponent2.value, props2.registeredComponents)
|
|
104
|
+
...provideRegisteredComponents(blockComponent2.value, props2.registeredComponents, props2.context.model)
|
|
104
105
|
},
|
|
105
106
|
context: props2.context,
|
|
106
107
|
linkComponent: props2.linkComponent,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const target = require("../../../constants/target.qwik.cjs");
|
|
4
|
+
const isEditing = require("../../../functions/is-editing.qwik.cjs");
|
|
5
|
+
const isPreviewing = require("../../../functions/is-previewing.qwik.cjs");
|
|
6
|
+
const SDKS_USING_ELEMENT_REF_APPROACH = [
|
|
7
|
+
"svelte",
|
|
8
|
+
"qwik",
|
|
9
|
+
"vue"
|
|
10
|
+
];
|
|
11
|
+
const needsElementRefDivForEditing = () => {
|
|
12
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(target.TARGET) && (isEditing.isEditing() || isPreviewing.isPreviewing());
|
|
13
|
+
};
|
|
14
|
+
exports.SDKS_USING_ELEMENT_REF_APPROACH = SDKS_USING_ELEMENT_REF_APPROACH;
|
|
15
|
+
exports.needsElementRefDivForEditing = needsElementRefDivForEditing;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TARGET } from "../../../constants/target.qwik.mjs";
|
|
2
|
+
import { isEditing } from "../../../functions/is-editing.qwik.mjs";
|
|
3
|
+
import { isPreviewing } from "../../../functions/is-previewing.qwik.mjs";
|
|
4
|
+
const SDKS_USING_ELEMENT_REF_APPROACH = [
|
|
5
|
+
"svelte",
|
|
6
|
+
"qwik",
|
|
7
|
+
"vue"
|
|
8
|
+
];
|
|
9
|
+
const needsElementRefDivForEditing = () => {
|
|
10
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
SDKS_USING_ELEMENT_REF_APPROACH,
|
|
14
|
+
needsElementRefDivForEditing
|
|
15
|
+
};
|
|
@@ -17,6 +17,7 @@ const canTrack = require("../../../helpers/canTrack.qwik.cjs");
|
|
|
17
17
|
const subscribeToEditor = require("../../../helpers/subscribe-to-editor.qwik.cjs");
|
|
18
18
|
const initEditing = require("../../../scripts/init-editing.qwik.cjs");
|
|
19
19
|
const animator = require("../../block/animator.qwik.cjs");
|
|
20
|
+
const enableEditor_helpers = require("./enable-editor.helpers.qwik.cjs");
|
|
20
21
|
const styles_helpers = require("./styles.helpers.qwik.cjs");
|
|
21
22
|
const mergeNewRootState = function mergeNewRootState2(props, state, showContentProps, elementRef, newData) {
|
|
22
23
|
var _a, _b;
|
|
@@ -170,9 +171,11 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
170
171
|
} : {}
|
|
171
172
|
});
|
|
172
173
|
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
173
|
-
var _a2;
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
var _a2, _b2;
|
|
175
|
+
if (!props2.model || !((_a2 = registeredComponent.models) == null ? void 0 : _a2.length) || registeredComponent.models.includes(props2.model)) {
|
|
176
|
+
const message = registerComponent.createRegisterComponentMessage(registeredComponent);
|
|
177
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage(message, "*");
|
|
178
|
+
}
|
|
176
179
|
});
|
|
177
180
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, showContentProps2, elementRef2));
|
|
178
181
|
}, "EnableEditor_component_useOn_Qs8c0yql2i0", [
|
|
@@ -289,7 +292,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
289
292
|
state
|
|
290
293
|
]));
|
|
291
294
|
return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
292
|
-
children: props.builderContextSignal.content ? /* @__PURE__ */ qwik._jsxC(state.ContentWrapper, {
|
|
295
|
+
children: props.builderContextSignal.content || enableEditor_helpers.needsElementRefDivForEditing() ? /* @__PURE__ */ qwik._jsxC(state.ContentWrapper, {
|
|
293
296
|
get apiKey() {
|
|
294
297
|
return props.apiKey;
|
|
295
298
|
},
|
|
@@ -320,6 +323,9 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
320
323
|
return props.model;
|
|
321
324
|
},
|
|
322
325
|
className: styles_helpers.getWrapperClassName(((_a = props.content) == null ? void 0 : _a.testVariationId) || ((_b = props.content) == null ? void 0 : _b.id)),
|
|
326
|
+
style: {
|
|
327
|
+
display: !props.builderContextSignal.content && enableEditor_helpers.needsElementRefDivForEditing() ? "none" : void 0
|
|
328
|
+
},
|
|
323
329
|
...showContentProps.value,
|
|
324
330
|
...props.contentWrapperProps,
|
|
325
331
|
children: /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "06_0"),
|
|
@@ -15,6 +15,7 @@ import { getDefaultCanTrack } from "../../../helpers/canTrack.qwik.mjs";
|
|
|
15
15
|
import { createEditorListener } from "../../../helpers/subscribe-to-editor.qwik.mjs";
|
|
16
16
|
import { registerInsertMenu, setupBrowserForEditing } from "../../../scripts/init-editing.qwik.mjs";
|
|
17
17
|
import { triggerAnimation } from "../../block/animator.qwik.mjs";
|
|
18
|
+
import { needsElementRefDivForEditing } from "./enable-editor.helpers.qwik.mjs";
|
|
18
19
|
import { getWrapperClassName } from "./styles.helpers.qwik.mjs";
|
|
19
20
|
const mergeNewRootState = function mergeNewRootState2(props, state, showContentProps, elementRef, newData) {
|
|
20
21
|
var _a, _b;
|
|
@@ -168,9 +169,11 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
168
169
|
} : {}
|
|
169
170
|
});
|
|
170
171
|
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
171
|
-
var _a2;
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
var _a2, _b2;
|
|
173
|
+
if (!props2.model || !((_a2 = registeredComponent.models) == null ? void 0 : _a2.length) || registeredComponent.models.includes(props2.model)) {
|
|
174
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
175
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage(message, "*");
|
|
176
|
+
}
|
|
174
177
|
});
|
|
175
178
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, showContentProps2, elementRef2));
|
|
176
179
|
}, "EnableEditor_component_useOn_Qs8c0yql2i0", [
|
|
@@ -287,7 +290,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
287
290
|
state
|
|
288
291
|
]));
|
|
289
292
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
290
|
-
children: props.builderContextSignal.content ? /* @__PURE__ */ _jsxC(state.ContentWrapper, {
|
|
293
|
+
children: props.builderContextSignal.content || needsElementRefDivForEditing() ? /* @__PURE__ */ _jsxC(state.ContentWrapper, {
|
|
291
294
|
get apiKey() {
|
|
292
295
|
return props.apiKey;
|
|
293
296
|
},
|
|
@@ -318,6 +321,9 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
318
321
|
return props.model;
|
|
319
322
|
},
|
|
320
323
|
className: getWrapperClassName(((_a = props.content) == null ? void 0 : _a.testVariationId) || ((_b = props.content) == null ? void 0 : _b.id)),
|
|
324
|
+
style: {
|
|
325
|
+
display: !props.builderContextSignal.content && needsElementRefDivForEditing() ? "none" : void 0
|
|
326
|
+
},
|
|
321
327
|
...showContentProps.value,
|
|
322
328
|
...props.contentWrapperProps,
|
|
323
329
|
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0"),
|
|
@@ -13,7 +13,7 @@ const enableEditor = require("./components/enable-editor.qwik.cjs");
|
|
|
13
13
|
const styles = require("./components/styles.qwik.cjs");
|
|
14
14
|
const content_helpers = require("./content.helpers.qwik.cjs");
|
|
15
15
|
const ContentComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
16
|
-
var _a, _b
|
|
16
|
+
var _a, _b;
|
|
17
17
|
qwik._jsxBranch();
|
|
18
18
|
const state = qwik.useStore({
|
|
19
19
|
builderContextSignal: {
|
|
@@ -34,13 +34,7 @@ const ContentComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.
|
|
|
34
34
|
apiVersion: props.apiVersion,
|
|
35
35
|
componentInfos: [
|
|
36
36
|
...builderRegisteredComponents.getDefaultRegisteredComponents(),
|
|
37
|
-
...
|
|
38
|
-
if (!(models == null ? void 0 : models.length))
|
|
39
|
-
return true;
|
|
40
|
-
if (!props.model)
|
|
41
|
-
return true;
|
|
42
|
-
return models.includes(props.model);
|
|
43
|
-
})) || []
|
|
37
|
+
...props.customComponents || []
|
|
44
38
|
].reduce((acc, { component: _, ...info }) => ({
|
|
45
39
|
...acc,
|
|
46
40
|
[info.name]: registerComponent.serializeIncludingFunctions(info)
|
|
@@ -48,17 +42,12 @@ const ContentComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.
|
|
|
48
42
|
inheritedStyles: {},
|
|
49
43
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
50
44
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
51
|
-
nonce: props.nonce || ""
|
|
45
|
+
nonce: props.nonce || "",
|
|
46
|
+
model: props.model || ""
|
|
52
47
|
},
|
|
53
48
|
registeredComponents: [
|
|
54
49
|
...builderRegisteredComponents.getDefaultRegisteredComponents(),
|
|
55
|
-
...
|
|
56
|
-
if (!(models == null ? void 0 : models.length))
|
|
57
|
-
return true;
|
|
58
|
-
if (!props.model)
|
|
59
|
-
return true;
|
|
60
|
-
return models.includes(props.model);
|
|
61
|
-
})) || []
|
|
50
|
+
...props.customComponents || []
|
|
62
51
|
].reduce((acc, { component, ...info }) => ({
|
|
63
52
|
...acc,
|
|
64
53
|
[info.name]: {
|
|
@@ -68,9 +57,9 @@ const ContentComponent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.
|
|
|
68
57
|
}), {}),
|
|
69
58
|
scriptStr: helpers.getUpdateVariantVisibilityScript({
|
|
70
59
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
71
|
-
variationId: (
|
|
60
|
+
variationId: (_a = props.content) == null ? void 0 : _a.testVariationId,
|
|
72
61
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
73
|
-
contentId: (
|
|
62
|
+
contentId: (_b = props.content) == null ? void 0 : _b.id
|
|
74
63
|
})
|
|
75
64
|
}, {
|
|
76
65
|
deep: true
|
|
@@ -11,7 +11,7 @@ import { EnableEditor } from "./components/enable-editor.qwik.mjs";
|
|
|
11
11
|
import { ContentStyles } from "./components/styles.qwik.mjs";
|
|
12
12
|
import { getContentInitialValue, getRootStateInitialValue } from "./content.helpers.qwik.mjs";
|
|
13
13
|
const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
14
|
-
var _a, _b
|
|
14
|
+
var _a, _b;
|
|
15
15
|
_jsxBranch();
|
|
16
16
|
const state = useStore({
|
|
17
17
|
builderContextSignal: {
|
|
@@ -32,13 +32,7 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
32
32
|
apiVersion: props.apiVersion,
|
|
33
33
|
componentInfos: [
|
|
34
34
|
...getDefaultRegisteredComponents(),
|
|
35
|
-
...
|
|
36
|
-
if (!(models == null ? void 0 : models.length))
|
|
37
|
-
return true;
|
|
38
|
-
if (!props.model)
|
|
39
|
-
return true;
|
|
40
|
-
return models.includes(props.model);
|
|
41
|
-
})) || []
|
|
35
|
+
...props.customComponents || []
|
|
42
36
|
].reduce((acc, { component: _, ...info }) => ({
|
|
43
37
|
...acc,
|
|
44
38
|
[info.name]: serializeIncludingFunctions(info)
|
|
@@ -46,17 +40,12 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
46
40
|
inheritedStyles: {},
|
|
47
41
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
48
42
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
49
|
-
nonce: props.nonce || ""
|
|
43
|
+
nonce: props.nonce || "",
|
|
44
|
+
model: props.model || ""
|
|
50
45
|
},
|
|
51
46
|
registeredComponents: [
|
|
52
47
|
...getDefaultRegisteredComponents(),
|
|
53
|
-
...
|
|
54
|
-
if (!(models == null ? void 0 : models.length))
|
|
55
|
-
return true;
|
|
56
|
-
if (!props.model)
|
|
57
|
-
return true;
|
|
58
|
-
return models.includes(props.model);
|
|
59
|
-
})) || []
|
|
48
|
+
...props.customComponents || []
|
|
60
49
|
].reduce((acc, { component, ...info }) => ({
|
|
61
50
|
...acc,
|
|
62
51
|
[info.name]: {
|
|
@@ -66,9 +55,9 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
66
55
|
}), {}),
|
|
67
56
|
scriptStr: getUpdateVariantVisibilityScript({
|
|
68
57
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
69
|
-
variationId: (
|
|
58
|
+
variationId: (_a = props.content) == null ? void 0 : _a.testVariationId,
|
|
70
59
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
71
|
-
contentId: (
|
|
60
|
+
contentId: (_b = props.content) == null ? void 0 : _b.id
|
|
72
61
|
})
|
|
73
62
|
}, {
|
|
74
63
|
deep: true
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const IMAGE_FILE_TYPES = [
|
|
4
|
+
"jpeg",
|
|
5
|
+
"jpg",
|
|
6
|
+
"png",
|
|
7
|
+
"svg",
|
|
8
|
+
"webp",
|
|
9
|
+
"gif",
|
|
10
|
+
"jfif",
|
|
11
|
+
"pjpeg",
|
|
12
|
+
"pjp",
|
|
13
|
+
"apng",
|
|
14
|
+
"avif",
|
|
15
|
+
"tif",
|
|
16
|
+
"tiff",
|
|
17
|
+
"heif",
|
|
18
|
+
"bmp",
|
|
19
|
+
"eps",
|
|
20
|
+
"raw",
|
|
21
|
+
"cr2",
|
|
22
|
+
"nef",
|
|
23
|
+
"orf",
|
|
24
|
+
"sr2",
|
|
25
|
+
"psd",
|
|
26
|
+
"heic",
|
|
27
|
+
"dib",
|
|
28
|
+
"ai"
|
|
29
|
+
];
|
|
30
|
+
const VIDEO_FILE_TYPES = [
|
|
31
|
+
"mp4",
|
|
32
|
+
"webm",
|
|
33
|
+
"mkv",
|
|
34
|
+
"flv",
|
|
35
|
+
"vob",
|
|
36
|
+
"ogv",
|
|
37
|
+
"ogg",
|
|
38
|
+
"drc",
|
|
39
|
+
"gif",
|
|
40
|
+
"gifv",
|
|
41
|
+
"mng",
|
|
42
|
+
"avi",
|
|
43
|
+
"mov",
|
|
44
|
+
"qt",
|
|
45
|
+
"mts",
|
|
46
|
+
"m2ts",
|
|
47
|
+
"ts",
|
|
48
|
+
"wmv",
|
|
49
|
+
"yuv",
|
|
50
|
+
"rm",
|
|
51
|
+
"rmvb",
|
|
52
|
+
"viv",
|
|
53
|
+
"asf",
|
|
54
|
+
"amv",
|
|
55
|
+
"m4p",
|
|
56
|
+
"mpeg",
|
|
57
|
+
"mpe",
|
|
58
|
+
"m2v",
|
|
59
|
+
"m4v",
|
|
60
|
+
"svi",
|
|
61
|
+
"3gp",
|
|
62
|
+
"3g2",
|
|
63
|
+
"mxf",
|
|
64
|
+
"roq",
|
|
65
|
+
"nsv",
|
|
66
|
+
"f4v",
|
|
67
|
+
"f4p",
|
|
68
|
+
"f4a",
|
|
69
|
+
"f4b"
|
|
70
|
+
];
|
|
71
|
+
exports.IMAGE_FILE_TYPES = IMAGE_FILE_TYPES;
|
|
72
|
+
exports.VIDEO_FILE_TYPES = VIDEO_FILE_TYPES;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const IMAGE_FILE_TYPES = [
|
|
2
|
+
"jpeg",
|
|
3
|
+
"jpg",
|
|
4
|
+
"png",
|
|
5
|
+
"svg",
|
|
6
|
+
"webp",
|
|
7
|
+
"gif",
|
|
8
|
+
"jfif",
|
|
9
|
+
"pjpeg",
|
|
10
|
+
"pjp",
|
|
11
|
+
"apng",
|
|
12
|
+
"avif",
|
|
13
|
+
"tif",
|
|
14
|
+
"tiff",
|
|
15
|
+
"heif",
|
|
16
|
+
"bmp",
|
|
17
|
+
"eps",
|
|
18
|
+
"raw",
|
|
19
|
+
"cr2",
|
|
20
|
+
"nef",
|
|
21
|
+
"orf",
|
|
22
|
+
"sr2",
|
|
23
|
+
"psd",
|
|
24
|
+
"heic",
|
|
25
|
+
"dib",
|
|
26
|
+
"ai"
|
|
27
|
+
];
|
|
28
|
+
const VIDEO_FILE_TYPES = [
|
|
29
|
+
"mp4",
|
|
30
|
+
"webm",
|
|
31
|
+
"mkv",
|
|
32
|
+
"flv",
|
|
33
|
+
"vob",
|
|
34
|
+
"ogv",
|
|
35
|
+
"ogg",
|
|
36
|
+
"drc",
|
|
37
|
+
"gif",
|
|
38
|
+
"gifv",
|
|
39
|
+
"mng",
|
|
40
|
+
"avi",
|
|
41
|
+
"mov",
|
|
42
|
+
"qt",
|
|
43
|
+
"mts",
|
|
44
|
+
"m2ts",
|
|
45
|
+
"ts",
|
|
46
|
+
"wmv",
|
|
47
|
+
"yuv",
|
|
48
|
+
"rm",
|
|
49
|
+
"rmvb",
|
|
50
|
+
"viv",
|
|
51
|
+
"asf",
|
|
52
|
+
"amv",
|
|
53
|
+
"m4p",
|
|
54
|
+
"mpeg",
|
|
55
|
+
"mpe",
|
|
56
|
+
"m2v",
|
|
57
|
+
"m4v",
|
|
58
|
+
"svi",
|
|
59
|
+
"3gp",
|
|
60
|
+
"3g2",
|
|
61
|
+
"mxf",
|
|
62
|
+
"roq",
|
|
63
|
+
"nsv",
|
|
64
|
+
"f4v",
|
|
65
|
+
"f4p",
|
|
66
|
+
"f4a",
|
|
67
|
+
"f4b"
|
|
68
|
+
];
|
|
69
|
+
export {
|
|
70
|
+
IMAGE_FILE_TYPES,
|
|
71
|
+
VIDEO_FILE_TYPES
|
|
72
|
+
};
|