@qontinui/ui-bridge-native 0.7.1 → 0.9.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 +293 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +288 -26
- package/dist/index.mjs.map +1 -1
- package/dist/observation/observation.d.ts +15 -1
- package/dist/observation/observation.d.ts.map +1 -1
- package/dist/react/index.js +287 -25
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +287 -25
- 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 +276 -18
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +276 -18
- package/dist/server/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -66,7 +66,21 @@ export type UnknownCode =
|
|
|
66
66
|
/** The question needs more than one frame (e.g. `animation_settled`). */
|
|
67
67
|
| 'needs_multi_frame_input'
|
|
68
68
|
/** The input is known to be stale. */
|
|
69
|
-
| 'stale_input'
|
|
69
|
+
| 'stale_input'
|
|
70
|
+
/** The answer depends on frontier entries (declared edges never observed) that are still open. */
|
|
71
|
+
| 'frontier_open'
|
|
72
|
+
/** The observation ledger's storage does not exist in this deployment (its migration has not landed). */
|
|
73
|
+
| 'ledger_schema_absent'
|
|
74
|
+
/** The observation ledger exists but its writes are currently failing. */
|
|
75
|
+
| 'ledger_write_failing'
|
|
76
|
+
/** The ledger holds no observations at all for the question asked. */
|
|
77
|
+
| 'no_observations'
|
|
78
|
+
/** The query's destination node has never been observed. */
|
|
79
|
+
| 'to_node_unobserved'
|
|
80
|
+
/** The webview's `PerformanceObserver` does not support the entry type the measurement needs (e.g. `layout-shift`, `longtask`). */
|
|
81
|
+
| 'performance_observer_unsupported'
|
|
82
|
+
/** The awaited event did not occur before the observation window closed. */
|
|
83
|
+
| 'no_event_before_timeout';
|
|
70
84
|
/** Every {@link UnknownCode}, in the canonical (wire-contract) order. */
|
|
71
85
|
export declare const UNKNOWN_CODES: readonly UnknownCode[];
|
|
72
86
|
/** Type guard: is `value` one of the closed {@link UnknownCode} members? */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../../src/observation/observation.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH;;;;GAIG;AACH,MAAM,MAAM,WAAW;AACrB,2CAA2C;AACzC,iBAAiB;AACnB,gGAAgG;GAC9F,iCAAiC;AACnC,wFAAwF;GACtF,iBAAiB;AACnB,0FAA0F;GACxF,kBAAkB;AACpB,0EAA0E;GACxE,eAAe;AACjB,6EAA6E;GAC3E,wBAAwB;AAC1B,mDAAmD;GACjD,yBAAyB;AAC3B,yEAAyE;GACvE,yBAAyB;AAC3B,sCAAsC;GACpC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../../src/observation/observation.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH;;;;GAIG;AACH,MAAM,MAAM,WAAW;AACrB,2CAA2C;A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MAAM,EAAE,MAAM,EACd,IAAI,EAAE,qBAAqB,GAC1B,WAAW,CAAC,CAAC,CAAC,CAShB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -11,6 +11,164 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
// src/core/sha256.ts
|
|
15
|
+
var K = new Uint32Array([
|
|
16
|
+
1116352408,
|
|
17
|
+
1899447441,
|
|
18
|
+
3049323471,
|
|
19
|
+
3921009573,
|
|
20
|
+
961987163,
|
|
21
|
+
1508970993,
|
|
22
|
+
2453635748,
|
|
23
|
+
2870763221,
|
|
24
|
+
3624381080,
|
|
25
|
+
310598401,
|
|
26
|
+
607225278,
|
|
27
|
+
1426881987,
|
|
28
|
+
1925078388,
|
|
29
|
+
2162078206,
|
|
30
|
+
2614888103,
|
|
31
|
+
3248222580,
|
|
32
|
+
3835390401,
|
|
33
|
+
4022224774,
|
|
34
|
+
264347078,
|
|
35
|
+
604807628,
|
|
36
|
+
770255983,
|
|
37
|
+
1249150122,
|
|
38
|
+
1555081692,
|
|
39
|
+
1996064986,
|
|
40
|
+
2554220882,
|
|
41
|
+
2821834349,
|
|
42
|
+
2952996808,
|
|
43
|
+
3210313671,
|
|
44
|
+
3336571891,
|
|
45
|
+
3584528711,
|
|
46
|
+
113926993,
|
|
47
|
+
338241895,
|
|
48
|
+
666307205,
|
|
49
|
+
773529912,
|
|
50
|
+
1294757372,
|
|
51
|
+
1396182291,
|
|
52
|
+
1695183700,
|
|
53
|
+
1986661051,
|
|
54
|
+
2177026350,
|
|
55
|
+
2456956037,
|
|
56
|
+
2730485921,
|
|
57
|
+
2820302411,
|
|
58
|
+
3259730800,
|
|
59
|
+
3345764771,
|
|
60
|
+
3516065817,
|
|
61
|
+
3600352804,
|
|
62
|
+
4094571909,
|
|
63
|
+
275423344,
|
|
64
|
+
430227734,
|
|
65
|
+
506948616,
|
|
66
|
+
659060556,
|
|
67
|
+
883997877,
|
|
68
|
+
958139571,
|
|
69
|
+
1322822218,
|
|
70
|
+
1537002063,
|
|
71
|
+
1747873779,
|
|
72
|
+
1955562222,
|
|
73
|
+
2024104815,
|
|
74
|
+
2227730452,
|
|
75
|
+
2361852424,
|
|
76
|
+
2428436474,
|
|
77
|
+
2756734187,
|
|
78
|
+
3204031479,
|
|
79
|
+
3329325298
|
|
80
|
+
]);
|
|
81
|
+
var H0 = [
|
|
82
|
+
1779033703,
|
|
83
|
+
3144134277,
|
|
84
|
+
1013904242,
|
|
85
|
+
2773480762,
|
|
86
|
+
1359893119,
|
|
87
|
+
2600822924,
|
|
88
|
+
528734635,
|
|
89
|
+
1541459225
|
|
90
|
+
];
|
|
91
|
+
function utf8Bytes(input) {
|
|
92
|
+
const out = [];
|
|
93
|
+
for (let i = 0; i < input.length; i++) {
|
|
94
|
+
let cp = input.charCodeAt(i);
|
|
95
|
+
if (cp >= 55296 && cp <= 56319) {
|
|
96
|
+
const next = i + 1 < input.length ? input.charCodeAt(i + 1) : 0;
|
|
97
|
+
if (next >= 56320 && next <= 57343) {
|
|
98
|
+
cp = 65536 + (cp - 55296 << 10) + (next - 56320);
|
|
99
|
+
i++;
|
|
100
|
+
} else {
|
|
101
|
+
cp = 65533;
|
|
102
|
+
}
|
|
103
|
+
} else if (cp >= 56320 && cp <= 57343) {
|
|
104
|
+
cp = 65533;
|
|
105
|
+
}
|
|
106
|
+
if (cp < 128) {
|
|
107
|
+
out.push(cp);
|
|
108
|
+
} else if (cp < 2048) {
|
|
109
|
+
out.push(192 | cp >> 6, 128 | cp & 63);
|
|
110
|
+
} else if (cp < 65536) {
|
|
111
|
+
out.push(224 | cp >> 12, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
112
|
+
} else {
|
|
113
|
+
out.push(
|
|
114
|
+
240 | cp >> 18,
|
|
115
|
+
128 | cp >> 12 & 63,
|
|
116
|
+
128 | cp >> 6 & 63,
|
|
117
|
+
128 | cp & 63
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return Uint8Array.from(out);
|
|
122
|
+
}
|
|
123
|
+
var rotr = (x, n) => x >>> n | x << 32 - n;
|
|
124
|
+
function sha256Hex(input) {
|
|
125
|
+
const bytes = utf8Bytes(input);
|
|
126
|
+
const blockBytes = Math.ceil((bytes.length + 9) / 64) * 64;
|
|
127
|
+
const buffer = new Uint8Array(blockBytes);
|
|
128
|
+
buffer.set(bytes);
|
|
129
|
+
buffer[bytes.length] = 128;
|
|
130
|
+
const view = new DataView(buffer.buffer);
|
|
131
|
+
const bitLength = bytes.length * 8;
|
|
132
|
+
view.setUint32(blockBytes - 8, Math.floor(bitLength / 4294967296));
|
|
133
|
+
view.setUint32(blockBytes - 4, bitLength >>> 0);
|
|
134
|
+
const h = H0.slice();
|
|
135
|
+
const w = new Uint32Array(64);
|
|
136
|
+
for (let block = 0; block < blockBytes; block += 64) {
|
|
137
|
+
for (let t = 0; t < 16; t++) w[t] = view.getUint32(block + t * 4);
|
|
138
|
+
for (let t = 16; t < 64; t++) {
|
|
139
|
+
const s0 = rotr(w[t - 15], 7) ^ rotr(w[t - 15], 18) ^ w[t - 15] >>> 3;
|
|
140
|
+
const s1 = rotr(w[t - 2], 17) ^ rotr(w[t - 2], 19) ^ w[t - 2] >>> 10;
|
|
141
|
+
w[t] = w[t - 16] + s0 + w[t - 7] + s1;
|
|
142
|
+
}
|
|
143
|
+
let [a, b, c, d, e, f, g, hh] = h;
|
|
144
|
+
for (let t = 0; t < 64; t++) {
|
|
145
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
146
|
+
const ch = e & f ^ ~e & g;
|
|
147
|
+
const t1 = hh + S1 + ch + K[t] + w[t] | 0;
|
|
148
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
149
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
150
|
+
const t2 = S0 + maj | 0;
|
|
151
|
+
hh = g;
|
|
152
|
+
g = f;
|
|
153
|
+
f = e;
|
|
154
|
+
e = d + t1 | 0;
|
|
155
|
+
d = c;
|
|
156
|
+
c = b;
|
|
157
|
+
b = a;
|
|
158
|
+
a = t1 + t2 | 0;
|
|
159
|
+
}
|
|
160
|
+
h[0] = h[0] + a | 0;
|
|
161
|
+
h[1] = h[1] + b | 0;
|
|
162
|
+
h[2] = h[2] + c | 0;
|
|
163
|
+
h[3] = h[3] + d | 0;
|
|
164
|
+
h[4] = h[4] + e | 0;
|
|
165
|
+
h[5] = h[5] + f | 0;
|
|
166
|
+
h[6] = h[6] + g | 0;
|
|
167
|
+
h[7] = h[7] + hh | 0;
|
|
168
|
+
}
|
|
169
|
+
return h.map((word) => (word >>> 0).toString(16).padStart(8, "0")).join("");
|
|
170
|
+
}
|
|
171
|
+
|
|
14
172
|
// src/core/vision-fields.ts
|
|
15
173
|
var INTERACTIVE_HANDLER_NAMES = /* @__PURE__ */ new Set([
|
|
16
174
|
"onPress",
|
|
@@ -94,13 +252,18 @@ var NAMED_COLORS = {
|
|
|
94
252
|
gray: { r: 128, g: 128, b: 128 },
|
|
95
253
|
grey: { r: 128, g: 128, b: 128 },
|
|
96
254
|
silver: { r: 192, g: 192, b: 192 },
|
|
97
|
-
transparent: { r: 0, g: 0, b: 0 },
|
|
98
255
|
orange: { r: 255, g: 165, b: 0 },
|
|
99
256
|
yellow: { r: 255, g: 255, b: 0 },
|
|
100
257
|
purple: { r: 128, g: 0, b: 128 },
|
|
101
258
|
navy: { r: 0, g: 0, b: 128 }
|
|
102
259
|
};
|
|
103
260
|
var clamp255 = (n) => Math.max(0, Math.min(255, Math.round(n)));
|
|
261
|
+
function parseAlpha(p) {
|
|
262
|
+
const pct = p.endsWith("%");
|
|
263
|
+
const n = parseFloat(pct ? p.slice(0, -1) : p);
|
|
264
|
+
if (!Number.isFinite(n)) return void 0;
|
|
265
|
+
return Math.min(1, pct ? n / 100 : n);
|
|
266
|
+
}
|
|
104
267
|
function parseColorToRgb(input) {
|
|
105
268
|
if (typeof input !== "string") return void 0;
|
|
106
269
|
const raw = input.trim().toLowerCase();
|
|
@@ -111,6 +274,7 @@ function parseColorToRgb(input) {
|
|
|
111
274
|
if (raw.startsWith("#")) {
|
|
112
275
|
const hex = raw.slice(1);
|
|
113
276
|
if (hex.length === 3 || hex.length === 4) {
|
|
277
|
+
if (hex.length === 4 && hex[3] !== "f") return void 0;
|
|
114
278
|
const r = parseInt(hex[0] + hex[0], 16);
|
|
115
279
|
const g = parseInt(hex[1] + hex[1], 16);
|
|
116
280
|
const b = parseInt(hex[2] + hex[2], 16);
|
|
@@ -118,6 +282,7 @@ function parseColorToRgb(input) {
|
|
|
118
282
|
return void 0;
|
|
119
283
|
}
|
|
120
284
|
if (hex.length === 6 || hex.length === 8) {
|
|
285
|
+
if (hex.length === 8 && hex.slice(6, 8) !== "ff") return void 0;
|
|
121
286
|
const r = parseInt(hex.slice(0, 2), 16);
|
|
122
287
|
const g = parseInt(hex.slice(2, 4), 16);
|
|
123
288
|
const b = parseInt(hex.slice(4, 6), 16);
|
|
@@ -129,7 +294,11 @@ function parseColorToRgb(input) {
|
|
|
129
294
|
const rgbMatch = raw.match(/^rgba?\(([^)]+)\)$/);
|
|
130
295
|
if (rgbMatch) {
|
|
131
296
|
const parts = rgbMatch[1].split(",").map((p) => p.trim());
|
|
132
|
-
if (parts.length < 3) return void 0;
|
|
297
|
+
if (parts.length < 3 || parts.length > 4) return void 0;
|
|
298
|
+
if (parts.length === 4) {
|
|
299
|
+
const alpha = parseAlpha(parts[3]);
|
|
300
|
+
if (alpha === void 0 || alpha < 1) return void 0;
|
|
301
|
+
}
|
|
133
302
|
const channel = (p) => {
|
|
134
303
|
if (p.endsWith("%")) {
|
|
135
304
|
const pct = parseFloat(p.slice(0, -1));
|
|
@@ -161,13 +330,87 @@ function parseFontSizePx(input) {
|
|
|
161
330
|
}
|
|
162
331
|
return void 0;
|
|
163
332
|
}
|
|
333
|
+
var ASCII_WHITESPACE_EDGES = /^[\t\n\f\r ]+|[\t\n\f\r ]+$/g;
|
|
334
|
+
function nonEmptyString(v) {
|
|
335
|
+
return typeof v === "string" && v.length > 0 ? v : void 0;
|
|
336
|
+
}
|
|
337
|
+
var OBJECT_FIT_TO_RESIZE_MODE = /* @__PURE__ */ new Map([
|
|
338
|
+
["contain", "contain"],
|
|
339
|
+
["cover", "cover"],
|
|
340
|
+
["fill", "stretch"],
|
|
341
|
+
["scale-down", "contain"],
|
|
342
|
+
["none", "none"]
|
|
343
|
+
]);
|
|
344
|
+
var RESIZE_MODE_TO_OBJECT_FIT = /* @__PURE__ */ new Map([
|
|
345
|
+
["cover", "cover"],
|
|
346
|
+
["contain", "contain"],
|
|
347
|
+
["stretch", "fill"],
|
|
348
|
+
["center", "scale-down"],
|
|
349
|
+
["none", "none"]
|
|
350
|
+
]);
|
|
351
|
+
function resolveObjectFit(props, flatStyle) {
|
|
352
|
+
const styleFit = nonEmptyString(flatStyle?.objectFit);
|
|
353
|
+
const mode = (styleFit !== void 0 ? OBJECT_FIT_TO_RESIZE_MODE.get(styleFit) : void 0) ?? nonEmptyString(props?.resizeMode) ?? nonEmptyString(flatStyle?.resizeMode);
|
|
354
|
+
return mode !== void 0 ? RESIZE_MODE_TO_OBJECT_FIT.get(mode) : void 0;
|
|
355
|
+
}
|
|
356
|
+
function resolveImageSource(props) {
|
|
357
|
+
if (!props) return void 0;
|
|
358
|
+
if (props.srcSet !== void 0 && props.srcSet !== null) return void 0;
|
|
359
|
+
const src = nonEmptyString(props.src);
|
|
360
|
+
if (src !== void 0) return src;
|
|
361
|
+
const source = props.source;
|
|
362
|
+
const one = Array.isArray(source) ? source.length === 1 ? source[0] : void 0 : source;
|
|
363
|
+
if (one && typeof one === "object") {
|
|
364
|
+
return nonEmptyString(one.uri);
|
|
365
|
+
}
|
|
366
|
+
return void 0;
|
|
367
|
+
}
|
|
368
|
+
function isHiddenFromAccessibility(props) {
|
|
369
|
+
if (!props) return false;
|
|
370
|
+
return props.accessible === false && props.alt === void 0 || props.importantForAccessibility === "no" || props.importantForAccessibility === "no-hide-descendants" || props.accessibilityElementsHidden === true;
|
|
371
|
+
}
|
|
372
|
+
function resolveImageLabel(props, registryLabel) {
|
|
373
|
+
if (props === void 0) return registryLabel;
|
|
374
|
+
const own = props["aria-label"] ?? props.accessibilityLabel ?? props.alt;
|
|
375
|
+
return typeof own === "string" ? own : void 0;
|
|
376
|
+
}
|
|
377
|
+
function projectMedia(args) {
|
|
378
|
+
const { layout, props, flatStyle, accessibilityLabel, inViewport } = args;
|
|
379
|
+
const media = { kind: "img" };
|
|
380
|
+
if (layout && Number.isFinite(layout.width) && Number.isFinite(layout.height) && layout.width >= 0 && layout.height >= 0) {
|
|
381
|
+
media.rendered_px = { w: layout.width, h: layout.height };
|
|
382
|
+
}
|
|
383
|
+
const objectFit = resolveObjectFit(props, flatStyle);
|
|
384
|
+
if (objectFit !== void 0) media.object_fit = objectFit;
|
|
385
|
+
if (isHiddenFromAccessibility(props)) {
|
|
386
|
+
media.alt = { decorative: true };
|
|
387
|
+
} else {
|
|
388
|
+
const label = resolveImageLabel(props, accessibilityLabel);
|
|
389
|
+
const text = label?.replace(ASCII_WHITESPACE_EDGES, "");
|
|
390
|
+
if (text) media.alt = { decorative: false, text };
|
|
391
|
+
}
|
|
392
|
+
const src = resolveImageSource(props);
|
|
393
|
+
if (src !== void 0) media.src_digest = sha256Hex(src);
|
|
394
|
+
if (inViewport !== void 0) media.in_viewport = inViewport;
|
|
395
|
+
return media;
|
|
396
|
+
}
|
|
164
397
|
function projectVisionFields(args) {
|
|
165
398
|
const { type, label, handlerNames, state, flatStyle } = args;
|
|
166
399
|
const fields = {
|
|
167
400
|
interactable: deriveInteractable(type, handlerNames)
|
|
168
401
|
};
|
|
169
|
-
|
|
170
|
-
|
|
402
|
+
if (type === "image") {
|
|
403
|
+
fields.media = projectMedia({
|
|
404
|
+
layout: state.layout,
|
|
405
|
+
props: args.props,
|
|
406
|
+
flatStyle,
|
|
407
|
+
accessibilityLabel: args.accessibilityLabel,
|
|
408
|
+
inViewport: args.inViewport
|
|
409
|
+
});
|
|
410
|
+
} else {
|
|
411
|
+
const text = deriveText(state, label);
|
|
412
|
+
if (text !== void 0) fields.text = text;
|
|
413
|
+
}
|
|
171
414
|
const role = roleForType(type);
|
|
172
415
|
if (role !== void 0) fields.role = role;
|
|
173
416
|
if (flatStyle) {
|
|
@@ -307,11 +550,17 @@ function computeVisibility(state, clip) {
|
|
|
307
550
|
if (!rect) {
|
|
308
551
|
return { visibility: "visible" };
|
|
309
552
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return
|
|
553
|
+
return rectReachesClip(rect, clip) ? { visibility: "visible" } : { visibility: "hidden", visibilityReason: "off-screen" };
|
|
554
|
+
}
|
|
555
|
+
function rectReachesClip(rect, clip) {
|
|
556
|
+
if (isEmptyRect(clip)) return false;
|
|
557
|
+
return spansOverlap(rect.left, rect.right, clip.left, clip.right) && spansOverlap(rect.top, rect.bottom, clip.top, clip.bottom);
|
|
558
|
+
}
|
|
559
|
+
function computeInViewport(state, clip) {
|
|
560
|
+
if (!state.visible || !clip) return void 0;
|
|
561
|
+
const rect = pageRectOf(state);
|
|
562
|
+
if (!rect) return void 0;
|
|
563
|
+
return rectReachesClip(rect, clip);
|
|
315
564
|
}
|
|
316
565
|
function copyRouteInfo(info) {
|
|
317
566
|
const copy = { ...info };
|
|
@@ -1254,10 +1503,9 @@ var NativeUIBridgeRegistry = class {
|
|
|
1254
1503
|
elements: elements.map((e) => {
|
|
1255
1504
|
const handlers = extractHandlerNames(e.props);
|
|
1256
1505
|
const state = e.getState();
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
);
|
|
1506
|
+
const identifier = e.getIdentifier();
|
|
1507
|
+
const clip = this.getClipRectFor(e, viewport);
|
|
1508
|
+
const { visibility, visibilityReason } = computeVisibility(state, clip);
|
|
1261
1509
|
const bbox = projectBbox(state, visibility, this.pixelRatio);
|
|
1262
1510
|
const vision = projectVisionFields({
|
|
1263
1511
|
type: e.type,
|
|
@@ -1268,13 +1516,16 @@ var NativeUIBridgeRegistry = class {
|
|
|
1268
1516
|
// using it would mark plain text/view nodes interactable.
|
|
1269
1517
|
handlerNames: handlers,
|
|
1270
1518
|
state,
|
|
1271
|
-
flatStyle: e.flatStyle
|
|
1519
|
+
flatStyle: e.flatStyle,
|
|
1520
|
+
props: e.props,
|
|
1521
|
+
accessibilityLabel: identifier.accessibilityLabel,
|
|
1522
|
+
inViewport: computeInViewport(state, clip)
|
|
1272
1523
|
});
|
|
1273
1524
|
return {
|
|
1274
1525
|
id: e.id,
|
|
1275
1526
|
type: e.type,
|
|
1276
1527
|
label: e.label,
|
|
1277
|
-
identifier
|
|
1528
|
+
identifier,
|
|
1278
1529
|
state,
|
|
1279
1530
|
actions: e.actions,
|
|
1280
1531
|
customActions: serializeElementCustomActions(e.customActions),
|
|
@@ -3171,7 +3422,14 @@ var UNKNOWN_CODES = [
|
|
|
3171
3422
|
"below_confidence_floor",
|
|
3172
3423
|
"model_reply_unparseable",
|
|
3173
3424
|
"needs_multi_frame_input",
|
|
3174
|
-
"stale_input"
|
|
3425
|
+
"stale_input",
|
|
3426
|
+
"frontier_open",
|
|
3427
|
+
"ledger_schema_absent",
|
|
3428
|
+
"ledger_write_failing",
|
|
3429
|
+
"no_observations",
|
|
3430
|
+
"to_node_unobserved",
|
|
3431
|
+
"performance_observer_unsupported",
|
|
3432
|
+
"no_event_before_timeout"
|
|
3175
3433
|
];
|
|
3176
3434
|
function isUnknownCode(value) {
|
|
3177
3435
|
return typeof value === "string" && UNKNOWN_CODES.includes(value);
|
|
@@ -3361,7 +3619,7 @@ var NATIVE_PAGE_HEALTH_PRODUCER_ID = "sdk-native/page-health";
|
|
|
3361
3619
|
function defaultProducer() {
|
|
3362
3620
|
return {
|
|
3363
3621
|
id: NATIVE_PAGE_HEALTH_PRODUCER_ID,
|
|
3364
|
-
version: "0.
|
|
3622
|
+
version: "0.9.0"
|
|
3365
3623
|
};
|
|
3366
3624
|
}
|
|
3367
3625
|
function pageHealthUnknown(code, detail, options = {}) {
|
|
@@ -3930,10 +4188,9 @@ function createServerHandlers(registry, executor, config) {
|
|
|
3930
4188
|
const elements = allElements.map((e) => {
|
|
3931
4189
|
const handlers = extractHandlerNames(e.props);
|
|
3932
4190
|
const state = e.getState();
|
|
3933
|
-
const
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
);
|
|
4191
|
+
const identifier = e.getIdentifier();
|
|
4192
|
+
const clip = registry.getClipRectFor(e, viewport);
|
|
4193
|
+
const { visibility, visibilityReason } = computeVisibility(state, clip);
|
|
3937
4194
|
const bbox = projectBbox(state, visibility, registry.getPixelRatio());
|
|
3938
4195
|
const vision = projectVisionFields({
|
|
3939
4196
|
type: e.type,
|
|
@@ -3942,13 +4199,16 @@ function createServerHandlers(registry, executor, config) {
|
|
|
3942
4199
|
// synthesize press/click onto every element. See projectVisionFields.
|
|
3943
4200
|
handlerNames: handlers,
|
|
3944
4201
|
state,
|
|
3945
|
-
flatStyle: e.flatStyle
|
|
4202
|
+
flatStyle: e.flatStyle,
|
|
4203
|
+
props: e.props,
|
|
4204
|
+
accessibilityLabel: identifier.accessibilityLabel,
|
|
4205
|
+
inViewport: computeInViewport(state, clip)
|
|
3946
4206
|
});
|
|
3947
4207
|
return {
|
|
3948
4208
|
id: e.id,
|
|
3949
4209
|
type: e.type,
|
|
3950
4210
|
label: e.label,
|
|
3951
|
-
identifier
|
|
4211
|
+
identifier,
|
|
3952
4212
|
state,
|
|
3953
4213
|
actions: e.actions,
|
|
3954
4214
|
customActions: serializeElementCustomActions(e.customActions),
|
|
@@ -4656,7 +4916,7 @@ function createServerHandlers(registry, executor, config) {
|
|
|
4656
4916
|
};
|
|
4657
4917
|
if (config?.appInfo) {
|
|
4658
4918
|
response.uiBridge = {
|
|
4659
|
-
version: "0.
|
|
4919
|
+
version: "0.9.0",
|
|
4660
4920
|
...config.appInfo,
|
|
4661
4921
|
capabilities: ["elements", "components", "actions", "design"],
|
|
4662
4922
|
elementCount: stats.elements,
|
|
@@ -8219,7 +8479,9 @@ function TransitionTo(props) {
|
|
|
8219
8479
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
8220
8480
|
}
|
|
8221
8481
|
function effectiveInfo(info, unmatched) {
|
|
8222
|
-
|
|
8482
|
+
if (!unmatched) return info;
|
|
8483
|
+
const { params: _dropped, ...rest } = info;
|
|
8484
|
+
return { ...rest, pattern: null };
|
|
8223
8485
|
}
|
|
8224
8486
|
function useRouteAwareness(info, options = {}) {
|
|
8225
8487
|
const bridge = useUIBridgeNativeOptional();
|