@glassly/miniapp 0.4.1 → 0.4.2-beta.1188

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 (83) hide show
  1. package/README.md +1 -0
  2. package/dist/display/index.d.ts +14 -4
  3. package/dist/display/index.d.ts.map +1 -1
  4. package/dist/display/index.js +11 -4
  5. package/dist/display/index.js.map +1 -1
  6. package/dist/display/measurer/script-detection.d.ts +1 -1
  7. package/dist/display/measurer/script-detection.d.ts.map +1 -1
  8. package/dist/display/measurer/script-detection.js +46 -10
  9. package/dist/display/measurer/script-detection.js.map +1 -1
  10. package/dist/display/profiles/index.d.ts +1 -1
  11. package/dist/display/profiles/index.d.ts.map +1 -1
  12. package/dist/display/profiles/index.js +1 -1
  13. package/dist/display/profiles/index.js.map +1 -1
  14. package/dist/display/profiles/nimo.d.ts +6 -0
  15. package/dist/display/profiles/nimo.d.ts.map +1 -1
  16. package/dist/display/profiles/nimo.js +17 -0
  17. package/dist/display/profiles/nimo.js.map +1 -1
  18. package/dist/display/scene/anchor.d.ts +16 -0
  19. package/dist/display/scene/anchor.d.ts.map +1 -0
  20. package/dist/display/scene/anchor.js +32 -0
  21. package/dist/display/scene/anchor.js.map +1 -0
  22. package/dist/display/scene/degrade.d.ts +25 -0
  23. package/dist/display/scene/degrade.d.ts.map +1 -0
  24. package/dist/display/scene/degrade.js +67 -0
  25. package/dist/display/scene/degrade.js.map +1 -0
  26. package/dist/display/scene/differ.d.ts +50 -0
  27. package/dist/display/scene/differ.d.ts.map +1 -0
  28. package/dist/display/scene/differ.js +129 -0
  29. package/dist/display/scene/differ.js.map +1 -0
  30. package/dist/display/scene/process.d.ts +41 -0
  31. package/dist/display/scene/process.d.ts.map +1 -0
  32. package/dist/display/scene/process.js +408 -0
  33. package/dist/display/scene/process.js.map +1 -0
  34. package/dist/display/scene/store.d.ts +48 -0
  35. package/dist/display/scene/store.d.ts.map +1 -0
  36. package/dist/display/scene/store.js +0 -0
  37. package/dist/display/scene/store.js.map +1 -0
  38. package/dist/display/scene/svgPath.d.ts +9 -0
  39. package/dist/display/scene/svgPath.d.ts.map +1 -0
  40. package/dist/display/scene/svgPath.js +167 -0
  41. package/dist/display/scene/svgPath.js.map +1 -0
  42. package/dist/host/index.d.ts +7 -0
  43. package/dist/host/index.d.ts.map +1 -0
  44. package/dist/host/index.js +7 -0
  45. package/dist/host/index.js.map +1 -0
  46. package/dist/host/uiShim.d.ts +38 -0
  47. package/dist/host/uiShim.d.ts.map +1 -0
  48. package/dist/host/uiShim.js +383 -0
  49. package/dist/host/uiShim.js.map +1 -0
  50. package/dist/host/webviewGlobals.d.ts +60 -0
  51. package/dist/host/webviewGlobals.d.ts.map +1 -0
  52. package/dist/host/webviewGlobals.js +211 -0
  53. package/dist/host/webviewGlobals.js.map +1 -0
  54. package/dist/mirror/canvas.d.ts +13 -2
  55. package/dist/mirror/canvas.d.ts.map +1 -1
  56. package/dist/mirror/canvas.js +42 -21
  57. package/dist/mirror/canvas.js.map +1 -1
  58. package/dist/mirror/index.d.ts +1 -1
  59. package/dist/mirror/index.d.ts.map +1 -1
  60. package/dist/mirror/index.js.map +1 -1
  61. package/dist/modules/display.d.ts +10 -0
  62. package/dist/modules/display.d.ts.map +1 -1
  63. package/dist/modules/display.js.map +1 -1
  64. package/dist/ui/index.d.ts +1 -1
  65. package/dist/ui/index.js +1 -1
  66. package/package.json +6 -2
  67. package/src/display/index.ts +15 -3
  68. package/src/display/measurer/script-detection.ts +47 -10
  69. package/src/display/profiles/index.ts +1 -1
  70. package/src/display/profiles/nimo.ts +18 -0
  71. package/src/display/scene/anchor.ts +38 -0
  72. package/src/display/scene/degrade.ts +83 -0
  73. package/src/display/scene/differ.ts +152 -0
  74. package/src/display/scene/process.ts +443 -0
  75. package/src/display/scene/store.ts +0 -0
  76. package/src/display/scene/svgPath.ts +163 -0
  77. package/src/host/index.ts +14 -0
  78. package/src/host/uiShim.ts +389 -0
  79. package/src/host/webviewGlobals.ts +251 -0
  80. package/src/mirror/canvas.ts +86 -43
  81. package/src/mirror/index.ts +1 -1
  82. package/src/modules/display.ts +4 -0
  83. package/src/ui/index.ts +1 -1
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Scene differ — matches elements between the last frame sent to the device and
3
+ * the next scene, and classifies each element's change. Pure set arithmetic:
4
+ * nothing in here is device-specific (spec §1).
5
+ *
6
+ * Matching rules (design doc §3.4.1, in order):
7
+ * 1. same explicit `id` + same `type` ⇒ same element
8
+ * 2. no id: same `type` + identical box ⇒ same element
9
+ * 3. no id: same `type`, by order among the still-unmatched
10
+ * 4. anything unmatched in prev ⇒ removed; unmatched in next ⇒ created
11
+ *
12
+ * Matched no-id elements INHERIT the previous element's assigned id so the
13
+ * device-side id⇒firmware-component mapping stays stable; fresh elements get a
14
+ * synthesized id from the caller (SceneStore counter). Synthesized ids are
15
+ * prefixed "~" so they can never collide with app-supplied ids.
16
+ */
17
+ import { boxesEqual } from "./types";
18
+ function classify(prev, next) {
19
+ if (!boxesEqual(prev.box, next.box))
20
+ return "moved";
21
+ if (prev.contentHash !== next.contentHash)
22
+ return "updated";
23
+ return "unchanged";
24
+ }
25
+ /**
26
+ * Assemble the annotated FrameElement, OMITTING optional fields that are
27
+ * undefined. A present key with an `undefined` value cannot cross the Expo
28
+ * Android bridge — its `Map<String, Any>` converter rejects it ("Value is
29
+ * undefined, expected an Object"), which surfaces as ERR_UNEXPECTED from
30
+ * displayEvent. (iOS's `[String: Any]` bridge silently drops nils, so the
31
+ * defect was invisible there.) Keeping the keys absent — not undefined —
32
+ * matches the optional-field contract in types.ts.
33
+ */
34
+ function buildFrameElement(el, id, change) {
35
+ const out = { id, type: el.type, box: el.box, contentHash: el.contentHash, change };
36
+ if (el.text !== undefined)
37
+ out.text = el.text;
38
+ if (el.data !== undefined)
39
+ out.data = el.data;
40
+ if (el.style !== undefined)
41
+ out.style = el.style;
42
+ if (el.points !== undefined)
43
+ out.points = el.points;
44
+ if (el.startDeg !== undefined)
45
+ out.startDeg = el.startDeg;
46
+ if (el.endDeg !== undefined)
47
+ out.endDeg = el.endDeg;
48
+ if (el.transition !== undefined)
49
+ out.transition = el.transition;
50
+ if (el.d !== undefined)
51
+ out.d = el.d;
52
+ if (el.path !== undefined)
53
+ out.path = el.path;
54
+ if (el.pathScale !== undefined)
55
+ out.pathScale = el.pathScale;
56
+ if (el.fillRule !== undefined)
57
+ out.fillRule = el.fillRule;
58
+ if (el.rotation !== undefined)
59
+ out.rotation = el.rotation;
60
+ if (el.pivot !== undefined)
61
+ out.pivot = el.pivot;
62
+ if (el.depth !== undefined)
63
+ out.depth = el.depth;
64
+ return out;
65
+ }
66
+ /**
67
+ * Diff `next` against `prev` (the last frame sent for this app/view/device;
68
+ * empty array for a fresh scene). `nextSyntheticId` mints ids for elements the
69
+ * app didn't name — must be stable per (app, view) across calls (SceneStore).
70
+ */
71
+ export function diffScene(prev, next, nextSyntheticId) {
72
+ const prevUnmatched = new Set(prev.map((_, i) => i));
73
+ const prevByExplicitId = new Map();
74
+ prev.forEach((el, i) => {
75
+ if (!el.id.startsWith("~"))
76
+ prevByExplicitId.set(`${el.type}:${el.id}`, i);
77
+ });
78
+ // matches[nextIndex] = prevIndex | undefined
79
+ const matches = new Array(next.length).fill(undefined);
80
+ // Pass 1: explicit id + type.
81
+ next.forEach((el, i) => {
82
+ if (!el.id)
83
+ return;
84
+ const j = prevByExplicitId.get(`${el.type}:${el.id}`);
85
+ if (j !== undefined && prevUnmatched.has(j)) {
86
+ matches[i] = j;
87
+ prevUnmatched.delete(j);
88
+ }
89
+ });
90
+ // Pass 2: no-id elements match a no-id prev element of the same type with an
91
+ // identical box.
92
+ next.forEach((el, i) => {
93
+ if (el.id || matches[i] !== undefined)
94
+ return;
95
+ for (const j of prevUnmatched) {
96
+ const p = prev[j];
97
+ if (p.id.startsWith("~") && p.type === el.type && boxesEqual(p.box, el.box)) {
98
+ matches[i] = j;
99
+ prevUnmatched.delete(j);
100
+ break;
101
+ }
102
+ }
103
+ });
104
+ // Pass 3: remaining no-id elements match remaining no-id prev of the same
105
+ // type in order (k-th unmatched text ↔ k-th unmatched text).
106
+ next.forEach((el, i) => {
107
+ if (el.id || matches[i] !== undefined)
108
+ return;
109
+ for (const j of prevUnmatched) {
110
+ const p = prev[j];
111
+ if (p.id.startsWith("~") && p.type === el.type) {
112
+ matches[i] = j;
113
+ prevUnmatched.delete(j);
114
+ break;
115
+ }
116
+ }
117
+ });
118
+ const elements = next.map((el, i) => {
119
+ const j = matches[i];
120
+ if (j !== undefined) {
121
+ const p = prev[j];
122
+ return buildFrameElement(el, el.id ?? p.id, classify(p, el));
123
+ }
124
+ return buildFrameElement(el, el.id ?? nextSyntheticId(), "created");
125
+ });
126
+ const removed = [...prevUnmatched].map((j) => prev[j].id);
127
+ return { elements, removed };
128
+ }
129
+ //# sourceMappingURL=differ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"differ.js","sourceRoot":"","sources":["../../../src/display/scene/differ.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAA;AA+BlC,SAAS,QAAQ,CAAC,IAAkB,EAAE,IAAqB;IACzD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAA;IACnD,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW;QAAE,OAAO,SAAS,CAAA;IAC3D,OAAO,WAAW,CAAA;AACpB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,EAAmB,EAAE,EAAU,EAAE,MAAmB;IAC7E,MAAM,GAAG,GAAiB,EAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE,CAAC,WAAW,EAAE,MAAM,EAAC,CAAA;IAC/F,IAAI,EAAE,CAAC,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AQ,GAAmB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAClD,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;QACpB,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACpB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,OAAO,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QAC9D,CAAC;QACD,OAAO,iBAAiB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,eAAe,EAAE,EAAE,SAAS,CAAC,CAAA;IACrE,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACzD,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAA;AAC5B,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Scene processing — validate → clamp → budget → wrap. Everything here is
3
+ * generic; device variation enters only through the capabilities block and the
4
+ * display profile (data, not code). Spec §5.
5
+ *
6
+ * Never rejects a frame: offending elements are dropped per-element and
7
+ * reported via `dropped` / `degraded` (design doc §3.4.6; spec §4 refines the
8
+ * design doc's image "reject" to per-element drop).
9
+ */
10
+ import type { DisplayProfile } from "../profiles/types";
11
+ import type { DiffableElement } from "./differ";
12
+ import type { SceneDisplayCapabilities, SceneElementInput } from "./types";
13
+ export interface ProcessedScene {
14
+ elements: DiffableElement[];
15
+ degraded: boolean;
16
+ dropped: string[];
17
+ }
18
+ /**
19
+ * Text the host cannot wrap: a script the measurer has no widths or break
20
+ * rules for (Thai has no spaces between words, for one). It is passed through
21
+ * unwrapped and the device's text engine lays it out in the box.
22
+ */
23
+ export declare function wrapsOnDevice(text: string): boolean;
24
+ /**
25
+ * Line height for box-height→line-count math — ONLY when the profile declares
26
+ * a calibrated `lineHeightPx`. Deriving one from full-canvas numbers proved
27
+ * wrong on hardware (288/8=36px clipped the G2 nav instruction to one line;
28
+ * the real container line height is smaller). Without calibration we return
29
+ * null and the wrap step skips host-side height clipping entirely — text wraps
30
+ * to the box WIDTH and the firmware clips vertically in-box, which is exactly
31
+ * the legacy behavior.
32
+ */
33
+ export declare function profileLineHeightPx(profile: DisplayProfile, _canvasHeight: number): number | null;
34
+ /**
35
+ * Process a raw scene against a device's capabilities + profile. Output is
36
+ * diff-ready (text pre-wrapped, boxes clamped, content hashed) and reflects
37
+ * exactly what will be sent — the diff baseline is post-processed by design
38
+ * (spec §4).
39
+ */
40
+ export declare function processScene(input: readonly SceneElementInput[], caps: SceneDisplayCapabilities, profile: DisplayProfile): ProcessedScene;
41
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../src/display/scene/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAGV,wBAAwB,EACxB,iBAAiB,EAKlB,MAAM,SAAS,CAAA;AAGhB,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAkBD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKnD;AAmDD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEjG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,iBAAiB,EAAE,EACnC,IAAI,EAAE,wBAAwB,EAC9B,OAAO,EAAE,cAAc,GACtB,cAAc,CAoThB"}
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Scene processing — validate → clamp → budget → wrap. Everything here is
3
+ * generic; device variation enters only through the capabilities block and the
4
+ * display profile (data, not code). Spec §5.
5
+ *
6
+ * Never rejects a frame: offending elements are dropped per-element and
7
+ * reported via `dropped` / `degraded` (design doc §3.4.6; spec §4 refines the
8
+ * design doc's image "reject" to per-element drop).
9
+ */
10
+ import { compileSvgPath } from "./svgPath";
11
+ import { isUnsupportedScript } from "../measurer/script-detection";
12
+ import { TextMeasurer } from "../measurer/TextMeasurer";
13
+ import { TextWrapper } from "../wrapper/TextWrapper";
14
+ import { MAX_SCENE_DEPTH, POINT_SHAPE_ARITY, POINT_SHAPE_TYPES, elementContentHash } from "./types";
15
+ /** Reporting id for an element the app may not have named. */
16
+ function reportId(el, index) {
17
+ return el.id ?? `${el.type}[${index}]`;
18
+ }
19
+ function clampBox(box, width, height) {
20
+ const x1 = Math.max(0, Math.floor(box.x));
21
+ const y1 = Math.max(0, Math.floor(box.y));
22
+ const x2 = Math.min(width, Math.floor(box.x) + Math.max(0, Math.floor(box.w)));
23
+ const y2 = Math.min(height, Math.floor(box.y) + Math.max(0, Math.floor(box.h)));
24
+ if (x2 <= x1 || y2 <= y1)
25
+ return null;
26
+ return { x: x1, y: y1, w: x2 - x1, h: y2 - y1 };
27
+ }
28
+ const isFinite = (n) => typeof n === "number" && Number.isFinite(n);
29
+ /**
30
+ * Text the host cannot wrap: a script the measurer has no widths or break
31
+ * rules for (Thai has no spaces between words, for one). It is passed through
32
+ * unwrapped and the device's text engine lays it out in the box.
33
+ */
34
+ export function wrapsOnDevice(text) {
35
+ for (const char of text) {
36
+ if (isUnsupportedScript(char))
37
+ return true;
38
+ }
39
+ return false;
40
+ }
41
+ /** Integer points, or null when the count/values are invalid for the type. */
42
+ function validPoints(el) {
43
+ const raw = el.points;
44
+ if (!Array.isArray(raw) || !(POINT_SHAPE_ARITY[el.type] ?? []).includes(raw.length))
45
+ return null;
46
+ const points = [];
47
+ for (const p of raw) {
48
+ if (!p || typeof p !== "object" || !isFinite(p.x) || !isFinite(p.y))
49
+ return null;
50
+ points.push({ x: Math.floor(p.x), y: Math.floor(p.y) });
51
+ }
52
+ return points;
53
+ }
54
+ function pointsBox(points) {
55
+ const xs = points.map((p) => p.x);
56
+ const ys = points.map((p) => p.y);
57
+ const x = Math.min(...xs);
58
+ const y = Math.min(...ys);
59
+ return { x, y, w: Math.max(...xs) - x + 1, h: Math.max(...ys) - y + 1 };
60
+ }
61
+ function validEdge(e) {
62
+ if (!e || typeof e !== "object")
63
+ return undefined;
64
+ const dx = Math.round(Number(e.dx ?? 0));
65
+ const dy = Math.round(Number(e.dy ?? 0));
66
+ if (!isFinite(dx) || !isFinite(dy) || Math.abs(dx) > 1024 || Math.abs(dy) > 1024)
67
+ return undefined;
68
+ return { dx, dy };
69
+ }
70
+ function validTransition(t) {
71
+ if (!t || typeof t !== "object")
72
+ return undefined;
73
+ const { durationMs, easing } = t;
74
+ if (!isFinite(durationMs) || durationMs <= 0)
75
+ return undefined;
76
+ const out = easing ? { durationMs, easing } : { durationMs };
77
+ const enter = validEdge(t.enter);
78
+ const exit = validEdge(t.exit);
79
+ if (enter)
80
+ out.enter = enter;
81
+ if (exit)
82
+ out.exit = exit;
83
+ return out;
84
+ }
85
+ function boxShrunk(orig, clamped) {
86
+ return (clamped.x !== Math.floor(orig.x) ||
87
+ clamped.y !== Math.floor(orig.y) ||
88
+ clamped.w !== Math.floor(orig.w) ||
89
+ clamped.h !== Math.floor(orig.h));
90
+ }
91
+ /**
92
+ * Line height for box-height→line-count math — ONLY when the profile declares
93
+ * a calibrated `lineHeightPx`. Deriving one from full-canvas numbers proved
94
+ * wrong on hardware (288/8=36px clipped the G2 nav instruction to one line;
95
+ * the real container line height is smaller). Without calibration we return
96
+ * null and the wrap step skips host-side height clipping entirely — text wraps
97
+ * to the box WIDTH and the firmware clips vertically in-box, which is exactly
98
+ * the legacy behavior.
99
+ */
100
+ export function profileLineHeightPx(profile, _canvasHeight) {
101
+ return profile.lineHeightPx ?? null;
102
+ }
103
+ /**
104
+ * Process a raw scene against a device's capabilities + profile. Output is
105
+ * diff-ready (text pre-wrapped, boxes clamped, content hashed) and reflects
106
+ * exactly what will be sent — the diff baseline is post-processed by design
107
+ * (spec §4).
108
+ */
109
+ export function processScene(input, caps, profile) {
110
+ const dropped = [];
111
+ let degraded = false;
112
+ const measurer = new TextMeasurer(profile);
113
+ const wrapper = new TextWrapper(measurer);
114
+ const lineHeight = profileLineHeightPx(profile, caps.height);
115
+ // Validate + dedupe explicit ids (first occurrence wins; dupes are dev error).
116
+ const seenIds = new Set();
117
+ const valid = [];
118
+ input.forEach((raw, index) => {
119
+ if (!raw || typeof raw !== "object") {
120
+ dropped.push(reportId(raw ?? { type: "text" }, index));
121
+ degraded = true;
122
+ return;
123
+ }
124
+ let points;
125
+ if (POINT_SHAPE_TYPES.includes(raw.type)) {
126
+ const valid = validPoints(raw);
127
+ if (!valid) {
128
+ dropped.push(reportId(raw, index));
129
+ degraded = true;
130
+ return;
131
+ }
132
+ points = valid;
133
+ raw = { ...raw, box: pointsBox(valid) };
134
+ }
135
+ if (!raw.box) {
136
+ dropped.push(reportId(raw, index));
137
+ degraded = true;
138
+ return;
139
+ }
140
+ // Non-finite box numbers (NaN/±Infinity/non-number) would survive the
141
+ // Math.* clamp below and poison the frame all the way to native ints.
142
+ const b = raw.box;
143
+ if (![b.x, b.y, b.w, b.h].every(isFinite)) {
144
+ dropped.push(reportId(raw, index));
145
+ degraded = true;
146
+ return;
147
+ }
148
+ if ((raw.type === "arc" || raw.type === "pie") && !(isFinite(raw.startDeg) && isFinite(raw.endDeg))) {
149
+ dropped.push(reportId(raw, index));
150
+ degraded = true;
151
+ return;
152
+ }
153
+ // Leading "~" is the differ's synthetic-id namespace — an app id there
154
+ // would never match across frames (re-created every push). Normalize by
155
+ // stripping; the rewrite is deterministic, so diffing stays stable.
156
+ const el = raw.id?.startsWith("~") ? { ...raw, id: raw.id.replace(/^~+/, "") || undefined } : raw;
157
+ if (el.id) {
158
+ const key = `${el.type}:${el.id}`;
159
+ if (seenIds.has(key)) {
160
+ dropped.push(reportId(el, index));
161
+ degraded = true;
162
+ return;
163
+ }
164
+ seenIds.add(key);
165
+ }
166
+ valid.push({ el, index, box: el.box, points });
167
+ });
168
+ // Clamp + per-type limits, then budget in array order.
169
+ let textBudget = caps.maxTextElements;
170
+ let imageBudget = caps.maxImageElements;
171
+ const out = [];
172
+ let pathEdges = 0;
173
+ for (const { el, index, box, points } of valid) {
174
+ const transition = validTransition(el.transition);
175
+ // Leaving elements only exist to tween away; a device that jumps never shows them.
176
+ if (transition?.exit && !caps.animation)
177
+ continue;
178
+ const transform = {};
179
+ if (el.rotation !== undefined || el.pivot !== undefined) {
180
+ const angle = el.rotation ?? 0;
181
+ const pivot = el.pivot ?? { x: box.x + box.w / 2, y: box.y + box.h / 2 };
182
+ if (!isFinite(angle) ||
183
+ Math.abs(angle) > 36000 ||
184
+ !isFinite(pivot.x) ||
185
+ !isFinite(pivot.y) ||
186
+ Math.abs(pivot.x) > 32767 ||
187
+ Math.abs(pivot.y) > 32767 ||
188
+ !caps.rotation ||
189
+ el.type === "image" ||
190
+ el.type === "text") {
191
+ dropped.push(reportId(el, index));
192
+ degraded = true;
193
+ continue;
194
+ }
195
+ transform.rotation = Math.round(angle * 256) / 256;
196
+ transform.pivot = { x: Math.round(pivot.x), y: Math.round(pivot.y) };
197
+ if (transition)
198
+ transition.durationMs = Math.min(65535, transition.durationMs);
199
+ }
200
+ const transformHash = transform.rotation === undefined ? undefined : `${transform.rotation}:${transform.pivot?.x}:${transform.pivot?.y}`;
201
+ // Depth is a lens disparity, not content: devices without it draw the
202
+ // element flat instead of dropping it. A non-number is still a dev error.
203
+ let depth;
204
+ if (el.depth !== undefined) {
205
+ if (!isFinite(el.depth)) {
206
+ dropped.push(reportId(el, index));
207
+ degraded = true;
208
+ continue;
209
+ }
210
+ const d = Math.max(-MAX_SCENE_DEPTH, Math.min(MAX_SCENE_DEPTH, Math.round(el.depth)));
211
+ if (caps.depth && d !== 0)
212
+ depth = d;
213
+ }
214
+ const plane = depth === undefined ? {} : { depth };
215
+ const clamped = clampBox(box, caps.width, caps.height);
216
+ if (!clamped) {
217
+ dropped.push(reportId(el, index));
218
+ degraded = true;
219
+ continue;
220
+ }
221
+ const shrunk = boxShrunk(box, clamped);
222
+ if (shrunk)
223
+ degraded = true;
224
+ if (el.type === "svg") {
225
+ try {
226
+ if (!caps.shapes.includes("svg") || textBudget <= 0 || shrunk)
227
+ throw new Error("SVG unavailable or out of bounds");
228
+ const scale = el.scale ?? 1;
229
+ if (!isFinite(scale) ||
230
+ scale < 0 ||
231
+ scale > 8 ||
232
+ (el.fillRule !== undefined && el.fillRule !== "evenodd" && el.fillRule !== "nonzero"))
233
+ throw new Error("Invalid SVG scale or fill rule");
234
+ const compiled = compileSvgPath(el.d);
235
+ if (pathEdges + compiled.edges > 4096)
236
+ throw new Error("SVG scene exceeds the edge budget");
237
+ pathEdges += compiled.edges;
238
+ textBudget--;
239
+ out.push({
240
+ id: el.id,
241
+ type: "svg",
242
+ box: clamped,
243
+ d: el.d,
244
+ path: compiled.commands,
245
+ pathScale: Math.round(scale * 256),
246
+ fillRule: el.fillRule ?? "nonzero",
247
+ style: el.style,
248
+ ...transform,
249
+ ...plane,
250
+ ...(transition ? { transition } : {}),
251
+ contentHash: elementContentHash({
252
+ type: "svg",
253
+ data: `${el.d}:${scale}:${el.fillRule}:${transformHash}`,
254
+ style: el.style,
255
+ depth,
256
+ }),
257
+ });
258
+ }
259
+ catch {
260
+ dropped.push(reportId(el, index));
261
+ degraded = true;
262
+ }
263
+ continue;
264
+ }
265
+ if (el.type !== "text" && el.type !== "image" && el.type !== "rect") {
266
+ // Vector shapes: only devices that draw them get them; the device clips
267
+ // point shapes itself, so an off-canvas point is not a drop.
268
+ if (!caps.shapes.includes(el.type) || textBudget <= 0) {
269
+ dropped.push(reportId(el, index));
270
+ degraded = true;
271
+ continue;
272
+ }
273
+ textBudget--;
274
+ const angles = el.type === "arc" || el.type === "pie" ? { startDeg: el.startDeg, endDeg: el.endDeg } : {};
275
+ out.push({
276
+ id: el.id,
277
+ type: el.type,
278
+ box: clamped,
279
+ style: el.style,
280
+ ...(points ? { points } : {}),
281
+ ...angles,
282
+ ...(transition ? { transition } : {}),
283
+ ...transform,
284
+ ...plane,
285
+ contentHash: elementContentHash({
286
+ type: el.type,
287
+ style: el.style,
288
+ points,
289
+ ...angles,
290
+ data: transformHash,
291
+ depth,
292
+ }),
293
+ });
294
+ continue;
295
+ }
296
+ if (el.type === "image") {
297
+ // Images: a shrunk box can't be honored (we don't crop pixels host-side)
298
+ // and per-image device limits are box-level (the firmware allocates the
299
+ // component from the box). SGCs scale pixels to the box (phone-side
300
+ // scaling — never on glasses).
301
+ if (shrunk) {
302
+ dropped.push(reportId(el, index));
303
+ continue;
304
+ }
305
+ if (caps.maxImagePx && (clamped.w > caps.maxImagePx.width || clamped.h > caps.maxImagePx.height)) {
306
+ dropped.push(reportId(el, index));
307
+ degraded = true;
308
+ continue;
309
+ }
310
+ if (imageBudget <= 0) {
311
+ dropped.push(reportId(el, index));
312
+ degraded = true;
313
+ continue;
314
+ }
315
+ imageBudget--;
316
+ out.push({
317
+ id: el.id,
318
+ type: "image",
319
+ box: clamped,
320
+ data: el.data,
321
+ ...(el.style ? { style: el.style } : {}),
322
+ ...(transition ? { transition } : {}),
323
+ ...plane,
324
+ contentHash: elementContentHash({ type: "image", data: el.data, style: el.style, depth }),
325
+ });
326
+ continue;
327
+ }
328
+ // text + rect share the text-container budget (design doc §3.4.6).
329
+ if (textBudget <= 0) {
330
+ dropped.push(reportId(el, index));
331
+ degraded = true;
332
+ continue;
333
+ }
334
+ textBudget--;
335
+ if (el.type === "rect") {
336
+ out.push({
337
+ id: el.id,
338
+ type: "rect",
339
+ box: clamped,
340
+ style: el.style,
341
+ ...(transition ? { transition } : {}),
342
+ ...transform,
343
+ ...plane,
344
+ contentHash: elementContentHash({ type: "rect", style: el.style, data: transformHash, depth }),
345
+ });
346
+ continue;
347
+ }
348
+ // Text: wrap on the phone into the (clamped) box. The box then carries
349
+ // pre-wrapped text; firmware in-box wrap is a fallback, not the mechanism.
350
+ // Height clipping only applies with a CALIBRATED line height — otherwise
351
+ // the firmware clips vertically in-box (legacy behavior).
352
+ const style = el.style ?? {};
353
+ if (style.font === "mono" || style.font === "builtin" || wrapsOnDevice(el.text ?? "")) {
354
+ // Grid text is laid out by the app (cols × rows), builtin text by the
355
+ // glasses' own font engine and unsupported scripts by the device's text
356
+ // engine; the host's proportional wrap metrics don't apply to any of
357
+ // them. Pass lines through and let the device wrap and clip.
358
+ const monoText = el.text ?? "";
359
+ out.push({
360
+ id: el.id,
361
+ type: "text",
362
+ box: clamped,
363
+ text: monoText,
364
+ style: el.style,
365
+ ...(transition ? { transition } : {}),
366
+ ...plane,
367
+ contentHash: elementContentHash({ type: "text", text: monoText, style: el.style, depth }),
368
+ });
369
+ continue;
370
+ }
371
+ const maxLines = lineHeight ? Math.max(1, Math.floor(clamped.h / lineHeight)) : profile.maxLines;
372
+ const maxWidthPx = Math.max(1, clamped.w - 2 * (profile.textInsetPx ?? 0));
373
+ const result = wrapper.wrap(el.text ?? "", {
374
+ maxWidthPx,
375
+ maxLines,
376
+ ...(style.breakMode ? { breakMode: style.breakMode } : {}),
377
+ });
378
+ let lines = result.lines;
379
+ if (result.truncated) {
380
+ degraded = true;
381
+ if (style.overflow === "ellipsis" && lines.length > 0) {
382
+ // Trim the last line until it fits WITH the ellipsis appended —
383
+ // otherwise the extra glyph can overflow the clamped box width.
384
+ let last = lines[lines.length - 1];
385
+ while (last.length > 0 && !measurer.fitsInWidth(`${last}…`, maxWidthPx)) {
386
+ last = last.slice(0, -1);
387
+ }
388
+ // A box narrower than the ellipsis glyph itself gets an empty line —
389
+ // never emit a line wider than the clamped box.
390
+ const ellipsized = last.length > 0 || measurer.fitsInWidth("…", maxWidthPx) ? `${last}…` : "";
391
+ lines = [...lines.slice(0, -1), ellipsized];
392
+ }
393
+ }
394
+ const wrappedText = lines.join("\n");
395
+ out.push({
396
+ id: el.id,
397
+ type: "text",
398
+ box: clamped,
399
+ text: wrappedText,
400
+ style: el.style,
401
+ ...(transition ? { transition } : {}),
402
+ ...plane,
403
+ contentHash: elementContentHash({ type: "text", text: wrappedText, style: el.style, depth }),
404
+ });
405
+ }
406
+ return { elements: out, degraded, dropped };
407
+ }
408
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/display/scene/process.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAA;AACxC,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,wBAAwB,CAAA;AAalD,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAQjG,8DAA8D;AAC9D,SAAS,QAAQ,CAAC,EAAqB,EAAE,KAAa;IACpD,OAAO,EAAE,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,IAAI,KAAK,GAAG,CAAA;AACxC,CAAC;AAED,SAAS,QAAQ,CAAC,GAAa,EAAE,KAAa,EAAE,MAAc;IAC5D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACzC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,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