@builder.io/sdk-qwik 0.0.9 → 0.0.10

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.
@@ -5,7 +5,6 @@ import BuilderContext from "../../context/builder.context";
5
5
  import { getContent } from "../../functions/get-content/index.js";
6
6
  import {
7
7
  Fragment,
8
- Host,
9
8
  component$,
10
9
  h,
11
10
  useClientEffect$,
@@ -13,199 +12,66 @@ import {
13
12
  useStore,
14
13
  useWatch$,
15
14
  } from "@builder.io/qwik";
16
- export const Symbol = component$(
17
- (props) => {
18
- const builderContext = useContext(BuilderContext);
19
- const state = useStore({ className: "builder-symbol", content: null });
20
- useClientEffect$(() => {
21
- state.content = props.symbol?.content;
22
- });
23
- useWatch$(({ track }) => {
24
- props.symbol && track(props.symbol, "content");
25
- props.symbol && track(props.symbol, "model");
26
- props.symbol && track(props.symbol, "entry");
27
- state && track(state, "content");
28
- const symbolToUse = props.symbol;
29
- /**
30
- * If:
31
- * - we have a symbol prop
32
- * - yet it does not have any content
33
- * - and we have not already stored content from before
34
- * - and it has a model name
35
- *
36
- * then we want to re-fetch the symbol content.
37
- */
15
+ export const Symbol = component$((props) => {
16
+ const builderContext = useContext(BuilderContext);
17
+ const state = useStore({ className: "builder-symbol", content: null });
18
+ useClientEffect$(() => {
19
+ state.content = props.symbol?.content;
20
+ });
21
+ useWatch$(({ track }) => {
22
+ props.symbol && track(props.symbol, "content");
23
+ props.symbol && track(props.symbol, "model");
24
+ props.symbol && track(props.symbol, "entry");
25
+ state && track(state, "content");
26
+ const symbolToUse = props.symbol;
27
+ /**
28
+ * If:
29
+ * - we have a symbol prop
30
+ * - yet it does not have any content
31
+ * - and we have not already stored content from before
32
+ * - and it has a model name
33
+ *
34
+ * then we want to re-fetch the symbol content.
35
+ */
38
36
 
39
- if (
40
- symbolToUse &&
41
- !symbolToUse.content &&
42
- !state.content &&
43
- symbolToUse.model
44
- ) {
45
- getContent({
46
- model: symbolToUse.model,
47
- apiKey: builderContext.apiKey,
48
- query: {
49
- id: symbolToUse.entry,
50
- },
51
- }).then((response) => {
52
- state.content = response;
53
- });
54
- }
55
- });
56
- return (
57
- <Host
58
- {...props.attributes}
59
- dataSet={{
60
- class: state.className,
37
+ if (
38
+ symbolToUse &&
39
+ !symbolToUse.content &&
40
+ !state.content &&
41
+ symbolToUse.model
42
+ ) {
43
+ getContent({
44
+ model: symbolToUse.model,
45
+ apiKey: builderContext.apiKey,
46
+ query: {
47
+ id: symbolToUse.entry,
48
+ },
49
+ }).then((response) => {
50
+ state.content = response;
51
+ });
52
+ }
53
+ });
54
+ return (
55
+ <div
56
+ {...props.attributes}
57
+ dataSet={{
58
+ class: state.className,
59
+ }}
60
+ class={state.className}
61
+ >
62
+ <RenderContent
63
+ apiKey={builderContext.apiKey}
64
+ context={builderContext.context}
65
+ customComponents={Object.values(builderContext.registeredComponents)}
66
+ data={{
67
+ ...props.symbol?.data,
68
+ ...builderContext.state,
69
+ ...props.symbol?.content?.data?.state,
61
70
  }}
62
- class={state.className}
63
- >
64
- <RenderContent
65
- apiKey={builderContext.apiKey}
66
- context={builderContext.context}
67
- customComponents={Object.values(builderContext.registeredComponents)}
68
- data={{
69
- ...props.symbol?.data,
70
- ...builderContext.state,
71
- ...props.symbol?.content?.data?.state,
72
- }}
73
- model={props.symbol?.model}
74
- content={state.content}
75
- ></RenderContent>
76
- </Host>
77
- );
78
- },
79
- { tagName: "div" }
80
- );
71
+ model={props.symbol?.model}
72
+ content={state.content}
73
+ ></RenderContent>
74
+ </div>
75
+ );
76
+ });
81
77
  export default Symbol;
82
- export const COMPONENT = {
83
- "@type": "@builder.io/mitosis/component",
84
- imports: [
85
- {
86
- imports: {
87
- RenderContent: "default",
88
- },
89
- path: "../../components/render-content/render-content.lite",
90
- },
91
- {
92
- imports: {
93
- BuilderContext: "default",
94
- },
95
- path: "../../context/builder.context.lite",
96
- },
97
- {
98
- imports: {
99
- getContent: "getContent",
100
- },
101
- path: "../../functions/get-content/index.js",
102
- },
103
- ],
104
- exports: {},
105
- inputs: [],
106
- meta: {},
107
- refs: {},
108
- state: {
109
- className: "builder-symbol",
110
- content: null,
111
- },
112
- children: [
113
- {
114
- "@type": "@builder.io/mitosis/node",
115
- name: "Host",
116
- meta: {},
117
- scope: {},
118
- properties: {},
119
- bindings: {
120
- _spread: {
121
- code: "props.attributes",
122
- },
123
- dataSet: {
124
- code: "{\n class: state.className\n}",
125
- },
126
- class: {
127
- code: "state.className",
128
- },
129
- },
130
- children: [
131
- {
132
- "@type": "@builder.io/mitosis/node",
133
- name: "div",
134
- meta: {},
135
- scope: {},
136
- properties: {
137
- _text: "\n ",
138
- },
139
- bindings: {},
140
- children: [],
141
- },
142
- {
143
- "@type": "@builder.io/mitosis/node",
144
- name: "RenderContent",
145
- meta: {},
146
- scope: {},
147
- properties: {},
148
- bindings: {
149
- apiKey: {
150
- code: "builderContext.apiKey",
151
- },
152
- context: {
153
- code: "builderContext.context",
154
- },
155
- customComponents: {
156
- code: "Object.values(builderContext.registeredComponents)",
157
- },
158
- data: {
159
- code: "{ ...props.symbol?.data,\n ...builderContext.state,\n ...props.symbol?.content?.data?.state\n}",
160
- },
161
- model: {
162
- code: "props.symbol?.model",
163
- },
164
- content: {
165
- code: "state.content",
166
- },
167
- },
168
- children: [],
169
- },
170
- {
171
- "@type": "@builder.io/mitosis/node",
172
- name: "div",
173
- meta: {},
174
- scope: {},
175
- properties: {
176
- _text: "\n ",
177
- },
178
- bindings: {},
179
- children: [],
180
- },
181
- ],
182
- },
183
- ],
184
- hooks: {
185
- onMount: {
186
- code: "\n state.content = props.symbol?.content;\n",
187
- },
188
- onUpdate: [
189
- {
190
- code: "\n const symbolToUse = props.symbol;\n /**\n * If:\n * - we have a symbol prop\n * - yet it does not have any content\n * - and we have not already stored content from before\n * - and it has a model name\n *\n * then we want to re-fetch the symbol content.\n */\n\n if (symbolToUse && !symbolToUse.content && !state.content && symbolToUse.model) {\n getContent({\n model: symbolToUse.model,\n apiKey: builderContext.apiKey!,\n query: {\n id: symbolToUse.entry\n }\n }).then(response => {\n state.content = response;\n });\n }\n",
191
- deps: "[props.symbol?.content, props.symbol?.model, props.symbol?.entry, state.content]",
192
- },
193
- ],
194
- },
195
- context: {
196
- get: {
197
- builderContext: {
198
- name: "BuilderContext",
199
- path: "../../context/builder.context.lite:default",
200
- },
201
- },
202
- set: {},
203
- },
204
- name: "Symbol",
205
- subComponents: [],
206
- interfaces: [
207
- "export interface SymbolInfo {\n model?: string;\n entry?: string;\n data?: any;\n content?: BuilderContent;\n inline?: boolean;\n dynamic?: boolean;\n}",
208
- "export interface SymbolProps {\n symbol?: SymbolInfo;\n dataOnly?: boolean;\n dynamic?: boolean;\n builderBlock?: BuilderBlock;\n attributes?: any;\n inheritState?: boolean;\n}",
209
- ],
210
- propsTypeRef: "SymbolProps",
211
- };
@@ -1,46 +1,7 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
- import { Fragment, Host, component$, h } from "@builder.io/qwik";
4
- export const Text = component$(
5
- (props) => {
6
- return (
7
- <Host class="builder-text" dangerouslySetInnerHTML={props.text}></Host>
8
- );
9
- },
10
- { tagName: "div" }
11
- );
3
+ import { Fragment, component$, h } from "@builder.io/qwik";
4
+ export const Text = component$((props) => {
5
+ return <div class="builder-text" dangerouslySetInnerHTML={props.text}></div>;
6
+ });
12
7
  export default Text;
13
- export const COMPONENT = {
14
- "@type": "@builder.io/mitosis/component",
15
- imports: [],
16
- exports: {},
17
- inputs: [],
18
- meta: {},
19
- refs: {},
20
- state: {},
21
- children: [
22
- {
23
- "@type": "@builder.io/mitosis/node",
24
- name: "Host",
25
- meta: {},
26
- scope: {},
27
- properties: {
28
- class: "builder-text",
29
- },
30
- bindings: {
31
- innerHTML: {
32
- code: "props.text",
33
- },
34
- },
35
- children: [],
36
- },
37
- ],
38
- hooks: {},
39
- context: {
40
- get: {},
41
- set: {},
42
- },
43
- name: "Text",
44
- subComponents: [],
45
- propsTypeRef: "{\n text: string\n}",
46
- };
@@ -1,65 +1,15 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
- import { Fragment, Host, component$, h } from "@builder.io/qwik";
4
- export const Textarea = component$(
5
- (props) => {
6
- return (
7
- <Host
8
- {...props.attributes}
9
- placeholder={props.placeholder}
10
- name={props.name}
11
- value={props.value}
12
- defaultValue={props.defaultValue}
13
- ></Host>
14
- );
15
- },
16
- { tagName: "textarea" }
17
- );
3
+ import { Fragment, component$, h } from "@builder.io/qwik";
4
+ export const Textarea = component$((props) => {
5
+ return (
6
+ <textarea
7
+ {...props.attributes}
8
+ placeholder={props.placeholder}
9
+ name={props.name}
10
+ value={props.value}
11
+ defaultValue={props.defaultValue}
12
+ ></textarea>
13
+ );
14
+ });
18
15
  export default Textarea;
19
- export const COMPONENT = {
20
- "@type": "@builder.io/mitosis/component",
21
- imports: [],
22
- exports: {},
23
- inputs: [],
24
- meta: {},
25
- refs: {},
26
- state: {},
27
- children: [
28
- {
29
- "@type": "@builder.io/mitosis/node",
30
- name: "Host",
31
- meta: {},
32
- scope: {},
33
- properties: {},
34
- bindings: {
35
- _spread: {
36
- code: "props.attributes",
37
- },
38
- placeholder: {
39
- code: "props.placeholder",
40
- },
41
- name: {
42
- code: "props.name",
43
- },
44
- value: {
45
- code: "props.value",
46
- },
47
- defaultValue: {
48
- code: "props.defaultValue",
49
- },
50
- },
51
- children: [],
52
- },
53
- ],
54
- hooks: {},
55
- context: {
56
- get: {},
57
- set: {},
58
- },
59
- name: "Textarea",
60
- subComponents: [],
61
- interfaces: [
62
- "export interface TextareaProps {\n attributes?: any;\n name?: string;\n value?: string;\n defaultValue?: string;\n placeholder?: string;\n}",
63
- ],
64
- propsTypeRef: "TextareaProps",
65
- };
@@ -1,6 +1,6 @@
1
1
  // GENERATED BY MITOSIS
2
2
 
3
- import { Fragment, Host, component$, h } from "@builder.io/qwik";
3
+ import { Fragment, component$, h } from "@builder.io/qwik";
4
4
  export const videoProps = function videoProps(props, state) {
5
5
  return {
6
6
  ...(props.autoPlay === true
@@ -30,74 +30,24 @@ export const videoProps = function videoProps(props, state) {
30
30
  : {}),
31
31
  };
32
32
  };
33
- export const Video = component$(
34
- (props) => {
35
- const state = {};
36
- return (
37
- <Host
38
- {...videoProps(props, state)}
39
- style={{
40
- width: "100%",
41
- height: "100%",
42
- ...props.attributes?.style,
43
- objectFit: props.fit,
44
- objectPosition: props.position,
45
- // Hack to get object fit to work as expected and
46
- // not have the video overflow
47
- borderRadius: 1,
48
- }}
49
- src={props.video || "no-src"}
50
- poster={props.posterImage}
51
- ></Host>
52
- );
53
- },
54
- { tagName: "video" }
55
- );
33
+ export const Video = component$((props) => {
34
+ const state = {};
35
+ return (
36
+ <video
37
+ {...videoProps(props, state)}
38
+ style={{
39
+ width: "100%",
40
+ height: "100%",
41
+ ...props.attributes?.style,
42
+ objectFit: props.fit,
43
+ objectPosition: props.position,
44
+ // Hack to get object fit to work as expected and
45
+ // not have the video overflow
46
+ borderRadius: 1,
47
+ }}
48
+ src={props.video || "no-src"}
49
+ poster={props.posterImage}
50
+ ></video>
51
+ );
52
+ });
56
53
  export default Video;
57
- export const COMPONENT = {
58
- "@type": "@builder.io/mitosis/component",
59
- imports: [],
60
- exports: {},
61
- inputs: [],
62
- meta: {},
63
- refs: {},
64
- state: {
65
- videoProps:
66
- "@builder.io/mitosis/method:get videoProps() {\n return { ...(props.autoPlay === true ? {\n autoPlay: true\n } : {}),\n ...(props.muted === true ? {\n muted: true\n } : {}),\n ...(props.controls === true ? {\n controls: true\n } : {}),\n ...(props.loop === true ? {\n loop: true\n } : {}),\n ...(props.playsInline === true ? {\n playsInline: true\n } : {})\n };\n}",
67
- },
68
- children: [
69
- {
70
- "@type": "@builder.io/mitosis/node",
71
- name: "Host",
72
- meta: {},
73
- scope: {},
74
- properties: {},
75
- bindings: {
76
- _spread: {
77
- code: "videoProps(props,state)",
78
- },
79
- style: {
80
- code: "{\n width: '100%',\n height: '100%',\n ...props.attributes?.style,\n objectFit: props.fit,\n objectPosition: props.position,\n // Hack to get object fit to work as expected and\n // not have the video overflow\n borderRadius: 1\n}",
81
- },
82
- src: {
83
- code: "props.video || 'no-src'",
84
- },
85
- poster: {
86
- code: "props.posterImage",
87
- },
88
- },
89
- children: [],
90
- },
91
- ],
92
- hooks: {},
93
- context: {
94
- get: {},
95
- set: {},
96
- },
97
- name: "Video",
98
- subComponents: [],
99
- interfaces: [
100
- "export interface VideoProps {\n attributes?: any;\n video?: string;\n autoPlay?: boolean;\n controls?: boolean;\n muted?: boolean;\n loop?: boolean;\n playsInline?: boolean;\n aspectRatio?: number;\n width?: number;\n height?: number;\n fit?: 'contain' | 'cover' | 'fill';\n position?: 'center' | 'top' | 'left' | 'right' | 'bottom' | 'top left' | 'top right' | 'bottom left' | 'bottom right';\n posterImage?: string;\n lazyLoad?: boolean;\n}",
101
- ],
102
- propsTypeRef: "VideoProps",
103
- };
@@ -58,117 +58,3 @@ export const BlockStyles = (props) => {
58
58
  );
59
59
  };
60
60
  export default BlockStyles;
61
- export const COMPONENT = {
62
- "@type": "@builder.io/mitosis/component",
63
- imports: [
64
- {
65
- imports: {
66
- getMaxWidthQueryForSize: "getMaxWidthQueryForSize",
67
- },
68
- path: "../../constants/device-sizes.js",
69
- },
70
- {
71
- imports: {
72
- TARGET: "TARGET",
73
- },
74
- path: "../../constants/target.js",
75
- },
76
- {
77
- imports: {
78
- getProcessedBlock: "getProcessedBlock",
79
- },
80
- path: "../../functions/get-processed-block.js",
81
- },
82
- {
83
- imports: {
84
- convertStyleMaptoCSS: "convertStyleMaptoCSS",
85
- },
86
- path: "../../helpers/css.js",
87
- },
88
- {
89
- imports: {
90
- RenderInlinedStyles: "default",
91
- },
92
- path: "../render-inlined-styles.lite",
93
- },
94
- ],
95
- exports: {},
96
- inputs: [],
97
- meta: {
98
- useMetadata: {
99
- qwik: {
100
- component: {
101
- isLight: true,
102
- },
103
- },
104
- },
105
- },
106
- refs: {},
107
- state: {
108
- useBlock:
109
- "@builder.io/mitosis/method:get useBlock() {\n return getProcessedBlock({\n block: props.block,\n state: props.context.state,\n context: props.context.context,\n evaluateBindings: true\n });\n}",
110
- css: "@builder.io/mitosis/method:get css() {\n const styles = useBlock(props,state).responsiveStyles;\n const largeStyles = styles?.large;\n const mediumStyles = styles?.medium;\n const smallStyles = styles?.small;\n return `\n ${largeStyles ? `.${useBlock(props,state).id} {${convertStyleMaptoCSS(largeStyles)}}` : ''}\n ${mediumStyles ? `${getMaxWidthQueryForSize('medium')} {\n .${useBlock(props,state).id} {${convertStyleMaptoCSS(mediumStyles)}}\n }` : ''}\n ${smallStyles ? `${getMaxWidthQueryForSize('small')} {\n .${useBlock(props,state).id} {${convertStyleMaptoCSS(smallStyles)}}\n }` : ''}\n }`;\n}",
111
- },
112
- children: [
113
- {
114
- "@type": "@builder.io/mitosis/node",
115
- name: "Show",
116
- meta: {},
117
- scope: {},
118
- properties: {},
119
- bindings: {
120
- when: {
121
- code: "TARGET === 'vue2' || TARGET === 'vue3' || TARGET === 'svelte'",
122
- },
123
- },
124
- children: [
125
- {
126
- "@type": "@builder.io/mitosis/node",
127
- name: "div",
128
- meta: {},
129
- scope: {},
130
- properties: {
131
- _text: "\n ",
132
- },
133
- bindings: {},
134
- children: [],
135
- },
136
- {
137
- "@type": "@builder.io/mitosis/node",
138
- name: "RenderInlinedStyles",
139
- meta: {},
140
- scope: {},
141
- properties: {},
142
- bindings: {
143
- styles: {
144
- code: "css(props,state)",
145
- },
146
- },
147
- children: [],
148
- },
149
- {
150
- "@type": "@builder.io/mitosis/node",
151
- name: "div",
152
- meta: {},
153
- scope: {},
154
- properties: {
155
- _text: "\n ",
156
- },
157
- bindings: {},
158
- children: [],
159
- },
160
- ],
161
- },
162
- ],
163
- hooks: {},
164
- context: {
165
- get: {},
166
- set: {},
167
- },
168
- name: "BlockStyles",
169
- subComponents: [],
170
- types: [
171
- "export type BlockStylesProps = {\n block: BuilderBlock;\n context: BuilderContextInterface;\n};",
172
- ],
173
- propsTypeRef: "BlockStylesProps",
174
- };