imxc 0.1.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.
@@ -0,0 +1,12 @@
1
+ export type PropType = 'string' | 'number' | 'boolean' | 'callback' | 'style';
2
+ export interface PropDef {
3
+ type: PropType;
4
+ required: boolean;
5
+ }
6
+ export interface HostComponentDef {
7
+ props: Record<string, PropDef>;
8
+ hasChildren: boolean;
9
+ isContainer: boolean;
10
+ }
11
+ export declare const HOST_COMPONENTS: Record<string, HostComponentDef>;
12
+ export declare function isHostComponent(name: string): boolean;
@@ -0,0 +1,208 @@
1
+ export const HOST_COMPONENTS = {
2
+ Window: {
3
+ props: { title: { type: 'string', required: true } },
4
+ hasChildren: true, isContainer: true,
5
+ },
6
+ View: {
7
+ props: { style: { type: 'style', required: false } },
8
+ hasChildren: true, isContainer: true,
9
+ },
10
+ Row: {
11
+ props: { gap: { type: 'number', required: false }, style: { type: 'style', required: false } },
12
+ hasChildren: true, isContainer: true,
13
+ },
14
+ Column: {
15
+ props: { gap: { type: 'number', required: false }, style: { type: 'style', required: false } },
16
+ hasChildren: true, isContainer: true,
17
+ },
18
+ Text: {
19
+ props: { style: { type: 'style', required: false } },
20
+ hasChildren: true, isContainer: false,
21
+ },
22
+ Button: {
23
+ props: {
24
+ title: { type: 'string', required: true },
25
+ onPress: { type: 'callback', required: true },
26
+ disabled: { type: 'boolean', required: false },
27
+ style: { type: 'style', required: false },
28
+ },
29
+ hasChildren: false, isContainer: false,
30
+ },
31
+ TextInput: {
32
+ props: {
33
+ value: { type: 'string', required: true },
34
+ onChange: { type: 'callback', required: true },
35
+ label: { type: 'string', required: false },
36
+ placeholder: { type: 'string', required: false },
37
+ style: { type: 'style', required: false },
38
+ },
39
+ hasChildren: false, isContainer: false,
40
+ },
41
+ Checkbox: {
42
+ props: {
43
+ value: { type: 'boolean', required: true },
44
+ onChange: { type: 'callback', required: true },
45
+ label: { type: 'string', required: false },
46
+ style: { type: 'style', required: false },
47
+ },
48
+ hasChildren: false, isContainer: false,
49
+ },
50
+ Separator: {
51
+ props: {},
52
+ hasChildren: false, isContainer: false,
53
+ },
54
+ Popup: {
55
+ props: { id: { type: 'string', required: true }, style: { type: 'style', required: false } },
56
+ hasChildren: true, isContainer: true,
57
+ },
58
+ DockSpace: {
59
+ props: { style: { type: 'style', required: false } },
60
+ hasChildren: true, isContainer: true,
61
+ },
62
+ MenuBar: {
63
+ props: {},
64
+ hasChildren: true, isContainer: true,
65
+ },
66
+ Menu: {
67
+ props: { label: { type: 'string', required: true } },
68
+ hasChildren: true, isContainer: true,
69
+ },
70
+ MenuItem: {
71
+ props: {
72
+ label: { type: 'string', required: true },
73
+ onPress: { type: 'callback', required: false },
74
+ shortcut: { type: 'string', required: false },
75
+ },
76
+ hasChildren: false, isContainer: false,
77
+ },
78
+ Table: {
79
+ props: { columns: { type: 'string', required: true }, style: { type: 'style', required: false } },
80
+ hasChildren: true, isContainer: true,
81
+ },
82
+ TableRow: {
83
+ props: {},
84
+ hasChildren: true, isContainer: true,
85
+ },
86
+ TabBar: {
87
+ props: { style: { type: 'style', required: false } },
88
+ hasChildren: true, isContainer: true,
89
+ },
90
+ TabItem: {
91
+ props: { label: { type: 'string', required: true } },
92
+ hasChildren: true, isContainer: true,
93
+ },
94
+ TreeNode: {
95
+ props: { label: { type: 'string', required: true } },
96
+ hasChildren: true, isContainer: true,
97
+ },
98
+ CollapsingHeader: {
99
+ props: { label: { type: 'string', required: true } },
100
+ hasChildren: true, isContainer: true,
101
+ },
102
+ SliderFloat: {
103
+ props: {
104
+ label: { type: 'string', required: true },
105
+ value: { type: 'number', required: true },
106
+ onChange: { type: 'callback', required: true },
107
+ min: { type: 'number', required: true },
108
+ max: { type: 'number', required: true },
109
+ style: { type: 'style', required: false },
110
+ },
111
+ hasChildren: false, isContainer: false,
112
+ },
113
+ SliderInt: {
114
+ props: {
115
+ label: { type: 'string', required: true },
116
+ value: { type: 'number', required: true },
117
+ onChange: { type: 'callback', required: true },
118
+ min: { type: 'number', required: true },
119
+ max: { type: 'number', required: true },
120
+ style: { type: 'style', required: false },
121
+ },
122
+ hasChildren: false, isContainer: false,
123
+ },
124
+ DragFloat: {
125
+ props: {
126
+ label: { type: 'string', required: true },
127
+ value: { type: 'number', required: true },
128
+ onChange: { type: 'callback', required: true },
129
+ speed: { type: 'number', required: false },
130
+ style: { type: 'style', required: false },
131
+ },
132
+ hasChildren: false, isContainer: false,
133
+ },
134
+ DragInt: {
135
+ props: {
136
+ label: { type: 'string', required: true },
137
+ value: { type: 'number', required: true },
138
+ onChange: { type: 'callback', required: true },
139
+ speed: { type: 'number', required: false },
140
+ style: { type: 'style', required: false },
141
+ },
142
+ hasChildren: false, isContainer: false,
143
+ },
144
+ Combo: {
145
+ props: {
146
+ label: { type: 'string', required: true },
147
+ value: { type: 'number', required: true },
148
+ onChange: { type: 'callback', required: true },
149
+ items: { type: 'string', required: true },
150
+ style: { type: 'style', required: false },
151
+ },
152
+ hasChildren: false, isContainer: false,
153
+ },
154
+ InputInt: {
155
+ props: {
156
+ label: { type: 'string', required: true },
157
+ value: { type: 'number', required: true },
158
+ onChange: { type: 'callback', required: true },
159
+ style: { type: 'style', required: false },
160
+ },
161
+ hasChildren: false, isContainer: false,
162
+ },
163
+ InputFloat: {
164
+ props: {
165
+ label: { type: 'string', required: true },
166
+ value: { type: 'number', required: true },
167
+ onChange: { type: 'callback', required: true },
168
+ style: { type: 'style', required: false },
169
+ },
170
+ hasChildren: false, isContainer: false,
171
+ },
172
+ ColorEdit: {
173
+ props: {
174
+ label: { type: 'string', required: true },
175
+ value: { type: 'string', required: true },
176
+ onChange: { type: 'callback', required: true },
177
+ style: { type: 'style', required: false },
178
+ },
179
+ hasChildren: false, isContainer: false,
180
+ },
181
+ ListBox: {
182
+ props: {
183
+ label: { type: 'string', required: true },
184
+ value: { type: 'number', required: true },
185
+ onChange: { type: 'callback', required: true },
186
+ items: { type: 'string', required: true },
187
+ style: { type: 'style', required: false },
188
+ },
189
+ hasChildren: false, isContainer: false,
190
+ },
191
+ ProgressBar: {
192
+ props: {
193
+ value: { type: 'number', required: true },
194
+ overlay: { type: 'string', required: false },
195
+ style: { type: 'style', required: false },
196
+ },
197
+ hasChildren: false, isContainer: false,
198
+ },
199
+ Tooltip: {
200
+ props: {
201
+ text: { type: 'string', required: true },
202
+ },
203
+ hasChildren: false, isContainer: false,
204
+ },
205
+ };
206
+ export function isHostComponent(name) {
207
+ return name in HOST_COMPONENTS;
208
+ }
@@ -0,0 +1,12 @@
1
+ import type { IRComponent } from './ir.js';
2
+ /**
3
+ * Emit a .gen.h header for a component that has props.
4
+ * Contains the props struct and function forward declaration.
5
+ */
6
+ export declare function emitComponentHeader(comp: IRComponent): string;
7
+ export interface ImportInfo {
8
+ name: string;
9
+ headerFile: string;
10
+ }
11
+ export declare function emitComponent(comp: IRComponent, imports?: ImportInfo[]): string;
12
+ export declare function emitRoot(rootName: string, stateCount: number, bufferCount: number): string;