stitchkit 0.114.0 → 0.114.2
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/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/dist/browser/client-url.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/coding-tools.js +1 -1
- package/dist/entrypoints/agent-runtime/harness.js +4 -4
- package/dist/entrypoints/agent-runtime/realtime.js +2 -2
- package/dist/entrypoints/agent-runtime/sandbox.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/bun.js +3 -3
- package/dist/entrypoints/agent-runtime/sqlite/node.js +3 -3
- package/dist/entrypoints/agent-runtime/testing.js +4 -4
- package/dist/entrypoints/agent-runtime.js +12 -12
- package/dist/entrypoints/application/directory-inbox.js +3 -3
- package/dist/entrypoints/application.js +4 -4
- package/dist/entrypoints/cli/publish.js +1 -1
- package/dist/entrypoints/cli.js +4 -4
- package/dist/entrypoints/contract.js +2 -2
- package/dist/entrypoints/http.js +2 -2
- package/dist/entrypoints/index.js +5 -5
- package/dist/entrypoints/node.js +3 -3
- package/dist/entrypoints/observability.js +3 -3
- package/dist/entrypoints/react/keyboard/testing.d.ts +2 -0
- package/dist/entrypoints/react/keyboard/testing.d.ts.map +1 -0
- package/dist/entrypoints/react/keyboard/testing.js +127 -0
- package/dist/entrypoints/react/keyboard.d.ts +4 -2
- package/dist/entrypoints/react/keyboard.d.ts.map +1 -1
- package/dist/entrypoints/react/keyboard.js +83 -319
- package/dist/entrypoints/react.js +15 -3
- package/dist/entrypoints/realtime.js +1 -1
- package/dist/entrypoints/remote.js +1 -1
- package/dist/entrypoints/server.js +18 -18
- package/dist/entrypoints/telegram/grammy.d.ts +2 -0
- package/dist/entrypoints/telegram/grammy.d.ts.map +1 -0
- package/dist/entrypoints/telegram/grammy.js +50 -0
- package/dist/entrypoints/telegram/screens.js +1 -1
- package/dist/entrypoints/telegram.js +16 -10
- package/dist/entrypoints/testing.js +3 -3
- package/dist/entrypoints/tools/connections.js +10 -10
- package/dist/entrypoints/tools.js +19 -19
- package/dist/entrypoints/tracking.js +1 -1
- package/dist/{index-hs35ss3p.js → index-61hve0ez.js} +4 -25
- package/dist/index-6j725ez5.js +25 -0
- package/dist/{index-1csp1hwm.js → index-6p3frkv5.js} +1 -1
- package/dist/{index-erv5shjq.js → index-912sza5h.js} +1 -1
- package/dist/{index-fy4av0hq.js → index-9bwcthxw.js} +1 -1
- package/dist/{index-523tq7y4.js → index-a3462dqf.js} +1 -1
- package/dist/{index-506kd458.js → index-aw6zahv1.js} +1 -1
- package/dist/{index-tpwbct8j.js → index-dc9ere5p.js} +1 -1
- package/dist/{index-cxpcdswt.js → index-mgb7r8b8.js} +123 -63
- package/dist/{index-7fc0c2np.js → index-n3v695sb.js} +1 -1
- package/dist/index-p02zgk8x.js +351 -0
- package/dist/{index-vtann8bz.js → index-p0rf7sq9.js} +8 -8
- package/dist/{index-aykhzcnf.js → index-qj1sy4ep.js} +1 -1
- package/dist/{index-k7z3j3hr.js → index-tnxsq7cw.js} +4 -4
- package/dist/{index-c5at3ykd.js → index-tsngj2b5.js} +22 -10
- package/dist/internal/pinned-http.d.ts +27 -0
- package/dist/internal/pinned-http.d.ts.map +1 -0
- package/dist/internal/secure-fetch.d.ts +26 -6
- package/dist/internal/secure-fetch.d.ts.map +1 -1
- package/dist/react/entity-cache.d.ts +24 -2
- package/dist/react/entity-cache.d.ts.map +1 -1
- package/dist/react/keyboard/hooks.d.ts +41 -10
- package/dist/react/keyboard/hooks.d.ts.map +1 -1
- package/dist/react/keyboard/layers.d.ts +27 -8
- package/dist/react/keyboard/layers.d.ts.map +1 -1
- package/dist/react/keyboard/modality.d.ts +21 -0
- package/dist/react/keyboard/modality.d.ts.map +1 -0
- package/dist/react/keyboard/refs.d.ts +13 -0
- package/dist/react/keyboard/refs.d.ts.map +1 -0
- package/dist/react/keyboard/testing.d.ts +80 -0
- package/dist/react/keyboard/testing.d.ts.map +1 -0
- package/dist/react/keyboard/zone.d.ts +60 -10
- package/dist/react/keyboard/zone.d.ts.map +1 -1
- package/dist/telegram/budget-transformer.d.ts +35 -0
- package/dist/telegram/budget-transformer.d.ts.map +1 -0
- package/dist/telegram/outbound-budget.d.ts +4 -2
- package/dist/telegram/outbound-budget.d.ts.map +1 -1
- package/llms/react-keyboard-testing.txt +24 -0
- package/llms/react-keyboard.txt +264 -4
- package/llms/react.txt +1 -1
- package/llms/server.3.txt +31 -0
- package/llms/stitchkit.2.txt +118 -0
- package/llms/stitchkit.txt +4 -118
- package/llms/telegram-grammy.txt +22 -0
- package/llms/telegram.txt +19 -7
- package/llms-full.txt +345 -12
- package/llms.txt +7 -5
- package/package.json +9 -1
- package/dist/{index-616xh7f2.js → index-4qnzda76.js} +0 -0
- package/dist/{index-fsw1ybf3.js → index-d9hq291n.js} +3 -3
- package/dist/{index-bjcjqj46.js → index-m8a44e64.js} +3 -3
- package/dist/{index-5efrpfmj.js → index-qndsr7f0.js} +3 -3
- package/dist/{index-zktz242w.js → index-s47ac8zt.js} +3 -3
- package/dist/{index-56yx8dxp.js → index-tvtacc9a.js} +3 -3
- /package/dist/{index-v1tswj0z.js → index-txg1npmg.js} +0 -0
|
@@ -1,304 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
zone: 1,
|
|
10
|
-
global: 0
|
|
11
|
-
};
|
|
12
|
-
var KEY_FIELD_SELECTOR = [
|
|
13
|
-
"input:not([type=button],[type=submit],[type=reset],[type=checkbox],[type=image])",
|
|
14
|
-
"textarea",
|
|
15
|
-
"select",
|
|
16
|
-
"[contenteditable]:not([contenteditable=false])",
|
|
17
|
-
"[role=textbox]",
|
|
18
|
-
"[role=combobox]",
|
|
19
|
-
"[role=slider]",
|
|
20
|
-
"[role=spinbutton]",
|
|
21
|
-
"[data-local-keys]"
|
|
22
|
-
].join(",");
|
|
23
|
-
function hasClosest(target) {
|
|
24
|
-
return typeof target === "object" && target !== null && "closest" in target && typeof target.closest === "function";
|
|
25
|
-
}
|
|
26
|
-
function closestFromTarget(target, selectors) {
|
|
27
|
-
return hasClosest(target) ? target.closest(selectors) : null;
|
|
28
|
-
}
|
|
29
|
-
function isKeyFieldTarget(target) {
|
|
30
|
-
const field = closestFromTarget(target, KEY_FIELD_SELECTOR);
|
|
31
|
-
return field !== null && field !== undefined;
|
|
32
|
-
}
|
|
33
|
-
function liveScope(entry) {
|
|
34
|
-
const read = entry.state.scope;
|
|
35
|
-
if (read === undefined)
|
|
36
|
-
return "unscoped";
|
|
37
|
-
const element = read();
|
|
38
|
-
if (element === null || !element.isConnected)
|
|
39
|
-
return null;
|
|
40
|
-
const inert = element.closest("[inert]");
|
|
41
|
-
if (inert !== null && inert !== undefined)
|
|
42
|
-
return null;
|
|
43
|
-
if (element.checkVisibility !== undefined && !element.checkVisibility())
|
|
44
|
-
return null;
|
|
45
|
-
return element;
|
|
46
|
-
}
|
|
47
|
-
function askingOrder(entries) {
|
|
48
|
-
const live = [];
|
|
49
|
-
for (const entry of entries) {
|
|
50
|
-
if (entry.state.active === false)
|
|
51
|
-
continue;
|
|
52
|
-
const scope = liveScope(entry);
|
|
53
|
-
if (scope !== null)
|
|
54
|
-
live.push({ entry, scope, depth: 0 });
|
|
55
|
-
}
|
|
56
|
-
for (const layer of live) {
|
|
57
|
-
const own = layer.scope;
|
|
58
|
-
if (own === "unscoped")
|
|
59
|
-
continue;
|
|
60
|
-
layer.depth = live.filter((other) => other !== layer && other.entry.state.kind === layer.entry.state.kind && other.scope !== "unscoped" && other.scope !== own && other.scope.contains(own)).length;
|
|
61
|
-
}
|
|
62
|
-
return live.sort((left, right) => RANK[right.entry.state.kind] - RANK[left.entry.state.kind] || right.depth - left.depth || right.entry.order - left.entry.order);
|
|
63
|
-
}
|
|
64
|
-
function createKeyLayerStack(target) {
|
|
65
|
-
const entries = new Set;
|
|
66
|
-
let activations = 0;
|
|
67
|
-
const listener = (event) => {
|
|
68
|
-
dispatch(event);
|
|
69
|
-
};
|
|
70
|
-
function dispatch(event) {
|
|
71
|
-
if (event.defaultPrevented || event.isComposing)
|
|
72
|
-
return false;
|
|
73
|
-
const isEscape = event.key === "Escape";
|
|
74
|
-
if (isEscape && event.repeat)
|
|
75
|
-
return false;
|
|
76
|
-
const inField = !isEscape && isKeyFieldTarget(event.target);
|
|
77
|
-
let behindOverlay = false;
|
|
78
|
-
for (const { entry } of askingOrder(entries)) {
|
|
79
|
-
const { kind } = entry.state;
|
|
80
|
-
if (behindOverlay && kind !== "overlay")
|
|
81
|
-
break;
|
|
82
|
-
if (kind === "overlay")
|
|
83
|
-
behindOverlay = true;
|
|
84
|
-
if (inField && entry.state.fields !== "include")
|
|
85
|
-
continue;
|
|
86
|
-
if (entry.state.onKey(event)) {
|
|
87
|
-
event.preventDefault();
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
function add(state) {
|
|
94
|
-
const entry = { state, order: ++activations };
|
|
95
|
-
if (entries.size === 0)
|
|
96
|
-
target.addEventListener("keydown", listener);
|
|
97
|
-
entries.add(entry);
|
|
98
|
-
return {
|
|
99
|
-
update(next) {
|
|
100
|
-
const reactivated = entry.state.active === false && next.active !== false;
|
|
101
|
-
entry.state = next;
|
|
102
|
-
if (reactivated)
|
|
103
|
-
entry.order = ++activations;
|
|
104
|
-
},
|
|
105
|
-
remove() {
|
|
106
|
-
if (!entries.delete(entry))
|
|
107
|
-
return;
|
|
108
|
-
if (entries.size === 0)
|
|
109
|
-
target.removeEventListener("keydown", listener);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
return { add, dispatch };
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// src/react/keyboard/zone.ts
|
|
117
|
-
var ZONE_ATTRIBUTE = "data-keyboard-zone";
|
|
118
|
-
function nextZoneIndex({
|
|
119
|
-
length,
|
|
120
|
-
index,
|
|
121
|
-
move,
|
|
122
|
-
loop
|
|
123
|
-
}) {
|
|
124
|
-
if (length <= 0)
|
|
125
|
-
return move === "previous" || move === "first" ? "before-start" : "after-end";
|
|
126
|
-
if (move === "first")
|
|
127
|
-
return 0;
|
|
128
|
-
if (move === "last")
|
|
129
|
-
return length - 1;
|
|
130
|
-
if (index < 0 || index >= length)
|
|
131
|
-
return move === "next" ? 0 : length - 1;
|
|
132
|
-
const target = move === "next" ? index + 1 : index - 1;
|
|
133
|
-
if (target >= 0 && target < length)
|
|
134
|
-
return target;
|
|
135
|
-
if (loop)
|
|
136
|
-
return target < 0 ? length - 1 : 0;
|
|
137
|
-
return target < 0 ? "before-start" : "after-end";
|
|
138
|
-
}
|
|
139
|
-
function zoneIntent(event, orientation) {
|
|
140
|
-
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
141
|
-
return null;
|
|
142
|
-
const vertical = orientation === "vertical";
|
|
143
|
-
switch (event.key) {
|
|
144
|
-
case (vertical ? "ArrowDown" : "ArrowRight"):
|
|
145
|
-
return { type: "move", move: "next" };
|
|
146
|
-
case (vertical ? "ArrowUp" : "ArrowLeft"):
|
|
147
|
-
return { type: "move", move: "previous" };
|
|
148
|
-
case (vertical ? "ArrowRight" : "ArrowDown"):
|
|
149
|
-
return { type: "enter" };
|
|
150
|
-
case (vertical ? "ArrowLeft" : "ArrowUp"):
|
|
151
|
-
return { type: "exit" };
|
|
152
|
-
case "Home":
|
|
153
|
-
return { type: "move", move: "first" };
|
|
154
|
-
case "End":
|
|
155
|
-
return { type: "move", move: "last" };
|
|
156
|
-
case "Enter":
|
|
157
|
-
return { type: "confirm" };
|
|
158
|
-
default:
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function createNavZone(initial) {
|
|
163
|
-
let options = initial;
|
|
164
|
-
let pointed = null;
|
|
165
|
-
let awaiting = null;
|
|
166
|
-
const elements = new Map;
|
|
167
|
-
const listeners = new Set;
|
|
168
|
-
const point = (id) => {
|
|
169
|
-
if (pointed === id)
|
|
170
|
-
return;
|
|
171
|
-
pointed = id;
|
|
172
|
-
for (const listener of listeners)
|
|
173
|
-
listener();
|
|
174
|
-
};
|
|
175
|
-
function current() {
|
|
176
|
-
const { items, value } = options;
|
|
177
|
-
if (pointed !== null && items.includes(pointed))
|
|
178
|
-
return pointed;
|
|
179
|
-
if (value !== null && items.includes(value))
|
|
180
|
-
return value;
|
|
181
|
-
return items[0] ?? null;
|
|
182
|
-
}
|
|
183
|
-
function focusElement(element) {
|
|
184
|
-
element.focus({ preventScroll: true });
|
|
185
|
-
element.scrollIntoView?.({ block: "nearest", inline: "nearest" });
|
|
186
|
-
}
|
|
187
|
-
function focus(id) {
|
|
188
|
-
const target = id ?? current();
|
|
189
|
-
if (target === null)
|
|
190
|
-
return false;
|
|
191
|
-
point(target);
|
|
192
|
-
const element = elements.get(target);
|
|
193
|
-
if (element === undefined) {
|
|
194
|
-
awaiting = target;
|
|
195
|
-
options.onReveal?.(target);
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
awaiting = null;
|
|
199
|
-
focusElement(element);
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
const taken = (answer) => answer !== false;
|
|
203
|
-
function apply(intent) {
|
|
204
|
-
const { items, mode = "select", loop = false } = options;
|
|
205
|
-
const id = current();
|
|
206
|
-
switch (intent.type) {
|
|
207
|
-
case "move": {
|
|
208
|
-
const index = id === null ? -1 : items.indexOf(id);
|
|
209
|
-
const landed = nextZoneIndex({ length: items.length, index, move: intent.move, loop });
|
|
210
|
-
if (typeof landed !== "number") {
|
|
211
|
-
if (options.onBoundary === undefined)
|
|
212
|
-
return false;
|
|
213
|
-
return taken(options.onBoundary(landed === "before-start" ? "start" : "end"));
|
|
214
|
-
}
|
|
215
|
-
const next = items[landed];
|
|
216
|
-
if (next === undefined)
|
|
217
|
-
return false;
|
|
218
|
-
focus(next);
|
|
219
|
-
if (mode === "select" && next !== options.value)
|
|
220
|
-
options.onChange(next, "arrow");
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
case "enter":
|
|
224
|
-
return id !== null && options.onEnter !== undefined && taken(options.onEnter(id));
|
|
225
|
-
case "exit":
|
|
226
|
-
return options.onExit !== undefined && taken(options.onExit());
|
|
227
|
-
case "confirm":
|
|
228
|
-
if (id === null)
|
|
229
|
-
return false;
|
|
230
|
-
if (mode === "highlight") {
|
|
231
|
-
options.onChange(id, "confirm");
|
|
232
|
-
return true;
|
|
233
|
-
}
|
|
234
|
-
return options.onEnter !== undefined && taken(options.onEnter(id));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return {
|
|
238
|
-
update(next) {
|
|
239
|
-
if (next.value !== options.value)
|
|
240
|
-
pointed = null;
|
|
241
|
-
options = next;
|
|
242
|
-
},
|
|
243
|
-
get options() {
|
|
244
|
-
return options;
|
|
245
|
-
},
|
|
246
|
-
current,
|
|
247
|
-
keyDown(event, zone) {
|
|
248
|
-
if (event.defaultPrevented || event.isComposing || isKeyFieldTarget(event.target)) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
if (closestFromTarget(event.target, `[${ZONE_ATTRIBUTE}]`) !== zone)
|
|
252
|
-
return false;
|
|
253
|
-
const intent = zoneIntent(event, options.orientation ?? "vertical");
|
|
254
|
-
if (intent === null || !apply(intent))
|
|
255
|
-
return false;
|
|
256
|
-
event.preventDefault();
|
|
257
|
-
return true;
|
|
258
|
-
},
|
|
259
|
-
keyFromOutside(event) {
|
|
260
|
-
if (closestFromTarget(event.target, `[${ZONE_ATTRIBUTE}]`) !== null)
|
|
261
|
-
return false;
|
|
262
|
-
const intent = zoneIntent(event, options.orientation ?? "vertical");
|
|
263
|
-
if (intent?.type !== "move" || intent.move !== "next" && intent.move !== "previous") {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
return focus();
|
|
267
|
-
},
|
|
268
|
-
focused(id) {
|
|
269
|
-
if (!options.items.includes(id))
|
|
270
|
-
return;
|
|
271
|
-
awaiting = null;
|
|
272
|
-
point(id);
|
|
273
|
-
},
|
|
274
|
-
focus,
|
|
275
|
-
setItemElement(id, element) {
|
|
276
|
-
if (element === null) {
|
|
277
|
-
elements.delete(id);
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
elements.set(id, element);
|
|
281
|
-
if (id === awaiting) {
|
|
282
|
-
awaiting = null;
|
|
283
|
-
focusElement(element);
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
subscribe(listener) {
|
|
287
|
-
listeners.add(listener);
|
|
288
|
-
return () => {
|
|
289
|
-
listeners.delete(listener);
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
isKeyFieldTarget2,
|
|
3
|
+
createKeyLayerStack2,
|
|
4
|
+
ZONE_ATTRIBUTE,
|
|
5
|
+
nextZoneIndex2,
|
|
6
|
+
resolveZoneIndex,
|
|
7
|
+
createNavZone2
|
|
8
|
+
} from "../../index-p02zgk8x.js";
|
|
294
9
|
|
|
295
10
|
// src/react/keyboard/hooks.ts
|
|
11
|
+
import {
|
|
12
|
+
useEffect,
|
|
13
|
+
useLayoutEffect,
|
|
14
|
+
useRef,
|
|
15
|
+
useState,
|
|
16
|
+
useSyncExternalStore
|
|
17
|
+
} from "react";
|
|
18
|
+
var useCommittedEffect = typeof document === "undefined" ? useEffect : useLayoutEffect;
|
|
296
19
|
var stacks = new WeakMap;
|
|
297
20
|
function stackOf(view) {
|
|
298
21
|
const existing = stacks.get(view);
|
|
299
22
|
if (existing !== undefined)
|
|
300
23
|
return existing;
|
|
301
|
-
const created =
|
|
24
|
+
const created = createKeyLayerStack2(view);
|
|
302
25
|
stacks.set(view, created);
|
|
303
26
|
return created;
|
|
304
27
|
}
|
|
@@ -308,6 +31,7 @@ function layerState(options) {
|
|
|
308
31
|
kind: options.kind,
|
|
309
32
|
active: options.active,
|
|
310
33
|
fields: options.fields,
|
|
34
|
+
phase: options.phase,
|
|
311
35
|
scope: scope === undefined ? undefined : () => scope.current,
|
|
312
36
|
onKey: (event) => options.onKey(event)
|
|
313
37
|
};
|
|
@@ -335,15 +59,40 @@ function useEscapeLayer(options) {
|
|
|
335
59
|
onKey: (event) => event.key === "Escape" && options.onEscape() !== false
|
|
336
60
|
});
|
|
337
61
|
}
|
|
62
|
+
function createItemRefs(set) {
|
|
63
|
+
const cache = new Map;
|
|
64
|
+
return {
|
|
65
|
+
get(id) {
|
|
66
|
+
const cached = cache.get(id);
|
|
67
|
+
if (cached !== undefined)
|
|
68
|
+
return cached;
|
|
69
|
+
const created = (node) => {
|
|
70
|
+
set(id, node);
|
|
71
|
+
if (node === null && cache.get(id) === created)
|
|
72
|
+
cache.delete(id);
|
|
73
|
+
};
|
|
74
|
+
cache.set(id, created);
|
|
75
|
+
return created;
|
|
76
|
+
},
|
|
77
|
+
get size() {
|
|
78
|
+
return cache.size;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
338
82
|
function useNavZone(options) {
|
|
339
|
-
const [zone] = useState(() =>
|
|
340
|
-
|
|
341
|
-
|
|
83
|
+
const [zone] = useState(() => createNavZone2(options));
|
|
84
|
+
useCommittedEffect(() => {
|
|
85
|
+
zone.update(options);
|
|
86
|
+
});
|
|
87
|
+
useSyncExternalStore(zone.subscribe, zone.current, zone.current);
|
|
88
|
+
const value = options.value ?? null;
|
|
89
|
+
const pointed = value === (zone.options.value ?? null) ? zone.pointedItem() : null;
|
|
90
|
+
const current = options.items[resolveZoneIndex(options.items, value, pointed)] ?? null;
|
|
342
91
|
const element = useRef(null);
|
|
343
92
|
const [zoneRef] = useState(() => (node) => {
|
|
344
93
|
element.current = node;
|
|
345
94
|
});
|
|
346
|
-
const itemRefs =
|
|
95
|
+
const [itemRefs] = useState(() => createItemRefs((id, node) => zone.setItemElement(id, node)));
|
|
347
96
|
useKeyLayer({
|
|
348
97
|
kind: "zone",
|
|
349
98
|
active: options.active,
|
|
@@ -351,36 +100,28 @@ function useNavZone(options) {
|
|
|
351
100
|
onKey: (event) => zone.keyFromOutside(event)
|
|
352
101
|
});
|
|
353
102
|
const role = options.role ?? "listbox";
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
if (cached !== undefined)
|
|
357
|
-
return cached;
|
|
358
|
-
const created = (node) => {
|
|
359
|
-
zone.setItemElement(id, node);
|
|
360
|
-
};
|
|
361
|
-
itemRefs.current.set(id, created);
|
|
362
|
-
return created;
|
|
363
|
-
};
|
|
103
|
+
const label = options.label;
|
|
104
|
+
const itemRole = role === "listbox" ? "option" : role === "tablist" ? "tab" : undefined;
|
|
364
105
|
return {
|
|
365
106
|
zoneProps: {
|
|
366
107
|
ref: zoneRef,
|
|
367
|
-
role: role === "none" ? undefined : role,
|
|
368
108
|
"aria-orientation": options.orientation ?? "vertical",
|
|
369
|
-
"aria-label": options.label,
|
|
370
109
|
[ZONE_ATTRIBUTE]: "",
|
|
371
110
|
onKeyDown: (event) => {
|
|
372
111
|
zone.keyDown(event.nativeEvent, element.current);
|
|
373
|
-
}
|
|
112
|
+
},
|
|
113
|
+
...role !== "none" && { role },
|
|
114
|
+
...label !== undefined && { "aria-label": label }
|
|
374
115
|
},
|
|
375
116
|
itemProps: (id) => {
|
|
376
|
-
const chosen = id ===
|
|
117
|
+
const chosen = id === value;
|
|
377
118
|
return {
|
|
378
|
-
ref:
|
|
119
|
+
ref: itemRefs.get(id),
|
|
379
120
|
tabIndex: id === current ? 0 : -1,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
121
|
+
onFocus: () => zone.focused(id),
|
|
122
|
+
...itemRole !== undefined && { role: itemRole },
|
|
123
|
+
...role !== "none" && { "aria-selected": chosen },
|
|
124
|
+
...role === "none" && chosen && { "aria-current": "true" }
|
|
384
125
|
};
|
|
385
126
|
},
|
|
386
127
|
element,
|
|
@@ -388,9 +129,32 @@ function useNavZone(options) {
|
|
|
388
129
|
focus: (id) => zone.focus(id)
|
|
389
130
|
};
|
|
390
131
|
}
|
|
132
|
+
// src/react/keyboard/modality.ts
|
|
133
|
+
function openedByKeyboard() {
|
|
134
|
+
if (typeof document === "undefined")
|
|
135
|
+
return false;
|
|
136
|
+
try {
|
|
137
|
+
return document.activeElement?.matches(":focus-visible") === true;
|
|
138
|
+
} catch {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// src/react/keyboard/refs.ts
|
|
143
|
+
function mergeRefs(...refs) {
|
|
144
|
+
return (node) => {
|
|
145
|
+
for (const ref of refs) {
|
|
146
|
+
if (typeof ref === "function")
|
|
147
|
+
ref(node);
|
|
148
|
+
else if (ref !== null && ref !== undefined)
|
|
149
|
+
ref.current = node;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
391
153
|
export {
|
|
392
|
-
isKeyFieldTarget,
|
|
393
|
-
|
|
154
|
+
isKeyFieldTarget2 as isKeyFieldTarget,
|
|
155
|
+
mergeRefs,
|
|
156
|
+
nextZoneIndex2 as nextZoneIndex,
|
|
157
|
+
openedByKeyboard,
|
|
394
158
|
useEscapeLayer,
|
|
395
159
|
useKeyLayer,
|
|
396
160
|
useNavZone
|
|
@@ -150,8 +150,17 @@ function resolveKey(key, event) {
|
|
|
150
150
|
function ordered(items, compare) {
|
|
151
151
|
return compare ? [...items].sort(compare) : items;
|
|
152
152
|
}
|
|
153
|
-
function insertAt(items, item,
|
|
154
|
-
|
|
153
|
+
function insertAt(items, item, policy) {
|
|
154
|
+
const { createAt, insertCompare } = policy;
|
|
155
|
+
if (insertCompare === undefined) {
|
|
156
|
+
return ordered(createAt === "start" ? [item, ...items] : [...items, item], policy.compare);
|
|
157
|
+
}
|
|
158
|
+
const index = items.findIndex((existing) => {
|
|
159
|
+
const order = insertCompare(item, existing);
|
|
160
|
+
return createAt === "start" ? order <= 0 : order < 0;
|
|
161
|
+
});
|
|
162
|
+
const at = index === -1 ? items.length : index;
|
|
163
|
+
return [...items.slice(0, at), item, ...items.slice(at)];
|
|
155
164
|
}
|
|
156
165
|
function mutateItemArrays(arrays, mutation, config, getId) {
|
|
157
166
|
const present = arrays.some((items) => items.some((item) => getId(item) === mutation.id));
|
|
@@ -165,7 +174,7 @@ function mutateItemArrays(arrays, mutation, config, getId) {
|
|
|
165
174
|
return { arrays, present };
|
|
166
175
|
const target = config.createAt === "start" ? 0 : arrays.length - 1;
|
|
167
176
|
return {
|
|
168
|
-
arrays: arrays.map((items, index) => index === target ? insertAt(items, mutation.item, config
|
|
177
|
+
arrays: arrays.map((items, index) => index === target ? insertAt(items, mutation.item, config) : items),
|
|
169
178
|
present
|
|
170
179
|
};
|
|
171
180
|
}
|
|
@@ -310,6 +319,9 @@ function patchList(context, key, config, event, mutation, getId) {
|
|
|
310
319
|
}
|
|
311
320
|
}
|
|
312
321
|
function createEntityCacheHandlers(config) {
|
|
322
|
+
if (config.list.compare && config.list.insertCompare) {
|
|
323
|
+
throw new Error("Entity cache list takes compare or insertCompare, not both");
|
|
324
|
+
}
|
|
313
325
|
if (config.list.total && config.list.shape !== "paginated" && config.list.shape !== "infinite-paginated") {
|
|
314
326
|
throw new Error("Entity cache total policy requires a paginated list shape");
|
|
315
327
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createRetainedTopics2,
|
|
8
8
|
createRealtimeClientWithPeer,
|
|
9
9
|
createSocketIOClientWithPeer
|
|
10
|
-
} from "../index-
|
|
10
|
+
} from "../index-m8a44e64.js";
|
|
11
11
|
import"../index-jk29rwkr.js";
|
|
12
12
|
// src/browser/socket-io-explicit-peer.ts
|
|
13
13
|
var missingPeer = () => Promise.reject(new Error("stitchkit/realtime requires peers.client: () => import('socket.io-client') so the native bundler includes its transport."));
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
} from "../index-ct75c3at.js";
|
|
26
26
|
import"../index-3za04re9.js";
|
|
27
27
|
import"../index-4s0fep5q.js";
|
|
28
|
-
import"../index-
|
|
29
|
-
import"../index-
|
|
28
|
+
import"../index-d9hq291n.js";
|
|
29
|
+
import"../index-9bwcthxw.js";
|
|
30
30
|
import"../index-xqhede6x.js";
|
|
31
31
|
import {
|
|
32
32
|
contextContributionDelta,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
socketIoLane2,
|
|
50
50
|
UnixClientTransportError2,
|
|
51
51
|
createUnixClientTransport2
|
|
52
|
-
} from "../index-
|
|
52
|
+
} from "../index-p0rf7sq9.js";
|
|
53
53
|
import {
|
|
54
54
|
createFileStateStore2
|
|
55
55
|
} from "../index-hy802jnr.js";
|
|
@@ -68,6 +68,9 @@ import {
|
|
|
68
68
|
signJwt2,
|
|
69
69
|
verifyPkce2
|
|
70
70
|
} from "../index-9dyd8xzf.js";
|
|
71
|
+
import {
|
|
72
|
+
deriveCodeChallenge2
|
|
73
|
+
} from "../index-ap3gqe56.js";
|
|
71
74
|
import {
|
|
72
75
|
defineMultipartStream2,
|
|
73
76
|
createMultipartStream2,
|
|
@@ -75,21 +78,6 @@ import {
|
|
|
75
78
|
createImplement2,
|
|
76
79
|
createScopedImplement2
|
|
77
80
|
} from "../index-cqmqyjax.js";
|
|
78
|
-
import {
|
|
79
|
-
deriveCodeChallenge2
|
|
80
|
-
} from "../index-ap3gqe56.js";
|
|
81
|
-
import {
|
|
82
|
-
isWithinDir2,
|
|
83
|
-
realPathWithinDir
|
|
84
|
-
} from "../index-5cc6r990.js";
|
|
85
|
-
import"../index-1bx1xv1k.js";
|
|
86
|
-
import {
|
|
87
|
-
readBoundedChunks,
|
|
88
|
-
concatChunks
|
|
89
|
-
} from "../index-5efrpfmj.js";
|
|
90
|
-
import {
|
|
91
|
-
assertPositiveSafeInteger
|
|
92
|
-
} from "../index-0s4xebbg.js";
|
|
93
81
|
import {
|
|
94
82
|
DEFAULT_CORS_ALLOW_HEADERS2,
|
|
95
83
|
DEFAULT_CORS_EXPOSE_HEADERS2,
|
|
@@ -107,9 +95,21 @@ import {
|
|
|
107
95
|
getClientInfo2,
|
|
108
96
|
isPublicIp2
|
|
109
97
|
} from "../index-kw1ws0cs.js";
|
|
98
|
+
import {
|
|
99
|
+
isWithinDir2,
|
|
100
|
+
realPathWithinDir
|
|
101
|
+
} from "../index-5cc6r990.js";
|
|
102
|
+
import"../index-1bx1xv1k.js";
|
|
103
|
+
import {
|
|
104
|
+
readBoundedChunks,
|
|
105
|
+
concatChunks
|
|
106
|
+
} from "../index-qndsr7f0.js";
|
|
110
107
|
import {
|
|
111
108
|
isUnsafeKey
|
|
112
109
|
} from "../index-zsarb5xp.js";
|
|
110
|
+
import {
|
|
111
|
+
assertPositiveSafeInteger
|
|
112
|
+
} from "../index-0s4xebbg.js";
|
|
113
113
|
import {
|
|
114
114
|
zodIssues2,
|
|
115
115
|
formatZodError2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammy.d.ts","sourceRoot":"","sources":["../../../src/entrypoints/telegram/grammy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TelegramNotDispatchedError2
|
|
3
|
+
} from "../../index-6j725ez5.js";
|
|
4
|
+
|
|
5
|
+
// src/telegram/budget-transformer.ts
|
|
6
|
+
function platformSignal(signal) {
|
|
7
|
+
if (signal === undefined)
|
|
8
|
+
return { signal: undefined, release: () => {
|
|
9
|
+
return;
|
|
10
|
+
} };
|
|
11
|
+
if (signal instanceof AbortSignal)
|
|
12
|
+
return { signal, release: () => {
|
|
13
|
+
return;
|
|
14
|
+
} };
|
|
15
|
+
const controller = new AbortController;
|
|
16
|
+
const abort = () => {
|
|
17
|
+
const reason = Reflect.get(signal, "reason");
|
|
18
|
+
controller.abort(reason ?? new DOMException("This operation was aborted", "AbortError"));
|
|
19
|
+
};
|
|
20
|
+
if (signal.aborted)
|
|
21
|
+
abort();
|
|
22
|
+
else
|
|
23
|
+
signal.addEventListener("abort", abort);
|
|
24
|
+
return {
|
|
25
|
+
signal: controller.signal,
|
|
26
|
+
release: () => signal.removeEventListener("abort", abort)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function telegramBudgetTransformer(budget) {
|
|
30
|
+
return async (previous, method, payload, signal) => {
|
|
31
|
+
const gate = platformSignal(signal);
|
|
32
|
+
let handedOn = false;
|
|
33
|
+
try {
|
|
34
|
+
return await budget.run(method, payload, gate.signal, () => {
|
|
35
|
+
handedOn = true;
|
|
36
|
+
return previous(method, payload, signal);
|
|
37
|
+
});
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (!handedOn && gate.signal?.aborted && error === gate.signal.reason) {
|
|
40
|
+
throw new TelegramNotDispatchedError2("request", "the Telegram request was cancelled before it was sent", { cause: error });
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
} finally {
|
|
44
|
+
gate.release();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
telegramBudgetTransformer
|
|
50
|
+
};
|