@typecad/ui 1.0.0-alpha.13 → 1.0.0-alpha.15
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 +1457 -1469
- package/dist/cli.js +22 -19
- package/dist/preview/host-ui-runtime.js +0 -1
- package/dist/ui-engine/model.js +7 -1
- package/dist/ui-engine/runtime-header/canvas-scrollbar.js +115 -115
- package/dist/ui-engine/runtime-header/dirty-scroll-mutators.js +182 -182
- package/dist/ui-engine/runtime-header/forward-decls.js +227 -216
- package/dist/ui-engine/runtime-header/init-press-input.js +138 -138
- package/dist/ui-engine/runtime-header/keyboard.js +676 -676
- package/dist/ui-engine/runtime-header/node-draw-body.js +1658 -1656
- package/dist/ui-engine/runtime-header/paint-order-coords.js +259 -259
- package/dist/ui-engine/runtime-header/paint-rects-repair.js +736 -736
- package/dist/ui-engine/runtime-header/scroll-physics.js +4 -4
- package/dist/ui-engine/runtime-header/structs.js +228 -228
- package/dist/ui-engine/runtime-header/text-rendering.js +888 -888
- package/dist/ui-engine/runtime-header/tick/bindings-phase.js +118 -118
- package/dist/ui-engine/runtime-header/tick/dirty-draw-phase.js +896 -896
- package/dist/ui-engine/runtime-header/tick/scroll-canvas-phase.js +24 -24
- package/dist/ui-engine/runtime-header/touch-keyboard-fwd.js +11 -11
- package/dist/ui-engine/runtime-header/types-defines.js +110 -110
- package/dist/ui-engine/shadcn-kit.d.ts +1 -1
- package/dist/ui-engine/shadcn-kit.js +4 -0
- package/dist/ui-engine/ui-lowering.d.ts +1 -1
- package/dist/ui-engine/ui-lowering.js +14 -5
- package/dist/ui-engine/ui-registry.js +9 -1
- package/dist/wizard/display-catalog.d.ts +0 -3
- package/dist/wizard/display-catalog.js +3 -12
- package/dist/wizard/index.d.ts +2 -0
- package/dist/wizard/index.js +1 -0
- package/dist/wizard/integration-wizard.d.ts +3 -0
- package/dist/wizard/integration-wizard.js +69 -20
- package/dist/wizard/package-writer.d.ts +20 -0
- package/dist/wizard/package-writer.js +79 -0
- package/package.json +4 -4
- package/src/cli.ts +90 -87
- package/src/preview/host-ui-runtime.ts +0 -1
- package/src/ui-engine/model.ts +6 -1
- package/src/ui-engine/runtime-header/canvas-scrollbar.ts +121 -121
- package/src/ui-engine/runtime-header/dirty-scroll-mutators.ts +188 -188
- package/src/ui-engine/runtime-header/forward-decls.ts +238 -227
- package/src/ui-engine/runtime-header/init-press-input.ts +144 -144
- package/src/ui-engine/runtime-header/keyboard.ts +689 -689
- package/src/ui-engine/runtime-header/node-draw-body.ts +1683 -1681
- package/src/ui-engine/runtime-header/paint-order-coords.ts +265 -265
- package/src/ui-engine/runtime-header/paint-rects-repair.ts +742 -742
- package/src/ui-engine/runtime-header/scroll-physics.ts +4 -4
- package/src/ui-engine/runtime-header/structs.ts +234 -234
- package/src/ui-engine/runtime-header/text-rendering.ts +894 -894
- package/src/ui-engine/runtime-header/tick/bindings-phase.ts +124 -124
- package/src/ui-engine/runtime-header/tick/dirty-draw-phase.ts +902 -902
- package/src/ui-engine/runtime-header/tick/scroll-canvas-phase.ts +30 -30
- package/src/ui-engine/runtime-header/touch-keyboard-fwd.ts +11 -11
- package/src/ui-engine/runtime-header/types-defines.ts +116 -116
- package/src/ui-engine/shadcn-kit.ts +4 -0
- package/src/ui-engine/ui-lowering.ts +12 -4
- package/src/ui-engine/ui-registry.ts +9 -1
- package/src/wizard/display-catalog.ts +261 -273
- package/src/wizard/index.ts +46 -38
- package/src/wizard/integration-wizard.ts +679 -619
- package/src/wizard/package-writer.ts +98 -0
|
@@ -1,273 +1,261 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Display + touch hardware catalog for the @typecad/ui integration wizard.
|
|
3
|
-
//
|
|
4
|
-
// Mirrors the built-in display profiles exported by
|
|
5
|
-
// (
|
|
6
|
-
// @typecad/cuttlefish's display-profile.ts. The wizard asks questions and
|
|
7
|
-
// fills defaults from these entries; the resulting object literal is written
|
|
8
|
-
// into the project's cuttlefish.config.ts `display` section.
|
|
9
|
-
//
|
|
10
|
-
// Keep this catalog in sync with the framework's BUILT_IN_PROFILES when a
|
|
11
|
-
// display or touch library is added there.
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
|
|
14
|
-
export type WizardBus = "spi" | "i2c" | "none";
|
|
15
|
-
export type WizardTouchKind = "none" | "spi" | "i2c" | "analog" | "adapter" | "sdl";
|
|
16
|
-
|
|
17
|
-
export interface DisplayCatalogEntry {
|
|
18
|
-
/** Catalog id — also the `display.profile` value for built-ins. */
|
|
19
|
-
id: string;
|
|
20
|
-
label: string;
|
|
21
|
-
hint: string;
|
|
22
|
-
/** Built-in profile name written to config (omitted for custom/sdl). */
|
|
23
|
-
profile?: string;
|
|
24
|
-
/** Driver name written when no built-in profile applies. */
|
|
25
|
-
driver?: string;
|
|
26
|
-
bus: WizardBus;
|
|
27
|
-
/** Wizard question defaults. */
|
|
28
|
-
defaults: {
|
|
29
|
-
cs?: number;
|
|
30
|
-
dc?: number;
|
|
31
|
-
rst?: number;
|
|
32
|
-
/** Backlight GPIO; undefined = don't ask, null = ask but default blank. */
|
|
33
|
-
backlight?: number | null;
|
|
34
|
-
/** Backlight pin the built-in profile drives when `backlight` is omitted. */
|
|
35
|
-
backlightProfileDefault?: number;
|
|
36
|
-
spiFrequency?: number;
|
|
37
|
-
address?: number;
|
|
38
|
-
width?: number;
|
|
39
|
-
height?: number;
|
|
40
|
-
/** Native panel size before rotation (used for capacitive touch calibration). */
|
|
41
|
-
nativeWidth?: number;
|
|
42
|
-
nativeHeight?: number;
|
|
43
|
-
rotation?: number;
|
|
44
|
-
colorOrder?: "rgb" | "bgr";
|
|
45
|
-
invert?: boolean;
|
|
46
|
-
antialias?: boolean;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
id: "
|
|
219
|
-
label: "
|
|
220
|
-
hint: '2.
|
|
221
|
-
kind: "
|
|
222
|
-
defaults: {
|
|
223
|
-
|
|
224
|
-
calibration: { xMin:
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
for (const [touchKey, touchValue] of Object.entries(touchPins)) {
|
|
264
|
-
if (touchValue === undefined) continue;
|
|
265
|
-
const owner = claimed.get(touchValue);
|
|
266
|
-
if (owner !== undefined) {
|
|
267
|
-
conflicts.push(
|
|
268
|
-
`display.${owner} and touch.${touchKey} are both wired to GPIO ${touchValue}`,
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return conflicts;
|
|
273
|
-
}
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Display + touch hardware catalog for the @typecad/ui integration wizard.
|
|
3
|
+
//
|
|
4
|
+
// Mirrors the built-in display profiles exported by the active framework
|
|
5
|
+
// (BUILT_IN_PROFILES) and the TouchLibrary union in
|
|
6
|
+
// @typecad/cuttlefish's display-profile.ts. The wizard asks questions and
|
|
7
|
+
// fills defaults from these entries; the resulting object literal is written
|
|
8
|
+
// into the project's cuttlefish.config.ts `display` section.
|
|
9
|
+
//
|
|
10
|
+
// Keep this catalog in sync with the framework's BUILT_IN_PROFILES when a
|
|
11
|
+
// display or touch library is added there.
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
export type WizardBus = "spi" | "i2c" | "none";
|
|
15
|
+
export type WizardTouchKind = "none" | "spi" | "i2c" | "analog" | "adapter" | "sdl";
|
|
16
|
+
|
|
17
|
+
export interface DisplayCatalogEntry {
|
|
18
|
+
/** Catalog id — also the `display.profile` value for built-ins. */
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
hint: string;
|
|
22
|
+
/** Built-in profile name written to config (omitted for custom/sdl). */
|
|
23
|
+
profile?: string;
|
|
24
|
+
/** Driver name written when no built-in profile applies. */
|
|
25
|
+
driver?: string;
|
|
26
|
+
bus: WizardBus;
|
|
27
|
+
/** Wizard question defaults. */
|
|
28
|
+
defaults: {
|
|
29
|
+
cs?: number;
|
|
30
|
+
dc?: number;
|
|
31
|
+
rst?: number;
|
|
32
|
+
/** Backlight GPIO; undefined = don't ask, null = ask but default blank. */
|
|
33
|
+
backlight?: number | null;
|
|
34
|
+
/** Backlight pin the built-in profile drives when `backlight` is omitted. */
|
|
35
|
+
backlightProfileDefault?: number;
|
|
36
|
+
spiFrequency?: number;
|
|
37
|
+
address?: number;
|
|
38
|
+
width?: number;
|
|
39
|
+
height?: number;
|
|
40
|
+
/** Native panel size before rotation (used for capacitive touch calibration). */
|
|
41
|
+
nativeWidth?: number;
|
|
42
|
+
nativeHeight?: number;
|
|
43
|
+
rotation?: number;
|
|
44
|
+
colorOrder?: "rgb" | "bgr";
|
|
45
|
+
invert?: boolean;
|
|
46
|
+
antialias?: boolean;
|
|
47
|
+
};
|
|
48
|
+
/** A wiring note printed with the summary. */
|
|
49
|
+
wiringNote?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const DISPLAY_CATALOG: readonly DisplayCatalogEntry[] = [
|
|
53
|
+
{
|
|
54
|
+
id: "ili9341-spi",
|
|
55
|
+
label: "ILI9341 320×240 SPI TFT",
|
|
56
|
+
hint: '2.2"–3.2" color TFT modules, often with resistive touch',
|
|
57
|
+
profile: "ili9341-spi",
|
|
58
|
+
bus: "spi",
|
|
59
|
+
defaults: {
|
|
60
|
+
// ESP32 VSPI wiring used by the repo demos and the framework profile.
|
|
61
|
+
cs: 5,
|
|
62
|
+
dc: 21,
|
|
63
|
+
rst: 22,
|
|
64
|
+
// The ILI9341 built-in profile drives backlight GPIO 17 when the config
|
|
65
|
+
// omits `backlight` — surface that in the wizard's blank-answer hint.
|
|
66
|
+
backlightProfileDefault: 17,
|
|
67
|
+
spiFrequency: 40_000_000,
|
|
68
|
+
width: 320,
|
|
69
|
+
height: 240,
|
|
70
|
+
rotation: 1,
|
|
71
|
+
colorOrder: "rgb",
|
|
72
|
+
antialias: true,
|
|
73
|
+
},
|
|
74
|
+
wiringNote: "Defaults assume ESP32 VSPI: SCK=18, MOSI=23, MISO=19.",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "st7796-spi",
|
|
78
|
+
label: "ST7796S 320×480 SPI TFT",
|
|
79
|
+
hint: '3.5"/4" color TFT modules, often with FT6336U capacitive touch',
|
|
80
|
+
profile: "st7796-spi",
|
|
81
|
+
bus: "spi",
|
|
82
|
+
defaults: {
|
|
83
|
+
// Wiring proven on the repo's ESP32-S3 demo hardware (demos/demo-st).
|
|
84
|
+
cs: 5,
|
|
85
|
+
dc: 17,
|
|
86
|
+
rst: 16,
|
|
87
|
+
backlight: null,
|
|
88
|
+
spiFrequency: 80_000_000,
|
|
89
|
+
width: 480,
|
|
90
|
+
height: 320,
|
|
91
|
+
nativeWidth: 320,
|
|
92
|
+
nativeHeight: 480,
|
|
93
|
+
rotation: 1,
|
|
94
|
+
colorOrder: "bgr",
|
|
95
|
+
invert: false,
|
|
96
|
+
antialias: true,
|
|
97
|
+
},
|
|
98
|
+
wiringNote:
|
|
99
|
+
"Defaults assume ESP32 VSPI: SCK=18, MOSI=23, MISO=19. Adafruit_ST7796S.h comes from the" +
|
|
100
|
+
" Adafruit_ST7735_and_ST7789 fork bundled in the typecode demos (demos/demo-st/lib) —" +
|
|
101
|
+
" copy it into your libraries/ folder if your Library Manager copy lacks the class.",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "ssd1309-i2c",
|
|
105
|
+
label: "SSD1309 128×64 monochrome OLED (I2C)",
|
|
106
|
+
hint: "1-bit OLED panels driven via the Adafruit_SSD1306 API",
|
|
107
|
+
profile: "ssd1309-i2c",
|
|
108
|
+
bus: "i2c",
|
|
109
|
+
defaults: {
|
|
110
|
+
address: 0x3c,
|
|
111
|
+
width: 128,
|
|
112
|
+
height: 64,
|
|
113
|
+
rotation: 0,
|
|
114
|
+
antialias: false,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "sdl",
|
|
119
|
+
label: "Desktop simulator window (no hardware)",
|
|
120
|
+
hint: "native target — renders your UI in an SDL2 window",
|
|
121
|
+
driver: "sdl",
|
|
122
|
+
bus: "none",
|
|
123
|
+
defaults: {
|
|
124
|
+
width: 320,
|
|
125
|
+
height: 240,
|
|
126
|
+
rotation: 0,
|
|
127
|
+
antialias: true,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: "custom",
|
|
132
|
+
label: "Custom display — enter driver, bus, and pins manually",
|
|
133
|
+
hint: "any controller not listed above",
|
|
134
|
+
bus: "spi",
|
|
135
|
+
defaults: {},
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
export interface TouchCatalogEntry {
|
|
140
|
+
/** `touch.library` value written to config (built-in libraries only). */
|
|
141
|
+
id: string;
|
|
142
|
+
label: string;
|
|
143
|
+
hint: string;
|
|
144
|
+
kind: WizardTouchKind;
|
|
145
|
+
defaults: {
|
|
146
|
+
cs?: number;
|
|
147
|
+
irq?: number;
|
|
148
|
+
i2cAddress?: number;
|
|
149
|
+
i2cFrequency?: number;
|
|
150
|
+
resetPin?: number;
|
|
151
|
+
/** Resistive raw-ADC calibration (capacitive uses panel pixel space). */
|
|
152
|
+
calibration?: { xMin: number; xMax: number; yMin: number; yMax: number };
|
|
153
|
+
analogPins?: { xp: number; yp: number; xm: number; ym: number; rx: number };
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const TOUCH_CATALOG: readonly TouchCatalogEntry[] = [
|
|
158
|
+
{
|
|
159
|
+
id: "none",
|
|
160
|
+
label: "No touch (display only)",
|
|
161
|
+
hint: "skip touch configuration",
|
|
162
|
+
kind: "none",
|
|
163
|
+
defaults: {},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "XPT2046_Touchscreen",
|
|
167
|
+
label: "XPT2046 resistive (SPI)",
|
|
168
|
+
hint: "the resistive controller on most ILI9341 modules",
|
|
169
|
+
kind: "spi",
|
|
170
|
+
defaults: {
|
|
171
|
+
cs: 15,
|
|
172
|
+
// Typical raw-ADC range for 320×240 modules; refine per panel.
|
|
173
|
+
calibration: { xMin: 375, xMax: 3950, yMin: 200, yMax: 3750 },
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: "FT6336U",
|
|
178
|
+
label: "FT6336U capacitive (I2C)",
|
|
179
|
+
hint: "on many ST7796S 320×480 modules",
|
|
180
|
+
kind: "i2c",
|
|
181
|
+
defaults: {
|
|
182
|
+
i2cAddress: 0x38,
|
|
183
|
+
i2cFrequency: 400_000,
|
|
184
|
+
},
|
|
185
|
+
// The framework's FT6336U adapter includes RAK14014_FT6336U.h.
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: "GT911",
|
|
189
|
+
label: "GT911 capacitive (I2C)",
|
|
190
|
+
hint: "common on larger IPS panels",
|
|
191
|
+
kind: "i2c",
|
|
192
|
+
defaults: {
|
|
193
|
+
i2cAddress: 0x5d,
|
|
194
|
+
i2cFrequency: 400_000,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: "CST816S",
|
|
199
|
+
label: "CST816S capacitive (I2C)",
|
|
200
|
+
hint: "on many compact ESP32 display boards",
|
|
201
|
+
kind: "i2c",
|
|
202
|
+
defaults: {
|
|
203
|
+
i2cAddress: 0x15,
|
|
204
|
+
i2cFrequency: 400_000,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "Adafruit_TouchScreen",
|
|
209
|
+
label: "Adafruit 4-wire resistive (analog pins)",
|
|
210
|
+
hint: '2.4"/2.8" Adafruit shields with XP/YP/XM/YM analog pins',
|
|
211
|
+
kind: "analog",
|
|
212
|
+
defaults: {
|
|
213
|
+
analogPins: { xp: 24, yp: 25, xm: 26, ym: 27, rx: 300 },
|
|
214
|
+
calibration: { xMin: 100, xMax: 900, yMin: 120, yMax: 900 },
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: "Adafruit_STMPE610",
|
|
219
|
+
label: "STMPE610 resistive (SPI)",
|
|
220
|
+
hint: 'Adafruit 2.8" TFT touch cape controller',
|
|
221
|
+
kind: "spi",
|
|
222
|
+
defaults: {
|
|
223
|
+
cs: 14,
|
|
224
|
+
calibration: { xMin: 375, xMax: 3950, yMin: 200, yMax: 3750 },
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: "adapter",
|
|
229
|
+
label: "Custom touch adapter file",
|
|
230
|
+
hint: "path to your own TypeScript adapter",
|
|
231
|
+
kind: "adapter",
|
|
232
|
+
defaults: {},
|
|
233
|
+
},
|
|
234
|
+
];
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Collect GPIO collisions between the display wiring and the touch wiring so
|
|
238
|
+
* the wizard can warn before writing the config (a shared pin is almost
|
|
239
|
+
* always a mis-entered default rather than real hardware).
|
|
240
|
+
*/
|
|
241
|
+
export function findPinConflicts(
|
|
242
|
+
displayPins: Record<string, number | undefined>,
|
|
243
|
+
touchPins: Record<string, number | undefined>,
|
|
244
|
+
): string[] {
|
|
245
|
+
const conflicts: string[] = [];
|
|
246
|
+
const claimed = new Map<number, string>();
|
|
247
|
+
for (const [displayKey, displayValue] of Object.entries(displayPins)) {
|
|
248
|
+
if (displayValue === undefined) continue;
|
|
249
|
+
claimed.set(displayValue, displayKey);
|
|
250
|
+
}
|
|
251
|
+
for (const [touchKey, touchValue] of Object.entries(touchPins)) {
|
|
252
|
+
if (touchValue === undefined) continue;
|
|
253
|
+
const owner = claimed.get(touchValue);
|
|
254
|
+
if (owner !== undefined) {
|
|
255
|
+
conflicts.push(
|
|
256
|
+
`display.${owner} and touch.${touchKey} are both wired to GPIO ${touchValue}`,
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return conflicts;
|
|
261
|
+
}
|
package/src/wizard/index.ts
CHANGED
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Public surface of the @typecad/ui integration wizard (`npx @typecad/ui
|
|
3
|
-
// --config`). Pure helpers (catalog, rendering, config splicing, starter
|
|
4
|
-
// template) are exported for tests and tooling; the interactive flow lives in
|
|
5
|
-
// integration-wizard.ts.
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
DISPLAY_CATALOG,
|
|
10
|
-
TOUCH_CATALOG,
|
|
11
|
-
findPinConflicts,
|
|
12
|
-
} from "./display-catalog.js";
|
|
13
|
-
export type {
|
|
14
|
-
DisplayCatalogEntry,
|
|
15
|
-
TouchCatalogEntry,
|
|
16
|
-
WizardBus,
|
|
17
|
-
WizardTouchKind,
|
|
18
|
-
} from "./display-catalog.js";
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
findCuttlefishConfig,
|
|
22
|
-
findSyntaxError,
|
|
23
|
-
readConfigSection,
|
|
24
|
-
readEntryPath,
|
|
25
|
-
renderDisplayBody,
|
|
26
|
-
renderDisplayProperty,
|
|
27
|
-
upsertDisplaySection,
|
|
28
|
-
} from "./config-writer.js";
|
|
29
|
-
export type {
|
|
30
|
-
ConfigRecord,
|
|
31
|
-
RenderDisplayOptions,
|
|
32
|
-
UpsertDisplayResult,
|
|
33
|
-
} from "./config-writer.js";
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Public surface of the @typecad/ui integration wizard (`npx @typecad/ui
|
|
3
|
+
// --config`). Pure helpers (catalog, rendering, config splicing, starter
|
|
4
|
+
// template) are exported for tests and tooling; the interactive flow lives in
|
|
5
|
+
// integration-wizard.ts.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
DISPLAY_CATALOG,
|
|
10
|
+
TOUCH_CATALOG,
|
|
11
|
+
findPinConflicts,
|
|
12
|
+
} from "./display-catalog.js";
|
|
13
|
+
export type {
|
|
14
|
+
DisplayCatalogEntry,
|
|
15
|
+
TouchCatalogEntry,
|
|
16
|
+
WizardBus,
|
|
17
|
+
WizardTouchKind,
|
|
18
|
+
} from "./display-catalog.js";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
findCuttlefishConfig,
|
|
22
|
+
findSyntaxError,
|
|
23
|
+
readConfigSection,
|
|
24
|
+
readEntryPath,
|
|
25
|
+
renderDisplayBody,
|
|
26
|
+
renderDisplayProperty,
|
|
27
|
+
upsertDisplaySection,
|
|
28
|
+
} from "./config-writer.js";
|
|
29
|
+
export type {
|
|
30
|
+
ConfigRecord,
|
|
31
|
+
RenderDisplayOptions,
|
|
32
|
+
UpsertDisplayResult,
|
|
33
|
+
} from "./config-writer.js";
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
findPackageJson,
|
|
37
|
+
previewScriptCommand,
|
|
38
|
+
readPackageScript,
|
|
39
|
+
upsertPackageScript,
|
|
40
|
+
} from "./package-writer.js";
|
|
41
|
+
export type { UpsertScriptResult } from "./package-writer.js";
|
|
42
|
+
|
|
43
|
+
export { renderStarterUi } from "./starter-ui.js";
|
|
44
|
+
|
|
45
|
+
export { runIntegrationWizard } from "./integration-wizard.js";
|
|
46
|
+
export type { WizardRunResult, WizardStreams } from "./integration-wizard.js";
|