@typecad/ui 1.0.0-alpha.11 → 1.0.0-alpha.13
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 +21 -1
- package/assets/fonts/dejavu/DejaVuSans-Bold.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSans-ExtraLight.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSans-Oblique.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSans.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSansMono-Bold.ttf +0 -0
- package/assets/fonts/dejavu/DejaVuSansMono.ttf +0 -0
- package/assets/fonts/dejavu/LICENSE +187 -0
- package/assets/fonts/dejavu/README.md +49 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +74 -0
- package/dist/engine-index.js +2 -0
- package/dist/preview/build-program.d.ts +7 -1
- package/dist/preview/build-program.js +94 -15
- package/dist/preview/host-gfx.d.ts +3 -0
- package/dist/preview/host-gfx.js +30 -3
- package/dist/preview/host-ui-runtime.d.ts +115 -0
- package/dist/preview/host-ui-runtime.js +928 -46
- package/dist/ui-engine/block-layout.js +25 -11
- package/dist/ui-engine/color.d.ts +6 -0
- package/dist/ui-engine/color.js +80 -2
- package/dist/ui-engine/compat-report.d.ts +8 -0
- package/dist/ui-engine/compat-report.js +124 -0
- package/dist/ui-engine/css-imports.d.ts +4 -0
- package/dist/ui-engine/css-imports.js +70 -0
- package/dist/ui-engine/css-parser.js +58 -14
- package/dist/ui-engine/default-font.d.ts +25 -0
- package/dist/ui-engine/default-font.js +80 -0
- package/dist/ui-engine/font-assets.d.ts +2 -2
- package/dist/ui-engine/font-assets.js +22 -5
- package/dist/ui-engine/html-parser.d.ts +4 -0
- package/dist/ui-engine/html-parser.js +241 -26
- package/dist/ui-engine/image-assets.d.ts +8 -1
- package/dist/ui-engine/image-assets.js +35 -2
- package/dist/ui-engine/image-decode.d.ts +22 -0
- package/dist/ui-engine/image-decode.js +194 -0
- package/dist/ui-engine/inline-parser.js +1 -1
- package/dist/ui-engine/layout-engine.d.ts +19 -0
- package/dist/ui-engine/layout-engine.js +59 -3
- package/dist/ui-engine/model.d.ts +18 -0
- package/dist/ui-engine/model.js +76 -8
- package/dist/ui-engine/runtime-header/blend-bodies.js +29 -9
- package/dist/ui-engine/runtime-header/canvas-helpers.js +5 -2
- package/dist/ui-engine/runtime-header/canvas-scrollbar.js +115 -111
- package/dist/ui-engine/runtime-header/cuttlefish-gfx.js +21 -0
- package/dist/ui-engine/runtime-header/dirty-scroll-mutators.js +182 -179
- package/dist/ui-engine/runtime-header/forward-decls.js +215 -167
- package/dist/ui-engine/runtime-header/init-press-input.js +138 -135
- package/dist/ui-engine/runtime-header/keyboard.js +682 -380
- package/dist/ui-engine/runtime-header/node-draw-body.js +1656 -1377
- package/dist/ui-engine/runtime-header/paint-order-coords.js +259 -214
- package/dist/ui-engine/runtime-header/paint-rects-repair.js +736 -568
- package/dist/ui-engine/runtime-header/scroll-physics.js +25 -1
- package/dist/ui-engine/runtime-header/state-bindings-nav.js +9 -0
- package/dist/ui-engine/runtime-header/structs.js +228 -216
- package/dist/ui-engine/runtime-header/text-rendering.js +888 -770
- package/dist/ui-engine/runtime-header/tick/bindings-phase.js +118 -116
- package/dist/ui-engine/runtime-header/tick/dirty-draw-phase.js +897 -633
- package/dist/ui-engine/runtime-header/tick/scroll-canvas-phase.js +24 -25
- package/dist/ui-engine/runtime-header/touch-keyboard-fwd.js +79 -23
- package/dist/ui-engine/runtime-header/types-defines.js +110 -93
- package/dist/ui-engine/shadcn-kit.d.ts +1 -0
- package/dist/ui-engine/shadcn-kit.js +502 -0
- package/dist/ui-engine/style-resolver.d.ts +4 -0
- package/dist/ui-engine/style-resolver.js +58 -6
- package/dist/ui-engine/transpile-ui.js +12 -5
- package/dist/ui-engine/ua-stylesheet.d.ts +22 -1
- package/dist/ui-engine/ua-stylesheet.js +119 -32
- package/dist/ui-engine/ui-lowering.js +37 -3
- package/dist/ui-engine/ui-registry.js +32 -4
- package/dist/ui-engine/yoga-layout.js +57 -52
- package/dist/wizard/config-writer.d.ts +49 -0
- package/dist/wizard/config-writer.js +366 -0
- package/dist/wizard/display-catalog.d.ts +75 -0
- package/dist/wizard/display-catalog.js +207 -0
- package/dist/wizard/index.d.ts +7 -0
- package/dist/wizard/index.js +10 -0
- package/dist/wizard/integration-wizard.d.ts +15 -0
- package/dist/wizard/integration-wizard.js +486 -0
- package/dist/wizard/prompts.d.ts +32 -0
- package/dist/wizard/prompts.js +95 -0
- package/dist/wizard/starter-ui.d.ts +1 -0
- package/dist/wizard/starter-ui.js +56 -0
- package/package.json +18 -5
- package/src/cli.ts +87 -0
- package/src/engine-index.ts +53 -51
- package/src/preview/build-program.ts +810 -734
- package/src/preview/host-gfx.ts +30 -3
- package/src/preview/host-ui-runtime.ts +4133 -3289
- package/src/ui-engine/block-layout.ts +24 -11
- package/src/ui-engine/color.ts +77 -2
- package/src/ui-engine/compat-report.ts +139 -0
- package/src/ui-engine/css-imports.ts +69 -0
- package/src/ui-engine/css-parser.ts +64 -15
- package/src/ui-engine/default-font.ts +95 -0
- package/src/ui-engine/font-assets.ts +545 -525
- package/src/ui-engine/html-parser.ts +615 -397
- package/src/ui-engine/image-assets.ts +37 -2
- package/src/ui-engine/image-decode.ts +244 -0
- package/src/ui-engine/inline-parser.ts +1 -1
- package/src/ui-engine/layout-engine.ts +61 -3
- package/src/ui-engine/model.ts +1317 -1230
- package/src/ui-engine/runtime-header/blend-bodies.ts +29 -9
- package/src/ui-engine/runtime-header/canvas-helpers.ts +5 -2
- package/src/ui-engine/runtime-header/canvas-scrollbar.ts +121 -117
- package/src/ui-engine/runtime-header/cuttlefish-gfx.ts +21 -0
- package/src/ui-engine/runtime-header/dirty-scroll-mutators.ts +188 -185
- package/src/ui-engine/runtime-header/forward-decls.ts +227 -179
- package/src/ui-engine/runtime-header/init-press-input.ts +144 -141
- package/src/ui-engine/runtime-header/keyboard.ts +689 -386
- package/src/ui-engine/runtime-header/node-draw-body.ts +1681 -1402
- package/src/ui-engine/runtime-header/paint-order-coords.ts +265 -220
- package/src/ui-engine/runtime-header/paint-rects-repair.ts +742 -574
- package/src/ui-engine/runtime-header/scroll-physics.ts +25 -1
- package/src/ui-engine/runtime-header/state-bindings-nav.ts +9 -0
- package/src/ui-engine/runtime-header/structs.ts +234 -222
- package/src/ui-engine/runtime-header/text-rendering.ts +894 -776
- package/src/ui-engine/runtime-header/tick/bindings-phase.ts +124 -122
- package/src/ui-engine/runtime-header/tick/dirty-draw-phase.ts +902 -638
- package/src/ui-engine/runtime-header/tick/scroll-canvas-phase.ts +30 -31
- package/src/ui-engine/runtime-header/touch-keyboard-fwd.ts +79 -23
- package/src/ui-engine/runtime-header/types-defines.ts +116 -99
- package/src/ui-engine/shadcn-kit.ts +503 -0
- package/src/ui-engine/style-resolver.ts +471 -416
- package/src/ui-engine/transpile-ui.ts +12 -5
- package/src/ui-engine/ua-stylesheet.ts +137 -31
- package/src/ui-engine/ui-lowering.ts +486 -452
- package/src/ui-engine/ui-registry.ts +556 -524
- package/src/ui-engine/yoga-layout.ts +307 -309
- package/src/wizard/config-writer.ts +404 -0
- package/src/wizard/display-catalog.ts +273 -0
- package/src/wizard/index.ts +38 -0
- package/src/wizard/integration-wizard.ts +619 -0
- package/src/wizard/prompts.ts +145 -0
- package/src/wizard/starter-ui.ts +58 -0
package/src/preview/host-gfx.ts
CHANGED
|
@@ -67,6 +67,12 @@ export class HostAdafruitGFX {
|
|
|
67
67
|
// When true (mono/e-ink target), draw primitives snap color values to black/
|
|
68
68
|
// white by luminance — mirrors the device's UI_MAYBE_SNAP_MONO565 choke-point.
|
|
69
69
|
private monoSnap = false;
|
|
70
|
+
// Storage depth of values written into the buffer. rgb565 targets store
|
|
71
|
+
// packed 565 (expanded at the canvas push); rgb888/rgb666 targets store
|
|
72
|
+
// packed RGB888, with rgb666 quantizing channels to 6 bits at the push
|
|
73
|
+
// boundary — mirroring the device's panel. Set by PreviewUIRuntime from the
|
|
74
|
+
// snapshot's colorFormat before the first frame.
|
|
75
|
+
private storage: "rgb565" | "rgb666" | "rgb888" = "rgb565";
|
|
70
76
|
private textSizeX = 1;
|
|
71
77
|
private textSizeY = 1;
|
|
72
78
|
private wrap = true;
|
|
@@ -91,6 +97,11 @@ export class HostAdafruitGFX {
|
|
|
91
97
|
this.monoSnap = on;
|
|
92
98
|
}
|
|
93
99
|
|
|
100
|
+
/** Set the buffer's storage depth (see the `storage` field). */
|
|
101
|
+
setStorageMode(mode: "rgb565" | "rgb666" | "rgb888"): void {
|
|
102
|
+
this.storage = mode;
|
|
103
|
+
}
|
|
104
|
+
|
|
94
105
|
private snap(c: number): number {
|
|
95
106
|
if (!this.monoSnap) return c;
|
|
96
107
|
// Pre-snapped mono values (0=black, 1=white from the transpiler's
|
|
@@ -242,7 +253,11 @@ export class HostAdafruitGFX {
|
|
|
242
253
|
}
|
|
243
254
|
r = Math.min(r, Math.trunc(Math.min(w, h) / 2));
|
|
244
255
|
this.fillRect(x + r, y, w - 2 * r, h, color);
|
|
245
|
-
|
|
256
|
+
// No max(0, ·) clamp: for a perfect pill (h == 2r) the raw value is -1 and
|
|
257
|
+
// fillCircleHelper's delta++ turns it into 0, landing the arc lines exactly
|
|
258
|
+
// on the box. Clamping to 0 first made every arc line one row too tall —
|
|
259
|
+
// a 1px orphan stub under each corner of pill-shaped badges.
|
|
260
|
+
const delta = h - 2 * r - 1;
|
|
246
261
|
this.fillCircleHelper(x + w - r - 1, y + r, r, 1, delta, color);
|
|
247
262
|
this.fillCircleHelper(x + r, y + r, r, 2, delta, color);
|
|
248
263
|
}
|
|
@@ -566,12 +581,24 @@ export class HostAdafruitGFX {
|
|
|
566
581
|
out[p] = (c >> 16) & 0xff;
|
|
567
582
|
out[p + 1] = (c >> 8) & 0xff;
|
|
568
583
|
out[p + 2] = c & 0xff;
|
|
569
|
-
} else {
|
|
570
|
-
// 565 target: unpack to 888.
|
|
584
|
+
} else if (this.storage === "rgb565") {
|
|
585
|
+
// 565 target: buffer holds packed 565 — unpack to 888.
|
|
571
586
|
const { r, g, b } = rgb565ToRgb888(c);
|
|
572
587
|
out[p] = r;
|
|
573
588
|
out[p + 1] = g;
|
|
574
589
|
out[p + 2] = b;
|
|
590
|
+
} else {
|
|
591
|
+
// rgb888/rgb666 target: buffer holds packed RGB888. rgb666
|
|
592
|
+
// quantizes to 6 bits/channel at the push (device panel parity).
|
|
593
|
+
let r = (c >> 16) & 0xff, g = (c >> 8) & 0xff, b = c & 0xff;
|
|
594
|
+
if (this.storage === "rgb666") {
|
|
595
|
+
r = (r & 0xfc) | (r >> 6);
|
|
596
|
+
g = (g & 0xfc) | (g >> 6);
|
|
597
|
+
b = (b & 0xfc) | (b >> 6);
|
|
598
|
+
}
|
|
599
|
+
out[p] = r;
|
|
600
|
+
out[p + 1] = g;
|
|
601
|
+
out[p + 2] = b;
|
|
575
602
|
}
|
|
576
603
|
out[p + 3] = 255;
|
|
577
604
|
}
|