@builder.io/sdk-svelte 0.0.1-31 → 0.0.1-32
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/package.json +1 -1
- package/src/blocks/button/button.svelte +14 -5
- package/src/blocks/columns/columns.svelte +27 -6
- package/src/blocks/columns/component-info.js +3 -2
- package/src/blocks/custom-code/custom-code.svelte +11 -4
- package/src/blocks/embed/component-info.js +3 -2
- package/src/blocks/embed/embed.svelte +9 -3
- package/src/blocks/form/form.svelte +87 -40
- package/src/blocks/fragment/fragment.svelte +9 -1
- package/src/blocks/image/component-info.js +3 -2
- package/src/blocks/image/image.svelte +33 -14
- package/src/blocks/img/img.svelte +29 -7
- package/src/blocks/input/input.svelte +20 -8
- package/src/blocks/raw-text/raw-text.svelte +10 -3
- package/src/blocks/section/section.svelte +12 -3
- package/src/blocks/select/select.svelte +20 -7
- package/src/blocks/submit-button/submit-button.svelte +10 -3
- package/src/blocks/symbol/symbol.svelte +23 -3
- package/src/blocks/text/text.svelte +8 -2
- package/src/blocks/textarea/textarea.svelte +16 -6
- package/src/blocks/util.js +7 -0
- package/src/blocks/video/video.svelte +39 -11
- package/src/components/render-block/block-styles.svelte +15 -12
- package/src/components/render-block/render-block.svelte +29 -25
- package/src/components/render-block/render-component.svelte +18 -8
- package/src/components/render-block/render-repeated-block.svelte +20 -4
- package/src/components/render-blocks.svelte +21 -8
- package/src/components/render-content/components/render-styles.svelte +19 -3
- package/src/components/render-content/render-content.svelte +67 -27
- package/src/components/render-inlined-styles.svelte +8 -2
- package/src/constants/builder-registered-components.js +3 -0
- package/src/functions/get-fetch.js +2 -2
- package/src/functions/get-processed-block.js +10 -6
- package/src/functions/get-processed-block.test.js +1 -1
- package/src/scripts/init-editing.js +4 -5
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
text?: string;
|
|
5
|
+
link?: string;
|
|
6
|
+
openLinkInNewTab?: boolean;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
export let attributes: ButtonProps["attributes"];
|
|
12
|
+
export let text: ButtonProps["text"];
|
|
13
|
+
export let link: ButtonProps["link"];
|
|
14
|
+
export let openLinkInNewTab: ButtonProps["openLinkInNewTab"];
|
|
6
15
|
</script>
|
|
7
16
|
|
|
8
17
|
{#if link}
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
type Column = {
|
|
3
|
+
blocks: any; // TODO: Implement this when support for dynamic CSS lands
|
|
4
|
+
|
|
5
|
+
width?: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type StackColumnsAt = "tablet" | "mobile" | "never";
|
|
9
|
+
|
|
10
|
+
export interface ColumnProps {
|
|
11
|
+
columns?: Column[];
|
|
12
|
+
builderBlock: BuilderBlock; // TODO: Implement this when support for dynamic CSS lands
|
|
13
|
+
|
|
14
|
+
space?: number; // TODO: Implement this when support for dynamic CSS lands
|
|
15
|
+
|
|
16
|
+
stackColumnsAt?: StackColumnsAt; // TODO: Implement this when support for dynamic CSS lands
|
|
17
|
+
|
|
18
|
+
reverseColumnsWhenStacked?: boolean;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
2
23
|
import RenderBlocks from "../../components/render-blocks.svelte";
|
|
3
24
|
|
|
4
|
-
export let space;
|
|
5
|
-
export let columns;
|
|
6
|
-
export let stackColumnsAt;
|
|
7
|
-
export let reverseColumnsWhenStacked;
|
|
8
|
-
export let builderBlock;
|
|
25
|
+
export let space: ColumnProps["space"];
|
|
26
|
+
export let columns: ColumnProps["columns"];
|
|
27
|
+
export let stackColumnsAt: ColumnProps["stackColumnsAt"];
|
|
28
|
+
export let reverseColumnsWhenStacked: ColumnProps["reverseColumnsWhenStacked"];
|
|
29
|
+
export let builderBlock: ColumnProps["builderBlock"];
|
|
9
30
|
|
|
10
31
|
function mitosis_styling(node, vars) {
|
|
11
32
|
Object.entries(vars).forEach(([p, v]) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markSerializable } from "../util";
|
|
1
2
|
const componentInfo = {
|
|
2
3
|
name: "Columns",
|
|
3
4
|
builtIn: true,
|
|
@@ -186,7 +187,7 @@ const componentInfo = {
|
|
|
186
187
|
]
|
|
187
188
|
}
|
|
188
189
|
],
|
|
189
|
-
onChange(options) {
|
|
190
|
+
onChange: markSerializable((options) => {
|
|
190
191
|
function clearWidths() {
|
|
191
192
|
columns.forEach((col) => {
|
|
192
193
|
col.delete("width");
|
|
@@ -210,7 +211,7 @@ const componentInfo = {
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
|
-
}
|
|
214
|
+
})
|
|
214
215
|
},
|
|
215
216
|
{
|
|
216
217
|
name: "space",
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface CustomCodeProps {
|
|
3
|
+
code: string;
|
|
4
|
+
replaceNodes?: boolean;
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
2
9
|
import { onMount } from "svelte";
|
|
3
10
|
|
|
4
|
-
export let elem;
|
|
5
|
-
export let replaceNodes;
|
|
6
|
-
export let code;
|
|
11
|
+
export let elem: CustomCodeProps["elem"];
|
|
12
|
+
export let replaceNodes: CustomCodeProps["replaceNodes"];
|
|
13
|
+
export let code: CustomCodeProps["code"];
|
|
7
14
|
|
|
8
15
|
const findAndRunScripts = function findAndRunScripts() {
|
|
9
16
|
// TODO: Move this function to standalone one in '@builder.io/utils'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markSerializable } from "../util";
|
|
1
2
|
const componentInfo = {
|
|
2
3
|
name: "Embed",
|
|
3
4
|
static: true,
|
|
@@ -9,7 +10,7 @@ const componentInfo = {
|
|
|
9
10
|
required: true,
|
|
10
11
|
defaultValue: "",
|
|
11
12
|
helperText: "e.g. enter a youtube url, google map, etc",
|
|
12
|
-
onChange(options) {
|
|
13
|
+
onChange: markSerializable((options) => {
|
|
13
14
|
const url = options.get("url");
|
|
14
15
|
if (url) {
|
|
15
16
|
options.set("content", "Loading...");
|
|
@@ -28,7 +29,7 @@ const componentInfo = {
|
|
|
28
29
|
} else {
|
|
29
30
|
options.delete("content");
|
|
30
31
|
}
|
|
31
|
-
}
|
|
32
|
+
})
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
name: "content",
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface EmbedProps {
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
2
8
|
import { afterUpdate } from "svelte";
|
|
3
9
|
|
|
4
10
|
import { isJsScript } from "./helpers";
|
|
5
11
|
|
|
6
|
-
export let elem;
|
|
7
|
-
export let content;
|
|
12
|
+
export let elem: EmbedProps["elem"];
|
|
13
|
+
export let content: EmbedProps["content"];
|
|
8
14
|
|
|
9
15
|
const findAndRunScripts = function findAndRunScripts() {
|
|
10
16
|
const scripts = elem.getElementsByTagName("script");
|
|
@@ -1,26 +1,87 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This component was copied over from the old SDKs and has a lot of code pointing to invalid functions/env vars. It needs
|
|
9
|
+
* to be cleaned up before the component can actually be usable.
|
|
10
|
+
*/
|
|
11
|
+
interface BuilderElement {}
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-nocheck
|
|
15
|
+
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This component was copied over from the old SDKs and has a lot of code pointing to invalid functions/env vars. It needs
|
|
20
|
+
* to be cleaned up before the component can actually be usable.
|
|
21
|
+
*/
|
|
22
|
+
export interface FormProps {
|
|
23
|
+
attributes?: any;
|
|
24
|
+
name?: string;
|
|
25
|
+
action?: string;
|
|
26
|
+
validate?: boolean;
|
|
27
|
+
method?: string;
|
|
28
|
+
builderBlock?: BuilderElement;
|
|
29
|
+
sendSubmissionsTo?: string;
|
|
30
|
+
sendSubmissionsToEmail?: string;
|
|
31
|
+
sendWithJs?: boolean;
|
|
32
|
+
contentType?: string;
|
|
33
|
+
customHeaders?: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
};
|
|
36
|
+
successUrl?: string;
|
|
37
|
+
previewState?: FormState;
|
|
38
|
+
successMessage?: BuilderElement[];
|
|
39
|
+
errorMessage?: BuilderElement[];
|
|
40
|
+
sendingMessage?: BuilderElement[];
|
|
41
|
+
resetFormOnSubmit?: boolean;
|
|
42
|
+
errorMessagePath?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
|
+
// @ts-nocheck
|
|
47
|
+
|
|
48
|
+
/* eslint-disable */
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* This component was copied over from the old SDKs and has a lot of code pointing to invalid functions/env vars. It needs
|
|
52
|
+
* to be cleaned up before the component can actually be usable.
|
|
53
|
+
*/
|
|
54
|
+
export type FormState = "unsubmitted" | "sending" | "success" | "error";
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<script lang="ts">
|
|
2
58
|
import RenderBlock from "../../components/render-block/render-block.svelte";
|
|
59
|
+
import BuilderBlocks from "../../components/render-blocks.svelte";
|
|
3
60
|
import { isEditing } from "../../functions/is-editing.js";
|
|
4
61
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
export let
|
|
11
|
-
export let
|
|
12
|
-
export let
|
|
13
|
-
export let
|
|
14
|
-
export let
|
|
15
|
-
export let
|
|
16
|
-
export let
|
|
17
|
-
export let
|
|
18
|
-
export let
|
|
19
|
-
export let
|
|
20
|
-
export let
|
|
21
|
-
export let
|
|
22
|
-
export let
|
|
23
|
-
export let
|
|
62
|
+
import { getContext, setContext } from "svelte";
|
|
63
|
+
|
|
64
|
+
export let formRef: FormProps["formRef"];
|
|
65
|
+
export let previewState: FormProps["previewState"];
|
|
66
|
+
export let sendWithJs: FormProps["sendWithJs"];
|
|
67
|
+
export let sendSubmissionsTo: FormProps["sendSubmissionsTo"];
|
|
68
|
+
export let action: FormProps["action"];
|
|
69
|
+
export let customHeaders: FormProps["customHeaders"];
|
|
70
|
+
export let contentType: FormProps["contentType"];
|
|
71
|
+
export let sendSubmissionsToEmail: FormProps["sendSubmissionsToEmail"];
|
|
72
|
+
export let name: FormProps["name"];
|
|
73
|
+
export let method: FormProps["method"];
|
|
74
|
+
export let errorMessagePath: FormProps["errorMessagePath"];
|
|
75
|
+
export let resetFormOnSubmit: FormProps["resetFormOnSubmit"];
|
|
76
|
+
export let successUrl: FormProps["successUrl"];
|
|
77
|
+
export let validate: FormProps["validate"];
|
|
78
|
+
export let attributes: FormProps["attributes"];
|
|
79
|
+
export let builderBlock: FormProps["builderBlock"];
|
|
80
|
+
export let errorMessage: FormProps["errorMessage"];
|
|
81
|
+
export let sendingMessage: FormProps["sendingMessage"];
|
|
82
|
+
export let successMessage: FormProps["successMessage"];
|
|
83
|
+
|
|
84
|
+
let builderContext = getContext(BuilderContext.key);
|
|
24
85
|
|
|
25
86
|
const onSubmit = function onSubmit(event) {
|
|
26
87
|
const sendWithJs = sendWithJs || sendSubmissionsTo === "email";
|
|
@@ -256,41 +317,27 @@
|
|
|
256
317
|
}}
|
|
257
318
|
>
|
|
258
319
|
{#if builderBlock && builderBlock.children}
|
|
259
|
-
{#each builderBlock?.children as block
|
|
260
|
-
<RenderBlock {block} />
|
|
320
|
+
{#each builderBlock?.children as block}
|
|
321
|
+
<RenderBlock {block} context={builderContext} />
|
|
261
322
|
{/each}
|
|
262
323
|
{/if}
|
|
263
324
|
|
|
264
325
|
{#if submissionState() === "error"}
|
|
265
|
-
<
|
|
266
|
-
this={BuilderBlocks}
|
|
267
|
-
dataPath="errorMessage"
|
|
268
|
-
blocks={errorMessage}
|
|
269
|
-
/>
|
|
326
|
+
<BuilderBlocks dataPath="errorMessage" blocks={errorMessage} />
|
|
270
327
|
{/if}
|
|
271
328
|
|
|
272
329
|
{#if submissionState() === "sending"}
|
|
273
|
-
<
|
|
274
|
-
this={BuilderBlocks}
|
|
275
|
-
dataPath="sendingMessage"
|
|
276
|
-
blocks={sendingMessage}
|
|
277
|
-
/>
|
|
330
|
+
<BuilderBlocks dataPath="sendingMessage" blocks={sendingMessage} />
|
|
278
331
|
{/if}
|
|
279
332
|
|
|
280
333
|
{#if submissionState() === "error" && responseData}
|
|
281
334
|
<pre class="builder-form-error-text pre">
|
|
282
|
-
|
|
283
|
-
{JSON.stringify(responseData, null, 2)}
|
|
284
|
-
|
|
335
|
+
{JSON.stringify(responseData, null, 2)}
|
|
285
336
|
</pre>
|
|
286
337
|
{/if}
|
|
287
338
|
|
|
288
339
|
{#if submissionState() === "success"}
|
|
289
|
-
<
|
|
290
|
-
this={BuilderBlocks}
|
|
291
|
-
dataPath="successMessage"
|
|
292
|
-
blocks={successMessage}
|
|
293
|
-
/>
|
|
340
|
+
<BuilderBlocks dataPath="successMessage" blocks={successMessage} />
|
|
294
341
|
{/if}
|
|
295
342
|
</form>
|
|
296
343
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { markSerializable } from "../util";
|
|
1
2
|
const componentInfo = {
|
|
2
3
|
name: "Image",
|
|
3
4
|
static: true,
|
|
@@ -18,7 +19,7 @@ const componentInfo = {
|
|
|
18
19
|
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
19
20
|
required: true,
|
|
20
21
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
21
|
-
onChange(options) {
|
|
22
|
+
onChange: markSerializable((options) => {
|
|
22
23
|
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
23
24
|
options.delete("srcset");
|
|
24
25
|
options.delete("noWebp");
|
|
@@ -64,7 +65,7 @@ const componentInfo = {
|
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
}
|
|
68
|
+
})
|
|
68
69
|
},
|
|
69
70
|
{
|
|
70
71
|
name: "backgroundSize",
|
|
@@ -1,17 +1,38 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface ImageProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
image: string;
|
|
5
|
+
sizes?: string;
|
|
6
|
+
lazy?: boolean;
|
|
7
|
+
height?: number;
|
|
8
|
+
width?: number;
|
|
9
|
+
altText?: string;
|
|
10
|
+
backgroundSize?: string;
|
|
11
|
+
backgroundPosition?: string;
|
|
12
|
+
srcset?: string;
|
|
13
|
+
aspectRatio?: number;
|
|
14
|
+
children?: JSX.Element;
|
|
15
|
+
fitContent?: boolean;
|
|
16
|
+
builderBlock?: BuilderBlock;
|
|
17
|
+
noWebp?: boolean;
|
|
18
|
+
src?: string;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
2
23
|
import { getSrcSet } from "./image.helpers";
|
|
3
24
|
|
|
4
|
-
export let image;
|
|
5
|
-
export let src;
|
|
6
|
-
export let srcset;
|
|
7
|
-
export let noWebp;
|
|
8
|
-
export let altText;
|
|
9
|
-
export let backgroundSize;
|
|
10
|
-
export let className;
|
|
11
|
-
export let sizes;
|
|
12
|
-
export let aspectRatio;
|
|
13
|
-
export let fitContent;
|
|
14
|
-
export let builderBlock;
|
|
25
|
+
export let image: ImageProps["image"];
|
|
26
|
+
export let src: ImageProps["src"];
|
|
27
|
+
export let srcset: ImageProps["srcset"];
|
|
28
|
+
export let noWebp: ImageProps["noWebp"];
|
|
29
|
+
export let altText: ImageProps["altText"];
|
|
30
|
+
export let backgroundSize: ImageProps["backgroundSize"];
|
|
31
|
+
export let className: ImageProps["className"];
|
|
32
|
+
export let sizes: ImageProps["sizes"];
|
|
33
|
+
export let aspectRatio: ImageProps["aspectRatio"];
|
|
34
|
+
export let fitContent: ImageProps["fitContent"];
|
|
35
|
+
export let builderBlock: ImageProps["builderBlock"];
|
|
15
36
|
|
|
16
37
|
function mitosis_styling(node, vars) {
|
|
17
38
|
Object.entries(vars).forEach(([p, v]) => {
|
|
@@ -57,7 +78,6 @@
|
|
|
57
78
|
{#if webpSrcSet()}
|
|
58
79
|
<source type="image/webp" srcset={webpSrcSet()} />
|
|
59
80
|
{/if}
|
|
60
|
-
|
|
61
81
|
<img
|
|
62
82
|
use:mitosis_styling={{
|
|
63
83
|
objectPosition: backgroundSize || "center",
|
|
@@ -71,7 +91,6 @@
|
|
|
71
91
|
srcset={srcSetToUse()}
|
|
72
92
|
{sizes}
|
|
73
93
|
/>
|
|
74
|
-
|
|
75
94
|
<source srcset={srcSetToUse()} />
|
|
76
95
|
</picture>
|
|
77
96
|
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface ImgProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
imgSrc?: string; // TODO(misko): I think this is unused
|
|
5
|
+
|
|
6
|
+
image?: string;
|
|
7
|
+
altText?: string;
|
|
8
|
+
backgroundSize?: "cover" | "contain";
|
|
9
|
+
backgroundPosition?:
|
|
10
|
+
| "center"
|
|
11
|
+
| "top"
|
|
12
|
+
| "left"
|
|
13
|
+
| "right"
|
|
14
|
+
| "bottom"
|
|
15
|
+
| "top left"
|
|
16
|
+
| "top right"
|
|
17
|
+
| "bottom left"
|
|
18
|
+
| "bottom right";
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
2
23
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
24
|
|
|
4
|
-
export let backgroundSize;
|
|
5
|
-
export let backgroundPosition;
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
25
|
+
export let backgroundSize: ImgProps["backgroundSize"];
|
|
26
|
+
export let backgroundPosition: ImgProps["backgroundPosition"];
|
|
27
|
+
export let imgSrc: ImgProps["imgSrc"];
|
|
28
|
+
export let altText: ImgProps["altText"];
|
|
29
|
+
export let image: ImgProps["image"];
|
|
30
|
+
export let attributes: ImgProps["attributes"];
|
|
9
31
|
|
|
10
32
|
function mitosis_styling(node, vars) {
|
|
11
33
|
Object.entries(vars).forEach(([p, v]) => {
|
|
@@ -22,5 +44,5 @@
|
|
|
22
44
|
}}
|
|
23
45
|
key={(isEditing() && imgSrc) || "default-key"}
|
|
24
46
|
alt={altText}
|
|
25
|
-
src={imgSrc}
|
|
47
|
+
src={imgSrc || image}
|
|
26
48
|
/>
|
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface FormInputProps {
|
|
3
|
+
type?: string;
|
|
4
|
+
attributes?: any;
|
|
5
|
+
name?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
2
14
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
15
|
|
|
4
|
-
export let attributes;
|
|
5
|
-
export let defaultValue;
|
|
6
|
-
export let placeholder;
|
|
7
|
-
export let type;
|
|
8
|
-
export let name;
|
|
9
|
-
export let value;
|
|
10
|
-
export let required;
|
|
16
|
+
export let attributes: FormInputProps["attributes"];
|
|
17
|
+
export let defaultValue: FormInputProps["defaultValue"];
|
|
18
|
+
export let placeholder: FormInputProps["placeholder"];
|
|
19
|
+
export let type: FormInputProps["type"];
|
|
20
|
+
export let name: FormInputProps["name"];
|
|
21
|
+
export let value: FormInputProps["value"];
|
|
22
|
+
export let required: FormInputProps["required"];
|
|
11
23
|
</script>
|
|
12
24
|
|
|
13
25
|
<input
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface RawTextProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
text?: string; // builderBlock?: any;
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export let attributes: RawTextProps["attributes"];
|
|
10
|
+
export let text: RawTextProps["text"];
|
|
4
11
|
</script>
|
|
5
12
|
|
|
6
13
|
<span class={attributes?.class || attributes?.className}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface SectionProps {
|
|
3
|
+
maxWidth?: number;
|
|
4
|
+
attributes?: any;
|
|
5
|
+
children?: any;
|
|
6
|
+
builderBlock?: any;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
export let attributes: SectionProps["attributes"];
|
|
12
|
+
export let maxWidth: SectionProps["maxWidth"];
|
|
4
13
|
|
|
5
14
|
function mitosis_styling(node, vars) {
|
|
6
15
|
Object.entries(vars).forEach(([p, v]) => {
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface FormSelectProps {
|
|
3
|
+
options?: {
|
|
4
|
+
name?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
7
|
+
attributes?: any;
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
2
15
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
16
|
|
|
4
|
-
export let attributes;
|
|
5
|
-
export let value;
|
|
6
|
-
export let defaultValue;
|
|
7
|
-
export let name;
|
|
8
|
-
export let options;
|
|
17
|
+
export let attributes: FormSelectProps["attributes"];
|
|
18
|
+
export let value: FormSelectProps["value"];
|
|
19
|
+
export let defaultValue: FormSelectProps["defaultValue"];
|
|
20
|
+
export let name: FormSelectProps["name"];
|
|
21
|
+
export let options: FormSelectProps["options"];
|
|
9
22
|
</script>
|
|
10
23
|
|
|
11
24
|
<select
|
|
@@ -15,7 +28,7 @@
|
|
|
15
28
|
{defaultValue}
|
|
16
29
|
{name}
|
|
17
30
|
>
|
|
18
|
-
{#each options as option
|
|
31
|
+
{#each options as option}
|
|
19
32
|
<option value={option.value}>{option.name || option.value}</option>
|
|
20
33
|
{/each}
|
|
21
34
|
</select>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
text?: string;
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export let attributes: ButtonProps["attributes"];
|
|
10
|
+
export let text: ButtonProps["text"];
|
|
4
11
|
</script>
|
|
5
12
|
|
|
6
13
|
<button {...attributes} type="submit">
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface SymbolInfo {
|
|
3
|
+
model?: string;
|
|
4
|
+
entry?: string;
|
|
5
|
+
data?: any;
|
|
6
|
+
content?: BuilderContent;
|
|
7
|
+
inline?: boolean;
|
|
8
|
+
dynamic?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SymbolProps {
|
|
12
|
+
symbol?: SymbolInfo;
|
|
13
|
+
dataOnly?: boolean;
|
|
14
|
+
dynamic?: boolean;
|
|
15
|
+
builderBlock?: BuilderBlock;
|
|
16
|
+
attributes?: any;
|
|
17
|
+
inheritState?: boolean;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
2
22
|
import { onMount } from "svelte";
|
|
3
23
|
import { afterUpdate } from "svelte";
|
|
4
24
|
|
|
@@ -8,8 +28,8 @@
|
|
|
8
28
|
|
|
9
29
|
import { getContext, setContext } from "svelte";
|
|
10
30
|
|
|
11
|
-
export let attributes;
|
|
12
|
-
export let symbol;
|
|
31
|
+
export let attributes: SymbolProps["attributes"];
|
|
32
|
+
export let symbol: SymbolProps["symbol"];
|
|
13
33
|
|
|
14
34
|
let builderContext = getContext(BuilderContext.key);
|
|
15
35
|
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface TextareaProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
name?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
export let attributes: TextareaProps["attributes"];
|
|
13
|
+
export let placeholder: TextareaProps["placeholder"];
|
|
14
|
+
export let name: TextareaProps["name"];
|
|
15
|
+
export let value: TextareaProps["value"];
|
|
16
|
+
export let defaultValue: TextareaProps["defaultValue"];
|
|
7
17
|
</script>
|
|
8
18
|
|
|
9
19
|
<textarea {...attributes} {placeholder} {name} {value} {defaultValue} />
|