@builder.io/sdk-svelte 0.7.1-1 → 0.7.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/button/button.svelte +5 -2
- package/lib/browser/blocks/columns/columns.svelte +1 -1
- package/lib/browser/blocks/img/img.svelte +4 -1
- package/lib/browser/blocks/input/input.svelte +4 -1
- package/lib/browser/blocks/section/section.svelte +4 -1
- package/lib/browser/blocks/select/select.svelte +4 -1
- package/lib/browser/blocks/submit-button/submit-button.svelte +4 -1
- package/lib/browser/blocks/submit-button/submit-button.svelte.d.ts +2 -1
- package/lib/browser/blocks/symbol/symbol.svelte +4 -1
- package/lib/browser/blocks/textarea/textarea.svelte +4 -1
- package/lib/browser/components/block/block.svelte +24 -6
- package/lib/browser/components/block/components/block-wrapper.svelte +3 -0
- package/lib/browser/components/block/components/block-wrapper.svelte.d.ts +4 -3
- package/lib/browser/components/block/components/component-ref/component-ref.helpers.d.ts +1 -0
- package/lib/browser/components/block/components/component-ref/component-ref.svelte +2 -2
- package/lib/browser/components/blocks/blocks.svelte +3 -3
- package/lib/browser/components/content/components/enable-editor.svelte +7 -7
- package/lib/browser/components/content/components/styles.svelte +1 -2
- package/lib/browser/components/content/content.svelte +5 -5
- package/lib/browser/components/content-variants/content-variants.svelte +5 -5
- package/lib/browser/constants/builder-registered-components.js +6 -6
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/context/types.d.ts +1 -1
- package/lib/browser/functions/evaluate/choose-eval.js +1 -1
- package/lib/browser/functions/evaluate/edge-runtime/edge-runtime.js +1 -1
- package/lib/browser/functions/evaluate/evaluate.js +1 -1
- package/lib/browser/functions/evaluate/node-runtime/node-runtime.js +2 -2
- package/lib/browser/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +0 -2
- package/lib/browser/functions/get-content/generate-content-url.js +1 -1
- package/lib/browser/helpers/ab-tests.d.ts +1 -1
- package/lib/browser/helpers/ab-tests.js +2 -2
- package/lib/browser/index.js +3 -0
- package/lib/browser/server-index.d.ts +2 -2
- package/lib/browser/server-index.js +1 -1
- package/lib/browser/types/builder-props.d.ts +1 -0
- package/lib/edge/blocks/button/button.svelte +5 -2
- package/lib/edge/blocks/columns/columns.svelte +1 -1
- package/lib/edge/blocks/img/img.svelte +4 -1
- package/lib/edge/blocks/input/input.svelte +4 -1
- package/lib/edge/blocks/section/section.svelte +4 -1
- package/lib/edge/blocks/select/select.svelte +4 -1
- package/lib/edge/blocks/submit-button/submit-button.svelte +4 -1
- package/lib/edge/blocks/submit-button/submit-button.svelte.d.ts +2 -1
- package/lib/edge/blocks/symbol/symbol.svelte +4 -1
- package/lib/edge/blocks/textarea/textarea.svelte +4 -1
- package/lib/edge/components/block/block.svelte +24 -6
- package/lib/edge/components/block/components/block-wrapper.svelte +3 -0
- package/lib/edge/components/block/components/block-wrapper.svelte.d.ts +4 -3
- package/lib/edge/components/block/components/component-ref/component-ref.helpers.d.ts +1 -0
- package/lib/edge/components/block/components/component-ref/component-ref.svelte +2 -2
- package/lib/edge/components/blocks/blocks.svelte +3 -3
- package/lib/edge/components/content/components/enable-editor.svelte +7 -7
- package/lib/edge/components/content/components/styles.svelte +1 -2
- package/lib/edge/components/content/content.svelte +5 -5
- package/lib/edge/components/content-variants/content-variants.svelte +5 -5
- package/lib/edge/constants/builder-registered-components.js +6 -6
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/context/types.d.ts +1 -1
- package/lib/edge/functions/evaluate/choose-eval.js +1 -1
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.js +1 -1
- package/lib/edge/functions/evaluate/evaluate.js +1 -1
- package/lib/edge/functions/evaluate/node-runtime/node-runtime.js +2 -2
- package/lib/edge/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +0 -2
- package/lib/edge/functions/get-content/generate-content-url.js +1 -1
- package/lib/edge/helpers/ab-tests.d.ts +1 -1
- package/lib/edge/helpers/ab-tests.js +2 -2
- package/lib/edge/index.js +3 -0
- package/lib/edge/server-index.d.ts +2 -2
- package/lib/edge/server-index.js +1 -1
- package/lib/edge/types/builder-props.d.ts +1 -0
- package/lib/node/blocks/button/button.svelte +5 -2
- package/lib/node/blocks/columns/columns.svelte +1 -1
- package/lib/node/blocks/img/img.svelte +4 -1
- package/lib/node/blocks/input/input.svelte +4 -1
- package/lib/node/blocks/section/section.svelte +4 -1
- package/lib/node/blocks/select/select.svelte +4 -1
- package/lib/node/blocks/submit-button/submit-button.svelte +4 -1
- package/lib/node/blocks/submit-button/submit-button.svelte.d.ts +2 -1
- package/lib/node/blocks/symbol/symbol.svelte +4 -1
- package/lib/node/blocks/textarea/textarea.svelte +4 -1
- package/lib/node/components/block/block.svelte +24 -6
- package/lib/node/components/block/components/block-wrapper.svelte +3 -0
- package/lib/node/components/block/components/block-wrapper.svelte.d.ts +4 -3
- package/lib/node/components/block/components/component-ref/component-ref.helpers.d.ts +1 -0
- package/lib/node/components/block/components/component-ref/component-ref.svelte +2 -2
- package/lib/node/components/blocks/blocks.svelte +3 -3
- package/lib/node/components/content/components/enable-editor.svelte +7 -7
- package/lib/node/components/content/components/styles.svelte +1 -2
- package/lib/node/components/content/content.svelte +5 -5
- package/lib/node/components/content-variants/content-variants.svelte +5 -5
- package/lib/node/constants/builder-registered-components.js +6 -6
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/context/types.d.ts +1 -1
- package/lib/node/functions/evaluate/choose-eval.js +1 -1
- package/lib/node/functions/evaluate/edge-runtime/edge-runtime.js +1 -1
- package/lib/node/functions/evaluate/evaluate.js +1 -1
- package/lib/node/functions/evaluate/node-runtime/node-runtime.js +2 -2
- package/lib/node/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +0 -2
- package/lib/node/functions/get-content/generate-content-url.js +1 -1
- package/lib/node/helpers/ab-tests.d.ts +1 -1
- package/lib/node/helpers/ab-tests.js +2 -2
- package/lib/node/index.js +3 -0
- package/lib/node/server-index.d.ts +2 -2
- package/lib/node/server-index.js +1 -1
- package/lib/node/types/builder-props.d.ts +1 -0
- package/package.json +3 -3
- package/src/blocks/button/button.svelte +3 -2
- package/src/blocks/columns/columns.svelte +5 -5
- package/src/blocks/img/img.svelte +2 -1
- package/src/blocks/input/input.svelte +2 -1
- package/src/blocks/section/section.svelte +2 -1
- package/src/blocks/select/select.svelte +2 -1
- package/src/blocks/submit-button/submit-button.svelte +2 -1
- package/src/blocks/symbol/symbol.svelte +5 -3
- package/src/blocks/textarea/textarea.svelte +2 -1
- package/src/components/block/block.svelte +25 -7
- package/src/components/block/components/block-wrapper.svelte +4 -3
- package/src/components/block/components/component-ref/component-ref.svelte +2 -2
- package/src/components/blocks/blocks.svelte +6 -6
- package/src/components/content/components/enable-editor.svelte +11 -12
- package/src/components/content/components/styles.svelte +1 -2
- package/src/components/content/content.svelte +8 -8
- package/src/components/content-variants/content-variants.svelte +7 -7
- package/src/constants/builder-registered-components.ts +6 -6
- package/src/constants/sdk-version.ts +1 -1
- package/src/context/types.ts +1 -1
- package/src/functions/evaluate/choose-eval.ts +1 -1
- package/src/functions/evaluate/edge-runtime/edge-runtime.ts +1 -1
- package/src/functions/evaluate/evaluate.ts +1 -1
- package/src/functions/evaluate/node-runtime/node-runtime.ts +3 -3
- package/src/functions/fetch-builder-props.ts +1 -1
- package/src/functions/get-content/generate-content-url.ts +1 -1
- package/src/helpers/ab-tests.ts +4 -4
- package/src/index.ts +3 -0
- package/src/server-index.ts +2 -2
- package/src/types/element.ts +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>import { onDestroy, onMount, setContext } from "svelte";
|
|
4
|
+
import builderContext from "../../../context/builder.context.js";
|
|
4
5
|
import { evaluate } from "../../../functions/evaluate/index.js";
|
|
6
|
+
import { fastClone } from "../../../functions/fast-clone.js";
|
|
7
|
+
import { fetchOneEntry } from "../../../functions/get-content/index.js";
|
|
5
8
|
import { fetch } from "../../../functions/get-fetch.js";
|
|
6
9
|
import { isBrowser } from "../../../functions/is-browser.js";
|
|
7
10
|
import { isEditing } from "../../../functions/is-editing.js";
|
|
11
|
+
import { isPreviewing } from "../../../functions/is-previewing.js";
|
|
8
12
|
import { createRegisterComponentMessage } from "../../../functions/register-component.js";
|
|
9
13
|
import { _track } from "../../../functions/track/index.js";
|
|
10
|
-
import builderContext from "../../../context/builder.context.js";
|
|
11
|
-
import { registerInsertMenu, setupBrowserForEditing, } from "../../../scripts/init-editing.js";
|
|
12
14
|
import { getInteractionPropertiesForEvent } from "../../../functions/track/interaction.js";
|
|
13
|
-
import { fetchOneEntry } from "../../../functions/get-content/index.js";
|
|
14
|
-
import { isPreviewing } from "../../../functions/is-previewing.js";
|
|
15
|
-
import "../../../helpers/preview-lru-cache/set.js";
|
|
16
|
-
import { fastClone } from "../../../functions/fast-clone.js";
|
|
17
|
-
import { logger } from "../../../helpers/logger.js";
|
|
18
15
|
import { getDefaultCanTrack } from "../../../helpers/canTrack.js";
|
|
16
|
+
import { logger } from "../../../helpers/logger.js";
|
|
17
|
+
import "../../../helpers/preview-lru-cache/set.js";
|
|
18
|
+
import { registerInsertMenu, setupBrowserForEditing, } from "../../../scripts/init-editing.js";
|
|
19
19
|
export let builderContextSignal;
|
|
20
20
|
export let model = undefined;
|
|
21
21
|
export let context = undefined;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>import InlinedStyles from "../../inlined-styles.svelte";
|
|
4
|
-
import { getCss } from "./styles.helpers.js";
|
|
5
|
-
import { getFontCss } from "./styles.helpers.js";
|
|
4
|
+
import { getCss, getFontCss } from "./styles.helpers.js";
|
|
6
5
|
export let cssCode = undefined;
|
|
7
6
|
export let contentId = undefined;
|
|
8
7
|
export let customFonts = undefined;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script>import { setContext } from "svelte";
|
|
2
2
|
import { writable } from "svelte/store";
|
|
3
3
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
4
|
+
import { TARGET } from "../../constants/target.js";
|
|
5
|
+
import ComponentsContext from "../../context/components.context.js";
|
|
4
6
|
import { components, serializeComponentInfo, } from "../../functions/register-component.js";
|
|
5
7
|
import Blocks from "../blocks/blocks.svelte";
|
|
6
|
-
import ContentStyles from "./components/styles.svelte";
|
|
7
|
-
import { getContentInitialValue, getContextStateInitialValue, } from "./content.helpers.js";
|
|
8
|
-
import { TARGET } from "../../constants/target.js";
|
|
9
8
|
import { getRenderContentScriptString } from "../content-variants/helpers.js";
|
|
10
|
-
import EnableEditor from "./components/enable-editor.svelte";
|
|
11
9
|
import InlinedScript from "../inlined-script.svelte";
|
|
10
|
+
import EnableEditor from "./components/enable-editor.svelte";
|
|
11
|
+
import ContentStyles from "./components/styles.svelte";
|
|
12
|
+
import { getContentInitialValue, getContextStateInitialValue, } from "./content.helpers.js";
|
|
12
13
|
import "./wrap-component-ref.js";
|
|
13
|
-
import ComponentsContext from "../../context/components.context.js";
|
|
14
14
|
export let content = undefined;
|
|
15
15
|
export let customComponents = undefined;
|
|
16
16
|
export let data = undefined;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>import { onMount } from "svelte";
|
|
4
|
-
import {
|
|
5
|
-
import ContentComponent from "../content/content.svelte";
|
|
6
|
-
import { getDefaultCanTrack } from "../../helpers/canTrack.js";
|
|
7
|
-
import InlinedStyles from "../inlined-styles.svelte";
|
|
4
|
+
import { TARGET } from "../../constants/target.js";
|
|
8
5
|
import { handleABTestingSync } from "../../helpers/ab-tests.js";
|
|
6
|
+
import { getDefaultCanTrack } from "../../helpers/canTrack.js";
|
|
7
|
+
import ContentComponent from "../content/content.svelte";
|
|
9
8
|
import InlinedScript from "../inlined-script.svelte";
|
|
10
|
-
import
|
|
9
|
+
import InlinedStyles from "../inlined-styles.svelte";
|
|
10
|
+
import { checkShouldRunVariants, getScriptString, getVariants, getVariantsScriptString, } from "./helpers.js";
|
|
11
11
|
export let canTrack = undefined;
|
|
12
12
|
export let content = undefined;
|
|
13
13
|
export let __isNestedRender = undefined;
|
|
@@ -2,10 +2,16 @@ import { default as Button } from '../blocks/button/button.svelte';
|
|
|
2
2
|
import { componentInfo as buttonComponentInfo } from '../blocks/button/component-info.js';
|
|
3
3
|
import { default as Columns } from '../blocks/columns/columns.svelte';
|
|
4
4
|
import { componentInfo as columnsComponentInfo } from '../blocks/columns/component-info.js';
|
|
5
|
+
import { componentInfo as customCodeInfo } from '../blocks/custom-code/component-info.js';
|
|
6
|
+
import { default as customCode } from '../blocks/custom-code/custom-code.svelte';
|
|
7
|
+
import { componentInfo as embedComponentInfo } from '../blocks/embed/component-info.js';
|
|
8
|
+
import { default as embed } from '../blocks/embed/embed.svelte';
|
|
5
9
|
import { componentInfo as fragmentComponentInfo } from '../blocks/fragment/component-info.js';
|
|
6
10
|
import { default as Fragment } from '../blocks/fragment/fragment.svelte';
|
|
7
11
|
import { componentInfo as imageComponentInfo } from '../blocks/image/component-info.js';
|
|
8
12
|
import { default as Image } from '../blocks/image/image.svelte';
|
|
13
|
+
import { componentInfo as imgComponentInfo } from '../blocks/img/component-info.js';
|
|
14
|
+
import { default as Img } from '../blocks/img/img.svelte';
|
|
9
15
|
import { componentInfo as sectionComponentInfo } from '../blocks/section/component-info.js';
|
|
10
16
|
import { default as Section } from '../blocks/section/section.svelte';
|
|
11
17
|
import { componentInfo as symbolComponentInfo } from '../blocks/symbol/component-info.js';
|
|
@@ -14,12 +20,6 @@ import { componentInfo as textComponentInfo } from '../blocks/text/component-inf
|
|
|
14
20
|
import { default as Text } from '../blocks/text/text.svelte';
|
|
15
21
|
import { componentInfo as videoComponentInfo } from '../blocks/video/component-info.js';
|
|
16
22
|
import { default as Video } from '../blocks/video/video.svelte';
|
|
17
|
-
import { componentInfo as embedComponentInfo } from '../blocks/embed/component-info.js';
|
|
18
|
-
import { default as embed } from '../blocks/embed/embed.svelte';
|
|
19
|
-
import { default as Img } from '../blocks/img/img.svelte';
|
|
20
|
-
import { componentInfo as imgComponentInfo } from '../blocks/img/component-info.js';
|
|
21
|
-
import { default as customCode } from '../blocks/custom-code/custom-code.svelte';
|
|
22
|
-
import { componentInfo as customCodeInfo } from '../blocks/custom-code/component-info.js';
|
|
23
23
|
/**
|
|
24
24
|
* Returns a list of all registered components.
|
|
25
25
|
* NOTE: This needs to be a function to work around ESM circular dependencies.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.7.1
|
|
1
|
+
export declare const SDK_VERSION = "0.7.1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.7.1
|
|
1
|
+
export const SDK_VERSION = "0.7.1";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { ApiVersion } from '../types/api-version.js';
|
|
1
2
|
import type { BuilderContent } from '../types/builder-content.js';
|
|
2
3
|
import type { ComponentInfo } from '../types/components.js';
|
|
3
4
|
import type { Dictionary, Nullable } from '../types/typescript.js';
|
|
4
|
-
import type { ApiVersion } from '../types/api-version.js';
|
|
5
5
|
export type RegisteredComponent = ComponentInfo & {
|
|
6
6
|
component: any;
|
|
7
7
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { runInBrowser } from './browser-runtime/browser.js';
|
|
2
1
|
import { isBrowser } from '../is-browser.js';
|
|
2
|
+
import { runInBrowser } from './browser-runtime/browser.js';
|
|
3
3
|
/**
|
|
4
4
|
* THIS IS A MAGICAL IMPORT. It is aliased by the build process of every SDK configuration, so that
|
|
5
5
|
* it points to the correct runtime for that configuration, which are expected to live exactly at:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from '../../../helpers/logger.js';
|
|
2
2
|
import { set } from '../../set.js';
|
|
3
|
-
import Interpreter from './acorn-interpreter.js';
|
|
4
3
|
import { getFunctionArguments } from '../helpers.js';
|
|
4
|
+
import Interpreter from './acorn-interpreter.js';
|
|
5
5
|
const processCode = (code) => {
|
|
6
6
|
return code.split('\n').map(line => {
|
|
7
7
|
const trimmed = line.trim();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { logger } from '../../helpers/logger.js';
|
|
2
|
-
import { getBuilderGlobals, parseCode } from './helpers.js';
|
|
3
2
|
import { chooseBrowserOrServerEval } from './choose-eval.js';
|
|
3
|
+
import { getBuilderGlobals, parseCode } from './helpers.js';
|
|
4
4
|
export function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
|
|
5
5
|
if (code === '') {
|
|
6
6
|
logger.warn('Skipping evaluation of empty code block.');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getFunctionArguments } from '../helpers.js';
|
|
2
|
-
import { safeDynamicRequire } from './safeDynamicRequire.js';
|
|
3
1
|
import { fastClone } from '../../fast-clone.js';
|
|
4
2
|
import { set } from '../../set.js';
|
|
3
|
+
import { getFunctionArguments } from '../helpers.js';
|
|
4
|
+
import { safeDynamicRequire } from './safeDynamicRequire.js';
|
|
5
5
|
const ivm = safeDynamicRequire('isolated-vm');
|
|
6
6
|
const getSyncValName = (key) => `bldr_${key}_sync`;
|
|
7
7
|
const BUILDER_SET_STATE_NAME = 'BUILDER_SET_STATE';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { flatten } from '../../helpers/flatten.js';
|
|
2
|
-
import { getBuilderSearchParamsFromWindow, normalizeSearchParams } from '../get-builder-search-params/index.js';
|
|
3
2
|
import { DEFAULT_API_VERSION } from '../../types/api-version.js';
|
|
3
|
+
import { getBuilderSearchParamsFromWindow, normalizeSearchParams } from '../get-builder-search-params/index.js';
|
|
4
4
|
const isPositiveNumber = (thing) => typeof thing === 'number' && !isNaN(thing) && thing >= 0;
|
|
5
5
|
export const generateContentUrl = (options) => {
|
|
6
6
|
let { noTraverse = false } = options;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CanTrack } from '../types/can-track.js';
|
|
2
1
|
import type { BuilderContent } from '../types/builder-content.js';
|
|
2
|
+
import type { CanTrack } from '../types/can-track.js';
|
|
3
3
|
import type { Nullable } from '../types/typescript.js';
|
|
4
4
|
export declare const handleABTestingSync: ({ item, canTrack }: {
|
|
5
5
|
item: Nullable<BuilderContent>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TARGET } from '../constants/target.js';
|
|
2
2
|
import { checkIsDefined } from '../helpers/nullable.js';
|
|
3
|
+
import { getCookie, getCookieSync, setCookie } from './cookie.js';
|
|
3
4
|
import { logger } from './logger.js';
|
|
4
|
-
import { TARGET } from '../constants/target.js';
|
|
5
5
|
const BUILDER_STORE_PREFIX = 'builder.tests';
|
|
6
6
|
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
7
7
|
const getContentVariationCookie = ({ contentId }) => getCookie({
|
package/lib/node/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
// ignore prettier formatting for this file because the order of exports is meaningful
|
|
2
|
+
// prettier-ignore
|
|
1
3
|
export * from './index-helpers/top-of-file.js';
|
|
4
|
+
// prettier-ignore
|
|
2
5
|
export * from './index-helpers/blocks-exports.js';
|
|
3
6
|
/**
|
|
4
7
|
* We have a separate entry point to the SDKs that guarantees no components are being imported. This is useful
|
|
@@ -6,10 +6,10 @@ export { register } from './functions/register.js';
|
|
|
6
6
|
export type { InsertMenuConfig, InsertMenuItem } from './functions/register.js';
|
|
7
7
|
export { setEditorSettings } from './functions/set-editor-settings.js';
|
|
8
8
|
export type { Settings } from './functions/set-editor-settings.js';
|
|
9
|
-
export { fetchEntries, fetchOneEntry, getAllContent, getContent
|
|
9
|
+
export { _processContentResult, fetchEntries, fetchOneEntry, getAllContent, getContent } from './functions/get-content/index.js';
|
|
10
10
|
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
11
11
|
export { track } from './functions/track/index.js';
|
|
12
|
+
export type { ContentProps } from './components/content/content.types.js';
|
|
12
13
|
export type { RegisteredComponent } from './context/types.js';
|
|
13
14
|
export type { ComponentInfo } from './types/components.js';
|
|
14
|
-
export type { ContentProps } from './components/content/content.types.js';
|
|
15
15
|
export { fetchBuilderProps } from './functions/fetch-builder-props.js';
|
package/lib/node/server-index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { isPreviewing } from './functions/is-previewing.js';
|
|
|
4
4
|
export { createRegisterComponentMessage } from './functions/register-component.js';
|
|
5
5
|
export { register } from './functions/register.js';
|
|
6
6
|
export { setEditorSettings } from './functions/set-editor-settings.js';
|
|
7
|
-
export { fetchEntries, fetchOneEntry, getAllContent, getContent
|
|
7
|
+
export { _processContentResult, fetchEntries, fetchOneEntry, getAllContent, getContent } from './functions/get-content/index.js';
|
|
8
8
|
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
9
9
|
export { track } from './functions/track/index.js';
|
|
10
10
|
export { fetchBuilderProps } from './functions/fetch-builder-props.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-svelte",
|
|
3
3
|
"description": "Builder.io SDK for Svelte",
|
|
4
|
-
"version": "0.7.1
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"lib",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/svelte#readme",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/BuilderIO/builder.git",
|
|
13
|
+
"url": "git+https://github.com/BuilderIO/builder.git",
|
|
14
14
|
"directory": "packages/sdks/output/svelte"
|
|
15
15
|
},
|
|
16
16
|
"main": "./lib/node/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"release": "npm publish",
|
|
41
41
|
"prepare": "SDK_ENV=browser svelte-kit sync",
|
|
42
|
-
"build": "nx run-many -p @builder.io/sdk-svelte -t build:node build:edge build:browser",
|
|
42
|
+
"build": "nx run-many -p @builder.io/sdk-svelte -t build:node build:edge build:browser --parallel=false",
|
|
43
43
|
"build:node": "SDK_ENV=node svelte-package -i src/ -o lib/node",
|
|
44
44
|
"build:edge": "SDK_ENV=edge svelte-package -i src/ -o lib/edge",
|
|
45
45
|
"build:browser": "SDK_ENV=browser svelte-package -i src/ -o lib/browser",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface ButtonProps {
|
|
6
7
|
attributes?: any;
|
|
7
8
|
text?: string;
|
|
@@ -32,10 +33,10 @@
|
|
|
32
33
|
|
|
33
34
|
{#if link}
|
|
34
35
|
<a
|
|
35
|
-
role="button"
|
|
36
36
|
{...filterAttrs(attributes, "on:", false)}
|
|
37
37
|
href={link}
|
|
38
38
|
target={openLinkInNewTab ? "_blank" : undefined}
|
|
39
|
+
role={"button"}
|
|
39
40
|
use:setAttrs={filterAttrs(attributes, "on:", true)}
|
|
40
41
|
>
|
|
41
42
|
{text}
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
|
|
20
20
|
<script lang="ts">
|
|
21
21
|
import Blocks from "../../components/blocks/blocks.svelte";
|
|
22
|
-
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
23
|
-
import { getSizesForBreakpoints } from "../../constants/device-sizes.js";
|
|
24
|
-
import type { SizeName } from "../../constants/device-sizes.js";
|
|
25
22
|
import InlinedStyles from "../../components/inlined-styles.svelte";
|
|
23
|
+
import type { SizeName } from "../../constants/device-sizes.js";
|
|
24
|
+
import { getSizesForBreakpoints } from "../../constants/device-sizes.js";
|
|
26
25
|
import { TARGET } from "../../constants/target.js";
|
|
27
|
-
import
|
|
26
|
+
import { deoptSignal } from "../../functions/deopt.js";
|
|
27
|
+
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
28
28
|
import type {
|
|
29
29
|
BuilderComponentsProp,
|
|
30
30
|
PropsWithBuilderData,
|
|
31
31
|
} from "../../types/builder-props.js";
|
|
32
|
-
import {
|
|
32
|
+
import type { Dictionary } from "../../types/typescript.js";
|
|
33
33
|
|
|
34
34
|
export let js: PropsWithBuilderData<ColumnProps>["js"];
|
|
35
35
|
export let space: PropsWithBuilderData<ColumnProps>["space"] = undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface ImgProps {
|
|
6
7
|
attributes?: any;
|
|
7
8
|
imgSrc?: string; // TODO(misko): I think this is unused
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface FormInputProps {
|
|
6
7
|
type?: string;
|
|
7
8
|
attributes?: any;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface SectionProps {
|
|
6
7
|
maxWidth?: number;
|
|
7
8
|
attributes?: any;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface FormSelectProps {
|
|
6
7
|
options?: {
|
|
7
8
|
name?: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface ButtonProps {
|
|
6
7
|
attributes?: any;
|
|
7
8
|
text?: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface SymbolInfo {
|
|
6
7
|
model?: string;
|
|
7
8
|
entry?: string;
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* This import is used by the Svelte SDK. Do not remove.
|
|
16
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
17
19
|
export interface SymbolProps extends BuilderComponentsProp {
|
|
18
20
|
symbol?: SymbolInfo;
|
|
19
21
|
dataOnly?: boolean;
|
|
@@ -33,9 +35,9 @@
|
|
|
33
35
|
PropsWithBuilderData,
|
|
34
36
|
} from "../../types/builder-props.js";
|
|
35
37
|
import { filterAttrs } from "../helpers.js";
|
|
38
|
+
import type { Nullable } from "../../types/typescript.js";
|
|
36
39
|
import { setAttrs } from "../helpers.js";
|
|
37
40
|
import { fetchSymbolContent } from "./symbol.helpers.js";
|
|
38
|
-
import type { Nullable } from "../../types/typescript.js";
|
|
39
41
|
|
|
40
42
|
export let js: PropsWithBuilderData<SymbolProps>["js"];
|
|
41
43
|
export let attributes: PropsWithBuilderData<SymbolProps>["attributes"] =
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
export interface TextareaProps {
|
|
6
7
|
attributes?: any;
|
|
7
8
|
name?: string;
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
BuilderContextInterface,
|
|
14
14
|
RegisteredComponents,
|
|
15
15
|
} from "../../context/types.js";
|
|
16
|
+
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
16
17
|
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
17
18
|
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
18
19
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
19
20
|
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
20
|
-
import BlockStyles from "./components/block-styles.svelte";
|
|
21
21
|
import {
|
|
22
22
|
getComponent,
|
|
23
23
|
getRepeatItemData,
|
|
24
24
|
isEmptyHtmlElement,
|
|
25
25
|
} from "./block.helpers.js";
|
|
26
|
-
import
|
|
27
|
-
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
28
|
-
import ComponentRef from "./components/component-ref/component-ref.svelte";
|
|
29
|
-
import type { ComponentProps } from "./components/component-ref/component-ref.helpers.js";
|
|
26
|
+
import BlockStyles from "./components/block-styles.svelte";
|
|
30
27
|
import BlockWrapper from "./components/block-wrapper.svelte";
|
|
28
|
+
import type { ComponentProps } from "./components/component-ref/component-ref.helpers.js";
|
|
29
|
+
import ComponentRef from "./components/component-ref/component-ref.svelte";
|
|
30
|
+
import RepeatedBlock from "./components/repeated-block.svelte";
|
|
31
31
|
import type { Writable } from "svelte/store";
|
|
32
32
|
|
|
33
33
|
export let block: BlockProps["block"];
|
|
@@ -137,7 +137,16 @@
|
|
|
137
137
|
{context}
|
|
138
138
|
hasChildren={true}
|
|
139
139
|
>
|
|
140
|
-
<ComponentRef
|
|
140
|
+
<ComponentRef
|
|
141
|
+
componentRef={componentRefProps().componentRef}
|
|
142
|
+
componentOptions={componentRefProps().componentOptions}
|
|
143
|
+
blockChildren={componentRefProps().blockChildren}
|
|
144
|
+
context={componentRefProps().context}
|
|
145
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
146
|
+
builderBlock={componentRefProps().builderBlock}
|
|
147
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
148
|
+
isInteractive={componentRefProps().isInteractive}
|
|
149
|
+
/>
|
|
141
150
|
|
|
142
151
|
{#each childrenWithoutParentComponent() as child ("block-" + child.id)}
|
|
143
152
|
<svelte:self
|
|
@@ -153,6 +162,15 @@
|
|
|
153
162
|
</BlockWrapper>
|
|
154
163
|
{/if}
|
|
155
164
|
{:else}
|
|
156
|
-
<ComponentRef
|
|
165
|
+
<ComponentRef
|
|
166
|
+
componentRef={componentRefProps().componentRef}
|
|
167
|
+
componentOptions={componentRefProps().componentOptions}
|
|
168
|
+
blockChildren={componentRefProps().blockChildren}
|
|
169
|
+
context={componentRefProps().context}
|
|
170
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
171
|
+
builderBlock={componentRefProps().builderBlock}
|
|
172
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
173
|
+
isInteractive={componentRefProps().isInteractive}
|
|
174
|
+
/>
|
|
157
175
|
{/if}
|
|
158
176
|
{/if}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script context="module" lang="ts">
|
|
2
2
|
/**
|
|
3
3
|
* This import is used by the Svelte SDK. Do not remove.
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
|
|
5
6
|
type BlockWrapperProps = {
|
|
6
7
|
Wrapper: string;
|
|
7
8
|
block: BuilderBlock;
|
|
@@ -19,11 +20,11 @@
|
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
22
|
<script lang="ts">
|
|
22
|
-
import type { PropsWithChildren } from "../../../types/typescript.js";
|
|
23
|
-
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
24
23
|
import type { BuilderContextInterface } from "../../../context/types.js";
|
|
25
24
|
import { getBlockActions } from "../../../functions/get-block-actions.js";
|
|
26
25
|
import { getBlockProperties } from "../../../functions/get-block-properties.js";
|
|
26
|
+
import type { BuilderBlock } from "../../../types/builder-block.js";
|
|
27
|
+
import type { PropsWithChildren } from "../../../types/typescript.js";
|
|
27
28
|
import { setAttrs } from "../../../blocks/helpers.js";
|
|
28
29
|
import type { Writable } from "svelte/store";
|
|
29
30
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { wrapComponentRef } from "../../../content/wrap-component-ref.js";
|
|
3
3
|
import Block from "../../block.svelte";
|
|
4
|
+
import BlockStyles from "../block-styles.svelte";
|
|
4
5
|
import InteractiveElement from "../interactive-element.svelte";
|
|
5
6
|
import type { ComponentProps } from "./component-ref.helpers.js";
|
|
6
7
|
import { getWrapperProps } from "./component-ref.helpers.js";
|
|
7
|
-
import { wrapComponentRef } from "../../../content/wrap-component-ref.js";
|
|
8
8
|
|
|
9
9
|
export let isInteractive: ComponentProps["isInteractive"];
|
|
10
10
|
export let componentRef: ComponentProps["componentRef"];
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import { getContext } from "svelte";
|
|
10
10
|
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import type { BlocksWrapperProps } from "./blocks-wrapper.svelte";
|
|
14
|
-
import BlocksWrapper from "./blocks-wrapper.svelte";
|
|
11
|
+
import BuilderContext from "../../context/builder.context.js";
|
|
12
|
+
import ComponentsContext from "../../context/components.context.js";
|
|
15
13
|
import type {
|
|
16
14
|
BuilderContextInterface,
|
|
17
15
|
RegisteredComponents,
|
|
18
16
|
} from "../../context/types.js";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
17
|
+
import Block from "../block/block.svelte";
|
|
18
|
+
import BlockStyles from "../block/components/block-styles.svelte";
|
|
19
|
+
import type { BlocksWrapperProps } from "./blocks-wrapper.svelte";
|
|
20
|
+
import BlocksWrapper from "./blocks-wrapper.svelte";
|
|
21
21
|
import type { Writable } from "svelte/store";
|
|
22
22
|
|
|
23
23
|
export let blocks: BlocksProps["blocks"];
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
<script lang="ts">
|
|
13
13
|
import { onDestroy, onMount, setContext } from "svelte";
|
|
14
14
|
|
|
15
|
+
import builderContext from "../../../context/builder.context.js";
|
|
15
16
|
import type { BuilderContextInterface } from "../../../context/types.js";
|
|
16
17
|
import { evaluate } from "../../../functions/evaluate/index.js";
|
|
18
|
+
import { fastClone } from "../../../functions/fast-clone.js";
|
|
19
|
+
import { fetchOneEntry } from "../../../functions/get-content/index.js";
|
|
17
20
|
import { fetch } from "../../../functions/get-fetch.js";
|
|
18
21
|
import { isBrowser } from "../../../functions/is-browser.js";
|
|
19
22
|
import { isEditing } from "../../../functions/is-editing.js";
|
|
23
|
+
import { isPreviewing } from "../../../functions/is-previewing.js";
|
|
20
24
|
import { createRegisterComponentMessage } from "../../../functions/register-component.js";
|
|
21
25
|
import { _track } from "../../../functions/track/index.js";
|
|
22
|
-
import
|
|
26
|
+
import { getInteractionPropertiesForEvent } from "../../../functions/track/interaction.js";
|
|
27
|
+
import { getDefaultCanTrack } from "../../../helpers/canTrack.js";
|
|
28
|
+
import { logger } from "../../../helpers/logger.js";
|
|
29
|
+
import { postPreviewContent } from "../../../helpers/preview-lru-cache/set.js";
|
|
23
30
|
import {
|
|
24
31
|
registerInsertMenu,
|
|
25
32
|
setupBrowserForEditing,
|
|
26
33
|
} from "../../../scripts/init-editing.js";
|
|
27
|
-
import {
|
|
34
|
+
import type { BuilderContent } from "../../../types/builder-content.js";
|
|
35
|
+
import type { ComponentInfo } from "../../../types/components.js";
|
|
28
36
|
import type {
|
|
29
|
-
ContentProps,
|
|
30
37
|
BuilderComponentStateChange,
|
|
38
|
+
ContentProps,
|
|
31
39
|
} from "../content.types.js";
|
|
32
|
-
import type { ComponentInfo } from "../../../types/components.js";
|
|
33
|
-
import { fetchOneEntry } from "../../../functions/get-content/index.js";
|
|
34
|
-
import { isPreviewing } from "../../../functions/is-previewing.js";
|
|
35
|
-
import type { BuilderContent } from "../../../types/builder-content.js";
|
|
36
|
-
import { postPreviewContent } from "../../../helpers/preview-lru-cache/set.js";
|
|
37
|
-
import { fastClone } from "../../../functions/fast-clone.js";
|
|
38
|
-
import { logger } from "../../../helpers/logger.js";
|
|
39
|
-
import { getDefaultCanTrack } from "../../../helpers/canTrack.js";
|
|
40
40
|
import type { Writable } from "svelte/store";
|
|
41
41
|
|
|
42
42
|
export let builderContextSignal: BuilderEditorProps["builderContextSignal"];
|
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
mergeNewContent(contentData);
|
|
102
102
|
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
103
103
|
}
|
|
104
|
-
|
|
105
104
|
break;
|
|
106
105
|
}
|
|
107
106
|
}
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
<script lang="ts">
|
|
10
10
|
import InlinedStyles from "../../inlined-styles.svelte";
|
|
11
11
|
import type { CustomFont } from "./styles.helpers.js";
|
|
12
|
-
import { getCss } from "./styles.helpers.js";
|
|
13
|
-
import { getFontCss } from "./styles.helpers.js";
|
|
12
|
+
import { getCss, getFontCss } from "./styles.helpers.js";
|
|
14
13
|
|
|
15
14
|
export let cssCode: Props["cssCode"] = undefined;
|
|
16
15
|
export let contentId: Props["contentId"] = undefined;
|