@builder.io/sdk-solid 0.4.5 → 0.5.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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/blocks/BaseText.jsx +1 -1
- package/src/blocks/button/button.jsx +5 -3
- package/src/blocks/button/component-info.js +16 -22
- package/src/blocks/columns/columns.jsx +12 -21
- package/src/blocks/columns/component-info.js +203 -226
- package/src/blocks/custom-code/component-info.js +19 -25
- package/src/blocks/embed/component-info.js +31 -37
- package/src/blocks/embed/helpers.js +3 -9
- package/src/blocks/form/component-info.js +174 -212
- package/src/blocks/form/form.jsx +1 -268
- package/src/blocks/fragment/component-info.js +1 -3
- package/src/blocks/helpers.js +27 -0
- package/src/blocks/image/component-info.js +105 -133
- package/src/blocks/image/image.helpers.js +3 -5
- package/src/blocks/img/component-info.js +8 -12
- package/src/blocks/img/img.jsx +2 -0
- package/src/blocks/input/component-info.js +29 -57
- package/src/blocks/input/input.jsx +2 -0
- package/src/blocks/raw-text/component-info.js +7 -11
- package/src/blocks/raw-text/raw-text.jsx +2 -2
- package/src/blocks/section/component-info.js +24 -31
- package/src/blocks/section/section.jsx +3 -0
- package/src/blocks/select/component-info.js +34 -48
- package/src/blocks/select/select.jsx +2 -0
- package/src/blocks/submit-button/component-info.js +6 -10
- package/src/blocks/submit-button/submit-button.jsx +3 -1
- package/src/blocks/symbol/component-info.js +30 -37
- package/src/blocks/symbol/symbol.helpers.js +60 -0
- package/src/blocks/symbol/symbol.jsx +31 -68
- package/src/blocks/text/component-info.js +10 -13
- package/src/blocks/text/text.jsx +1 -1
- package/src/blocks/textarea/component-info.js +22 -30
- package/src/blocks/textarea/textarea.jsx +3 -0
- package/src/blocks/video/component-info.js +74 -96
- package/src/blocks/video/video.jsx +1 -0
- package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
- package/src/components/{render-block/render-block.jsx → block/block.jsx} +65 -80
- package/src/components/{render-block → block/components}/block-styles.jsx +16 -16
- package/src/components/block/components/block-wrapper.jsx +50 -0
- package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
- package/src/components/block/components/component-ref/component-ref.jsx +58 -0
- package/src/components/block/components/interactive-element.jsx +30 -0
- package/src/components/block/components/repeated-block.jsx +20 -0
- package/src/components/blocks/blocks-wrapper.jsx +66 -0
- package/src/components/blocks/blocks.jsx +57 -0
- package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +86 -175
- package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
- package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +4 -4
- package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
- package/src/components/content/content.jsx +136 -0
- package/src/components/content/index.js +2 -0
- package/src/components/content/wrap-component-ref.js +2 -0
- package/src/components/{render-content-variants/render-content-variants.jsx → content-variants/content-variants.jsx} +19 -22
- package/src/components/{render-content-variants → content-variants}/helpers.js +28 -40
- package/src/constants/builder-registered-components.js +34 -25
- package/src/constants/device-sizes.js +6 -6
- package/src/constants/sdk-version.js +1 -1
- package/src/context/builder.context.js +1 -1
- package/src/context/components.context.js +5 -0
- package/src/functions/apply-patch-with-mutation.js +66 -0
- package/src/functions/camel-to-kebab-case.js +2 -4
- package/src/functions/evaluate/acorn.js +1595 -0
- package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
- package/src/functions/evaluate/index.js +2 -0
- package/src/functions/evaluate/interpreter.js +2801 -0
- package/src/functions/evaluate/non-node-runtime.js +92 -0
- package/src/functions/evaluate/types.js +0 -0
- package/src/functions/event-handler-name.js +2 -4
- package/src/functions/extract-text-styles.js +4 -12
- package/src/functions/fast-clone.js +2 -4
- package/src/functions/get-block-actions-handler.js +3 -5
- package/src/functions/get-block-actions.js +15 -4
- package/src/functions/get-block-component-options.js +11 -12
- package/src/functions/get-block-properties.js +29 -19
- package/src/functions/get-builder-search-params/index.js +5 -10
- package/src/functions/get-content/generate-content-url.js +17 -19
- package/src/functions/get-content/index.js +43 -29
- package/src/functions/get-fetch.js +1 -3
- package/src/functions/get-global-this.js +1 -3
- package/src/functions/get-processed-block.js +12 -13
- package/src/functions/get-react-native-block-styles.js +11 -12
- package/src/functions/if-target.js +1 -3
- package/src/functions/is-browser.js +1 -3
- package/src/functions/is-editing.js +1 -3
- package/src/functions/is-iframe.js +1 -3
- package/src/functions/is-non-node-server.js +9 -0
- package/src/functions/is-previewing.js +1 -3
- package/src/functions/on-change.js +1 -4
- package/src/functions/register-component.js +34 -42
- package/src/functions/register.js +1 -3
- package/src/functions/sanitize-react-native-block-styles.js +22 -17
- package/src/functions/set-editor-settings.js +1 -3
- package/src/functions/set.js +1 -3
- package/src/functions/track/helpers.js +3 -5
- package/src/functions/track/index.js +45 -43
- package/src/functions/track/interaction.js +11 -7
- package/src/functions/transform-block-properties.js +1 -3
- package/src/functions/transform-block.js +1 -3
- package/src/helpers/ab-tests.js +45 -28
- package/src/helpers/canTrack.js +3 -5
- package/src/helpers/cookie.js +15 -24
- package/src/helpers/css.js +3 -7
- package/src/helpers/flatten.js +15 -18
- package/src/helpers/localStorage.js +1 -4
- package/src/helpers/logger.js +1 -3
- package/src/helpers/nullable.js +2 -4
- package/src/helpers/preview-lru-cache/get.js +8 -0
- package/src/helpers/preview-lru-cache/helpers.js +10 -0
- package/src/helpers/preview-lru-cache/init.js +10 -0
- package/src/helpers/preview-lru-cache/set.js +35 -0
- package/src/helpers/preview-lru-cache/types.js +0 -0
- package/src/helpers/sessionId.js +14 -11
- package/src/helpers/time.js +1 -3
- package/src/helpers/url.js +2 -4
- package/src/helpers/uuid.js +4 -6
- package/src/helpers/visitorId.js +8 -7
- package/src/index-helpers/blocks-exports.js +3 -14
- package/src/index-helpers/top-of-file.js +1 -3
- package/src/index.js +2 -17
- package/src/scripts/init-editing.js +62 -48
- package/src/types/api-version.js +1 -3
- package/src/types/builder-props.js +0 -0
- package/src/blocks/util.js +0 -8
- package/src/components/render-block/render-component.jsx +0 -40
- package/src/components/render-block/render-repeated-block.jsx +0 -16
- package/src/components/render-blocks.jsx +0 -100
- package/src/components/render-content/builder-editing.jsx +0 -5
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/wrap-component-ref.js +0 -4
- package/src/functions/evaluate.test.js +0 -17
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-content/generate-content-url.test.js +0 -97
- package/src/functions/get-processed-block.test.js +0 -34
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/set.test.js +0 -16
- package/src/helpers/url.test.js +0 -21
- /package/src/components/{render-block → block}/types.js +0 -0
- /package/src/components/{render-content/render-content.types.js → content/content.types.js} +0 -0
- /package/src/components/{render-content-variants/render-content-variants.types.js → content-variants/content-variants.types.js} +0 -0
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
getScriptString,
|
|
6
6
|
getVariants,
|
|
7
7
|
getVariantsScriptString,
|
|
8
|
-
} from "./helpers";
|
|
9
|
-
import
|
|
10
|
-
import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
8
|
+
} from "./helpers.js";
|
|
9
|
+
import ContentComponent from "../content/content.jsx";
|
|
10
|
+
import { getDefaultCanTrack } from "../../helpers/canTrack.js";
|
|
11
11
|
import InlinedStyles from "../inlined-styles.jsx";
|
|
12
|
-
import { handleABTestingSync } from "../../helpers/ab-tests";
|
|
12
|
+
import { handleABTestingSync } from "../../helpers/ab-tests.js";
|
|
13
13
|
import InlinedScript from "../inlined-script.jsx";
|
|
14
|
-
import { TARGET } from "../../constants/target";
|
|
14
|
+
import { TARGET } from "../../constants/target.js";
|
|
15
15
|
|
|
16
|
-
function
|
|
16
|
+
function ContentVariants(props) {
|
|
17
17
|
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
18
18
|
checkShouldRunVariants({
|
|
19
19
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
@@ -21,29 +21,26 @@ function RenderContentVariants(props) {
|
|
|
21
21
|
})
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
getVariantsScriptString(
|
|
24
|
+
function variantScriptStr() {
|
|
25
|
+
return getVariantsScriptString(
|
|
26
26
|
getVariants(props.content).map((value) => ({
|
|
27
27
|
id: value.testVariationId,
|
|
28
28
|
testRatio: value.testRatio,
|
|
29
29
|
})),
|
|
30
30
|
props.content?.id || ""
|
|
31
|
-
)
|
|
32
|
-
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
getVariants(props.content)
|
|
34
|
+
function hideVariantsStyleString() {
|
|
35
|
+
return getVariants(props.content)
|
|
36
36
|
.map((value) => `.variant-${value.testVariationId} { display: none; } `)
|
|
37
|
-
.join("")
|
|
38
|
-
|
|
37
|
+
.join("");
|
|
38
|
+
}
|
|
39
39
|
|
|
40
40
|
onMount(() => {
|
|
41
41
|
/**
|
|
42
42
|
* We unmount the non-winning variants post-hydration in Vue.
|
|
43
43
|
*/
|
|
44
|
-
if (TARGET === "vue2" || TARGET === "vue3") {
|
|
45
|
-
setShouldRenderVariants(false);
|
|
46
|
-
}
|
|
47
44
|
});
|
|
48
45
|
|
|
49
46
|
return (
|
|
@@ -61,7 +58,7 @@ function RenderContentVariants(props) {
|
|
|
61
58
|
{(variant, _index) => {
|
|
62
59
|
const index = _index();
|
|
63
60
|
return (
|
|
64
|
-
<
|
|
61
|
+
<ContentComponent
|
|
65
62
|
key={variant.testVariationId}
|
|
66
63
|
content={variant}
|
|
67
64
|
showContent={false}
|
|
@@ -77,12 +74,12 @@ function RenderContentVariants(props) {
|
|
|
77
74
|
includeRefs={props.includeRefs}
|
|
78
75
|
enrich={props.enrich}
|
|
79
76
|
isSsrAbTest={shouldRenderVariants()}
|
|
80
|
-
></
|
|
77
|
+
></ContentComponent>
|
|
81
78
|
);
|
|
82
79
|
}}
|
|
83
80
|
</For>
|
|
84
81
|
</Show>
|
|
85
|
-
<
|
|
82
|
+
<ContentComponent
|
|
86
83
|
{...{}}
|
|
87
84
|
content={
|
|
88
85
|
shouldRenderVariants()
|
|
@@ -105,9 +102,9 @@ function RenderContentVariants(props) {
|
|
|
105
102
|
includeRefs={props.includeRefs}
|
|
106
103
|
enrich={props.enrich}
|
|
107
104
|
isSsrAbTest={shouldRenderVariants()}
|
|
108
|
-
></
|
|
105
|
+
></ContentComponent>
|
|
109
106
|
</>
|
|
110
107
|
);
|
|
111
108
|
}
|
|
112
109
|
|
|
113
|
-
export default
|
|
110
|
+
export default ContentVariants;
|
|
@@ -4,22 +4,23 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value
|
|
12
|
+
}) : obj[key] = value;
|
|
8
13
|
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
14
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
17
18
|
return a;
|
|
18
19
|
};
|
|
19
20
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { TARGET } from "../../constants/target";
|
|
21
|
-
import { isBrowser } from "../../functions/is-browser";
|
|
22
|
-
const getVariants =
|
|
21
|
+
import { TARGET } from "../../constants/target.js";
|
|
22
|
+
import { isBrowser } from "../../functions/is-browser.js";
|
|
23
|
+
const getVariants = content => Object.values((content == null ? void 0 : content.variations) || {}).map(variant => __spreadProps(__spreadValues({}, variant), {
|
|
23
24
|
testVariationId: variant.id,
|
|
24
25
|
id: content == null ? void 0 : content.id
|
|
25
26
|
}));
|
|
@@ -28,16 +29,11 @@ const checkShouldRunVariants = ({
|
|
|
28
29
|
content
|
|
29
30
|
}) => {
|
|
30
31
|
const hasVariants = getVariants(content).length > 0;
|
|
31
|
-
if (TARGET === "reactNative")
|
|
32
|
-
|
|
33
|
-
if (!
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
return false;
|
|
37
|
-
if (TARGET === "vue2" || TARGET === "vue3")
|
|
38
|
-
return true;
|
|
39
|
-
if (isBrowser())
|
|
40
|
-
return false;
|
|
32
|
+
if (TARGET === "reactNative") return false;
|
|
33
|
+
if (!hasVariants) return false;
|
|
34
|
+
if (!canTrack) return false;
|
|
35
|
+
if (TARGET === "vue2" || TARGET === "vue3") return true;
|
|
36
|
+
if (isBrowser()) return false;
|
|
41
37
|
return true;
|
|
42
38
|
};
|
|
43
39
|
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
@@ -57,16 +53,14 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
57
53
|
const ca = document.cookie.split(";");
|
|
58
54
|
for (let i = 0; i < ca.length; i++) {
|
|
59
55
|
let c = ca[i];
|
|
60
|
-
while (c.charAt(0) === " ")
|
|
61
|
-
|
|
62
|
-
if (c.indexOf(nameEQ) === 0)
|
|
63
|
-
return c.substring(nameEQ.length, c.length);
|
|
56
|
+
while (c.charAt(0) === " ") c = c.substring(1, c.length);
|
|
57
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
64
58
|
}
|
|
65
59
|
return null;
|
|
66
60
|
}
|
|
67
61
|
const cookieName = `builder.tests.${contentId}`;
|
|
68
62
|
const variantInCookie = getCookie(cookieName);
|
|
69
|
-
const availableIDs = variants.map(
|
|
63
|
+
const availableIDs = variants.map(vr => vr.id).concat(contentId);
|
|
70
64
|
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
71
65
|
return variantInCookie;
|
|
72
66
|
}
|
|
@@ -91,7 +85,9 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
91
85
|
const thisScriptEl = document.currentScript;
|
|
92
86
|
thisScriptEl == null ? void 0 : thisScriptEl.remove();
|
|
93
87
|
} else {
|
|
94
|
-
const newStyleStr = variants.concat({
|
|
88
|
+
const newStyleStr = variants.concat({
|
|
89
|
+
id: contentId
|
|
90
|
+
}).filter(variant => variant.id !== winningVariantId).map(value => {
|
|
95
91
|
return `.variant-${value.id} { display: none; }
|
|
96
92
|
`;
|
|
97
93
|
}).join("");
|
|
@@ -108,10 +104,8 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
108
104
|
const ca = document.cookie.split(";");
|
|
109
105
|
for (let i = 0; i < ca.length; i++) {
|
|
110
106
|
let c = ca[i];
|
|
111
|
-
while (c.charAt(0) === " ")
|
|
112
|
-
|
|
113
|
-
if (c.indexOf(nameEQ) === 0)
|
|
114
|
-
return c.substring(nameEQ.length, c.length);
|
|
107
|
+
while (c.charAt(0) === " ") c = c.substring(1, c.length);
|
|
108
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
115
109
|
}
|
|
116
110
|
return null;
|
|
117
111
|
}
|
|
@@ -138,7 +132,7 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
138
132
|
}
|
|
139
133
|
return;
|
|
140
134
|
}
|
|
141
|
-
const getIsHydrationTarget =
|
|
135
|
+
const getIsHydrationTarget = target => target === "react" || target === "reactNative";
|
|
142
136
|
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
143
137
|
const AB_TEST_FN_NAME = "builderIoAbTest";
|
|
144
138
|
const CONTENT_FN_NAME = "builderIoRenderContent";
|
|
@@ -161,10 +155,4 @@ const getRenderContentScriptString = ({
|
|
|
161
155
|
return `
|
|
162
156
|
window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
|
|
163
157
|
};
|
|
164
|
-
export {
|
|
165
|
-
checkShouldRunVariants,
|
|
166
|
-
getRenderContentScriptString,
|
|
167
|
-
getScriptString,
|
|
168
|
-
getVariants,
|
|
169
|
-
getVariantsScriptString
|
|
170
|
-
};
|
|
158
|
+
export { checkShouldRunVariants, getRenderContentScriptString, getScriptString, getVariants, getVariantsScriptString }
|
|
@@ -2,16 +2,17 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value
|
|
10
|
+
}) : obj[key] = value;
|
|
6
11
|
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
12
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
15
16
|
return a;
|
|
16
17
|
};
|
|
17
18
|
import { default as Button } from "../blocks/button/button";
|
|
@@ -36,19 +37,27 @@ import { default as Img } from "../blocks/img/img";
|
|
|
36
37
|
import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.js";
|
|
37
38
|
import { default as customCode } from "../blocks/custom-code/custom-code";
|
|
38
39
|
import { componentInfo as customCodeInfo } from "../blocks/custom-code/component-info.js";
|
|
39
|
-
const getDefaultRegisteredComponents = () => [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
const getDefaultRegisteredComponents = () => [__spreadValues({
|
|
41
|
+
component: Button
|
|
42
|
+
}, buttonComponentInfo), __spreadValues({
|
|
43
|
+
component: Columns
|
|
44
|
+
}, columnsComponentInfo), __spreadValues({
|
|
45
|
+
component: customCode
|
|
46
|
+
}, customCodeInfo), __spreadValues({
|
|
47
|
+
component: embed
|
|
48
|
+
}, embedComponentInfo), __spreadValues({
|
|
49
|
+
component: Fragment
|
|
50
|
+
}, fragmentComponentInfo), __spreadValues({
|
|
51
|
+
component: Image
|
|
52
|
+
}, imageComponentInfo), __spreadValues({
|
|
53
|
+
component: Img
|
|
54
|
+
}, imgComponentInfo), __spreadValues({
|
|
55
|
+
component: Section
|
|
56
|
+
}, sectionComponentInfo), __spreadValues({
|
|
57
|
+
component: Symbol
|
|
58
|
+
}, symbolComponentInfo), __spreadValues({
|
|
59
|
+
component: Text
|
|
60
|
+
}, textComponentInfo), __spreadValues({
|
|
61
|
+
component: Video
|
|
62
|
+
}, videoComponentInfo)];
|
|
63
|
+
export { getDefaultRegisteredComponents }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fastClone } from "../functions/fast-clone";
|
|
1
|
+
import { fastClone } from "../functions/fast-clone.js";
|
|
2
2
|
const SIZES = {
|
|
3
3
|
small: {
|
|
4
4
|
min: 320,
|
|
@@ -17,7 +17,10 @@ const SIZES = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
20
|
-
const getSizesForBreakpoints = ({
|
|
20
|
+
const getSizesForBreakpoints = ({
|
|
21
|
+
small,
|
|
22
|
+
medium
|
|
23
|
+
}) => {
|
|
21
24
|
const newSizes = fastClone(SIZES);
|
|
22
25
|
if (!small || !medium) {
|
|
23
26
|
return newSizes;
|
|
@@ -42,7 +45,4 @@ const getSizesForBreakpoints = ({ small, medium }) => {
|
|
|
42
45
|
};
|
|
43
46
|
return newSizes;
|
|
44
47
|
};
|
|
45
|
-
export {
|
|
46
|
-
getMaxWidthQueryForSize,
|
|
47
|
-
getSizesForBreakpoints
|
|
48
|
-
};
|
|
48
|
+
export { getMaxWidthQueryForSize, getSizesForBreakpoints }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.5.1"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value
|
|
10
|
+
}) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
18
|
+
const applyPatchWithMinimalMutationChain = (obj, patch, preserveRoot = false) => {
|
|
19
|
+
if (Object(obj) !== obj) {
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
const {
|
|
23
|
+
path,
|
|
24
|
+
op,
|
|
25
|
+
value
|
|
26
|
+
} = patch;
|
|
27
|
+
const pathArr = path.split(/\//);
|
|
28
|
+
if (pathArr[0] === "") {
|
|
29
|
+
pathArr.shift();
|
|
30
|
+
}
|
|
31
|
+
const newObj = preserveRoot ? obj : __spreadValues({}, obj);
|
|
32
|
+
let objPart = newObj;
|
|
33
|
+
for (let i = 0; i < pathArr.length; i++) {
|
|
34
|
+
const isLast = i === pathArr.length - 1;
|
|
35
|
+
const property = pathArr[i];
|
|
36
|
+
if (isLast) {
|
|
37
|
+
if (op === "replace") {
|
|
38
|
+
objPart[property] = value;
|
|
39
|
+
} else if (op === "add") {
|
|
40
|
+
const index = Number(property);
|
|
41
|
+
if (Array.isArray(objPart)) {
|
|
42
|
+
if (property === "-") {
|
|
43
|
+
objPart.push(value);
|
|
44
|
+
} else {
|
|
45
|
+
objPart.splice(index, 0, value);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
objPart[property] = value;
|
|
49
|
+
}
|
|
50
|
+
} else if (op === "remove") {
|
|
51
|
+
const index = Number(property);
|
|
52
|
+
if (Array.isArray(objPart)) {
|
|
53
|
+
objPart.splice(index, 1);
|
|
54
|
+
} else {
|
|
55
|
+
delete objPart[property];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
const nextProperty = pathArr[i + 1];
|
|
60
|
+
const newPart = Object(objPart[property]) === objPart[property] ? objPart[property] : String(Number(nextProperty)) === nextProperty ? [] : {};
|
|
61
|
+
objPart = objPart[property] = Array.isArray(newPart) ? [...newPart] : __spreadValues({}, newPart);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return newObj;
|
|
65
|
+
};
|
|
66
|
+
export { applyPatchWithMinimalMutationChain }
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
const camelToKebabCase =
|
|
2
|
-
export {
|
|
3
|
-
camelToKebabCase
|
|
4
|
-
};
|
|
1
|
+
const camelToKebabCase = string => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
2
|
+
export { camelToKebabCase }
|