@builder.io/sdk-qwik 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Builder.io Qwik SDK",
5
5
  "type": "module",
6
6
  "main": "./lib/index.qwik.cjs",
@@ -7,6 +7,7 @@ export declare type RenderBlockProps = {
7
7
  export declare const component: (props: any, state: any) => import("../../context/types.js").RegisteredComponent | null | undefined;
8
8
  export declare const tag: (props: any, state: any) => string;
9
9
  export declare const useBlock: (props: any, state: any) => any;
10
+ export declare const proxyState: (props: any, state: any) => any;
10
11
  export declare const actions: (props: any, state: any) => {
11
12
  [index: string]: (event: Event) => any;
12
13
  };
@@ -24,6 +25,7 @@ export declare const renderComponentProps: (props: any, state: any) => {
24
25
  state: any;
25
26
  content: any;
26
27
  context: any;
28
+ setState: any;
27
29
  registeredComponents: any;
28
30
  inheritedStyles: Partial<CSSStyleDeclaration>;
29
31
  };
@@ -35,6 +37,7 @@ export declare const childrenContext: (props: any, state: any) => {
35
37
  state: any;
36
38
  content: any;
37
39
  context: any;
40
+ setState: any;
38
41
  registeredComponents: any;
39
42
  inheritedStyles: Partial<CSSStyleDeclaration>;
40
43
  };
@@ -1,9 +1,16 @@
1
1
  import type { BuilderBlock } from "../../types/builder-block.js";
2
2
  import type { BuilderContextInterface } from "../../context/types.js";
3
3
  import type { Breakpoints } from "../../types/builder-content.js";
4
+ declare type ComponentOptions = {
5
+ [index: string]: any;
6
+ customBreakpoints?: Breakpoints;
7
+ attributes?: {
8
+ [index: string]: any;
9
+ };
10
+ };
4
11
  export interface RenderComponentProps {
5
12
  componentRef: any;
6
- componentOptions: any;
13
+ componentOptions: ComponentOptions;
7
14
  blockChildren: BuilderBlock[];
8
15
  context: BuilderContextInterface;
9
16
  customBreakpoints?: Breakpoints;
@@ -1,19 +1,8 @@
1
- interface CustomFont {
2
- family?: string;
3
- kind?: string;
4
- fileUrl?: string;
5
- files?: {
6
- [key: string]: string;
7
- };
8
- }
1
+ import type { CustomFont } from "./render-styles.helpers";
9
2
  interface Props {
10
3
  cssCode?: string;
11
4
  customFonts?: CustomFont[];
5
+ contentId?: string;
12
6
  }
13
- export declare const getCssFromFont: (props: any, state: any, font: CustomFont) => string;
14
- export declare const getFontCss: (props: any, state: any, { customFonts, }: {
15
- customFonts?: CustomFont[] | undefined;
16
- }) => string;
17
- export declare const injectedStyles: (props: any, state: any) => string;
18
7
  export declare const RenderContentStyles: import("@builder.io/qwik").Component<Props>;
19
8
  export default RenderContentStyles;
@@ -0,0 +1,15 @@
1
+ export interface CustomFont {
2
+ family?: string;
3
+ kind?: string;
4
+ fileUrl?: string;
5
+ files?: {
6
+ [key: string]: string;
7
+ };
8
+ }
9
+ export declare const getFontCss: ({ customFonts }: {
10
+ customFonts?: CustomFont[] | undefined;
11
+ }) => string;
12
+ export declare const getCss: ({ cssCode, contentId, }: {
13
+ cssCode?: string | undefined;
14
+ contentId?: string | undefined;
15
+ }) => string;
@@ -1,21 +1,9 @@
1
- import type { BuilderRenderContext, RegisteredComponent } from "../../context/types.js";
2
- import type { BuilderContent } from "../../types/builder-content.js";
3
- import type { Nullable } from "../../types/typescript.js";
4
- export declare type RenderContentProps = {
5
- content?: Nullable<BuilderContent>;
6
- model?: string;
7
- data?: {
8
- [key: string]: any;
9
- };
10
- context?: BuilderRenderContext;
11
- apiKey: string;
12
- customComponents?: RegisteredComponent[];
13
- canTrack?: boolean;
14
- locale?: string;
15
- includeRefs?: boolean;
16
- };
17
- export declare const useContent: (props: any, state: any, elementRef: any) => any;
18
- export declare const contentState: (props: any, state: any, elementRef: any) => any;
1
+ import type { BuilderRenderState } from "../../context/types.js";
2
+ import type { Breakpoints, BuilderContent } from "../../types/builder-content.js";
3
+ import type { RenderContentProps } from "./render-content.types.js";
4
+ export declare const mergeNewContent: (props: any, state: any, elementRef: any, newContent: BuilderContent) => void;
5
+ export declare const setBreakpoints: (props: any, state: any, elementRef: any, breakpoints: Breakpoints) => void;
6
+ export declare const setContextState: (props: any, state: any, elementRef: any, newState: BuilderRenderState) => void;
19
7
  export declare const processMessage: (props: any, state: any, elementRef: any, event: MessageEvent) => void;
20
8
  export declare const evaluateJsCode: (props: any, state: any, elementRef: any) => void;
21
9
  export declare const onClick: (props: any, state: any, elementRef: any, event: any) => void;
@@ -0,0 +1,7 @@
1
+ import type { BuilderContent } from '../../types/builder-content';
2
+ import type { Nullable } from '../../types/typescript';
3
+ import type { RenderContentProps } from './render-content.types';
4
+ export declare const getContextStateInitialValue: ({ content, data, locale, }: Pick<RenderContentProps, 'content' | 'data' | 'locale'>) => {
5
+ [x: string]: unknown;
6
+ };
7
+ export declare const getContentInitialValue: ({ content, data, }: Pick<RenderContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
@@ -0,0 +1,27 @@
1
+ import type { BuilderRenderContext, RegisteredComponent, BuilderRenderState } from '../../context/types';
2
+ import type { BuilderContent } from '../../types/builder-content';
3
+ import type { Nullable } from '../../types/typescript';
4
+ export declare type RenderContentProps = {
5
+ content?: Nullable<BuilderContent>;
6
+ model?: string;
7
+ data?: {
8
+ [key: string]: any;
9
+ };
10
+ context?: BuilderRenderContext;
11
+ apiKey: string;
12
+ customComponents?: RegisteredComponent[];
13
+ canTrack?: boolean;
14
+ locale?: string;
15
+ includeRefs?: boolean;
16
+ };
17
+ export interface BuilderComponentStateChange {
18
+ state: BuilderRenderState;
19
+ ref: {
20
+ name?: string;
21
+ props?: {
22
+ builderBlock?: {
23
+ id?: string;
24
+ };
25
+ };
26
+ };
27
+ }
@@ -11,6 +11,7 @@ export interface BuilderContextInterface {
11
11
  content: Nullable<BuilderContent>;
12
12
  context: BuilderRenderContext;
13
13
  state: BuilderRenderState;
14
+ setState?: (state: BuilderRenderState) => void;
14
15
  apiKey: string | null;
15
16
  registeredComponents: RegisteredComponents;
16
17
  inheritedStyles: Record<string, unknown>;
@@ -1,10 +1,10 @@
1
+ export { default as Button } from '../blocks/button/button';
1
2
  export { default as Columns } from '../blocks/columns/columns';
3
+ export { default as Fragment } from '../blocks/fragment/fragment';
2
4
  export { default as Image } from '../blocks/image/image';
5
+ export { default as RenderBlocks } from '../components/render-blocks';
6
+ export { default as RenderContent } from '../components/render-content/render-content';
7
+ export { default as Section } from '../blocks/section/section';
8
+ export { default as Symbol } from '../blocks/symbol/symbol';
3
9
  export { default as Text } from '../blocks/text/text';
4
10
  export { default as Video } from '../blocks/video/video';
5
- export { default as Symbol } from '../blocks/symbol/symbol';
6
- export { default as Button } from '../blocks/button/button';
7
- export { default as Section } from '../blocks/section/section';
8
- export { default as Fragment } from '../blocks/fragment/fragment';
9
- export { default as RenderContent } from '../components/render-content/render-content';
10
- export { default as RenderBlocks } from '../components/render-blocks';
@@ -1,6 +1,6 @@
1
1
  import type { BuilderBlock } from './builder-block.js';
2
+ import type { Input } from './components.js';
2
3
  import type { Nullable } from './typescript.js';
3
- declare type Input = any;
4
4
  export interface Breakpoints {
5
5
  small: number;
6
6
  medium: number;
@@ -44,4 +44,3 @@ export interface BuilderContent extends BuilderContentVariation {
44
44
  testVariationId?: string;
45
45
  testVariationName?: string;
46
46
  }
47
- export {};
@@ -0,0 +1,117 @@
1
+ export interface Input {
2
+ /** This is the name of the component prop this input represents */
3
+ name: string;
4
+ /** A friendlier name to show in the UI if the component prop name is not ideal for end users */
5
+ friendlyName?: string;
6
+ /** @hidden @deprecated */
7
+ description?: string;
8
+ /** A default value to use */
9
+ defaultValue?: any;
10
+ /**
11
+ * The type of input to use, such as 'text'
12
+ *
13
+ * See all available inputs [here](https://www.builder.io/c/docs/custom-react-components#input-types)
14
+ * and you can create your own custom input types and associated editor UIs with [plugins](https://www.builder.io/c/docs/extending/plugins)
15
+ */
16
+ type: string;
17
+ /** Is this input mandatory or not */
18
+ required?: boolean;
19
+ /** @hidden */
20
+ autoFocus?: boolean;
21
+ subFields?: Input[];
22
+ /**
23
+ * Additional text to render in the UI to give guidance on how to use this
24
+ *
25
+ * @example
26
+ * ```js
27
+ * helperText: 'Be sure to use a proper URL, starting with "https://"'
28
+ * 111
29
+ */
30
+ helperText?: string;
31
+ /** @hidden */
32
+ allowedFileTypes?: string[];
33
+ /** @hidden */
34
+ imageHeight?: number;
35
+ /** @hidden */
36
+ imageWidth?: number;
37
+ /** @hidden */
38
+ mediaHeight?: number;
39
+ /** @hidden */
40
+ mediaWidth?: number;
41
+ /** @hidden */
42
+ hideFromUI?: boolean;
43
+ /** @hidden */
44
+ modelId?: string;
45
+ /**
46
+ * Number field type validation maximum accepted input
47
+ */
48
+ max?: number;
49
+ /**
50
+ * Number field type validation minimum accepted input
51
+ */
52
+ min?: number;
53
+ /**
54
+ * Number field type step size when using arrows
55
+ */
56
+ step?: number;
57
+ /**
58
+ * Set this to `true` to show the editor for this input when
59
+ * children of this component are selected. This is useful for things
60
+ * like Tabs, such that users may not always select the Tabs component
61
+ * directly but will still be looking for how to add additional tabs
62
+ */
63
+ broadcast?: boolean;
64
+ /**
65
+ * Set this to `true` to show the editor for this input when
66
+ * group locked parents of this component are selected. This is useful
67
+ * to bubble up important inputs for locked groups, like text and images
68
+ */
69
+ bubble?: boolean;
70
+ /**
71
+ * Set this to `true` if you want this component to be translatable
72
+ */
73
+ localized?: boolean;
74
+ /** @hidden */
75
+ options?: {
76
+ [key: string]: any;
77
+ };
78
+ /**
79
+ * For "text" input type, specifying an enum will show a dropdown of options instead
80
+ */
81
+ enum?: string[] | {
82
+ label: string;
83
+ value: any;
84
+ helperText?: string;
85
+ }[];
86
+ /** Regex field validation for all string types (text, longText, html, url, etc) */
87
+ regex?: {
88
+ /** pattern to test, like "^\/[a-z]$" */
89
+ pattern: string;
90
+ /** flags for the RegExp constructor, e.g. "gi" */
91
+ options?: string;
92
+ /**
93
+ * Friendly message to display to end-users if the regex fails, e.g.
94
+ * "You must use a relative url starting with '/...' "
95
+ */
96
+ message: string;
97
+ };
98
+ /**
99
+ * Set this to `true` to put this under the "show more" section of
100
+ * the options editor. Useful for things that are more advanced
101
+ * or more rarely used and don't need to be too prominent
102
+ */
103
+ advanced?: boolean;
104
+ /** @hidden */
105
+ /** @hidden */
106
+ code?: boolean;
107
+ /** @hidden */
108
+ richText?: boolean;
109
+ /** @hidden */
110
+ showIf?: ((options: Map<string, any>) => boolean) | string;
111
+ /** @hidden */
112
+ copyOnAdd?: boolean;
113
+ /**
114
+ * Use optionally with inputs of type `reference`. Restricts the content entry picker to a specific model by name.
115
+ */
116
+ model?: string;
117
+ }