@builder.io/sdk-solid 0.5.9 → 0.6.0

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.
Files changed (166) hide show
  1. package/README.md +0 -4
  2. package/dist/index.d.ts +51 -0
  3. package/lib/browser/dev.js +4790 -0
  4. package/lib/browser/dev.jsx +4392 -0
  5. package/lib/browser/index.js +4767 -0
  6. package/lib/browser/index.jsx +4374 -0
  7. package/lib/edge/dev.js +7921 -0
  8. package/lib/edge/dev.jsx +7525 -0
  9. package/lib/edge/index.js +7898 -0
  10. package/lib/edge/index.jsx +7507 -0
  11. package/lib/node/dev.js +4790 -0
  12. package/lib/node/dev.jsx +4392 -0
  13. package/lib/node/index.js +4767 -0
  14. package/lib/node/index.jsx +4374 -0
  15. package/package.json +86 -14
  16. package/CHANGELOG.md +0 -102
  17. package/solid-index.jsx +0 -5
  18. package/src/blocks/BaseText.jsx +0 -11
  19. package/src/blocks/button/button.jsx +0 -41
  20. package/src/blocks/button/component-info.js +0 -34
  21. package/src/blocks/columns/columns.jsx +0 -174
  22. package/src/blocks/columns/component-info.js +0 -218
  23. package/src/blocks/custom-code/component-info.js +0 -24
  24. package/src/blocks/custom-code/custom-code.jsx +0 -62
  25. package/src/blocks/embed/component-info.js +0 -37
  26. package/src/blocks/embed/embed.jsx +0 -50
  27. package/src/blocks/embed/helpers.js +0 -3
  28. package/src/blocks/form/component-info.js +0 -223
  29. package/src/blocks/form/form.jsx +0 -5
  30. package/src/blocks/fragment/component-info.js +0 -8
  31. package/src/blocks/fragment/fragment.jsx +0 -5
  32. package/src/blocks/helpers.js +0 -27
  33. package/src/blocks/image/component-info.js +0 -122
  34. package/src/blocks/image/image.helpers.js +0 -46
  35. package/src/blocks/image/image.jsx +0 -122
  36. package/src/blocks/img/component-info.js +0 -15
  37. package/src/blocks/img/img.jsx +0 -20
  38. package/src/blocks/input/component-info.js +0 -45
  39. package/src/blocks/input/input.jsx +0 -22
  40. package/src/blocks/raw-text/component-info.js +0 -11
  41. package/src/blocks/raw-text/raw-text.jsx +0 -10
  42. package/src/blocks/section/component-info.js +0 -41
  43. package/src/blocks/section/section.jsx +0 -26
  44. package/src/blocks/select/component-info.js +0 -44
  45. package/src/blocks/select/select.jsx +0 -30
  46. package/src/blocks/submit-button/component-info.js +0 -23
  47. package/src/blocks/submit-button/submit-button.jsx +0 -11
  48. package/src/blocks/symbol/component-info.js +0 -35
  49. package/src/blocks/symbol/symbol.helpers.js +0 -60
  50. package/src/blocks/symbol/symbol.jsx +0 -64
  51. package/src/blocks/text/component-info.js +0 -20
  52. package/src/blocks/text/text.jsx +0 -14
  53. package/src/blocks/textarea/component-info.js +0 -38
  54. package/src/blocks/textarea/textarea.jsx +0 -16
  55. package/src/blocks/video/component-info.js +0 -83
  56. package/src/blocks/video/video.jsx +0 -61
  57. package/src/components/block/block.helpers.js +0 -99
  58. package/src/components/block/block.jsx +0 -167
  59. package/src/components/block/components/block-styles.jsx +0 -85
  60. package/src/components/block/components/block-wrapper.jsx +0 -50
  61. package/src/components/block/components/component-ref/component-ref.helpers.js +0 -41
  62. package/src/components/block/components/component-ref/component-ref.jsx +0 -59
  63. package/src/components/block/components/interactive-element.jsx +0 -30
  64. package/src/components/block/components/repeated-block.jsx +0 -20
  65. package/src/components/block/types.js +0 -0
  66. package/src/components/blocks/blocks-wrapper.jsx +0 -66
  67. package/src/components/blocks/blocks.jsx +0 -57
  68. package/src/components/content/components/enable-editor.jsx +0 -347
  69. package/src/components/content/components/styles.helpers.js +0 -56
  70. package/src/components/content/components/styles.jsx +0 -36
  71. package/src/components/content/content.helpers.js +0 -48
  72. package/src/components/content/content.jsx +0 -136
  73. package/src/components/content/content.types.js +0 -0
  74. package/src/components/content/index.js +0 -2
  75. package/src/components/content/wrap-component-ref.js +0 -2
  76. package/src/components/content-variants/content-variants.jsx +0 -115
  77. package/src/components/content-variants/content-variants.types.js +0 -0
  78. package/src/components/content-variants/helpers.js +0 -158
  79. package/src/components/inlined-script.jsx +0 -5
  80. package/src/components/inlined-styles.jsx +0 -5
  81. package/src/constants/builder-registered-components.js +0 -63
  82. package/src/constants/device-sizes.js +0 -48
  83. package/src/constants/sdk-version.js +0 -1
  84. package/src/constants/target.js +0 -4
  85. package/src/context/builder.context.js +0 -16
  86. package/src/context/components.context.js +0 -5
  87. package/src/context/types.js +0 -0
  88. package/src/functions/apply-patch-with-mutation.js +0 -66
  89. package/src/functions/camel-to-kebab-case.js +0 -2
  90. package/src/functions/evaluate/browser-runtime/browser.js +0 -40
  91. package/src/functions/evaluate/browser-runtime/index.js +0 -2
  92. package/src/functions/evaluate/evaluate.js +0 -49
  93. package/src/functions/evaluate/helpers.js +0 -15
  94. package/src/functions/evaluate/index.js +0 -2
  95. package/src/functions/evaluate/node-runtime/index.js +0 -2
  96. package/src/functions/evaluate/non-node-runtime/acorn-interpreter.js +0 -2876
  97. package/src/functions/evaluate/non-node-runtime/index.js +0 -18
  98. package/src/functions/evaluate/non-node-runtime/non-node-runtime.js +0 -91
  99. package/src/functions/event-handler-name.js +0 -5
  100. package/src/functions/extract-text-styles.js +0 -14
  101. package/src/functions/fast-clone.js +0 -2
  102. package/src/functions/fetch-builder-props.js +0 -60
  103. package/src/functions/get-block-actions-handler.js +0 -11
  104. package/src/functions/get-block-actions.js +0 -29
  105. package/src/functions/get-block-component-options.js +0 -27
  106. package/src/functions/get-block-properties.js +0 -63
  107. package/src/functions/get-builder-search-params/index.js +0 -33
  108. package/src/functions/get-content/generate-content-url.js +0 -59
  109. package/src/functions/get-content/index.js +0 -116
  110. package/src/functions/get-content/types.js +0 -0
  111. package/src/functions/get-fetch.js +0 -12
  112. package/src/functions/get-global-this.js +0 -16
  113. package/src/functions/get-processed-block.js +0 -74
  114. package/src/functions/get-react-native-block-styles.js +0 -32
  115. package/src/functions/is-browser.js +0 -4
  116. package/src/functions/is-editing.js +0 -6
  117. package/src/functions/is-iframe.js +0 -5
  118. package/src/functions/is-non-node-server.js +0 -9
  119. package/src/functions/is-previewing.js +0 -12
  120. package/src/functions/on-change.js +0 -24
  121. package/src/functions/register-component.js +0 -60
  122. package/src/functions/register.js +0 -27
  123. package/src/functions/sanitize-react-native-block-styles.js +0 -71
  124. package/src/functions/set-editor-settings.js +0 -13
  125. package/src/functions/set.js +0 -9
  126. package/src/functions/track/helpers.js +0 -48
  127. package/src/functions/track/index.js +0 -131
  128. package/src/functions/track/interaction.js +0 -57
  129. package/src/functions/transform-block-properties.js +0 -4
  130. package/src/functions/transform-block.js +0 -4
  131. package/src/helpers/ab-tests.js +0 -158
  132. package/src/helpers/canTrack.js +0 -3
  133. package/src/helpers/cookie.js +0 -77
  134. package/src/helpers/css.js +0 -30
  135. package/src/helpers/flatten.js +0 -31
  136. package/src/helpers/localStorage.js +0 -32
  137. package/src/helpers/logger.js +0 -8
  138. package/src/helpers/nullable.js +0 -2
  139. package/src/helpers/preview-lru-cache/get.js +0 -4
  140. package/src/helpers/preview-lru-cache/helpers.js +0 -0
  141. package/src/helpers/preview-lru-cache/init.js +0 -2
  142. package/src/helpers/preview-lru-cache/set.js +0 -31
  143. package/src/helpers/preview-lru-cache/types.js +0 -0
  144. package/src/helpers/sessionId.js +0 -55
  145. package/src/helpers/time.js +0 -3
  146. package/src/helpers/url.js +0 -11
  147. package/src/helpers/uuid.js +0 -11
  148. package/src/helpers/visitorId.js +0 -35
  149. package/src/index-helpers/blocks-exports.js +0 -13
  150. package/src/index-helpers/top-of-file.js +0 -2
  151. package/src/index.js +0 -3
  152. package/src/scripts/init-editing.js +0 -109
  153. package/src/server-index.js +0 -11
  154. package/src/types/api-version.js +0 -2
  155. package/src/types/builder-block.js +0 -0
  156. package/src/types/builder-content.js +0 -0
  157. package/src/types/builder-props.js +0 -0
  158. package/src/types/can-track.js +0 -0
  159. package/src/types/components.js +0 -0
  160. package/src/types/deep-partial.js +0 -0
  161. package/src/types/element.js +0 -0
  162. package/src/types/enforced-partials.js +0 -0
  163. package/src/types/input.js +0 -0
  164. package/src/types/targets.js +0 -0
  165. package/src/types/typescript.js +0 -0
  166. package/vite.config.ts +0 -18
@@ -1,77 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = value => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = value => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { isBrowser } from "../functions/is-browser.js";
22
- import { logger } from "./logger.js";
23
- import { checkIsDefined } from "./nullable.js";
24
- import { getTopLevelDomain } from "./url.js";
25
- const getCookieSync = ({
26
- name,
27
- canTrack
28
- }) => {
29
- var _a;
30
- try {
31
- if (!canTrack) {
32
- return void 0;
33
- }
34
- return (_a = document.cookie.split("; ").find(row => row.startsWith(`${name}=`))) == null ? void 0 : _a.split("=")[1];
35
- } catch (err) {
36
- logger.warn("[COOKIE] GET error: ", (err == null ? void 0 : err.message) || err);
37
- return void 0;
38
- }
39
- };
40
- const getCookie = args => __async(void 0, null, function* () {
41
- return getCookieSync(args);
42
- });
43
- const stringifyCookie = cookie => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
44
- const SECURE_CONFIG = [["secure", ""], ["SameSite", "None"]];
45
- const createCookieString = ({
46
- name,
47
- value,
48
- expires
49
- }) => {
50
- const secure = isBrowser() ? location.protocol === "https:" : true;
51
- const secureObj = secure ? SECURE_CONFIG : [[]];
52
- const expiresObj = expires ? [["expires", expires.toUTCString()]] : [[]];
53
- const cookieValue = [[name, value], ...expiresObj, ["path", "/"], ["domain", getTopLevelDomain(window.location.hostname)], ...secureObj];
54
- const cookie = stringifyCookie(cookieValue);
55
- return cookie;
56
- };
57
- const setCookie = _0 => __async(void 0, [_0], function* ({
58
- name,
59
- value,
60
- expires,
61
- canTrack
62
- }) {
63
- try {
64
- if (!canTrack) {
65
- return;
66
- }
67
- const cookie = createCookieString({
68
- name,
69
- value,
70
- expires
71
- });
72
- document.cookie = cookie;
73
- } catch (err) {
74
- logger.warn("[COOKIE] SET error: ", (err == null ? void 0 : err.message) || err);
75
- }
76
- });
77
- export { getCookie, getCookieSync, setCookie }
@@ -1,30 +0,0 @@
1
- import { camelToKebabCase } from "../functions/camel-to-kebab-case.js";
2
- import { checkIsDefined } from "./nullable.js";
3
- const convertStyleMapToCSSArray = style => {
4
- const cssProps = Object.entries(style).map(([key, value]) => {
5
- if (typeof value === "string") {
6
- return `${camelToKebabCase(key)}: ${value};`;
7
- } else {
8
- return void 0;
9
- }
10
- });
11
- return cssProps.filter(checkIsDefined);
12
- };
13
- const convertStyleMapToCSS = style => convertStyleMapToCSSArray(style).join("\n");
14
- const createCssClass = ({
15
- mediaQuery,
16
- className,
17
- styles
18
- }) => {
19
- const cssClass = `.${className} {
20
- ${convertStyleMapToCSS(styles)}
21
- }`;
22
- if (mediaQuery) {
23
- return `${mediaQuery} {
24
- ${cssClass}
25
- }`;
26
- } else {
27
- return cssClass;
28
- }
29
- };
30
- export { convertStyleMapToCSS, convertStyleMapToCSSArray, createCssClass }
@@ -1,31 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
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;
13
- var __spreadValues = (a, b) => {
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
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- function flatten(object, path = null, separator = ".") {
22
- return Object.keys(object).reduce((acc, key) => {
23
- const value = object[key];
24
- const newPath = [path, key].filter(Boolean).join(separator);
25
- const isObject = [typeof value === "object", value !== null, !(Array.isArray(value) && value.length === 0)].every(Boolean);
26
- return isObject ? __spreadValues(__spreadValues({}, acc), flatten(value, newPath, separator)) : __spreadProps(__spreadValues({}, acc), {
27
- [newPath]: value
28
- });
29
- }, {});
30
- }
31
- export { flatten }
@@ -1,32 +0,0 @@
1
- import { isBrowser } from "../functions/is-browser.js";
2
- const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
3
- const getLocalStorageItem = ({
4
- key,
5
- canTrack
6
- }) => {
7
- var _a;
8
- try {
9
- if (canTrack) {
10
- return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
11
- }
12
- return void 0;
13
- } catch (err) {
14
- console.debug("[LocalStorage] GET error: ", err);
15
- return void 0;
16
- }
17
- };
18
- const setLocalStorageItem = ({
19
- key,
20
- canTrack,
21
- value
22
- }) => {
23
- var _a;
24
- try {
25
- if (canTrack) {
26
- (_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
27
- }
28
- } catch (err) {
29
- console.debug("[LocalStorage] SET error: ", err);
30
- }
31
- };
32
- export { getLocalStorageItem, setLocalStorageItem }
@@ -1,8 +0,0 @@
1
- const MSG_PREFIX = "[Builder.io]: ";
2
- const logger = {
3
- log: (...message) => console.log(MSG_PREFIX, ...message),
4
- error: (...message) => console.error(MSG_PREFIX, ...message),
5
- warn: (...message) => console.warn(MSG_PREFIX, ...message),
6
- debug: (...message) => console.debug(MSG_PREFIX, ...message)
7
- };
8
- export { logger }
@@ -1,2 +0,0 @@
1
- const checkIsDefined = maybeT => maybeT !== null && maybeT !== void 0;
2
- export { checkIsDefined }
@@ -1,4 +0,0 @@
1
- function getPreviewContent(_searchParams) {
2
- return void 0;
3
- }
4
- export { getPreviewContent }
File without changes
@@ -1,2 +0,0 @@
1
- function init() {}
2
- export { init }
@@ -1,31 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = value => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = value => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- function postPreviewContent(_0) {
22
- return __async(this, arguments, function* ({
23
- key,
24
- value
25
- }) {
26
- return {
27
- [key]: value
28
- };
29
- });
30
- }
31
- export { postPreviewContent }
File without changes
@@ -1,55 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = value => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = value => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { getCookie, setCookie } from "./cookie.js";
22
- import { checkIsDefined } from "./nullable.js";
23
- import { uuid } from "./uuid.js";
24
- const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
25
- const getSessionId = _0 => __async(void 0, [_0], function* ({
26
- canTrack
27
- }) {
28
- if (!canTrack) {
29
- return void 0;
30
- }
31
- const sessionId = yield getCookie({
32
- name: SESSION_LOCAL_STORAGE_KEY,
33
- canTrack
34
- });
35
- if (checkIsDefined(sessionId)) {
36
- return sessionId;
37
- } else {
38
- const newSessionId = createSessionId();
39
- setSessionId({
40
- id: newSessionId,
41
- canTrack
42
- });
43
- return newSessionId;
44
- }
45
- });
46
- const createSessionId = () => uuid();
47
- const setSessionId = ({
48
- id,
49
- canTrack
50
- }) => setCookie({
51
- name: SESSION_LOCAL_STORAGE_KEY,
52
- value: id,
53
- canTrack
54
- });
55
- export { createSessionId, getSessionId, setSessionId }
@@ -1,3 +0,0 @@
1
- const MINUTE_TO_MILLESECONDS_MULTIPLIER = 6e4;
2
- const getCurrentDatePlusMinutes = (minutes = 30) => new Date(Date.now() + minutes * MINUTE_TO_MILLESECONDS_MULTIPLIER);
3
- export { getCurrentDatePlusMinutes }
@@ -1,11 +0,0 @@
1
- const getTopLevelDomain = host => {
2
- if (host === "localhost" || host === "127.0.0.1") {
3
- return host;
4
- }
5
- const parts = host.split(".");
6
- if (parts.length > 2) {
7
- return parts.slice(1).join(".");
8
- }
9
- return host;
10
- };
11
- export { getTopLevelDomain }
@@ -1,11 +0,0 @@
1
- function uuidv4() {
2
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
3
- const r = Math.random() * 16 | 0,
4
- v = c == "x" ? r : r & 3 | 8;
5
- return v.toString(16);
6
- });
7
- }
8
- function uuid() {
9
- return uuidv4().replace(/-/g, "");
10
- }
11
- export { uuid, uuidv4 }
@@ -1,35 +0,0 @@
1
- import { getLocalStorageItem, setLocalStorageItem } from "./localStorage.js";
2
- import { checkIsDefined } from "./nullable.js";
3
- import { uuid } from "./uuid.js";
4
- const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
5
- const getVisitorId = ({
6
- canTrack
7
- }) => {
8
- if (!canTrack) {
9
- return void 0;
10
- }
11
- const visitorId = getLocalStorageItem({
12
- key: VISITOR_LOCAL_STORAGE_KEY,
13
- canTrack
14
- });
15
- if (checkIsDefined(visitorId)) {
16
- return visitorId;
17
- } else {
18
- const newVisitorId = createVisitorId();
19
- setVisitorId({
20
- id: newVisitorId,
21
- canTrack
22
- });
23
- return newVisitorId;
24
- }
25
- };
26
- const createVisitorId = () => uuid();
27
- const setVisitorId = ({
28
- id,
29
- canTrack
30
- }) => setLocalStorageItem({
31
- key: VISITOR_LOCAL_STORAGE_KEY,
32
- value: id,
33
- canTrack
34
- });
35
- export { createVisitorId, getVisitorId, setVisitorId }
@@ -1,13 +0,0 @@
1
- import { default as default2 } from "../blocks/button/button";
2
- import { default as default3 } from "../blocks/columns/columns";
3
- import { default as default4 } from "../blocks/fragment/fragment";
4
- import { default as default5 } from "../blocks/image/image";
5
- import { default as default6 } from "../blocks/section/section";
6
- import { default as default7 } from "../blocks/symbol/symbol";
7
- import { default as default8 } from "../blocks/text/text";
8
- import { default as default9 } from "../blocks/video/video";
9
- import { default as Blocks } from "../components/blocks/blocks";
10
- import { default as Content } from "../components/content-variants/content-variants";
11
- const RenderBlocks = Blocks;
12
- const RenderContent = Content;
13
- export { Blocks, default2 as Button, default3 as Columns, Content, default4 as Fragment, default5 as Image, RenderBlocks, RenderContent, default6 as Section, default7 as Symbol, default8 as Text, default9 as Video }
@@ -1,2 +0,0 @@
1
- var stdin_default = void 0;
2
- export { stdin_default as default }
package/src/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from "./index-helpers/top-of-file.js";
2
- export * from "./index-helpers/blocks-exports.js";
3
- export * from "./server-index.js"
@@ -1,109 +0,0 @@
1
- import { SDK_VERSION } from "../constants/sdk-version.js";
2
- import { TARGET } from "../constants/target.js";
3
- import { isBrowser } from "../functions/is-browser.js";
4
- import { register } from "../functions/register.js";
5
- const registerInsertMenu = () => {
6
- register("insertMenu", {
7
- name: "_default",
8
- default: true,
9
- items: [{
10
- name: "Box"
11
- }, {
12
- name: "Text"
13
- }, {
14
- name: "Image"
15
- }, {
16
- name: "Columns"
17
- }, ...(TARGET === "reactNative" ? [] : [{
18
- name: "Core:Section"
19
- }, {
20
- name: "Core:Button"
21
- }, {
22
- name: "Embed"
23
- }, {
24
- name: "Custom Code"
25
- }])]
26
- });
27
- };
28
- let isSetupForEditing = false;
29
- const setupBrowserForEditing = (options = {}) => {
30
- var _a, _b;
31
- if (isSetupForEditing) {
32
- return;
33
- }
34
- isSetupForEditing = true;
35
- if (isBrowser()) {
36
- (_a = window.parent) == null ? void 0 : _a.postMessage({
37
- type: "builder.sdkInfo",
38
- data: {
39
- target: TARGET,
40
- version: SDK_VERSION,
41
- supportsPatchUpdates: false,
42
- supportsAddBlockScoping: true,
43
- supportsCustomBreakpoints: true
44
- }
45
- }, "*");
46
- (_b = window.parent) == null ? void 0 : _b.postMessage({
47
- type: "builder.updateContent",
48
- data: {
49
- options
50
- }
51
- }, "*");
52
- window.addEventListener("message", ({
53
- data
54
- }) => {
55
- var _a2, _b2;
56
- if (!(data == null ? void 0 : data.type)) {
57
- return;
58
- }
59
- switch (data.type) {
60
- case "builder.evaluate":
61
- {
62
- const text = data.data.text;
63
- const args = data.data.arguments || [];
64
- const id = data.data.id;
65
- const fn = new Function(text);
66
- let result;
67
- let error = null;
68
- try {
69
- result = fn.apply(null, args);
70
- } catch (err) {
71
- error = err;
72
- }
73
- if (error) {
74
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage({
75
- type: "builder.evaluateError",
76
- data: {
77
- id,
78
- error: error.message
79
- }
80
- }, "*");
81
- } else {
82
- if (result && typeof result.then === "function") {
83
- result.then(finalResult => {
84
- var _a3;
85
- (_a3 = window.parent) == null ? void 0 : _a3.postMessage({
86
- type: "builder.evaluateResult",
87
- data: {
88
- id,
89
- result: finalResult
90
- }
91
- }, "*");
92
- }).catch(console.error);
93
- } else {
94
- (_b2 = window.parent) == null ? void 0 : _b2.postMessage({
95
- type: "builder.evaluateResult",
96
- data: {
97
- result,
98
- id
99
- }
100
- }, "*");
101
- }
102
- }
103
- break;
104
- }
105
- }
106
- });
107
- }
108
- };
109
- export { registerInsertMenu, setupBrowserForEditing }
@@ -1,11 +0,0 @@
1
- export * from "./index-helpers/top-of-file.js";
2
- import { isEditing } from "./functions/is-editing.js";
3
- import { isPreviewing } from "./functions/is-previewing.js";
4
- import { createRegisterComponentMessage } from "./functions/register-component.js";
5
- import { register } from "./functions/register.js";
6
- import { setEditorSettings } from "./functions/set-editor-settings.js";
7
- import { fetchEntries, fetchOneEntry, getAllContent, getContent, _processContentResult } from "./functions/get-content/index.js";
8
- import { getBuilderSearchParams } from "./functions/get-builder-search-params/index.js";
9
- import { track } from "./functions/track/index.js";
10
- import { fetchBuilderProps } from "./functions/fetch-builder-props.js";
11
- export { _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getAllContent, getBuilderSearchParams, getContent, isEditing, isPreviewing, register, setEditorSettings, track }
@@ -1,2 +0,0 @@
1
- const DEFAULT_API_VERSION = "v3";
2
- export { DEFAULT_API_VERSION }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/vite.config.ts DELETED
@@ -1,18 +0,0 @@
1
- import { resolve } from 'path';
2
- import { defineConfig } from 'vite';
3
- import solidPlugin from 'vite-plugin-solid';
4
- // import dts from 'vite-plugin-dts';
5
-
6
- // https://vitejs.dev/config/
7
- export default defineConfig({
8
- plugins: [
9
- solidPlugin(),
10
- // dts({ insertTypesEntry: true })
11
- ],
12
- build: {
13
- lib: {
14
- entry: resolve(__dirname, 'src/index.js'),
15
- formats: ['cjs', 'es'],
16
- },
17
- },
18
- });