@builder.io/sdk-solid 0.0.8-21 → 0.0.8-24

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 (38) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button/button.jsx +6 -1
  3. package/src/blocks/columns/columns.jsx +44 -47
  4. package/src/blocks/columns/component-info.js +3 -2
  5. package/src/blocks/custom-code/custom-code.jsx +34 -37
  6. package/src/blocks/embed/component-info.js +3 -2
  7. package/src/blocks/embed/embed.jsx +28 -31
  8. package/src/blocks/form/form.jsx +172 -173
  9. package/src/blocks/image/component-info.js +3 -2
  10. package/src/blocks/image/image.jsx +26 -29
  11. package/src/blocks/img/img.jsx +1 -1
  12. package/src/blocks/symbol/symbol.jsx +10 -13
  13. package/src/blocks/util.js +7 -0
  14. package/src/blocks/video/video.jsx +19 -23
  15. package/src/components/render-block/block-styles.jsx +22 -27
  16. package/src/components/render-block/render-block.jsx +155 -159
  17. package/src/components/render-block/render-component.jsx +2 -2
  18. package/src/components/render-block/render-repeated-block.jsx +1 -1
  19. package/src/components/render-blocks.jsx +32 -33
  20. package/src/components/render-content/components/render-styles.jsx +38 -41
  21. package/src/components/render-content/render-content.jsx +170 -156
  22. package/src/components/render-inlined-styles.jsx +10 -13
  23. package/src/constants/builder-registered-components.js +3 -0
  24. package/src/functions/get-fetch.js +2 -2
  25. package/src/functions/get-processed-block.js +10 -6
  26. package/src/functions/get-processed-block.test.js +1 -1
  27. package/src/functions/track.js +71 -2
  28. package/src/helpers/cookie.js +59 -0
  29. package/src/helpers/localStorage.js +34 -0
  30. package/src/helpers/nullable.js +4 -0
  31. package/src/helpers/sessionId.js +26 -0
  32. package/src/helpers/time.js +5 -0
  33. package/src/helpers/url.js +10 -0
  34. package/src/helpers/url.test.js +15 -0
  35. package/src/helpers/uuid.js +13 -0
  36. package/src/helpers/visitorId.js +33 -0
  37. package/src/scripts/init-editing.js +4 -5
  38. package/src/types/can-track.js +0 -0
@@ -1,250 +1,249 @@
1
- import { Show, For } from "solid-js";
2
- import { createMutable } from "solid-js/store";
1
+ import { useContext, Show, For, createSignal } from "solid-js";
3
2
  import { css } from "solid-styled-components";
4
3
  import RenderBlock from "../../components/render-block/render-block.jsx";
4
+ import BuilderBlocks from "../../components/render-blocks.jsx";
5
5
  import { isEditing } from "../../functions/is-editing.js";
6
6
 
7
7
  function FormComponent(props) {
8
- const state = createMutable({
9
- formState: "unsubmitted",
10
- responseData: null,
11
- formErrorMessage: "",
8
+ const [formState, setFormState] = createSignal("unsubmitted");
9
+ const [responseData, setResponseData] = createSignal(null);
10
+ const [formErrorMessage, setFormErrorMessage] = createSignal("");
12
11
 
13
- get submissionState() {
14
- return isEditing() && props.previewState || state.formState;
15
- },
12
+ function submissionState() {
13
+ return isEditing() && props.previewState || formState();
14
+ }
16
15
 
17
- onSubmit(event) {
18
- const sendWithJs = props.sendWithJs || props.sendSubmissionsTo === "email";
16
+ function onSubmit(event) {
17
+ const sendWithJs = props.sendWithJs || props.sendSubmissionsTo === "email";
19
18
 
20
- if (props.sendSubmissionsTo === "zapier") {
19
+ if (props.sendSubmissionsTo === "zapier") {
20
+ event.preventDefault();
21
+ } else if (sendWithJs) {
22
+ if (!(props.action || props.sendSubmissionsTo === "email")) {
21
23
  event.preventDefault();
22
- } else if (sendWithJs) {
23
- if (!(props.action || props.sendSubmissionsTo === "email")) {
24
- event.preventDefault();
25
- return;
26
- }
24
+ return;
25
+ }
27
26
 
28
- event.preventDefault();
29
- const el = event.currentTarget;
30
- const headers = props.customHeaders || {};
31
- let body;
32
- const formData = new FormData(el); // TODO: maybe support null
33
-
34
- const formPairs = Array.from(event.currentTarget.querySelectorAll("input,select,textarea")).filter(el => !!el.name).map(el => {
35
- let value;
36
- const key = el.name;
37
-
38
- if (el instanceof HTMLInputElement) {
39
- if (el.type === "radio") {
40
- if (el.checked) {
41
- value = el.name;
42
- return {
43
- key,
44
- value
45
- };
46
- }
47
- } else if (el.type === "checkbox") {
48
- value = el.checked;
49
- } else if (el.type === "number" || el.type === "range") {
50
- const num = el.valueAsNumber;
27
+ event.preventDefault();
28
+ const el = event.currentTarget;
29
+ const headers = props.customHeaders || {};
30
+ let body;
31
+ const formData = new FormData(el); // TODO: maybe support null
32
+
33
+ const formPairs = Array.from(event.currentTarget.querySelectorAll("input,select,textarea")).filter(el => !!el.name).map(el => {
34
+ let value;
35
+ const key = el.name;
36
+
37
+ if (el instanceof HTMLInputElement) {
38
+ if (el.type === "radio") {
39
+ if (el.checked) {
40
+ value = el.name;
41
+ return {
42
+ key,
43
+ value
44
+ };
45
+ }
46
+ } else if (el.type === "checkbox") {
47
+ value = el.checked;
48
+ } else if (el.type === "number" || el.type === "range") {
49
+ const num = el.valueAsNumber;
51
50
 
52
- if (!isNaN(num)) {
53
- value = num;
54
- }
55
- } else if (el.type === "file") {
56
- // TODO: one vs multiple files
57
- value = el.files;
58
- } else {
59
- value = el.value;
51
+ if (!isNaN(num)) {
52
+ value = num;
60
53
  }
54
+ } else if (el.type === "file") {
55
+ // TODO: one vs multiple files
56
+ value = el.files;
61
57
  } else {
62
58
  value = el.value;
63
59
  }
60
+ } else {
61
+ value = el.value;
62
+ }
64
63
 
65
- return {
66
- key,
67
- value
68
- };
69
- });
70
- let contentType = props.contentType;
64
+ return {
65
+ key,
66
+ value
67
+ };
68
+ });
69
+ let contentType = props.contentType;
71
70
 
72
- if (props.sendSubmissionsTo === "email") {
71
+ if (props.sendSubmissionsTo === "email") {
72
+ contentType = "multipart/form-data";
73
+ }
74
+
75
+ Array.from(formPairs).forEach(({
76
+ value
77
+ }) => {
78
+ if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
73
79
  contentType = "multipart/form-data";
74
80
  }
75
-
81
+ }); // TODO: send as urlEncoded or multipart by default
82
+ // because of ease of use and reliability in browser API
83
+ // for encoding the form?
84
+
85
+ if (contentType !== "application/json") {
86
+ body = formData;
87
+ } else {
88
+ // Json
89
+ const json = {};
76
90
  Array.from(formPairs).forEach(({
77
- value
91
+ value,
92
+ key
78
93
  }) => {
79
- if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
80
- contentType = "multipart/form-data";
81
- }
82
- }); // TODO: send as urlEncoded or multipart by default
83
- // because of ease of use and reliability in browser API
84
- // for encoding the form?
94
+ set(json, key, value);
95
+ });
96
+ body = JSON.stringify(json);
97
+ }
85
98
 
86
- if (contentType !== "application/json") {
87
- body = formData;
88
- } else {
89
- // Json
90
- const json = {};
91
- Array.from(formPairs).forEach(({
92
- value,
93
- key
94
- }) => {
95
- set(json, key, value);
96
- });
97
- body = JSON.stringify(json);
99
+ if (contentType && contentType !== "multipart/form-data") {
100
+ if (
101
+ /* Zapier doesn't allow content-type header to be sent from browsers */
102
+ !(sendWithJs && props.action?.includes("zapier.com"))) {
103
+ headers["content-type"] = contentType;
98
104
  }
105
+ }
99
106
 
100
- if (contentType && contentType !== "multipart/form-data") {
101
- if (
102
- /* Zapier doesn't allow content-type header to be sent from browsers */
103
- !(sendWithJs && props.action?.includes("zapier.com"))) {
104
- headers["content-type"] = contentType;
105
- }
107
+ const presubmitEvent = new CustomEvent("presubmit", {
108
+ detail: {
109
+ body
106
110
  }
111
+ });
107
112
 
108
- const presubmitEvent = new CustomEvent("presubmit", {
109
- detail: {
110
- body
111
- }
112
- });
113
-
114
- if (formRef) {
115
- formRef.dispatchEvent(presubmitEvent);
113
+ if (formRef) {
114
+ formRef.dispatchEvent(presubmitEvent);
116
115
 
117
- if (presubmitEvent.defaultPrevented) {
118
- return;
119
- }
116
+ if (presubmitEvent.defaultPrevented) {
117
+ return;
120
118
  }
119
+ }
121
120
 
122
- state.formState = "sending";
123
- const formUrl = `${builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
124
- fetch(props.sendSubmissionsTo === "email" ? formUrl : props.action,
125
- /* TODO: throw error if no action URL */
126
- {
127
- body,
128
- headers,
129
- method: props.method || "post"
130
- }).then(async res => {
131
- let body;
132
- const contentType = res.headers.get("content-type");
133
-
134
- if (contentType && contentType.indexOf("application/json") !== -1) {
135
- body = await res.json();
136
- } else {
137
- body = await res.text();
138
- }
121
+ setFormState("sending");
122
+ const formUrl = `${builder.env === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${builder.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
123
+ fetch(props.sendSubmissionsTo === "email" ? formUrl : props.action,
124
+ /* TODO: throw error if no action URL */
125
+ {
126
+ body,
127
+ headers,
128
+ method: props.method || "post"
129
+ }).then(async res => {
130
+ let body;
131
+ const contentType = res.headers.get("content-type");
139
132
 
140
- if (!res.ok && props.errorMessagePath) {
141
- /* TODO: allow supplying an error formatter function */
142
- let message = get(body, props.errorMessagePath);
133
+ if (contentType && contentType.indexOf("application/json") !== -1) {
134
+ body = await res.json();
135
+ } else {
136
+ body = await res.text();
137
+ }
143
138
 
144
- if (message) {
145
- if (typeof message !== "string") {
146
- /* TODO: ideally convert json to yaml so it woul dbe like
147
- error: - email has been taken */
148
- message = JSON.stringify(message);
149
- }
139
+ if (!res.ok && props.errorMessagePath) {
140
+ /* TODO: allow supplying an error formatter function */
141
+ let message = get(body, props.errorMessagePath);
150
142
 
151
- state.formErrorMessage = message;
143
+ if (message) {
144
+ if (typeof message !== "string") {
145
+ /* TODO: ideally convert json to yaml so it woul dbe like
146
+ error: - email has been taken */
147
+ message = JSON.stringify(message);
152
148
  }
149
+
150
+ setFormErrorMessage(message);
153
151
  }
152
+ }
154
153
 
155
- state.responseData = body;
156
- state.formState = res.ok ? "success" : "error";
154
+ setResponseData(body);
155
+ setFormState(res.ok ? "success" : "error");
157
156
 
158
- if (res.ok) {
159
- const submitSuccessEvent = new CustomEvent("submit:success", {
160
- detail: {
161
- res,
162
- body
163
- }
164
- });
157
+ if (res.ok) {
158
+ const submitSuccessEvent = new CustomEvent("submit:success", {
159
+ detail: {
160
+ res,
161
+ body
162
+ }
163
+ });
165
164
 
166
- if (formRef) {
167
- formRef.dispatchEvent(submitSuccessEvent);
165
+ if (formRef) {
166
+ formRef.dispatchEvent(submitSuccessEvent);
168
167
 
169
- if (submitSuccessEvent.defaultPrevented) {
170
- return;
171
- }
172
- /* TODO: option to turn this on/off? */
168
+ if (submitSuccessEvent.defaultPrevented) {
169
+ return;
170
+ }
171
+ /* TODO: option to turn this on/off? */
173
172
 
174
173
 
175
- if (props.resetFormOnSubmit !== false) {
176
- formRef.reset();
177
- }
174
+ if (props.resetFormOnSubmit !== false) {
175
+ formRef.reset();
178
176
  }
179
- /* TODO: client side route event first that can be preventDefaulted */
180
-
177
+ }
178
+ /* TODO: client side route event first that can be preventDefaulted */
181
179
 
182
- if (props.successUrl) {
183
- if (formRef) {
184
- const event = new CustomEvent("route", {
185
- detail: {
186
- url: props.successUrl
187
- }
188
- });
189
- formRef.dispatchEvent(event);
190
180
 
191
- if (!event.defaultPrevented) {
192
- location.href = props.successUrl;
181
+ if (props.successUrl) {
182
+ if (formRef) {
183
+ const event = new CustomEvent("route", {
184
+ detail: {
185
+ url: props.successUrl
193
186
  }
194
- } else {
187
+ });
188
+ formRef.dispatchEvent(event);
189
+
190
+ if (!event.defaultPrevented) {
195
191
  location.href = props.successUrl;
196
192
  }
193
+ } else {
194
+ location.href = props.successUrl;
197
195
  }
198
196
  }
199
- }, err => {
200
- const submitErrorEvent = new CustomEvent("submit:error", {
201
- detail: {
202
- error: err
203
- }
204
- });
197
+ }
198
+ }, err => {
199
+ const submitErrorEvent = new CustomEvent("submit:error", {
200
+ detail: {
201
+ error: err
202
+ }
203
+ });
205
204
 
206
- if (formRef) {
207
- formRef.dispatchEvent(submitErrorEvent);
205
+ if (formRef) {
206
+ formRef.dispatchEvent(submitErrorEvent);
208
207
 
209
- if (submitErrorEvent.defaultPrevented) {
210
- return;
211
- }
208
+ if (submitErrorEvent.defaultPrevented) {
209
+ return;
212
210
  }
211
+ }
213
212
 
214
- state.responseData = err;
215
- state.formState = "error";
216
- });
217
- }
213
+ setResponseData(err);
214
+ setFormState("error");
215
+ });
218
216
  }
217
+ }
219
218
 
220
- });
221
219
  let formRef;
222
- return <form {...props.attributes} validate={props.validate} ref={formRef} action={!props.sendWithJs && props.action} method={props.method} name={props.name} onSubmit={event => state.onSubmit(event)}>
220
+ const builderContext = useContext(BuilderContext);
221
+ return <form {...props.attributes} validate={props.validate} ref={formRef} action={!props.sendWithJs && props.action} method={props.method} name={props.name} onSubmit={event => onSubmit(event)}>
223
222
  <Show when={props.builderBlock && props.builderBlock.children}>
224
223
  <For each={props.builderBlock?.children}>
225
224
  {(block, _index) => {
226
225
  const index = _index();
227
226
 
228
- return <RenderBlock block={block}></RenderBlock>;
227
+ return <RenderBlock block={block} context={builderContext}></RenderBlock>;
229
228
  }}
230
229
  </For>
231
230
  </Show>
232
- <Show when={state.submissionState === "error"}>
231
+ <Show when={submissionState() === "error"}>
233
232
  <BuilderBlocks dataPath="errorMessage" blocks={props.errorMessage}></BuilderBlocks>
234
233
  </Show>
235
- <Show when={state.submissionState === "sending"}>
234
+ <Show when={submissionState() === "sending"}>
236
235
  <BuilderBlocks dataPath="sendingMessage" blocks={props.sendingMessage}></BuilderBlocks>
237
236
  </Show>
238
- <Show when={state.submissionState === "error" && state.responseData}>
237
+ <Show when={submissionState() === "error" && responseData()}>
239
238
  <pre class={"builder-form-error-text " + css({
240
239
  padding: "10px",
241
240
  color: "red",
242
241
  textAlign: "center"
243
242
  })}>
244
- {JSON.stringify(state.responseData, null, 2)}
243
+ {JSON.stringify(responseData(), null, 2)}
245
244
  </pre>
246
245
  </Show>
247
- <Show when={state.submissionState === "success"}>
246
+ <Show when={submissionState() === "success"}>
248
247
  <BuilderBlocks dataPath="successMessage" blocks={props.successMessage}></BuilderBlocks>
249
248
  </Show>
250
249
  </form>;
@@ -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,47 +1,44 @@
1
1
  import { Show } from "solid-js";
2
- import { createMutable } from "solid-js/store";
3
2
  import { css } from "solid-styled-components";
4
3
  import { getSrcSet } from "./image.helpers";
5
4
 
6
5
  function Image(props) {
7
- const state = createMutable({
8
- get srcSetToUse() {
9
- const imageToUse = props.image || props.src;
10
- const url = imageToUse;
6
+ function srcSetToUse() {
7
+ const imageToUse = props.image || props.src;
8
+ const url = imageToUse;
11
9
 
12
- if (!url || // We can auto add srcset for cdn.builder.io and shopify
13
- // images, otherwise you can supply this prop manually
14
- !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
15
- return props.srcset;
16
- }
10
+ if (!url || // We can auto add srcset for cdn.builder.io and shopify
11
+ // images, otherwise you can supply this prop manually
12
+ !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
13
+ return props.srcset;
14
+ }
17
15
 
18
- if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
19
- if (!props.srcset.includes(props.image.split("?")[0])) {
20
- console.debug("Removed given srcset");
21
- return getSrcSet(url);
22
- }
23
- } else if (props.image && !props.srcset) {
16
+ if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
17
+ if (!props.srcset.includes(props.image.split("?")[0])) {
18
+ console.debug("Removed given srcset");
24
19
  return getSrcSet(url);
25
20
  }
26
-
21
+ } else if (props.image && !props.srcset) {
27
22
  return getSrcSet(url);
28
- },
23
+ }
29
24
 
30
- get webpSrcSet() {
31
- if (state.srcSetToUse?.match(/builder\.io/) && !props.noWebp) {
32
- return state.srcSetToUse.replace(/\?/g, "?format=webp&");
33
- } else {
34
- return "";
35
- }
25
+ return getSrcSet(url);
26
+ }
27
+
28
+ function webpSrcSet() {
29
+ if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
30
+ return srcSetToUse().replace(/\?/g, "?format=webp&");
31
+ } else {
32
+ return "";
36
33
  }
34
+ }
37
35
 
38
- });
39
36
  return <div class={css({
40
37
  position: "relative"
41
38
  })}>
42
39
  <picture>
43
- <Show when={state.webpSrcSet}>
44
- <source type="image/webp" srcset={state.webpSrcSet} />
40
+ <Show when={webpSrcSet()}>
41
+ <source type="image/webp" srcset={webpSrcSet()} />
45
42
  </Show>
46
43
  <img class={"builder-image" + (props.className ? " " + props.className : "") + " " + css({
47
44
  opacity: "1",
@@ -54,8 +51,8 @@ function Image(props) {
54
51
  })} loading="lazy" alt={props.altText} role={props.altText ? "presentation" : undefined} style={{
55
52
  "object-position": props.backgroundSize || "center",
56
53
  "object-fit": props.backgroundSize || "cover"
57
- }} src={props.image} srcset={state.srcSetToUse} sizes={props.sizes} />
58
- <source srcset={state.srcSetToUse} />
54
+ }} src={props.image} srcset={srcSetToUse()} sizes={props.sizes} />
55
+ <source srcset={srcSetToUse()} />
59
56
  </picture>
60
57
  <Show when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}>
61
58
  <div class={"builder-image-sizer " + css({
@@ -4,7 +4,7 @@ function ImgComponent(props) {
4
4
  return <img {...props.attributes} style={{
5
5
  "object-fit": props.backgroundSize || "cover",
6
6
  "object-position": props.backgroundPosition || "center"
7
- }} key={isEditing() && props.imgSrc || "default-key"} alt={props.altText} src={props.imgSrc} />;
7
+ }} key={isEditing() && props.imgSrc || "default-key"} alt={props.altText} src={props.imgSrc || props.image} />;
8
8
  }
9
9
 
10
10
  export default ImgComponent;
@@ -1,17 +1,14 @@
1
- import { useContext, onMount, on, createEffect } from "solid-js";
2
- import { createMutable } from "solid-js/store";
1
+ import { useContext, onMount, on, createEffect, createSignal } from "solid-js";
3
2
  import RenderContent from "../../components/render-content/render-content.jsx";
4
3
  import BuilderContext from "../../context/builder.context";
5
4
  import { getContent } from "../../functions/get-content/index.js";
6
5
 
7
6
  function Symbol(props) {
8
- const state = createMutable({
9
- className: "builder-symbol",
10
- content: null
11
- });
7
+ const [className, setClassName] = createSignal("builder-symbol");
8
+ const [content, setContent] = createSignal(null);
12
9
  const builderContext = useContext(BuilderContext);
13
10
  onMount(() => {
14
- state.content = props.symbol?.content;
11
+ setContent(props.symbol?.content);
15
12
  });
16
13
 
17
14
  function onUpdateFn_0() {
@@ -26,7 +23,7 @@ function Symbol(props) {
26
23
  * then we want to re-fetch the symbol content.
27
24
  */
28
25
 
29
- if (symbolToUse && !symbolToUse.content && !state.content && symbolToUse.model) {
26
+ if (symbolToUse && !symbolToUse.content && !content() && symbolToUse.model) {
30
27
  getContent({
31
28
  model: symbolToUse.model,
32
29
  apiKey: builderContext.apiKey,
@@ -34,19 +31,19 @@ function Symbol(props) {
34
31
  id: symbolToUse.entry
35
32
  }
36
33
  }).then(response => {
37
- state.content = response;
34
+ setContent(response);
38
35
  });
39
36
  }
40
37
  }
41
38
 
42
- createEffect(on(() => [props.symbol?.content, props.symbol?.model, props.symbol?.entry, state.content], onUpdateFn_0));
43
- return <div class={state.className} {...props.attributes} dataSet={{
44
- class: state.className
39
+ createEffect(on(() => [props.symbol?.content, props.symbol?.model, props.symbol?.entry, content()], onUpdateFn_0));
40
+ return <div class={className()} {...props.attributes} dataSet={{
41
+ class: className()
45
42
  }}>
46
43
  <RenderContent apiKey={builderContext.apiKey} context={builderContext.context} customComponents={Object.values(builderContext.registeredComponents)} data={{ ...props.symbol?.data,
47
44
  ...builderContext.state,
48
45
  ...props.symbol?.content?.data?.state
49
- }} model={props.symbol?.model} content={state.content}></RenderContent>
46
+ }} model={props.symbol?.model} content={content()}></RenderContent>
50
47
  </div>;
51
48
  }
52
49
 
@@ -0,0 +1,7 @@
1
+ function markSerializable(fn) {
2
+ fn.__qwik_serializable__ = true;
3
+ return fn;
4
+ }
5
+ export {
6
+ markSerializable
7
+ };
@@ -1,28 +1,24 @@
1
- import { createMutable } from "solid-js/store";
2
-
3
1
  function Video(props) {
4
- const state = createMutable({
5
- get videoProps() {
6
- return { ...(props.autoPlay === true ? {
7
- autoPlay: true
8
- } : {}),
9
- ...(props.muted === true ? {
10
- muted: true
11
- } : {}),
12
- ...(props.controls === true ? {
13
- controls: true
14
- } : {}),
15
- ...(props.loop === true ? {
16
- loop: true
17
- } : {}),
18
- ...(props.playsInline === true ? {
19
- playsInline: true
20
- } : {})
21
- };
22
- }
2
+ function videoProps() {
3
+ return { ...(props.autoPlay === true ? {
4
+ autoPlay: true
5
+ } : {}),
6
+ ...(props.muted === true ? {
7
+ muted: true
8
+ } : {}),
9
+ ...(props.controls === true ? {
10
+ controls: true
11
+ } : {}),
12
+ ...(props.loop === true ? {
13
+ loop: true
14
+ } : {}),
15
+ ...(props.playsInline === true ? {
16
+ playsInline: true
17
+ } : {})
18
+ };
19
+ }
23
20
 
24
- });
25
- return <video {...state.videoProps} style={{
21
+ return <video {...videoProps()} style={{
26
22
  width: "100%",
27
23
  height: "100%",
28
24
  ...props.attributes?.style,