@builder.io/sdk-qwik 0.0.7 → 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.
- package/README.md +65 -2
- package/lib/index.97024df8.js +80165 -0
- package/lib/index.d8c1e37f.cjs +80165 -0
- package/lib/index.qwik.cjs +2465 -0
- package/lib/index.qwik.mjs +2465 -0
- package/package.json +3 -3
- package/src/blocks/button/button.jsx +0 -175
- package/src/blocks/columns/columns.jsx +27 -197
- package/src/blocks/custom-code/custom-code.jsx +16 -75
- package/src/blocks/embed/embed.jsx +20 -87
- package/src/blocks/form/builder-blocks.jsx +0 -75
- package/src/blocks/form/form.jsx +57 -536
- package/src/blocks/fragment/fragment.jsx +8 -56
- package/src/blocks/image/image.jsx +49 -493
- package/src/blocks/img/img.jsx +15 -72
- package/src/blocks/input/input.jsx +17 -83
- package/src/blocks/raw-text/raw-text.jsx +9 -50
- package/src/blocks/section/section.jsx +17 -94
- package/src/blocks/select/select.jsx +20 -145
- package/src/blocks/submit-button/submit-button.jsx +8 -84
- package/src/blocks/symbol/symbol.jsx +60 -194
- package/src/blocks/text/text.jsx +4 -43
- package/src/blocks/textarea/textarea.jsx +12 -62
- package/src/blocks/video/video.jsx +21 -71
- package/src/components/render-block/block-styles.jsx +0 -114
- package/src/components/render-block/render-block.jsx +0 -514
- package/src/components/render-block/render-component.jsx +0 -211
- package/src/components/render-block/render-repeated-block.jsx +0 -67
- package/src/components/render-blocks.jsx +40 -334
- package/src/components/render-content/components/render-styles.jsx +0 -50
- package/src/components/render-content/render-content.jsx +96 -374
- package/src/components/render-inlined-styles.jsx +0 -116
- package/src/scripts/init-editing.js +4 -5
- 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).
|