@builder.io/sdk-qwik 0.0.2-0
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/DEVELOPER.md +118 -0
- package/README.md +7 -0
- package/lib/index.97024df8.js +78916 -0
- package/lib/index.d8c1e37f.cjs +1 -0
- package/lib/index.qwik.cjs +81 -0
- package/lib/index.qwik.mjs +2094 -0
- package/package.json +27 -0
- package/root.json +1176 -0
- package/src/blocks/button/button.jsx +211 -0
- package/src/blocks/button/component-info.js +41 -0
- package/src/blocks/columns/columns.jsx +288 -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 +100 -0
- package/src/blocks/form/component-info.js +262 -0
- package/src/blocks/form/form.jsx +789 -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 +230 -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 +12 -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 +186 -0
- package/src/components/render-block/render-block.helpers.js +23 -0
- package/src/components/render-block/render-block.jsx +749 -0
- package/src/components/render-block/render-component.jsx +257 -0
- package/src/components/render-block/render-repeated-block.jsx +119 -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 +140 -0
- package/src/components/render-content/index.js +4 -0
- package/src/components/render-content/render-content.jsx +636 -0
- package/src/components/render-inlined-styles.jsx +153 -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 +33 -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 +27 -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/tsconfig.json +110 -0
- package/types.d.ts +13 -0
- package/vite.config.ts +16 -0
package/DEVELOPER.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# DEVELOPER
|
|
2
|
+
|
|
3
|
+
This documentation contains instructions on how to setup the environment and develop Qwik SDK.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
There are many different ways you can set up your environment to develop Qwik SDK, but here is the one which works well for me, and so if you are new to Qwik SDK development you should consider this as a starting point. Feel free to tweak as you see fit after you get familiar with the development.
|
|
8
|
+
|
|
9
|
+
## Directory Layout
|
|
10
|
+
|
|
11
|
+
When working on Qwik SDK you will often times need to make changes to, mitosis, qwik, SDK, and a test file. For this reason all of these repositories and testing folders should be next to each other.
|
|
12
|
+
|
|
13
|
+
Setup your directory structure as shown here:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
- qwik-sdk-workspace/
|
|
17
|
+
- builder/ # git clone git@github.com:BuilderIO/builder.git
|
|
18
|
+
- qwik/ # git clone git@github.com:BuilderIO/qwik.git
|
|
19
|
+
- mitosis/ # git clone git@github.com:BuilderIO/mitosis.git
|
|
20
|
+
- test/ # npm create qwik@latest # QwikCity starter project
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## VS Code
|
|
24
|
+
|
|
25
|
+
I usually open the `qwik-sdk-workspace` folder in VS Code so that I can easily open and edit any of the files.
|
|
26
|
+
|
|
27
|
+
## NPM Symlinks
|
|
28
|
+
|
|
29
|
+
When developing Qwik SDK you may need to change many different repos. For this reason set up the symlinks as shown here:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
- qwik-sdk-workspace/
|
|
33
|
+
- builder/
|
|
34
|
+
- packages/
|
|
35
|
+
- sdks/
|
|
36
|
+
- NPM: @builder.io/mitosis => ../../../mitosis/packages/core
|
|
37
|
+
- qwik/
|
|
38
|
+
- mitosis/
|
|
39
|
+
- test/
|
|
40
|
+
- NPM: @builder.io/qwik => ../qwik/packages/core
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Building / Running
|
|
44
|
+
|
|
45
|
+
- Mitosis
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cd mitosis/packages/core
|
|
49
|
+
yarn start # Will automatically build and run the SDK
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- Builder
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cd builder/packages/sdks
|
|
56
|
+
yarn build # Will build the SDK by running mitosis on SDK inputs
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Qwik
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cd qwik/
|
|
63
|
+
yarn build.full
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Test App
|
|
67
|
+
```bash
|
|
68
|
+
cd test/
|
|
69
|
+
yarn build.ssr
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Test application for Qwik SDK
|
|
73
|
+
|
|
74
|
+
In the Qwik-city create a `[index.tsx]` which will intercept all of the URL requests. Then use something like this to render the content from the Qwik SDK:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
export default component$((props: MainProps) => {
|
|
78
|
+
const context = useStore({});
|
|
79
|
+
|
|
80
|
+
useContextProvider(builderContext, context);
|
|
81
|
+
const BUILDER_PUBLIC_API_KEY = 'f1a790f8c3204b3b8c5c1795aeac4660'; // ggignore
|
|
82
|
+
const contentRsrc = useResource$<any>(() => {
|
|
83
|
+
const url = new URL(props.url);
|
|
84
|
+
return getContent({
|
|
85
|
+
model: 'page',
|
|
86
|
+
apiKey: BUILDER_PUBLIC_API_KEY,
|
|
87
|
+
userAttributes: {
|
|
88
|
+
urlPath: url.pathname || '/',
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Host>
|
|
95
|
+
<Resource
|
|
96
|
+
resource={contentRsrc}
|
|
97
|
+
onPending={() => <div>Loading...</div>}
|
|
98
|
+
onResolved={(content) => {
|
|
99
|
+
return (
|
|
100
|
+
<RenderContent
|
|
101
|
+
model="page"
|
|
102
|
+
content={content}
|
|
103
|
+
apiKey={BUILDER_PUBLIC_API_KEY}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
</Host>
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Testing Pages for SDK
|
|
114
|
+
|
|
115
|
+
1. Open https://builder.io/spaces
|
|
116
|
+
2. Open https://builder.io/content/037948e52eaf4743afed464f02c70da4 to see the content.
|
|
117
|
+
3. Editing content should work with the SDK. (to be fixed)
|
|
118
|
+
4. To navigate to the workspace cmnd-p: `org f1a790f8c3204b3b8c5c1795aeac4660`
|