@builder.io/sdk-qwik 0.0.8 → 0.0.9
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/README.md +65 -2
- package/lib/index.qwik.cjs +104 -7
- package/lib/index.qwik.mjs +104 -7
- package/package.json +1 -1
- package/src/blocks/button/button.jsx +197 -0
- package/src/blocks/button/component-info.js +41 -0
- package/src/blocks/columns/columns.jsx +267 -0
- package/src/blocks/columns/component-info.js +242 -0
- package/src/blocks/custom-code/component-info.js +31 -0
- package/src/blocks/custom-code/custom-code.jsx +130 -0
- package/src/blocks/embed/component-info.js +44 -0
- package/src/blocks/embed/embed.jsx +130 -0
- package/src/blocks/embed/helpers.js +9 -0
- package/src/blocks/form/builder-blocks.jsx +86 -0
- package/src/blocks/form/component-info.js +262 -0
- package/src/blocks/form/form.jsx +782 -0
- package/src/blocks/fragment/component-info.js +11 -0
- package/src/blocks/fragment/fragment.jsx +59 -0
- package/src/blocks/image/component-info.js +151 -0
- package/src/blocks/image/image.helpers.js +48 -0
- package/src/blocks/image/image.jsx +554 -0
- package/src/blocks/img/component-info.js +20 -0
- package/src/blocks/img/img.jsx +76 -0
- package/src/blocks/input/component-info.js +74 -0
- package/src/blocks/input/input.jsx +87 -0
- package/src/blocks/raw-text/component-info.js +16 -0
- package/src/blocks/raw-text/raw-text.jsx +53 -0
- package/src/blocks/section/component-info.js +49 -0
- package/src/blocks/section/section.jsx +97 -0
- package/src/blocks/select/component-info.js +59 -0
- package/src/blocks/select/select.jsx +149 -0
- package/src/blocks/submit-button/component-info.js +28 -0
- package/src/blocks/submit-button/submit-button.jsx +87 -0
- package/src/blocks/symbol/component-info.js +43 -0
- package/src/blocks/symbol/symbol.jsx +211 -0
- package/src/blocks/text/component-info.js +24 -0
- package/src/blocks/text/text.jsx +46 -0
- package/src/blocks/textarea/component-info.js +47 -0
- package/src/blocks/textarea/textarea.jsx +65 -0
- package/src/blocks/util.js +7 -0
- package/src/blocks/video/component-info.js +106 -0
- package/src/blocks/video/video.jsx +103 -0
- package/src/components/render-block/block-styles.jsx +174 -0
- package/src/components/render-block/render-block.helpers.js +23 -0
- package/src/components/render-block/render-block.jsx +733 -0
- package/src/components/render-block/render-component.jsx +245 -0
- package/src/components/render-block/render-repeated-block.jsx +104 -0
- package/src/components/render-block/types.js +0 -0
- package/src/components/render-blocks.jsx +387 -0
- package/src/components/render-content/components/render-styles.jsx +126 -0
- package/src/components/render-content/index.js +4 -0
- package/src/components/render-content/render-content.jsx +650 -0
- package/src/components/render-inlined-styles.jsx +141 -0
- package/src/constants/builder-registered-components.js +48 -0
- package/src/constants/device-sizes.js +21 -0
- package/src/constants/target.js +4 -0
- package/src/context/builder.context.js +5 -0
- package/src/functions/camel-to-kebab-case.js +4 -0
- package/src/functions/convert-style-object.js +6 -0
- package/src/functions/evaluate.js +28 -0
- package/src/functions/event-handler-name.js +7 -0
- package/src/functions/get-block-actions.js +23 -0
- package/src/functions/get-block-component-options.js +28 -0
- package/src/functions/get-block-properties.js +29 -0
- package/src/functions/get-block-styles.js +34 -0
- package/src/functions/get-block-tag.js +6 -0
- package/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/src/functions/get-builder-search-params/index.js +33 -0
- package/src/functions/get-content/ab-testing.js +38 -0
- package/src/functions/get-content/fn.test.js +31 -0
- package/src/functions/get-content/index.js +96 -0
- package/src/functions/get-content/types.js +0 -0
- package/src/functions/get-fetch.js +34 -0
- package/src/functions/get-global-this.js +18 -0
- package/src/functions/get-processed-block.js +53 -0
- package/src/functions/get-processed-block.test.js +32 -0
- package/src/functions/if-target.js +15 -0
- package/src/functions/is-browser.js +6 -0
- package/src/functions/is-editing.js +7 -0
- package/src/functions/is-iframe.js +7 -0
- package/src/functions/is-previewing.js +14 -0
- package/src/functions/on-change.js +27 -0
- package/src/functions/on-change.test.js +19 -0
- package/src/functions/register-component.js +72 -0
- package/src/functions/register.js +29 -0
- package/src/functions/sanitize-styles.js +5 -0
- package/src/functions/set-editor-settings.js +15 -0
- package/src/functions/set.js +11 -0
- package/src/functions/set.test.js +16 -0
- package/src/functions/track.js +22 -0
- package/src/functions/transform-block.js +6 -0
- package/src/helpers/css.js +12 -0
- package/src/helpers/flatten.js +34 -0
- package/src/index-helpers/blocks-exports.js +22 -0
- package/src/index-helpers/top-of-file.js +4 -0
- package/src/index.js +10 -0
- package/src/scripts/init-editing.js +79 -0
- package/src/types/builder-block.js +0 -0
- package/src/types/builder-content.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
- package/types.d.ts +7 -12
- package/root.json +0 -1176
package/README.md
CHANGED
|
@@ -1,7 +1,70 @@
|
|
|
1
1
|
# Builder.io SDK for Qwik
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use Qwik SDK to connect your Qwik application to Builder.io.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Installing the Qwik SDK is done in two steps:
|
|
8
|
+
|
|
9
|
+
1. Set up Qwik-city project.
|
|
10
|
+
2. Install the Qwik SDK into your Qwik-city project.
|
|
11
|
+
|
|
12
|
+
### Set up Qwik-city project
|
|
13
|
+
|
|
14
|
+
1. Follow the instructions on [Qwik-city](https://qwik.builder.io/qwikcity/overview)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm init qwik@latest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Follow instructions for setting up Qwik-city project.
|
|
21
|
+
|
|
22
|
+
### Install the Qwik SDK into your Qwik-city project
|
|
23
|
+
|
|
24
|
+
Add `@builder.io/sdk-qwik` to your `package.json` file:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm add --save @builder.io/sdk-qwik
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Add Qwik SDK code to a particular route (such as `src/routes/index.tsx`)
|
|
31
|
+
|
|
32
|
+
```typscript
|
|
33
|
+
import { component$, Host, Resource, useResource$ } from "@builder.io/qwik";
|
|
34
|
+
import { DocumentHead, useLocation } from "@builder.io/qwik-city";
|
|
35
|
+
import { getContent, RenderContent } from "@builder.io/sdk-qwik";
|
|
36
|
+
|
|
37
|
+
export const BUILDER_PUBLIC_API_KEY = "YOUR_API_KEY_GOES_HERE"; // ggignore
|
|
38
|
+
export default component$(() => {
|
|
39
|
+
const location = useLocation();
|
|
40
|
+
const builderContentRsrc = useResource$<any>(() => {
|
|
41
|
+
return getContent({
|
|
42
|
+
model: "page",
|
|
43
|
+
apiKey: BUILDER_PUBLIC_API_KEY,
|
|
44
|
+
userAttributes: {
|
|
45
|
+
urlPath: location.pathname || "/",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Host>
|
|
52
|
+
<Resource
|
|
53
|
+
resource={builderContentRsrc}
|
|
54
|
+
onPending={() => <div>Loading...</div>}
|
|
55
|
+
onResolved={(content) => (
|
|
56
|
+
<RenderContent
|
|
57
|
+
model="page"
|
|
58
|
+
content={content}
|
|
59
|
+
apiKey={BUILDER_PUBLIC_API_KEY}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
</Host>
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
```
|
|
4
67
|
|
|
5
68
|
## Mitosis
|
|
6
69
|
|
|
7
|
-
This SDK is generated by [Mitosis](https://github.com/BuilderIO/mitosis). To see the Mitosis source-code, go [here](
|
|
70
|
+
This SDK is generated by [Mitosis](https://github.com/BuilderIO/mitosis). To see the Mitosis source-code, go [here](https://github.com/BuilderIO/builder/tree/main/packages/sdks/src).
|
package/lib/index.qwik.cjs
CHANGED
|
@@ -6,12 +6,6 @@ const TARGET = "qwik";
|
|
|
6
6
|
function isBrowser() {
|
|
7
7
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
8
8
|
}
|
|
9
|
-
function isIframe() {
|
|
10
|
-
return isBrowser() && window.self !== window.top;
|
|
11
|
-
}
|
|
12
|
-
function isEditing() {
|
|
13
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
14
|
-
}
|
|
15
9
|
const registry = {};
|
|
16
10
|
function register(type, info) {
|
|
17
11
|
let typeList = registry[type];
|
|
@@ -35,7 +29,106 @@ function register(type, info) {
|
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
31
|
}
|
|
32
|
+
const registerInsertMenu = () => {
|
|
33
|
+
register("insertMenu", {
|
|
34
|
+
name: "_default",
|
|
35
|
+
default: true,
|
|
36
|
+
items: [
|
|
37
|
+
{
|
|
38
|
+
name: "Box"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Text"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "Image"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "Columns"
|
|
48
|
+
},
|
|
49
|
+
...TARGET === "reactNative" ? [] : [
|
|
50
|
+
{
|
|
51
|
+
name: "Core:Section"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "Core:Button"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "Embed"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "Custom Code"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const setupBrowserForEditing = () => {
|
|
67
|
+
var _a;
|
|
68
|
+
if (isBrowser()) {
|
|
69
|
+
(_a = window.parent) == null || _a.postMessage({
|
|
70
|
+
type: "builder.sdkInfo",
|
|
71
|
+
data: {
|
|
72
|
+
target: TARGET,
|
|
73
|
+
supportsPatchUpdates: false
|
|
74
|
+
}
|
|
75
|
+
}, "*");
|
|
76
|
+
window.addEventListener("message", ({ data }) => {
|
|
77
|
+
var _a2, _b;
|
|
78
|
+
if (data)
|
|
79
|
+
switch (data.type) {
|
|
80
|
+
case "builder.evaluate": {
|
|
81
|
+
const text = data.data.text;
|
|
82
|
+
const args = data.data.arguments || [];
|
|
83
|
+
const id = data.data.id;
|
|
84
|
+
const fn = new Function(text);
|
|
85
|
+
let result;
|
|
86
|
+
let error = null;
|
|
87
|
+
try {
|
|
88
|
+
result = fn.apply(null, args);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
error = err;
|
|
91
|
+
}
|
|
92
|
+
if (error)
|
|
93
|
+
(_a2 = window.parent) == null || _a2.postMessage({
|
|
94
|
+
type: "builder.evaluateError",
|
|
95
|
+
data: {
|
|
96
|
+
id,
|
|
97
|
+
error: error.message
|
|
98
|
+
}
|
|
99
|
+
}, "*");
|
|
100
|
+
else if (result && typeof result.then === "function")
|
|
101
|
+
result.then((finalResult) => {
|
|
102
|
+
var _a3;
|
|
103
|
+
(_a3 = window.parent) == null || _a3.postMessage({
|
|
104
|
+
type: "builder.evaluateResult",
|
|
105
|
+
data: {
|
|
106
|
+
id,
|
|
107
|
+
result: finalResult
|
|
108
|
+
}
|
|
109
|
+
}, "*");
|
|
110
|
+
}).catch(console.error);
|
|
111
|
+
else
|
|
112
|
+
(_b = window.parent) == null || _b.postMessage({
|
|
113
|
+
type: "builder.evaluateResult",
|
|
114
|
+
data: {
|
|
115
|
+
result,
|
|
116
|
+
id
|
|
117
|
+
}
|
|
118
|
+
}, "*");
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
38
125
|
var stdin_default = qwik.createContext("Builder");
|
|
126
|
+
function isIframe() {
|
|
127
|
+
return isBrowser() && window.self !== window.top;
|
|
128
|
+
}
|
|
129
|
+
function isEditing() {
|
|
130
|
+
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
131
|
+
}
|
|
39
132
|
const SIZES = {
|
|
40
133
|
small: {
|
|
41
134
|
min: 320,
|
|
@@ -2212,6 +2305,7 @@ const shouldRenderContentStyles = function shouldRenderContentStyles2(props, sta
|
|
|
2212
2305
|
const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
2213
2306
|
const hostElement = qwik.useHostElement();
|
|
2214
2307
|
const state = qwik.useStore({
|
|
2308
|
+
forceReRenderCount: 0,
|
|
2215
2309
|
overrideContent: null,
|
|
2216
2310
|
update: 0,
|
|
2217
2311
|
overrideState: {}
|
|
@@ -2237,7 +2331,10 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2237
2331
|
const [hostElement2, props2, state2] = qwik.useLexicalScope();
|
|
2238
2332
|
if (isBrowser()) {
|
|
2239
2333
|
if (isEditing()) {
|
|
2334
|
+
state2.forceReRenderCount++;
|
|
2240
2335
|
qwik._useMutableProps(hostElement2, true);
|
|
2336
|
+
registerInsertMenu();
|
|
2337
|
+
setupBrowserForEditing();
|
|
2241
2338
|
Object.values(allRegisteredComponents(props2)).forEach((registeredComponent) => {
|
|
2242
2339
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
2243
2340
|
window.parent?.postMessage(message, "*");
|
|
@@ -2323,7 +2420,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2323
2420
|
}) : null,
|
|
2324
2421
|
/* @__PURE__ */ jsxRuntime.jsx(RenderBlocks$1, {
|
|
2325
2422
|
blocks: useContent(props, state)?.data?.blocks
|
|
2326
|
-
})
|
|
2423
|
+
}, state.forceReRenderCount)
|
|
2327
2424
|
]
|
|
2328
2425
|
}) : null
|
|
2329
2426
|
});
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -4,12 +4,6 @@ const TARGET = "qwik";
|
|
|
4
4
|
function isBrowser() {
|
|
5
5
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
6
6
|
}
|
|
7
|
-
function isIframe() {
|
|
8
|
-
return isBrowser() && window.self !== window.top;
|
|
9
|
-
}
|
|
10
|
-
function isEditing() {
|
|
11
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
12
|
-
}
|
|
13
7
|
const registry = {};
|
|
14
8
|
function register(type, info) {
|
|
15
9
|
let typeList = registry[type];
|
|
@@ -33,7 +27,106 @@ function register(type, info) {
|
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
}
|
|
30
|
+
const registerInsertMenu = () => {
|
|
31
|
+
register("insertMenu", {
|
|
32
|
+
name: "_default",
|
|
33
|
+
default: true,
|
|
34
|
+
items: [
|
|
35
|
+
{
|
|
36
|
+
name: "Box"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Text"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "Image"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Columns"
|
|
46
|
+
},
|
|
47
|
+
...TARGET === "reactNative" ? [] : [
|
|
48
|
+
{
|
|
49
|
+
name: "Core:Section"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "Core:Button"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "Embed"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "Custom Code"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const setupBrowserForEditing = () => {
|
|
65
|
+
var _a;
|
|
66
|
+
if (isBrowser()) {
|
|
67
|
+
(_a = window.parent) == null || _a.postMessage({
|
|
68
|
+
type: "builder.sdkInfo",
|
|
69
|
+
data: {
|
|
70
|
+
target: TARGET,
|
|
71
|
+
supportsPatchUpdates: false
|
|
72
|
+
}
|
|
73
|
+
}, "*");
|
|
74
|
+
window.addEventListener("message", ({ data }) => {
|
|
75
|
+
var _a2, _b;
|
|
76
|
+
if (data)
|
|
77
|
+
switch (data.type) {
|
|
78
|
+
case "builder.evaluate": {
|
|
79
|
+
const text = data.data.text;
|
|
80
|
+
const args = data.data.arguments || [];
|
|
81
|
+
const id = data.data.id;
|
|
82
|
+
const fn = new Function(text);
|
|
83
|
+
let result;
|
|
84
|
+
let error = null;
|
|
85
|
+
try {
|
|
86
|
+
result = fn.apply(null, args);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
error = err;
|
|
89
|
+
}
|
|
90
|
+
if (error)
|
|
91
|
+
(_a2 = window.parent) == null || _a2.postMessage({
|
|
92
|
+
type: "builder.evaluateError",
|
|
93
|
+
data: {
|
|
94
|
+
id,
|
|
95
|
+
error: error.message
|
|
96
|
+
}
|
|
97
|
+
}, "*");
|
|
98
|
+
else if (result && typeof result.then === "function")
|
|
99
|
+
result.then((finalResult) => {
|
|
100
|
+
var _a3;
|
|
101
|
+
(_a3 = window.parent) == null || _a3.postMessage({
|
|
102
|
+
type: "builder.evaluateResult",
|
|
103
|
+
data: {
|
|
104
|
+
id,
|
|
105
|
+
result: finalResult
|
|
106
|
+
}
|
|
107
|
+
}, "*");
|
|
108
|
+
}).catch(console.error);
|
|
109
|
+
else
|
|
110
|
+
(_b = window.parent) == null || _b.postMessage({
|
|
111
|
+
type: "builder.evaluateResult",
|
|
112
|
+
data: {
|
|
113
|
+
result,
|
|
114
|
+
id
|
|
115
|
+
}
|
|
116
|
+
}, "*");
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
36
123
|
var stdin_default = createContext("Builder");
|
|
124
|
+
function isIframe() {
|
|
125
|
+
return isBrowser() && window.self !== window.top;
|
|
126
|
+
}
|
|
127
|
+
function isEditing() {
|
|
128
|
+
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
129
|
+
}
|
|
37
130
|
const SIZES = {
|
|
38
131
|
small: {
|
|
39
132
|
min: 320,
|
|
@@ -2210,6 +2303,7 @@ const shouldRenderContentStyles = function shouldRenderContentStyles2(props, sta
|
|
|
2210
2303
|
const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
2211
2304
|
const hostElement = useHostElement();
|
|
2212
2305
|
const state = useStore({
|
|
2306
|
+
forceReRenderCount: 0,
|
|
2213
2307
|
overrideContent: null,
|
|
2214
2308
|
update: 0,
|
|
2215
2309
|
overrideState: {}
|
|
@@ -2235,7 +2329,10 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2235
2329
|
const [hostElement2, props2, state2] = useLexicalScope();
|
|
2236
2330
|
if (isBrowser()) {
|
|
2237
2331
|
if (isEditing()) {
|
|
2332
|
+
state2.forceReRenderCount++;
|
|
2238
2333
|
_useMutableProps(hostElement2, true);
|
|
2334
|
+
registerInsertMenu();
|
|
2335
|
+
setupBrowserForEditing();
|
|
2239
2336
|
Object.values(allRegisteredComponents(props2)).forEach((registeredComponent) => {
|
|
2240
2337
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
2241
2338
|
window.parent?.postMessage(message, "*");
|
|
@@ -2321,7 +2418,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2321
2418
|
}) : null,
|
|
2322
2419
|
/* @__PURE__ */ jsx(RenderBlocks$1, {
|
|
2323
2420
|
blocks: useContent(props, state)?.data?.blocks
|
|
2324
|
-
})
|
|
2421
|
+
}, state.forceReRenderCount)
|
|
2325
2422
|
]
|
|
2326
2423
|
}) : null
|
|
2327
2424
|
});
|
package/package.json
CHANGED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// GENERATED BY MITOSIS
|
|
2
|
+
|
|
3
|
+
import { Fragment, component$, h } from "@builder.io/qwik";
|
|
4
|
+
export const Button = component$((props) => {
|
|
5
|
+
return (
|
|
6
|
+
<Fragment>
|
|
7
|
+
{props.link ? (
|
|
8
|
+
<a
|
|
9
|
+
role="button"
|
|
10
|
+
{...props.attributes}
|
|
11
|
+
href={props.link}
|
|
12
|
+
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
13
|
+
>
|
|
14
|
+
{props.text}
|
|
15
|
+
</a>
|
|
16
|
+
) : (
|
|
17
|
+
<span {...props.attributes}>{props.text}</span>
|
|
18
|
+
)}
|
|
19
|
+
</Fragment>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
export default Button;
|
|
23
|
+
export const COMPONENT = {
|
|
24
|
+
"@type": "@builder.io/mitosis/component",
|
|
25
|
+
imports: [],
|
|
26
|
+
exports: {},
|
|
27
|
+
inputs: [],
|
|
28
|
+
meta: {},
|
|
29
|
+
refs: {},
|
|
30
|
+
state: {},
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
"@type": "@builder.io/mitosis/node",
|
|
34
|
+
name: "Fragment",
|
|
35
|
+
meta: {},
|
|
36
|
+
scope: {},
|
|
37
|
+
properties: {},
|
|
38
|
+
bindings: {},
|
|
39
|
+
children: [
|
|
40
|
+
{
|
|
41
|
+
"@type": "@builder.io/mitosis/node",
|
|
42
|
+
name: "div",
|
|
43
|
+
meta: {},
|
|
44
|
+
scope: {},
|
|
45
|
+
properties: {
|
|
46
|
+
_text: "\n ",
|
|
47
|
+
},
|
|
48
|
+
bindings: {},
|
|
49
|
+
children: [],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"@type": "@builder.io/mitosis/node",
|
|
53
|
+
name: "Show",
|
|
54
|
+
meta: {
|
|
55
|
+
else: {
|
|
56
|
+
"@type": "@builder.io/mitosis/node",
|
|
57
|
+
name: "span",
|
|
58
|
+
meta: {},
|
|
59
|
+
scope: {},
|
|
60
|
+
properties: {},
|
|
61
|
+
bindings: {
|
|
62
|
+
_spread: {
|
|
63
|
+
code: "props.attributes",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
children: [
|
|
67
|
+
{
|
|
68
|
+
"@type": "@builder.io/mitosis/node",
|
|
69
|
+
name: "div",
|
|
70
|
+
meta: {},
|
|
71
|
+
scope: {},
|
|
72
|
+
properties: {},
|
|
73
|
+
bindings: {
|
|
74
|
+
_text: {
|
|
75
|
+
code: "props.text",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
children: [],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
scope: {},
|
|
84
|
+
properties: {},
|
|
85
|
+
bindings: {
|
|
86
|
+
when: {
|
|
87
|
+
code: "props.link",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
{
|
|
92
|
+
"@type": "@builder.io/mitosis/node",
|
|
93
|
+
name: "div",
|
|
94
|
+
meta: {},
|
|
95
|
+
scope: {},
|
|
96
|
+
properties: {
|
|
97
|
+
_text: "\n ",
|
|
98
|
+
},
|
|
99
|
+
bindings: {},
|
|
100
|
+
children: [],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"@type": "@builder.io/mitosis/node",
|
|
104
|
+
name: "a",
|
|
105
|
+
meta: {},
|
|
106
|
+
scope: {},
|
|
107
|
+
properties: {
|
|
108
|
+
role: "button",
|
|
109
|
+
},
|
|
110
|
+
bindings: {
|
|
111
|
+
_spread: {
|
|
112
|
+
code: "props.attributes",
|
|
113
|
+
},
|
|
114
|
+
href: {
|
|
115
|
+
code: "props.link",
|
|
116
|
+
},
|
|
117
|
+
target: {
|
|
118
|
+
code: "props.openLinkInNewTab ? '_blank' : undefined",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
{
|
|
123
|
+
"@type": "@builder.io/mitosis/node",
|
|
124
|
+
name: "div",
|
|
125
|
+
meta: {},
|
|
126
|
+
scope: {},
|
|
127
|
+
properties: {
|
|
128
|
+
_text: "\n ",
|
|
129
|
+
},
|
|
130
|
+
bindings: {},
|
|
131
|
+
children: [],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"@type": "@builder.io/mitosis/node",
|
|
135
|
+
name: "div",
|
|
136
|
+
meta: {},
|
|
137
|
+
scope: {},
|
|
138
|
+
properties: {},
|
|
139
|
+
bindings: {
|
|
140
|
+
_text: {
|
|
141
|
+
code: "props.text",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
children: [],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"@type": "@builder.io/mitosis/node",
|
|
148
|
+
name: "div",
|
|
149
|
+
meta: {},
|
|
150
|
+
scope: {},
|
|
151
|
+
properties: {
|
|
152
|
+
_text: "\n ",
|
|
153
|
+
},
|
|
154
|
+
bindings: {},
|
|
155
|
+
children: [],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"@type": "@builder.io/mitosis/node",
|
|
161
|
+
name: "div",
|
|
162
|
+
meta: {},
|
|
163
|
+
scope: {},
|
|
164
|
+
properties: {
|
|
165
|
+
_text: "\n ",
|
|
166
|
+
},
|
|
167
|
+
bindings: {},
|
|
168
|
+
children: [],
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"@type": "@builder.io/mitosis/node",
|
|
174
|
+
name: "div",
|
|
175
|
+
meta: {},
|
|
176
|
+
scope: {},
|
|
177
|
+
properties: {
|
|
178
|
+
_text: "\n ",
|
|
179
|
+
},
|
|
180
|
+
bindings: {},
|
|
181
|
+
children: [],
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
hooks: {},
|
|
187
|
+
context: {
|
|
188
|
+
get: {},
|
|
189
|
+
set: {},
|
|
190
|
+
},
|
|
191
|
+
name: "Button",
|
|
192
|
+
subComponents: [],
|
|
193
|
+
interfaces: [
|
|
194
|
+
"export interface ButtonProps {\n attributes?: any;\n text?: string;\n link?: string;\n openLinkInNewTab?: boolean;\n}",
|
|
195
|
+
],
|
|
196
|
+
propsTypeRef: "ButtonProps",
|
|
197
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Core:Button",
|
|
3
|
+
builtIn: true,
|
|
4
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
5
|
+
defaultStyles: {
|
|
6
|
+
appearance: "none",
|
|
7
|
+
paddingTop: "15px",
|
|
8
|
+
paddingBottom: "15px",
|
|
9
|
+
paddingLeft: "25px",
|
|
10
|
+
paddingRight: "25px",
|
|
11
|
+
backgroundColor: "#000000",
|
|
12
|
+
color: "white",
|
|
13
|
+
borderRadius: "4px",
|
|
14
|
+
textAlign: "center",
|
|
15
|
+
cursor: "pointer"
|
|
16
|
+
},
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
name: "text",
|
|
20
|
+
type: "text",
|
|
21
|
+
defaultValue: "Click me!",
|
|
22
|
+
bubble: true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "link",
|
|
26
|
+
type: "url",
|
|
27
|
+
bubble: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "openLinkInNewTab",
|
|
31
|
+
type: "boolean",
|
|
32
|
+
defaultValue: false,
|
|
33
|
+
friendlyName: "Open link in new tab"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
static: true,
|
|
37
|
+
noWrap: true
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
componentInfo
|
|
41
|
+
};
|