@builder.io/sdk-svelte 0.0.4 → 0.0.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.
Files changed (118) hide show
  1. package/package/--package.json +3 -2
  2. package/package.json +3 -2
  3. package/src/blocks/BaseText.svelte +27 -0
  4. package/src/blocks/button/button.svelte +36 -0
  5. package/src/blocks/button/component-info.ts +42 -0
  6. package/src/blocks/columns/columns.svelte +148 -0
  7. package/src/blocks/columns/component-info.ts +254 -0
  8. package/src/blocks/custom-code/component-info.ts +31 -0
  9. package/src/blocks/custom-code/custom-code.svelte +66 -0
  10. package/src/blocks/embed/component-info.ts +53 -0
  11. package/src/blocks/embed/embed.svelte +51 -0
  12. package/src/blocks/embed/helpers.ts +8 -0
  13. package/src/blocks/form/component-info.ts +282 -0
  14. package/src/blocks/form/form.svelte +332 -0
  15. package/src/blocks/fragment/component-info.ts +10 -0
  16. package/src/blocks/fragment/fragment.svelte +12 -0
  17. package/src/blocks/image/component-info.ts +170 -0
  18. package/src/blocks/image/image.helpers.ts +75 -0
  19. package/src/blocks/image/image.svelte +145 -0
  20. package/src/blocks/img/component-info.ts +21 -0
  21. package/src/blocks/img/img.svelte +51 -0
  22. package/src/blocks/input/component-info.ts +78 -0
  23. package/src/blocks/input/input.svelte +34 -0
  24. package/src/blocks/raw-text/component-info.ts +15 -0
  25. package/src/blocks/raw-text/raw-text.svelte +16 -0
  26. package/src/blocks/section/component-info.ts +50 -0
  27. package/src/blocks/section/section.svelte +34 -0
  28. package/src/blocks/select/component-info.ts +61 -0
  29. package/src/blocks/select/select.svelte +34 -0
  30. package/src/blocks/submit-button/component-info.ts +32 -0
  31. package/src/blocks/submit-button/submit-button.svelte +15 -0
  32. package/src/blocks/symbol/component-info.ts +43 -0
  33. package/src/blocks/symbol/symbol.svelte +100 -0
  34. package/src/blocks/text/component-info.ts +24 -0
  35. package/src/blocks/text/text.svelte +11 -0
  36. package/src/blocks/textarea/component-info.ts +48 -0
  37. package/src/blocks/textarea/textarea.svelte +19 -0
  38. package/src/blocks/util.ts +6 -0
  39. package/src/blocks/video/component-info.ts +109 -0
  40. package/src/blocks/video/video.svelte +102 -0
  41. package/src/components/render-block/block-styles.svelte +62 -0
  42. package/src/components/render-block/render-block.helpers.ts +27 -0
  43. package/src/components/render-block/render-block.svelte +228 -0
  44. package/src/components/render-block/render-component-with-context.svelte +38 -0
  45. package/src/components/render-block/render-component.svelte +35 -0
  46. package/src/components/render-block/render-repeated-block.svelte +53 -0
  47. package/src/components/render-block/types.ts +7 -0
  48. package/src/components/render-blocks.svelte +104 -0
  49. package/src/components/render-content/components/render-styles.svelte +80 -0
  50. package/src/components/render-content/index.ts +1 -0
  51. package/src/components/render-content/render-content.svelte +354 -0
  52. package/src/components/render-inlined-styles.svelte +26 -0
  53. package/src/constants/builder-registered-components.ts +42 -0
  54. package/src/constants/device-sizes.ts +28 -0
  55. package/src/constants/target.ts +2 -0
  56. package/src/context/builder.context.ts +13 -0
  57. package/src/context/types.ts +23 -0
  58. package/src/functions/camel-to-kebab-case.ts +2 -0
  59. package/src/functions/evaluate.ts +52 -0
  60. package/src/functions/event-handler-name.ts +6 -0
  61. package/src/functions/extract-text-styles.ts +39 -0
  62. package/src/functions/fast-clone.ts +5 -0
  63. package/src/functions/get-block-actions-handler.ts +19 -0
  64. package/src/functions/get-block-actions.ts +25 -0
  65. package/src/functions/get-block-component-options.ts +12 -0
  66. package/src/functions/get-block-properties.ts +11 -0
  67. package/src/functions/get-block-tag.ts +7 -0
  68. package/src/functions/get-builder-search-params/fn.test.ts +19 -0
  69. package/src/functions/get-builder-search-params/index.ts +48 -0
  70. package/src/functions/get-content/ab-testing.ts +132 -0
  71. package/src/functions/get-content/fn.test.ts +35 -0
  72. package/src/functions/get-content/index.ts +77 -0
  73. package/src/functions/get-content/types.ts +36 -0
  74. package/src/functions/get-fetch.ts +14 -0
  75. package/src/functions/get-global-this.ts +15 -0
  76. package/src/functions/get-processed-block.test.ts +33 -0
  77. package/src/functions/get-processed-block.ts +54 -0
  78. package/src/functions/get-react-native-block-styles.ts +30 -0
  79. package/src/functions/if-target.ts +20 -0
  80. package/src/functions/is-browser.ts +3 -0
  81. package/src/functions/is-editing.ts +7 -0
  82. package/src/functions/is-iframe.ts +5 -0
  83. package/src/functions/is-previewing.ts +14 -0
  84. package/src/functions/mark-mutable.ts +7 -0
  85. package/src/functions/on-change.test.ts +23 -0
  86. package/src/functions/on-change.ts +29 -0
  87. package/src/functions/register-component.ts +67 -0
  88. package/src/functions/register.ts +46 -0
  89. package/src/functions/sanitize-react-native-block-styles.ts +65 -0
  90. package/src/functions/set-editor-settings.ts +16 -0
  91. package/src/functions/set.test.ts +19 -0
  92. package/src/functions/set.ts +26 -0
  93. package/src/functions/track.ts +90 -0
  94. package/src/functions/transform-block.ts +6 -0
  95. package/src/helpers/ab-tests.ts +22 -0
  96. package/src/helpers/cookie.ts +102 -0
  97. package/src/helpers/css.ts +33 -0
  98. package/src/helpers/flatten.ts +24 -0
  99. package/src/helpers/localStorage.ts +38 -0
  100. package/src/helpers/nullable.ts +4 -0
  101. package/src/helpers/sessionId.ts +34 -0
  102. package/src/helpers/time.ts +4 -0
  103. package/src/helpers/url.test.ts +16 -0
  104. package/src/helpers/url.ts +12 -0
  105. package/src/helpers/uuid.ts +17 -0
  106. package/src/helpers/visitorId.ts +38 -0
  107. package/src/index-helpers/blocks-exports.ts +10 -0
  108. package/src/index-helpers/top-of-file.ts +4 -0
  109. package/src/index.ts +12 -0
  110. package/src/scripts/init-editing.ts +102 -0
  111. package/src/types/builder-block.ts +58 -0
  112. package/src/types/builder-content.ts +39 -0
  113. package/src/types/can-track.ts +3 -0
  114. package/src/types/components.ts +188 -0
  115. package/src/types/deep-partial.ts +7 -0
  116. package/src/types/element.ts +60 -0
  117. package/src/types/targets.ts +6 -0
  118. package/src/types/typescript.ts +7 -0
@@ -0,0 +1,38 @@
1
+ import type { CanTrack } from '../types/can-track.js';
2
+ import { getLocalStorageItem, setLocalStorageItem } from './localStorage.js';
3
+ import { checkIsDefined } from './nullable.js';
4
+ import { uuid } from './uuid.js';
5
+
6
+ const VISITOR_LOCAL_STORAGE_KEY = 'builderVisitorId';
7
+
8
+ export const getVisitorId = ({ canTrack }: CanTrack) => {
9
+ if (!canTrack) {
10
+ return undefined;
11
+ }
12
+
13
+ const visitorId = getLocalStorageItem({
14
+ key: VISITOR_LOCAL_STORAGE_KEY,
15
+ canTrack,
16
+ });
17
+
18
+ if (checkIsDefined(visitorId)) {
19
+ return visitorId;
20
+ } else {
21
+ const newVisitorId = createVisitorId();
22
+ setVisitorId({ id: newVisitorId, canTrack });
23
+ }
24
+ };
25
+
26
+ export const createVisitorId = () => uuid();
27
+
28
+ export const setVisitorId = ({
29
+ id,
30
+ canTrack,
31
+ }: {
32
+ id: string;
33
+ } & CanTrack) =>
34
+ setLocalStorageItem({
35
+ key: VISITOR_LOCAL_STORAGE_KEY,
36
+ value: id,
37
+ canTrack,
38
+ });
@@ -0,0 +1,10 @@
1
+ export { default as Columns } from '../blocks/columns/columns.svelte';
2
+ export { default as Image } from '../blocks/image/image.svelte';
3
+ export { default as Text } from '../blocks/text/text.svelte';
4
+ export { default as Video } from '../blocks/video/video.svelte';
5
+ export { default as Symbol } from '../blocks/symbol/symbol.svelte';
6
+ export { default as Button } from '../blocks/button/button.svelte';
7
+ export { default as Section } from '../blocks/section/section.svelte';
8
+ export { default as Fragment } from '../blocks/fragment/fragment.svelte';
9
+ export { default as RenderContent } from '../components/render-content/render-content.svelte';
10
+ export { default as RenderBlocks } from '../components/render-blocks.svelte';
@@ -0,0 +1,4 @@
1
+ // no-op
2
+ // this file exists in case a target needs to add logic to the top of the index file in an
3
+ // override.
4
+ export default undefined;
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ import './index-helpers/top-of-file.js';
2
+ import './scripts/init-editing.js';
3
+
4
+ export * from './index-helpers/blocks-exports.js';
5
+
6
+ export * from './functions/is-editing.js';
7
+ export * from './functions/is-previewing.js';
8
+ export * from './functions/register-component.js';
9
+ export * from './functions/register.js';
10
+ export * from './functions/set-editor-settings.js';
11
+ export * from './functions/get-content/index.js';
12
+ export * from './functions/get-builder-search-params/index.js';
@@ -0,0 +1,102 @@
1
+ import { TARGET } from '../constants/target.js';
2
+ import { isBrowser } from '../functions/is-browser.js';
3
+ import { register } from '../functions/register.js';
4
+
5
+ export const registerInsertMenu = () => {
6
+ register('insertMenu', {
7
+ name: '_default',
8
+ default: true,
9
+ items: [
10
+ { name: 'Box' },
11
+ { name: 'Text' },
12
+ { name: 'Image' },
13
+ { name: 'Columns' },
14
+ ...(TARGET === 'reactNative'
15
+ ? []
16
+ : [
17
+ { name: 'Core:Section' },
18
+ { name: 'Core:Button' },
19
+ { name: 'Embed' },
20
+ { name: 'Custom Code' },
21
+ ]),
22
+ ],
23
+ });
24
+ };
25
+
26
+ export const setupBrowserForEditing = () => {
27
+ if (isBrowser()) {
28
+ window.parent?.postMessage(
29
+ {
30
+ type: 'builder.sdkInfo',
31
+ data: {
32
+ target: TARGET,
33
+ // TODO: compile these in
34
+ // type: process.env.SDK_TYPE,
35
+ // version: process.env.SDK_VERSION,
36
+ supportsPatchUpdates: false,
37
+ // Supports builder-model="..." attribute which is needed to
38
+ // scope our '+ add block' button styling
39
+ supportsAddBlockScoping: true,
40
+ },
41
+ },
42
+ '*'
43
+ );
44
+
45
+ window.addEventListener('message', ({ data }) => {
46
+ if (!data?.type) {
47
+ return;
48
+ }
49
+
50
+ switch (data.type) {
51
+ case 'builder.evaluate': {
52
+ const text = data.data.text;
53
+ const args = data.data.arguments || [];
54
+ const id = data.data.id;
55
+ // tslint:disable-next-line:no-function-constructor-with-string-args
56
+ const fn = new Function(text);
57
+ let result: any;
58
+ let error: Error | null = null;
59
+ try {
60
+ // eslint-disable-next-line prefer-spread
61
+ result = fn.apply(null, args);
62
+ } catch (err) {
63
+ error = err as Error;
64
+ }
65
+
66
+ if (error) {
67
+ window.parent?.postMessage(
68
+ {
69
+ type: 'builder.evaluateError',
70
+ data: { id, error: error.message },
71
+ },
72
+ '*'
73
+ );
74
+ } else {
75
+ if (result && typeof result.then === 'function') {
76
+ (result as Promise<any>)
77
+ .then((finalResult) => {
78
+ window.parent?.postMessage(
79
+ {
80
+ type: 'builder.evaluateResult',
81
+ data: { id, result: finalResult },
82
+ },
83
+ '*'
84
+ );
85
+ })
86
+ .catch(console.error);
87
+ } else {
88
+ window.parent?.postMessage(
89
+ {
90
+ type: 'builder.evaluateResult',
91
+ data: { result, id },
92
+ },
93
+ '*'
94
+ );
95
+ }
96
+ }
97
+ break;
98
+ }
99
+ }
100
+ });
101
+ }
102
+ };
@@ -0,0 +1,58 @@
1
+ type JSONValue = string | number | boolean | JSONObject | JSONArray;
2
+
3
+ interface JSONObject {
4
+ [x: string]: JSONValue;
5
+ }
6
+
7
+ interface JSONArray extends Array<JSONValue> {}
8
+
9
+ /** @todo typedoc this */
10
+ export interface BuilderBlock {
11
+ '@type': '@builder.io/sdk:Element';
12
+ '@version'?: number;
13
+ id?: string;
14
+ tagName?: string;
15
+ layerName?: string;
16
+ groupLocked?: boolean;
17
+ layerLocked?: boolean;
18
+ /** @todo make alias for properties.class */
19
+ class?: string;
20
+ children?: BuilderBlock[];
21
+ responsiveStyles?: {
22
+ large?: Partial<CSSStyleDeclaration>;
23
+ medium?: Partial<CSSStyleDeclaration>;
24
+ small?: Partial<CSSStyleDeclaration>;
25
+ /** @deprecated */
26
+ xsmall?: Partial<CSSStyleDeclaration>;
27
+ };
28
+ component?: {
29
+ name: string;
30
+ options?: any;
31
+ tag?: string;
32
+ };
33
+ bindings?: {
34
+ [key: string]: string;
35
+ };
36
+ meta?: {
37
+ [key: string]: JSONValue;
38
+ };
39
+ actions?: {
40
+ [key: string]: string;
41
+ };
42
+ properties?: {
43
+ [key: string]: string;
44
+ };
45
+ code?: {
46
+ bindings?: {
47
+ [key: string]: string;
48
+ };
49
+ actions?: {
50
+ [key: string]: string;
51
+ };
52
+ };
53
+ repeat?: {
54
+ collection: string;
55
+ itemName?: string;
56
+ } | null;
57
+ animations?: any[]; // TODO: type the animation spec
58
+ }
@@ -0,0 +1,39 @@
1
+ import type { BuilderBlock } from './builder-block.js';
2
+
3
+ // TODO
4
+ type Input = any;
5
+
6
+ export interface BuilderContentVariation {
7
+ data?: {
8
+ title?: string;
9
+ blocks?: BuilderBlock[];
10
+ inputs?: Input[];
11
+ state?: { [key: string]: any };
12
+ jsCode?: string;
13
+ tsCode?: string;
14
+ httpRequests?: { [key: string]: string };
15
+ [key: string]: any;
16
+ };
17
+ name?: string;
18
+ testRatio?: number;
19
+ id?: string;
20
+ }
21
+
22
+ // TODO: separate full and partial versions
23
+ export interface BuilderContent extends BuilderContentVariation {
24
+ // TODO: query
25
+ '@version'?: number;
26
+ id?: string;
27
+ name?: string;
28
+ published?: 'published' | 'draft' | 'archived';
29
+ modelId?: string;
30
+ priority?: number;
31
+ lastUpdated?: number;
32
+ startDate?: number;
33
+ endDate?: number;
34
+ variations?: {
35
+ [id: string]: BuilderContentVariation | undefined;
36
+ };
37
+ testVariationId?: string;
38
+ testVariationName?: string;
39
+ }
@@ -0,0 +1,3 @@
1
+ export type CanTrack = {
2
+ canTrack: boolean;
3
+ };
@@ -0,0 +1,188 @@
1
+ import type { BuilderElement } from './element';
2
+
3
+ export interface Input {
4
+ name: string;
5
+ friendlyName?: string;
6
+ description?: string;
7
+ defaultValue?: any;
8
+ type: string;
9
+ valueType?: {
10
+ type?: string;
11
+ };
12
+ required?: boolean;
13
+ autoFocus?: boolean;
14
+ subFields?: Input[];
15
+ helperText?: string;
16
+ allowedFileTypes?: string[];
17
+ imageHeight?: number;
18
+ imageWidth?: number;
19
+ mediaHeight?: number;
20
+ mediaWidth?: number;
21
+ hideFromUI?: boolean;
22
+ modelId?: string;
23
+ /**
24
+ * Number field type validation maximum accepted input
25
+ */
26
+ max?: number;
27
+ /**
28
+ * Number field type validation minimum accepted input
29
+ */
30
+ min?: number;
31
+ /**
32
+ * Number field type step size when using arrows
33
+ */
34
+ step?: number;
35
+
36
+ /**
37
+ * Set this to `true` to show the editor for this input when
38
+ * children of this component are selected. This is useful for things
39
+ * like Tabs, such that users may not always select the Tabs component
40
+ * directly but will still be looking for how to add additional tabs
41
+ */
42
+ broadcast?: boolean;
43
+ /**
44
+ * Set this to `true` to show the editor for this input when
45
+ * group locked parents of this component are selected. This is useful
46
+ * to bubble up important inputs for locked groups, like text and images
47
+ */
48
+ bubble?: boolean;
49
+ options?: { [key: string]: any };
50
+ enum?: string[] | { label: string; value: any; helperText?: string }[];
51
+ /** Regex field validation for all string types (text, longText, html, url, etc) */
52
+ regex?: {
53
+ /** pattern to test, like "^\/[a-z]$" */
54
+ pattern: string;
55
+ /** flags for the RegExp constructor, e.g. "gi" */
56
+ options?: string;
57
+ /**
58
+ * Friendly message to display to end-users if the regex fails, e.g.
59
+ * "You must use a relative url starting with '/...' "
60
+ */
61
+ message: string;
62
+ };
63
+ advanced?: boolean;
64
+ onChange?: ((options: Map<string, any>) => void | Promise<void>) | string;
65
+ code?: boolean;
66
+ richText?: boolean;
67
+ showIf?: ((options: Map<string, any>) => boolean) | string;
68
+ copyOnAdd?: boolean;
69
+ }
70
+
71
+ export interface ComponentInfo {
72
+ /**
73
+ * Name your component something unique, e.g. 'MyButton'. You can override built-in components
74
+ * by registering a component with the same name, e.g. 'Text', to replace the built-in text component
75
+ */
76
+ name: string;
77
+ description?: string;
78
+ /**
79
+ * Link to a documentation page for this component
80
+ */
81
+ docsLink?: string;
82
+ image?: string;
83
+ /**
84
+ * Input schema for your component for users to fill in the options
85
+ */
86
+ inputs?: Input[];
87
+ class?: any;
88
+ type?: 'angular' | 'webcomponent' | 'react' | 'vue';
89
+ defaultStyles?: { [key: string]: string };
90
+ /**
91
+ * Turn on if your component can accept children. Be sure to use in combination with
92
+ * withChildren(YourComponent) like here
93
+ * github.com/BuilderIO/builder/blob/master/examples/react-design-system/src/components/HeroWithChildren/HeroWithChildren.builder.js#L5
94
+ */
95
+ canHaveChildren?: boolean;
96
+ fragment?: boolean;
97
+ /**
98
+ * Do not wrap a component in a dom element. Be sure to use {...props.attributes} with this option
99
+ * like here github.com/BuilderIO/builder/blob/master/packages/react/src/blocks/forms/Input.tsx#L34
100
+ */
101
+ noWrap?: boolean;
102
+ /**
103
+ * Default children
104
+ */
105
+ defaultChildren?: BuilderElement[];
106
+ defaults?: Partial<BuilderElement>;
107
+ // eslint-disable-next-line @typescript-eslint/ban-types
108
+ hooks?: { [key: string]: string | Function };
109
+ /**
110
+ * Hide your component in editor, useful for gradually deprecating components
111
+ */
112
+ hideFromInsertMenu?: boolean;
113
+ // For webcomponents
114
+ tag?: string;
115
+ static?: boolean;
116
+ /**
117
+ * Passing a list of model names will restrict using the component to only the models listed here, otherwise it'll be available for all models
118
+ */
119
+ models?: string[];
120
+
121
+ // TO-DO specific to new SDKs?
122
+ // not used in visual editor. Can likely be removed
123
+ builtIn: true;
124
+
125
+ /**
126
+ * Specify restrictions direct children must match
127
+ */
128
+ childRequirements?: {
129
+ /** Message to show when this doesn't match, e.g. "Children of 'Columns' must be a 'Column'" */
130
+ message: string;
131
+ /** Simple way to say children must be a specific component name */
132
+ component?: string;
133
+ /**
134
+ * More advanced - specify a MongoDB-style query (using sift.js github.com/crcn/sift.js)
135
+ * of what the children objects should match, e.g.
136
+ *
137
+ * @example
138
+ * query: {
139
+ * // Child of this element must be a 'Button' or 'Text' component
140
+ * 'component.name': { $in: ['Button', 'Text'] }
141
+ * }
142
+ */
143
+ query?: any;
144
+ };
145
+
146
+ /**
147
+ * Specify restrictions any parent must match
148
+ */
149
+ requiresParent?: {
150
+ /** Message to show when this doesn't match, e.g. "'Add to cart' buttons must be within a 'Product box'" */
151
+ message: string;
152
+ /** Simple way to say a parent must be a specific component name, e.g. 'Product box' */
153
+ component?: string;
154
+
155
+ /**
156
+ * More advanced - specify a MongoDB-style query (using sift.js github.com/crcn/sift.js)
157
+ * of what at least one parent in the parents hierarchy should match, e.g.
158
+ *
159
+ * @example
160
+ * query: {
161
+ * // Thils element must be somewhere inside either a 'Product box' or 'Collection' component
162
+ * 'component.name': { $in: ['Product Box', 'Collection'] }
163
+ * }
164
+ */
165
+ query?: any;
166
+ };
167
+
168
+ /** not yet implemented */
169
+ friendlyName?: string;
170
+
171
+ /**
172
+ * Use to restrict access to your component based on a the current user permissions
173
+ * By default components will show to all users
174
+ * for more information on permissions in builder check https://www.builder.io/c/docs/guides/roles-and-permissions
175
+ */
176
+ requiredPermissions?: Array<Permission>;
177
+
178
+ // TO-DO: is this used?
179
+ hidden?: boolean;
180
+ }
181
+
182
+ type Permission =
183
+ | 'read'
184
+ | 'publish'
185
+ | 'editCode'
186
+ | 'editDesigns'
187
+ | 'admin'
188
+ | 'create';
@@ -0,0 +1,7 @@
1
+ export type DeepPartial<T> = {
2
+ [P in keyof T]?: T[P] extends Array<infer U>
3
+ ? Array<DeepPartial<U>>
4
+ : T[P] extends ReadonlyArray<infer U>
5
+ ? ReadonlyArray<DeepPartial<U>>
6
+ : DeepPartial<T[P]>;
7
+ };
@@ -0,0 +1,60 @@
1
+ type JSONValue = string | number | boolean | JSONObject | JSONArray;
2
+
3
+ interface JSONObject {
4
+ [x: string]: JSONValue;
5
+ }
6
+
7
+ interface JSONArray extends Array<JSONValue> {}
8
+
9
+ /** @todo typedoc this */
10
+ export interface BuilderElement {
11
+ '@type': '@builder.io/sdk:Element';
12
+ '@version'?: number;
13
+ id?: string;
14
+ tagName?: string;
15
+ layerName?: string;
16
+ groupLocked?: boolean;
17
+ layerLocked?: boolean;
18
+ /** @todo make alias for properties.class */
19
+ class?: string;
20
+ children?: BuilderElement[];
21
+ responsiveStyles?: {
22
+ large?: Partial<CSSStyleDeclaration>;
23
+ medium?: Partial<CSSStyleDeclaration>;
24
+ small?: Partial<CSSStyleDeclaration>;
25
+ /** @deprecated */
26
+ xsmall?: Partial<CSSStyleDeclaration>;
27
+ };
28
+ component?: {
29
+ name: string;
30
+ options?: any;
31
+ tag?: string;
32
+ };
33
+ bindings?: {
34
+ [key: string]: string;
35
+ };
36
+ meta?: {
37
+ [key: string]: JSONValue;
38
+ };
39
+ actions?: {
40
+ [key: string]: string;
41
+ };
42
+ properties?: {
43
+ [key: string]: string;
44
+ };
45
+ code?: {
46
+ bindings?: {
47
+ [key: string]: string;
48
+ };
49
+ actions?: {
50
+ [key: string]: string;
51
+ };
52
+ };
53
+ repeat?: {
54
+ collection: string;
55
+ itemName?: string;
56
+ } | null;
57
+ animations?: Animation[]; // TODO: type the animation spec
58
+ }
59
+
60
+ interface Animation {}
@@ -0,0 +1,6 @@
1
+ type MitosisTargets = import('@builder.io/mitosis').Target;
2
+
3
+ export type Target = Extract<
4
+ MitosisTargets,
5
+ 'vue3' | 'vue2' | 'reactNative' | 'svelte' | 'qwik'
6
+ >;
@@ -0,0 +1,7 @@
1
+ export type Nullable<T> = T | null | undefined;
2
+
3
+ export type Dictionary<T> = { [key: string]: T };
4
+
5
+ export type Overwrite<T, U> = keyof U extends keyof T
6
+ ? Pick<T, Exclude<keyof T, keyof U>> & U
7
+ : never;