@builder.io/sdk-qwik 0.0.34 → 0.0.36

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 CHANGED
@@ -32,7 +32,7 @@ Add Qwik SDK code to a particular route (such as `src/routes/index.tsx`)
32
32
  ```typscript
33
33
  import { component$, Resource, useResource$ } from "@builder.io/qwik";
34
34
  import { useLocation } from "@builder.io/qwik-city";
35
- import { getContent, RenderContent, getBuilderSearchParams } from "@builder.io/sdk-qwik";
35
+ import { getContent, RenderContent, RegisteredComponent, getBuilderSearchParams } from "@builder.io/sdk-qwik";
36
36
 
37
37
  export const BUILDER_PUBLIC_API_KEY = "YOUR_API_KEY_GOES_HERE"; // ggignore
38
38
  export default component$(() => {
@@ -57,11 +57,45 @@ export default component$(() => {
57
57
  model="page"
58
58
  content={content}
59
59
  apiKey={BUILDER_PUBLIC_API_KEY}
60
+ // Optional: pass in a custom component registry
61
+ // customComponents={CUSTOM_COMPONENTS}
60
62
  />
61
63
  )}
62
64
  />
63
65
  );
64
66
  });
67
+
68
+ // OPTIONAL: need to add custom components to your Qwik app
69
+
70
+ export const MyFunComponent = component$((props: { text: string }) => {
71
+ const state = useStore({
72
+ count: 0,
73
+ });
74
+
75
+ return (
76
+ <div>
77
+ <h3>{props.text.toUpperCase()}</h3>
78
+ <p>{state.count}</p>
79
+ <button onClick$={() => state.count++}>Click me</button>
80
+ </div>
81
+ );
82
+ });
83
+
84
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
85
+ {
86
+ component: MyFunComponent,
87
+ name: 'MyFunComponent',
88
+ builtIn: true,
89
+ inputs: [
90
+ {
91
+ name: 'text',
92
+ type: 'string',
93
+ defaultValue: 'Hello world',
94
+ },
95
+ ],
96
+ },
97
+ ];
98
+
65
99
  ```
66
100
 
67
101
  ## Mitosis
@@ -1656,9 +1656,18 @@ const componentInfo$6 = {
1656
1656
  const SectionComponent = /*#__PURE__*/ qwik.componentQrl(qwik.inlinedQrl((props)=>{
1657
1657
  return /*#__PURE__*/ jsxRuntime.jsx("section", {
1658
1658
  ...props.attributes,
1659
- style: (()=>{
1660
- props.maxWidth && typeof props.maxWidth === "number" ? props.maxWidth : undefined;
1661
- })(),
1659
+ style: {
1660
+ width: "100%",
1661
+ alignSelf: "stretch",
1662
+ flexGrow: "1",
1663
+ boxSizing: "border-box",
1664
+ maxWidth: `${props.maxWidth && typeof props.maxWidth === "number" ? props.maxWidth : 1200}px`,
1665
+ display: "flex",
1666
+ flexDirection: "column",
1667
+ alignItems: "stretch",
1668
+ marginLeft: "auto",
1669
+ marginRight: "auto"
1670
+ },
1662
1671
  children: /*#__PURE__*/ jsxRuntime.jsx(qwik.Slot, {})
1663
1672
  });
1664
1673
  }, "SectionComponent_component_ZWF9iD5WeLg"));
@@ -1652,9 +1652,18 @@ const componentInfo$6 = {
1652
1652
  const SectionComponent = /*#__PURE__*/ componentQrl(inlinedQrl((props)=>{
1653
1653
  return /*#__PURE__*/ jsx("section", {
1654
1654
  ...props.attributes,
1655
- style: (()=>{
1656
- props.maxWidth && typeof props.maxWidth === "number" ? props.maxWidth : undefined;
1657
- })(),
1655
+ style: {
1656
+ width: "100%",
1657
+ alignSelf: "stretch",
1658
+ flexGrow: "1",
1659
+ boxSizing: "border-box",
1660
+ maxWidth: `${props.maxWidth && typeof props.maxWidth === "number" ? props.maxWidth : 1200}px`,
1661
+ display: "flex",
1662
+ flexDirection: "column",
1663
+ alignItems: "stretch",
1664
+ marginLeft: "auto",
1665
+ marginRight: "auto"
1666
+ },
1658
1667
  children: /*#__PURE__*/ jsx(Slot, {})
1659
1668
  });
1660
1669
  }, "SectionComponent_component_ZWF9iD5WeLg"));
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
7
7
  "module": "./lib/index.qwik.mjs",
8
8
  "qwik": "./lib/index.qwik.mjs",
9
9
  "types": "./types/index.d.ts",
10
+ "files": [
11
+ "lib",
12
+ "types"
13
+ ],
10
14
  "exports": {
11
15
  ".": {
12
16
  "import": "./lib/index.qwik.mjs",
@@ -16,22 +20,15 @@
16
20
  "scripts": {
17
21
  "typecheck": "tsc --noEmit",
18
22
  "build": "tsc && vite build --mode lib",
19
- "release:patch": "yarn run build && npm version patch --no-git-tag-version && npm publish --access public",
20
- "release:dev": "yarn run build && npm version prerelease --no-git-tag-version && npm publish --tag latest --access public"
23
+ "release:patch": "yarn run build && yarn version patch && npm publish --access public",
24
+ "release:dev": "yarn run build && npm version prerelease && npm publish --tag latest --access public"
21
25
  },
22
- "files": [
23
- "README.md",
24
- "package.json",
25
- "types-hacks.d.ts",
26
- "types",
27
- "lib"
28
- ],
29
26
  "devDependencies": {
30
27
  "@types/node": "latest",
31
28
  "typescript": "^4",
32
29
  "vite": "^3.0.4"
33
30
  },
34
31
  "peerDependencies": {
35
- "@builder.io/qwik": ">=0.0.108"
32
+ "@builder.io/qwik": ">=0.13.3"
36
33
  }
37
34
  }
package/types-hacks.d.ts DELETED
@@ -1,13 +0,0 @@
1
- type Dictionary<T> = Record<string, T>;
2
- type BuilderContent = any;
3
- type BuilderBlock = any;
4
- type RegisteredComponent = any;
5
- type RegisteredComponents = any;
6
- declare const builder: { env: 'dev'; apiKey: string };
7
- // TODO(misko): HACKS to be removed
8
- declare const get: (obj: any, key: string) => any;
9
- declare const set: (obj: any, key: string, value: any) => void;
10
- interface CSSProperties {
11
- flexDirection: any;
12
- }
13
- declare const BuilderBlocks: (props: any) => any;