@qontinui/ui-bridge-native 0.7.0 → 0.8.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.
- package/dist/control/index.js +2 -0
- package/dist/control/index.js.map +1 -1
- package/dist/control/index.mjs +2 -0
- package/dist/control/index.mjs.map +1 -1
- package/dist/core/index.js +267 -15
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +267 -16
- package/dist/core/index.mjs.map +1 -1
- package/dist/core/registry.d.ts +13 -0
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/sha256.d.ts +19 -0
- package/dist/core/sha256.d.ts.map +1 -0
- package/dist/core/types.d.ts +20 -7
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/vision-fields.d.ts +164 -11
- package/dist/core/vision-fields.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +320 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -45
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +314 -44
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +314 -44
- package/dist/react/index.mjs.map +1 -1
- package/dist/react/useRouteAwareness.d.ts.map +1 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/index.js +303 -37
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +303 -37
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/page-health.d.ts +10 -1
- package/dist/server/page-health.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,164 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
+
// src/core/sha256.ts
|
|
13
|
+
var K = new Uint32Array([
|
|
14
|
+
1116352408,
|
|
15
|
+
1899447441,
|
|
16
|
+
3049323471,
|
|
17
|
+
3921009573,
|
|
18
|
+
961987163,
|
|
19
|
+
1508970993,
|
|
20
|
+
2453635748,
|
|
21
|
+
2870763221,
|
|
22
|
+
3624381080,
|
|
23
|
+
310598401,
|
|
24
|
+
607225278,
|
|
25
|
+
1426881987,
|
|
26
|
+
1925078388,
|
|
27
|
+
2162078206,
|
|
28
|
+
2614888103,
|
|
29
|
+
3248222580,
|
|
30
|
+
3835390401,
|
|
31
|
+
4022224774,
|
|
32
|
+
264347078,
|
|
33
|
+
604807628,
|
|
34
|
+
770255983,
|
|
35
|
+
1249150122,
|
|
36
|
+
1555081692,
|
|
37
|
+
1996064986,
|
|
38
|
+
2554220882,
|
|
39
|
+
2821834349,
|
|
40
|
+
2952996808,
|
|
41
|
+
3210313671,
|
|
42
|
+
3336571891,
|
|
43
|
+
3584528711,
|
|
44
|
+
113926993,
|
|
45
|
+
338241895,
|
|
46
|
+
666307205,
|
|
47
|
+
773529912,
|
|
48
|
+
1294757372,
|
|
49
|
+
1396182291,
|
|
50
|
+
1695183700,
|
|
51
|
+
1986661051,
|
|
52
|
+
2177026350,
|
|
53
|
+
2456956037,
|
|
54
|
+
2730485921,
|
|
55
|
+
2820302411,
|
|
56
|
+
3259730800,
|
|
57
|
+
3345764771,
|
|
58
|
+
3516065817,
|
|
59
|
+
3600352804,
|
|
60
|
+
4094571909,
|
|
61
|
+
275423344,
|
|
62
|
+
430227734,
|
|
63
|
+
506948616,
|
|
64
|
+
659060556,
|
|
65
|
+
883997877,
|
|
66
|
+
958139571,
|
|
67
|
+
1322822218,
|
|
68
|
+
1537002063,
|
|
69
|
+
1747873779,
|
|
70
|
+
1955562222,
|
|
71
|
+
2024104815,
|
|
72
|
+
2227730452,
|
|
73
|
+
2361852424,
|
|
74
|
+
2428436474,
|
|
75
|
+
2756734187,
|
|
76
|
+
3204031479,
|
|
77
|
+
3329325298
|
|
78
|
+
]);
|
|
79
|
+
var H0 = [
|
|
80
|
+
1779033703,
|
|
81
|
+
3144134277,
|
|
82
|
+
1013904242,
|
|
83
|
+
2773480762,
|
|
84
|
+
1359893119,
|
|
85
|
+
2600822924,
|
|
86
|
+
528734635,
|
|
87
|
+
1541459225
|
|
88
|
+
];
|
|
89
|
+
function utf8Bytes(input) {
|
|
90
|
+
const out = [];
|
|
91
|
+
for (let i = 0; i < input.length; i++) {
|
|
92
|
+
let cp = input.charCodeAt(i);
|
|
93
|
+
if (cp >= 55296 && cp <= 56319) {
|
|
94
|
+
const next = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
|
|
95
|
+
if (next >= 56320 && next <= 57343) {
|
|
96
|
+
cp = 65536 + (cp - 55296 << 10) + (next - 56320);
|
|
97
|
+
i++;
|
|
98
|
+
} else {
|
|
99
|
+
cp = 65533;
|
|
100
|
+
}
|
|
101
|
+
} else if (cp >= 56320 && cp <= 57343) {
|
|
102
|
+
cp = 65533;
|
|
103
|
+
}
|
|
104
|
+
if (cp < 128) {
|
|
105
|
+
out.push(cp);
|
|
106
|
+
} else if (cp < 2048) {
|
|
107
|
+
out.push(192 | cp >> 6, 128 | cp & 63);
|
|
108
|
+
} else if (cp < 65536) {
|
|
109
|
+
out.push(224 | cp >> 12, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
110
|
+
} else {
|
|
111
|
+
out.push(
|
|
112
|
+
240 | cp >> 18,
|
|
113
|
+
128 | cp >> 12 & 63,
|
|
114
|
+
128 | cp >> 6 & 63,
|
|
115
|
+
128 | cp & 63
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return Uint8Array.from(out);
|
|
120
|
+
}
|
|
121
|
+
var rotr = (x, n) => x >>> n | x << 32 - n;
|
|
122
|
+
function sha256Hex(input) {
|
|
123
|
+
const bytes = utf8Bytes(input);
|
|
124
|
+
const blockBytes = Math.ceil((bytes.length + 9) / 64) * 64;
|
|
125
|
+
const buffer = new Uint8Array(blockBytes);
|
|
126
|
+
buffer.set(bytes);
|
|
127
|
+
buffer[bytes.length] = 128;
|
|
128
|
+
const view = new DataView(buffer.buffer);
|
|
129
|
+
const bitLength = bytes.length * 8;
|
|
130
|
+
view.setUint32(blockBytes - 8, Math.floor(bitLength / 4294967296));
|
|
131
|
+
view.setUint32(blockBytes - 4, bitLength >>> 0);
|
|
132
|
+
const h = H0.slice();
|
|
133
|
+
const w = new Uint32Array(64);
|
|
134
|
+
for (let block = 0; block < blockBytes; block += 64) {
|
|
135
|
+
for (let t = 0; t < 16; t++) w[t] = view.getUint32(block + t * 4);
|
|
136
|
+
for (let t = 16; t < 64; t++) {
|
|
137
|
+
const s0 = rotr(w[t - 15], 7) ^ rotr(w[t - 15], 18) ^ w[t - 15] >>> 3;
|
|
138
|
+
const s1 = rotr(w[t - 2], 17) ^ rotr(w[t - 2], 19) ^ w[t - 2] >>> 10;
|
|
139
|
+
w[t] = w[t - 16] + s0 + w[t - 7] + s1;
|
|
140
|
+
}
|
|
141
|
+
let [a, b, c, d, e, f, g, hh] = h;
|
|
142
|
+
for (let t = 0; t < 64; t++) {
|
|
143
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
144
|
+
const ch = e & f ^ ~e & g;
|
|
145
|
+
const t1 = hh + S1 + ch + K[t] + w[t] | 0;
|
|
146
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
147
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
148
|
+
const t2 = S0 + maj | 0;
|
|
149
|
+
hh = g;
|
|
150
|
+
g = f;
|
|
151
|
+
f = e;
|
|
152
|
+
e = d + t1 | 0;
|
|
153
|
+
d = c;
|
|
154
|
+
c = b;
|
|
155
|
+
b = a;
|
|
156
|
+
a = t1 + t2 | 0;
|
|
157
|
+
}
|
|
158
|
+
h[0] = h[0] + a | 0;
|
|
159
|
+
h[1] = h[1] + b | 0;
|
|
160
|
+
h[2] = h[2] + c | 0;
|
|
161
|
+
h[3] = h[3] + d | 0;
|
|
162
|
+
h[4] = h[4] + e | 0;
|
|
163
|
+
h[5] = h[5] + f | 0;
|
|
164
|
+
h[6] = h[6] + g | 0;
|
|
165
|
+
h[7] = h[7] + hh | 0;
|
|
166
|
+
}
|
|
167
|
+
return h.map((word) => (word >>> 0).toString(16).padStart(8, "0")).join("");
|
|
168
|
+
}
|
|
169
|
+
|
|
12
170
|
// src/core/vision-fields.ts
|
|
13
171
|
var INTERACTIVE_HANDLER_NAMES = /* @__PURE__ */ new Set([
|
|
14
172
|
"onPress",
|
|
@@ -92,13 +250,18 @@ var NAMED_COLORS = {
|
|
|
92
250
|
gray: { r: 128, g: 128, b: 128 },
|
|
93
251
|
grey: { r: 128, g: 128, b: 128 },
|
|
94
252
|
silver: { r: 192, g: 192, b: 192 },
|
|
95
|
-
transparent: { r: 0, g: 0, b: 0 },
|
|
96
253
|
orange: { r: 255, g: 165, b: 0 },
|
|
97
254
|
yellow: { r: 255, g: 255, b: 0 },
|
|
98
255
|
purple: { r: 128, g: 0, b: 128 },
|
|
99
256
|
navy: { r: 0, g: 0, b: 128 }
|
|
100
257
|
};
|
|
101
258
|
var clamp255 = (n) => Math.max(0, Math.min(255, Math.round(n)));
|
|
259
|
+
function parseAlpha(p) {
|
|
260
|
+
const pct = p.endsWith("%");
|
|
261
|
+
const n = parseFloat(pct ? p.slice(0, -1) : p);
|
|
262
|
+
if (!Number.isFinite(n)) return void 0;
|
|
263
|
+
return Math.min(1, pct ? n / 100 : n);
|
|
264
|
+
}
|
|
102
265
|
function parseColorToRgb(input) {
|
|
103
266
|
if (typeof input !== "string") return void 0;
|
|
104
267
|
const raw = input.trim().toLowerCase();
|
|
@@ -109,6 +272,7 @@ function parseColorToRgb(input) {
|
|
|
109
272
|
if (raw.startsWith("#")) {
|
|
110
273
|
const hex = raw.slice(1);
|
|
111
274
|
if (hex.length === 3 || hex.length === 4) {
|
|
275
|
+
if (hex.length === 4 && hex[3] !== "f") return void 0;
|
|
112
276
|
const r = parseInt(hex[0] + hex[0], 16);
|
|
113
277
|
const g = parseInt(hex[1] + hex[1], 16);
|
|
114
278
|
const b = parseInt(hex[2] + hex[2], 16);
|
|
@@ -116,6 +280,7 @@ function parseColorToRgb(input) {
|
|
|
116
280
|
return void 0;
|
|
117
281
|
}
|
|
118
282
|
if (hex.length === 6 || hex.length === 8) {
|
|
283
|
+
if (hex.length === 8 && hex.slice(6, 8) !== "ff") return void 0;
|
|
119
284
|
const r = parseInt(hex.slice(0, 2), 16);
|
|
120
285
|
const g = parseInt(hex.slice(2, 4), 16);
|
|
121
286
|
const b = parseInt(hex.slice(4, 6), 16);
|
|
@@ -127,7 +292,11 @@ function parseColorToRgb(input) {
|
|
|
127
292
|
const rgbMatch = raw.match(/^rgba?\(([^)]+)\)$/);
|
|
128
293
|
if (rgbMatch) {
|
|
129
294
|
const parts = rgbMatch[1].split(",").map((p) => p.trim());
|
|
130
|
-
if (parts.length < 3) return void 0;
|
|
295
|
+
if (parts.length < 3 || parts.length > 4) return void 0;
|
|
296
|
+
if (parts.length === 4) {
|
|
297
|
+
const alpha = parseAlpha(parts[3]);
|
|
298
|
+
if (alpha === void 0 || alpha < 1) return void 0;
|
|
299
|
+
}
|
|
131
300
|
const channel = (p) => {
|
|
132
301
|
if (p.endsWith("%")) {
|
|
133
302
|
const pct = parseFloat(p.slice(0, -1));
|
|
@@ -159,13 +328,87 @@ function parseFontSizePx(input) {
|
|
|
159
328
|
}
|
|
160
329
|
return void 0;
|
|
161
330
|
}
|
|
331
|
+
var ASCII_WHITESPACE_EDGES = /^[\t\n\f\r ]+|[\t\n\f\r ]+$/g;
|
|
332
|
+
function nonEmptyString(v) {
|
|
333
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
334
|
+
}
|
|
335
|
+
var OBJECT_FIT_TO_RESIZE_MODE = /* @__PURE__ */ new Map([
|
|
336
|
+
["contain", "contain"],
|
|
337
|
+
["cover", "cover"],
|
|
338
|
+
["fill", "stretch"],
|
|
339
|
+
["scale-down", "contain"],
|
|
340
|
+
["none", "none"]
|
|
341
|
+
]);
|
|
342
|
+
var RESIZE_MODE_TO_OBJECT_FIT = /* @__PURE__ */ new Map([
|
|
343
|
+
["cover", "cover"],
|
|
344
|
+
["contain", "contain"],
|
|
345
|
+
["stretch", "fill"],
|
|
346
|
+
["center", "scale-down"],
|
|
347
|
+
["none", "none"]
|
|
348
|
+
]);
|
|
349
|
+
function resolveObjectFit(props, flatStyle) {
|
|
350
|
+
const styleFit = nonEmptyString(flatStyle?.objectFit);
|
|
351
|
+
const mode = (styleFit !== void 0 ? OBJECT_FIT_TO_RESIZE_MODE.get(styleFit) : void 0) ?? nonEmptyString(props?.resizeMode) ?? nonEmptyString(flatStyle?.resizeMode);
|
|
352
|
+
return mode !== void 0 ? RESIZE_MODE_TO_OBJECT_FIT.get(mode) : void 0;
|
|
353
|
+
}
|
|
354
|
+
function resolveImageSource(props) {
|
|
355
|
+
if (!props) return void 0;
|
|
356
|
+
if (props.srcSet !== void 0 && props.srcSet !== null) return void 0;
|
|
357
|
+
const src = nonEmptyString(props.src);
|
|
358
|
+
if (src !== void 0) return src;
|
|
359
|
+
const source = props.source;
|
|
360
|
+
const one = Array.isArray(source) ? source.length === 1 ? source[0] : void 0 : source;
|
|
361
|
+
if (one && typeof one === "object") {
|
|
362
|
+
return nonEmptyString(one.uri);
|
|
363
|
+
}
|
|
364
|
+
return void 0;
|
|
365
|
+
}
|
|
366
|
+
function isHiddenFromAccessibility(props) {
|
|
367
|
+
if (!props) return false;
|
|
368
|
+
return props.accessible === false && props.alt === void 0 || props.importantForAccessibility === "no" || props.importantForAccessibility === "no-hide-descendants" || props.accessibilityElementsHidden === true;
|
|
369
|
+
}
|
|
370
|
+
function resolveImageLabel(props, registryLabel) {
|
|
371
|
+
if (props === void 0) return registryLabel;
|
|
372
|
+
const own = props["aria-label"] ?? props.accessibilityLabel ?? props.alt;
|
|
373
|
+
return typeof own === "string" ? own : void 0;
|
|
374
|
+
}
|
|
375
|
+
function projectMedia(args) {
|
|
376
|
+
const { layout, props, flatStyle, accessibilityLabel, inViewport } = args;
|
|
377
|
+
const media = { kind: "img" };
|
|
378
|
+
if (layout && Number.isFinite(layout.width) && Number.isFinite(layout.height) && layout.width >= 0 && layout.height >= 0) {
|
|
379
|
+
media.rendered_px = { w: layout.width, h: layout.height };
|
|
380
|
+
}
|
|
381
|
+
const objectFit = resolveObjectFit(props, flatStyle);
|
|
382
|
+
if (objectFit !== void 0) media.object_fit = objectFit;
|
|
383
|
+
if (isHiddenFromAccessibility(props)) {
|
|
384
|
+
media.alt = { decorative: true };
|
|
385
|
+
} else {
|
|
386
|
+
const label = resolveImageLabel(props, accessibilityLabel);
|
|
387
|
+
const text = label?.replace(ASCII_WHITESPACE_EDGES, "");
|
|
388
|
+
if (text) media.alt = { decorative: false, text };
|
|
389
|
+
}
|
|
390
|
+
const src = resolveImageSource(props);
|
|
391
|
+
if (src !== void 0) media.src_digest = sha256Hex(src);
|
|
392
|
+
if (inViewport !== void 0) media.in_viewport = inViewport;
|
|
393
|
+
return media;
|
|
394
|
+
}
|
|
162
395
|
function projectVisionFields(args) {
|
|
163
396
|
const { type, label, handlerNames, state, flatStyle } = args;
|
|
164
397
|
const fields = {
|
|
165
398
|
interactable: deriveInteractable(type, handlerNames)
|
|
166
399
|
};
|
|
167
|
-
|
|
168
|
-
|
|
400
|
+
if (type === "image") {
|
|
401
|
+
fields.media = projectMedia({
|
|
402
|
+
layout: state.layout,
|
|
403
|
+
props: args.props,
|
|
404
|
+
flatStyle,
|
|
405
|
+
accessibilityLabel: args.accessibilityLabel,
|
|
406
|
+
inViewport: args.inViewport
|
|
407
|
+
});
|
|
408
|
+
} else {
|
|
409
|
+
const text = deriveText(state, label);
|
|
410
|
+
if (text !== void 0) fields.text = text;
|
|
411
|
+
}
|
|
169
412
|
const role = roleForType(type);
|
|
170
413
|
if (role !== void 0) fields.role = role;
|
|
171
414
|
if (flatStyle) {
|
|
@@ -305,11 +548,17 @@ function computeVisibility(state, clip) {
|
|
|
305
548
|
if (!rect) {
|
|
306
549
|
return { visibility: "visible" };
|
|
307
550
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return
|
|
551
|
+
return rectReachesClip(rect, clip) ? { visibility: "visible" } : { visibility: "hidden", visibilityReason: "off-screen" };
|
|
552
|
+
}
|
|
553
|
+
function rectReachesClip(rect, clip) {
|
|
554
|
+
if (isEmptyRect(clip)) return false;
|
|
555
|
+
return spansOverlap(rect.left, rect.right, clip.left, clip.right) && spansOverlap(rect.top, rect.bottom, clip.top, clip.bottom);
|
|
556
|
+
}
|
|
557
|
+
function computeInViewport(state, clip) {
|
|
558
|
+
if (!state.visible || !clip) return void 0;
|
|
559
|
+
const rect = pageRectOf(state);
|
|
560
|
+
if (!rect) return void 0;
|
|
561
|
+
return rectReachesClip(rect, clip);
|
|
313
562
|
}
|
|
314
563
|
function copyRouteInfo(info) {
|
|
315
564
|
const copy = { ...info };
|
|
@@ -1252,10 +1501,9 @@ var NativeUIBridgeRegistry = class {
|
|
|
1252
1501
|
elements: elements.map((e) => {
|
|
1253
1502
|
const handlers = extractHandlerNames(e.props);
|
|
1254
1503
|
const state = e.getState();
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
);
|
|
1504
|
+
const identifier = e.getIdentifier();
|
|
1505
|
+
const clip = this.getClipRectFor(e, viewport);
|
|
1506
|
+
const { visibility, visibilityReason } = computeVisibility(state, clip);
|
|
1259
1507
|
const bbox = projectBbox(state, visibility, this.pixelRatio);
|
|
1260
1508
|
const vision = projectVisionFields({
|
|
1261
1509
|
type: e.type,
|
|
@@ -1266,13 +1514,16 @@ var NativeUIBridgeRegistry = class {
|
|
|
1266
1514
|
// using it would mark plain text/view nodes interactable.
|
|
1267
1515
|
handlerNames: handlers,
|
|
1268
1516
|
state,
|
|
1269
|
-
flatStyle: e.flatStyle
|
|
1517
|
+
flatStyle: e.flatStyle,
|
|
1518
|
+
props: e.props,
|
|
1519
|
+
accessibilityLabel: identifier.accessibilityLabel,
|
|
1520
|
+
inViewport: computeInViewport(state, clip)
|
|
1270
1521
|
});
|
|
1271
1522
|
return {
|
|
1272
1523
|
id: e.id,
|
|
1273
1524
|
type: e.type,
|
|
1274
1525
|
label: e.label,
|
|
1275
|
-
identifier
|
|
1526
|
+
identifier,
|
|
1276
1527
|
state,
|
|
1277
1528
|
actions: e.actions,
|
|
1278
1529
|
customActions: serializeElementCustomActions(e.customActions),
|
|
@@ -3442,7 +3693,7 @@ var NATIVE_PAGE_HEALTH_PRODUCER_ID = "sdk-native/page-health";
|
|
|
3442
3693
|
function defaultProducer() {
|
|
3443
3694
|
return {
|
|
3444
3695
|
id: NATIVE_PAGE_HEALTH_PRODUCER_ID,
|
|
3445
|
-
version: "0.
|
|
3696
|
+
version: "0.8.0"
|
|
3446
3697
|
};
|
|
3447
3698
|
}
|
|
3448
3699
|
function pageHealthUnknown(code, detail, options = {}) {
|
|
@@ -3484,14 +3735,7 @@ var LOADING_PHRASES = [
|
|
|
3484
3735
|
"initializing",
|
|
3485
3736
|
"fetching"
|
|
3486
3737
|
];
|
|
3487
|
-
var EMPTY_PHRASES = [
|
|
3488
|
-
"no data",
|
|
3489
|
-
"no results",
|
|
3490
|
-
"nothing here",
|
|
3491
|
-
"empty",
|
|
3492
|
-
"no items",
|
|
3493
|
-
"get started"
|
|
3494
|
-
];
|
|
3738
|
+
var EMPTY_PHRASES = ["no data", "no results", "nothing here", "empty", "no items", "get started"];
|
|
3495
3739
|
function severityRank(s) {
|
|
3496
3740
|
if (s === "CRITICAL") return 3;
|
|
3497
3741
|
if (s === "WARNING") return 2;
|
|
@@ -3566,20 +3810,44 @@ function observe(input, producer, evaluatedAt) {
|
|
|
3566
3810
|
}
|
|
3567
3811
|
return analyze(elements, viewport, base);
|
|
3568
3812
|
}
|
|
3813
|
+
function nothingOnScreenDetail(elements, visibleCount, visibilityUnstated) {
|
|
3814
|
+
if (visibilityUnstated === 0 && visibleCount > 0) {
|
|
3815
|
+
return `all ${visibleCount} visible element(s) have no measured layout yet, so spatial coverage, layout regions and visual anomalies cannot be measured`;
|
|
3816
|
+
}
|
|
3817
|
+
if (visibilityUnstated > 0) {
|
|
3818
|
+
const geometry = visibleCount > 0 ? ` and none of the ${visibleCount} visible one(s) has a measured layout` : "";
|
|
3819
|
+
return `${visibilityUnstated} of ${elements.length} element(s) carry no boolean \`state.visible\`${geometry}, so no element can be placed on screen; spatial coverage, layout regions and visual anomalies cannot be measured`;
|
|
3820
|
+
}
|
|
3821
|
+
const unmounted = elements.filter((el) => el.state?.mounted === false).length;
|
|
3822
|
+
return `all ${elements.length} registered element(s) report visible: false (unmounted=${unmounted}, off-screen route or otherwise=${elements.length - unmounted}), so whatever is on screen is not a registered element and there is nothing on screen to measure; this says nothing about whether the screen is blank`;
|
|
3823
|
+
}
|
|
3569
3824
|
function analyze(elements, viewport, base) {
|
|
3570
3825
|
const findings = [];
|
|
3571
|
-
const
|
|
3572
|
-
const
|
|
3826
|
+
const onScreen = elements.filter((el) => el.state?.visible === true);
|
|
3827
|
+
const visibilityUnstated = elements.filter(
|
|
3828
|
+
(el) => typeof el.state?.visible !== "boolean"
|
|
3829
|
+
).length;
|
|
3830
|
+
const visible = onScreen.flatMap((el) => {
|
|
3573
3831
|
const rect = normalizeRect(el.state, viewport);
|
|
3574
3832
|
return rect ? [{ el, rect }] : [];
|
|
3575
3833
|
});
|
|
3576
|
-
const withoutGeometry =
|
|
3577
|
-
const unmeasured =
|
|
3578
|
-
|
|
3579
|
-
|
|
3834
|
+
const withoutGeometry = onScreen.length - visible.length;
|
|
3835
|
+
const unmeasured = [];
|
|
3836
|
+
if (withoutGeometry > 0) {
|
|
3837
|
+
unmeasured.push({ dimension: "geometry", count: withoutGeometry, code: "input_missing" });
|
|
3838
|
+
}
|
|
3839
|
+
if (visibilityUnstated > 0) {
|
|
3840
|
+
unmeasured.push({ dimension: "visibility", count: visibilityUnstated, code: "input_missing" });
|
|
3841
|
+
}
|
|
3842
|
+
const coverage = {
|
|
3843
|
+
considered: onScreen.length + visibilityUnstated,
|
|
3844
|
+
measured: visible.length,
|
|
3845
|
+
unmeasured
|
|
3846
|
+
};
|
|
3847
|
+
if (elements.length > 0 && visible.length === 0) {
|
|
3580
3848
|
return Observation.unknown(
|
|
3581
3849
|
"input_missing",
|
|
3582
|
-
|
|
3850
|
+
nothingOnScreenDetail(elements, onScreen.length, visibilityUnstated),
|
|
3583
3851
|
Observation.provenance({ ...base, coverage })
|
|
3584
3852
|
);
|
|
3585
3853
|
}
|
|
@@ -3669,7 +3937,7 @@ function analyze(elements, viewport, base) {
|
|
|
3669
3937
|
for (const el of elements) {
|
|
3670
3938
|
const elType = el.type ?? "";
|
|
3671
3939
|
if (SKIP_TEXT_TYPES.has(elType)) continue;
|
|
3672
|
-
const text = (el.state
|
|
3940
|
+
const text = (el.state?.textContent ?? "").toString();
|
|
3673
3941
|
if (!text) continue;
|
|
3674
3942
|
const textLower = text.toLowerCase();
|
|
3675
3943
|
for (const p of ERROR_PHRASES) {
|
|
@@ -3710,7 +3978,7 @@ function analyze(elements, viewport, base) {
|
|
|
3710
3978
|
for (const el of elements) {
|
|
3711
3979
|
if (!INTERACTIVE_TYPES2.has(el.type)) continue;
|
|
3712
3980
|
interactiveTotal++;
|
|
3713
|
-
if (el.state
|
|
3981
|
+
if (el.state?.enabled === false) interactiveDisabled++;
|
|
3714
3982
|
}
|
|
3715
3983
|
const interactiveSeverity = interactiveTotal > 0 && interactiveDisabled / interactiveTotal > 0.5 ? "WARNING" : "OK";
|
|
3716
3984
|
findings.push({
|
|
@@ -3734,9 +4002,7 @@ function analyze(elements, viewport, base) {
|
|
|
3734
4002
|
detail: `zero_size=${zeroSize}, outside_viewport=${outsideViewport} (horizontal-overflow only; below/above-fold scrollable content is not an anomaly)`,
|
|
3735
4003
|
data: { zero_size: zeroSize, outside_viewport: outsideViewport }
|
|
3736
4004
|
});
|
|
3737
|
-
const heatmap = grid.map(
|
|
3738
|
-
(row) => row.map((cell) => cell ? "#" : ".").join("")
|
|
3739
|
-
);
|
|
4005
|
+
const heatmap = grid.map((row) => row.map((cell) => cell ? "#" : ".").join(""));
|
|
3740
4006
|
return Observation.measured(
|
|
3741
4007
|
{
|
|
3742
4008
|
summary: worstSeverity(findings),
|
|
@@ -3996,10 +4262,9 @@ function createServerHandlers(registry, executor, config) {
|
|
|
3996
4262
|
const elements = allElements.map((e) => {
|
|
3997
4263
|
const handlers = extractHandlerNames(e.props);
|
|
3998
4264
|
const state = e.getState();
|
|
3999
|
-
const
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
);
|
|
4265
|
+
const identifier = e.getIdentifier();
|
|
4266
|
+
const clip = registry.getClipRectFor(e, viewport);
|
|
4267
|
+
const { visibility, visibilityReason } = computeVisibility(state, clip);
|
|
4003
4268
|
const bbox = projectBbox(state, visibility, registry.getPixelRatio());
|
|
4004
4269
|
const vision = projectVisionFields({
|
|
4005
4270
|
type: e.type,
|
|
@@ -4008,13 +4273,16 @@ function createServerHandlers(registry, executor, config) {
|
|
|
4008
4273
|
// synthesize press/click onto every element. See projectVisionFields.
|
|
4009
4274
|
handlerNames: handlers,
|
|
4010
4275
|
state,
|
|
4011
|
-
flatStyle: e.flatStyle
|
|
4276
|
+
flatStyle: e.flatStyle,
|
|
4277
|
+
props: e.props,
|
|
4278
|
+
accessibilityLabel: identifier.accessibilityLabel,
|
|
4279
|
+
inViewport: computeInViewport(state, clip)
|
|
4012
4280
|
});
|
|
4013
4281
|
return {
|
|
4014
4282
|
id: e.id,
|
|
4015
4283
|
type: e.type,
|
|
4016
4284
|
label: e.label,
|
|
4017
|
-
identifier
|
|
4285
|
+
identifier,
|
|
4018
4286
|
state,
|
|
4019
4287
|
actions: e.actions,
|
|
4020
4288
|
customActions: serializeElementCustomActions(e.customActions),
|
|
@@ -4722,7 +4990,7 @@ function createServerHandlers(registry, executor, config) {
|
|
|
4722
4990
|
};
|
|
4723
4991
|
if (config?.appInfo) {
|
|
4724
4992
|
response.uiBridge = {
|
|
4725
|
-
version: "0.
|
|
4993
|
+
version: "0.8.0",
|
|
4726
4994
|
...config.appInfo,
|
|
4727
4995
|
capabilities: ["elements", "components", "actions", "design"],
|
|
4728
4996
|
elementCount: stats.elements,
|
|
@@ -8220,7 +8488,9 @@ function useUIBridgeModal(opts) {
|
|
|
8220
8488
|
}, [modalDetector, id, title, type, blocking, dismissible]);
|
|
8221
8489
|
}
|
|
8222
8490
|
function effectiveInfo(info, unmatched) {
|
|
8223
|
-
|
|
8491
|
+
if (!unmatched) return info;
|
|
8492
|
+
const { params: _dropped, ...rest } = info;
|
|
8493
|
+
return { ...rest, pattern: null };
|
|
8224
8494
|
}
|
|
8225
8495
|
function useRouteAwareness(info, options = {}) {
|
|
8226
8496
|
const bridge = useUIBridgeNativeOptional();
|
|
@@ -9449,6 +9719,6 @@ var styles = StyleSheet.create({
|
|
|
9449
9719
|
}
|
|
9450
9720
|
});
|
|
9451
9721
|
|
|
9452
|
-
export { CloudRelayClient, DEFAULT_PARAM_VALIDATION_MODE, DefaultNativeActionExecutor, DeviceAnnouncer, MAX_ACTION_TIMEOUT_MS, ModalDetector, NATIVE_STANDARD_ACTION_EFFECTS, NativeActionError, NativeUIBridgeRegistry, NativeUIBridgeServer, State, ToastCapture, TransitionTo, UIBridgeInspector, UIBridgeNativeProvider, UI_BRIDGE_NATIVE_ROUTES, UndoTracker, WebSocketConnection, WebSocketEventBridge, bindWithRetry, buildTreePath, buildUpgradeResponse, captureNativeResponsiveSnapshot, captureNativeStateVariations, computeAcceptKey, computeVisibility, createDesignHandlers, createNativeActionExecutor, createNativeElementIdentifier, createNativeServer, createServerHandlers, deriveInteractable, deriveText, expoRouterPattern, expoRouterRouteStack, extractHandlerNames, findAllByPattern, findElementByIdentifier, formatParamValidationFailure, getDefaultParamValidationMode, getGlobalRegistry, getNativeElementDesignData, httpStatusForResponse, inertAbortSignal, intersectRects, isAddrInUseError, isEmptyRect, isExpoRouterUnmatched, mapNativeStyleToExtended, matchesIdentifier, nativeStandardActionEffect, normalizeActionTimeoutMs, pageRectOf, parseColorToRgb, parseFontSizePx, parseTreePath, projectVisionFields, reactNavigationPattern, resetDefaultParamValidationMode, resetGlobalRegistry, resolveActionEffect, roleForType, runAbortable, setDefaultParamValidationMode, setGlobalRegistry, useRouteAwareness, useToastRecorder, useUIBridge, useUIBridgeModal, useUIBridgeNative, useUIBridgeNativeOptional, useUIBridgeNativeRequired, useUIBridgeRequired, useUIBridgeToast, useUIComponent, useUIComponentAction, useUIElement, useUIElementWithProps, validateActionParams };
|
|
9722
|
+
export { CloudRelayClient, DEFAULT_PARAM_VALIDATION_MODE, DefaultNativeActionExecutor, DeviceAnnouncer, MAX_ACTION_TIMEOUT_MS, ModalDetector, NATIVE_STANDARD_ACTION_EFFECTS, NativeActionError, NativeUIBridgeRegistry, NativeUIBridgeServer, State, ToastCapture, TransitionTo, UIBridgeInspector, UIBridgeNativeProvider, UI_BRIDGE_NATIVE_ROUTES, UndoTracker, WebSocketConnection, WebSocketEventBridge, bindWithRetry, buildTreePath, buildUpgradeResponse, captureNativeResponsiveSnapshot, captureNativeStateVariations, computeAcceptKey, computeInViewport, computeVisibility, createDesignHandlers, createNativeActionExecutor, createNativeElementIdentifier, createNativeServer, createServerHandlers, deriveInteractable, deriveText, expoRouterPattern, expoRouterRouteStack, extractHandlerNames, findAllByPattern, findElementByIdentifier, formatParamValidationFailure, getDefaultParamValidationMode, getGlobalRegistry, getNativeElementDesignData, httpStatusForResponse, inertAbortSignal, intersectRects, isAddrInUseError, isEmptyRect, isExpoRouterUnmatched, isHiddenFromAccessibility, mapNativeStyleToExtended, matchesIdentifier, nativeStandardActionEffect, normalizeActionTimeoutMs, pageRectOf, parseColorToRgb, parseFontSizePx, parseTreePath, projectMedia, projectVisionFields, reactNavigationPattern, resetDefaultParamValidationMode, resetGlobalRegistry, resolveActionEffect, resolveImageLabel, resolveImageSource, resolveObjectFit, roleForType, runAbortable, setDefaultParamValidationMode, setGlobalRegistry, useRouteAwareness, useToastRecorder, useUIBridge, useUIBridgeModal, useUIBridgeNative, useUIBridgeNativeOptional, useUIBridgeNativeRequired, useUIBridgeRequired, useUIBridgeToast, useUIComponent, useUIComponentAction, useUIElement, useUIElementWithProps, validateActionParams };
|
|
9453
9723
|
//# sourceMappingURL=index.mjs.map
|
|
9454
9724
|
//# sourceMappingURL=index.mjs.map
|