gesso-framework 0.4.1 → 0.5.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/CHANGELOG.md +114 -0
- package/README.md +2 -0
- package/dist/ChannelProtocol-ByNoHujM.d.ts +247 -0
- package/dist/{FunctionComponent-CgwLKE5d.d.ts → FunctionComponent-fYMdePtH.d.ts} +3 -247
- package/dist/agent/index.d.ts +317 -0
- package/dist/agent/index.js +184 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/app-BvlIO1G9.js +326 -0
- package/dist/app-BvlIO1G9.js.map +1 -0
- package/dist/{index-C9FAI_Kt.d.ts → index-BDM_gzzZ.d.ts} +377 -268
- package/dist/index.d.ts +5 -3
- package/dist/index.js +974 -92
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +1 -1
- package/dist/{persisted-CsTPnjkc.js → persisted-pix1fS1D.js} +6 -1
- package/dist/{persisted-CsTPnjkc.js.map → persisted-pix1fS1D.js.map} +1 -1
- package/dist/remote-xxij8zXe.js +600 -0
- package/dist/remote-xxij8zXe.js.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/ui-U39HjNFA.d.ts +517 -0
- package/dist/webmcp-CJVFvAHe.js +77 -0
- package/dist/webmcp-CJVFvAHe.js.map +1 -0
- package/dist/worker/index.d.ts +4 -2
- package/dist/worker/index.js +1 -1
- package/package.json +12 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as ChannelToken, m as CommandMap, o as Patch, p as Command, r as ChannelPort } from "./ChannelProtocol-ByNoHujM.js";
|
|
2
|
+
import { E as WorkerHandle, s as AgentConfirmation, t as UiHost, y as ChannelSource } from "./ui-U39HjNFA.js";
|
|
3
|
+
import { S as InternalState, _ as ReadableCell, a as ComponentType, h as OutputCell, i as ComponentProps, l as ChannelReplica, m as InputCell, n as ComponentArgs, r as ComponentContext, s as Inputs, w as Component } from "./FunctionComponent-fYMdePtH.js";
|
|
2
4
|
import { BehaviorSubject, Observable, Subscription } from "rxjs";
|
|
3
|
-
import { AnimatedCell, AnimationDriver, CanvasHost, CaretRect, ComponentLikeElement, ComponentResolver, EditingState, EditingState as EditingState$1, IconRasterizer, ImageResolver, LayoutExplanation, LayoutInspector, MARK_PREFIX, MotionStateInput, MotionTiming, RendererBackend, Size, TextMeasureRequest, TextMeasurer, UI_ROLES, UI_SEMANTIC_STATES, UiAnimation, UiChild, UiDurationToken, UiEasing, UiEasingToken, UiEditingController, UiElement, UiFileDropMessage, UiFindController, UiFocusManager, UiFrameClockFactory, UiInputDispatcher, UiInsets, UiKeyModifiers, UiKeyboardController, UiLength, UiModifier, UiMotion, UiNode, UiPlatformAdapter, UiPointerController, UiPointerDevice, UiReducedMotionPolicy, UiRole, UiScrollability, UiSelectionController, UiSemanticState, UiSemanticsAction, UiSemanticsMap, UiSemanticsMap as UiSemanticsMap$1, UiSemanticsPatch, UiSemanticsRecord, UiSemanticsRecord as UiSemanticsRecord$1, UiSemanticsUpdate, UiShortcutRegistry, UiSpringSpec, UiSpringToken, UiThemeExtension, UiTouchScroller, UiWheelController, VideoClock, VideoResolver, markInstant, markNow, measureSpan, performanceMarksEnabled, setPerformanceMarks as setPerformanceMarks$1 } from "gesso-core";
|
|
5
|
+
import { AnimatedCell, AnimationDriver, CanvasHost, CaretRect, ComponentLikeElement, ComponentResolver, EditingState, EditingState as EditingState$1, FocusOptions, IconRasterizer, ImageResolver, LayoutExplanation, LayoutInspector, MARK_PREFIX, MotionStateInput, MotionTiming, RendererBackend, Size, TextMeasureRequest, TextMeasurer, UI_ROLES, UI_SEMANTIC_STATES, UiAnimation, UiChild, UiContrast, UiDurationToken, UiEasing, UiEasingToken, UiEditingController, UiElement, UiFileDropMessage, UiFindController, UiFocusManager, UiFrameClockFactory, UiInputDispatcher, UiInsets, UiKeyModifiers, UiKeyboardController, UiLength, UiModifier, UiMotion, UiNode, UiPlatformAdapter, UiPointerController, UiPointerDevice, UiReducedMotionPolicy, UiRole, UiScrollability, UiSelectionController, UiSemanticState, UiSemanticsAction, UiSemanticsMap, UiSemanticsMap as UiSemanticsMap$1, UiSemanticsPatch, UiSemanticsRecord, UiSemanticsRecord as UiSemanticsRecord$1, UiSemanticsUpdate, UiShortcutRegistry, UiSpringSpec, UiSpringToken, UiTextPosition, UiThemeExtension, UiTouchScroller, UiWheelController, VideoClock, VideoResolver, markInstant, markNow, measureSpan, performanceMarksEnabled, setPerformanceMarks as setPerformanceMarks$1 } from "gesso-core";
|
|
4
6
|
//#region src/service/ServiceRegistry.d.ts
|
|
5
7
|
/**
|
|
6
8
|
* The runtime services a component may inject.
|
|
@@ -947,49 +949,6 @@ declare function Channel(token: {
|
|
|
947
949
|
name: string;
|
|
948
950
|
}): PropertyDecorator;
|
|
949
951
|
//#endregion
|
|
950
|
-
//#region src/channel/provide.d.ts
|
|
951
|
-
/** What the owning thread supplies for a channel. */
|
|
952
|
-
interface ChannelSource<View extends object, Commands extends object> {
|
|
953
|
-
/** One observable per declared view key. */
|
|
954
|
-
view: { readonly [K in keyof View]: Observable<View[K]>; };
|
|
955
|
-
/** One handler per declared command. */
|
|
956
|
-
commands?: Commands;
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Publishes a channel from the thread that owns its data.
|
|
960
|
-
*
|
|
961
|
-
* Each view key is subscribed, diffed against what the other side last
|
|
962
|
-
* saw, and sent as patches. Whatever produced the observable — a bare
|
|
963
|
-
* subject or a stack of layers — stays here; only plain data crosses.
|
|
964
|
-
*
|
|
965
|
-
* Keys are subscribed on the first sync request, so a channel nobody
|
|
966
|
-
* is watching costs nothing.
|
|
967
|
-
*/
|
|
968
|
-
declare function provide<View extends object, Commands extends object>(token: ChannelToken<View, Commands>, source: ChannelSource<View, Commands>, port: ChannelPort): ProvidedChannel;
|
|
969
|
-
declare class ProvidedChannel {
|
|
970
|
-
private readonly token;
|
|
971
|
-
private readonly source;
|
|
972
|
-
private readonly port;
|
|
973
|
-
private readonly subscriptions;
|
|
974
|
-
/**
|
|
975
|
-
* What the other side is known to hold, seeded from the token's
|
|
976
|
-
* initial value — which the replica also starts from, so an app
|
|
977
|
-
* whose first emission equals the initial sends nothing at all.
|
|
978
|
-
*/
|
|
979
|
-
private readonly previous;
|
|
980
|
-
private readonly checked;
|
|
981
|
-
private synced;
|
|
982
|
-
constructor(token: ChannelToken<object, CommandMap>, source: ChannelSource<object, CommandMap>, port: ChannelPort);
|
|
983
|
-
private receive;
|
|
984
|
-
private runCommand;
|
|
985
|
-
private sync;
|
|
986
|
-
private publish;
|
|
987
|
-
/** Re-sends every key in full, for a client that reattached. */
|
|
988
|
-
private resend;
|
|
989
|
-
private post;
|
|
990
|
-
dispose(): void;
|
|
991
|
-
}
|
|
992
|
-
//#endregion
|
|
993
952
|
//#region src/channel/ChannelRegistry.d.ts
|
|
994
953
|
/**
|
|
995
954
|
* The channels a runtime can hand to its components, by name.
|
|
@@ -1040,154 +999,6 @@ declare function findUnplainPath(value: unknown, path?: readonly (string | numbe
|
|
|
1040
999
|
*/
|
|
1041
1000
|
declare function requirePlainData(channelName: string, key: string, value: unknown): void;
|
|
1042
1001
|
//#endregion
|
|
1043
|
-
//#region src/worker/WorkerPorts.d.ts
|
|
1044
|
-
/**
|
|
1045
|
-
* Named `MessagePort`s into a worker.
|
|
1046
|
-
*
|
|
1047
|
-
* A worker's global `onmessage` is a single channel, so a worker that
|
|
1048
|
-
* receives messages on it can host exactly one conversation. That is
|
|
1049
|
-
* why a store in a data worker used to mean a worker per store: the
|
|
1050
|
-
* client claimed the `Worker` object itself, and a second one had
|
|
1051
|
-
* nowhere to go.
|
|
1052
|
-
*
|
|
1053
|
-
* A handshake fixes it. The client opens a `MessageChannel`, keeps one
|
|
1054
|
-
* end and transfers the other with a name; the worker serves that name
|
|
1055
|
-
* and the two ends talk privately from then on. The global channel is
|
|
1056
|
-
* used once per conversation and carries nothing else.
|
|
1057
|
-
*
|
|
1058
|
-
* Nothing here knows what travels over a port. It is the transport the
|
|
1059
|
-
* store replication in `../store/worker` runs on today and the barrier
|
|
1060
|
-
* contract will run on next.
|
|
1061
|
-
*/
|
|
1062
|
-
/** A port-shaped thing: `MessagePort` and `Worker` both satisfy it. */
|
|
1063
|
-
interface MessageEndpoint {
|
|
1064
|
-
postMessage(message: unknown): void;
|
|
1065
|
-
onmessage: ((event: {
|
|
1066
|
-
data: unknown;
|
|
1067
|
-
}) => void) | null;
|
|
1068
|
-
}
|
|
1069
|
-
/** The one message the global channel carries. */
|
|
1070
|
-
interface PortHandshake {
|
|
1071
|
-
type: 'gesso:port';
|
|
1072
|
-
key: string;
|
|
1073
|
-
}
|
|
1074
|
-
declare function isPortHandshake(value: unknown): value is PortHandshake;
|
|
1075
|
-
/**
|
|
1076
|
-
* A worker spawned at most once, serving any number of named ports.
|
|
1077
|
-
*
|
|
1078
|
-
* Handed to several `useChannel` calls, it is what lets one worker
|
|
1079
|
-
* hold a whole application layer instead of one channel. Spawning is
|
|
1080
|
-
* deferred to the first `open`, so a handle nobody uses costs nothing.
|
|
1081
|
-
*/
|
|
1082
|
-
interface WorkerHandle {
|
|
1083
|
-
/**
|
|
1084
|
-
* Opens a private channel under `key`, spawning the worker if this
|
|
1085
|
-
* is the first one.
|
|
1086
|
-
*/
|
|
1087
|
-
open(key: string): MessagePort;
|
|
1088
|
-
/** Whether the worker has been spawned. */
|
|
1089
|
-
readonly spawned: boolean;
|
|
1090
|
-
/** Stops the worker, if it was ever started. */
|
|
1091
|
-
terminate(): void;
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Stands for "whichever worker the shell spawned for the application".
|
|
1095
|
-
*
|
|
1096
|
-
* A registration inside the render worker cannot name that worker: it
|
|
1097
|
-
* is created by the shell and its port only arrives with `init`, long
|
|
1098
|
-
* after `useChannel` and `useService` have run. This sentinel is what a
|
|
1099
|
-
* registration puts there instead, and the render worker swaps it for
|
|
1100
|
-
* the real handle once the port shows up.
|
|
1101
|
-
*
|
|
1102
|
-
* Opening a port on it before then is a bug rather than a race, so it
|
|
1103
|
-
* says so.
|
|
1104
|
-
*/
|
|
1105
|
-
declare const APPLICATION_WORKER: WorkerHandle;
|
|
1106
|
-
/**
|
|
1107
|
-
* Anything a handshake can be posted to with a port attached.
|
|
1108
|
-
* `Worker` and `MessagePort` both satisfy it.
|
|
1109
|
-
*/
|
|
1110
|
-
interface TransferTarget {
|
|
1111
|
-
postMessage(message: unknown, transfer: Transferable[]): void;
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* A handle over an endpoint someone else owns.
|
|
1115
|
-
*
|
|
1116
|
-
* The shell spawns the application worker and hands the render worker
|
|
1117
|
-
* one end of a channel to it; this is what the render worker opens
|
|
1118
|
-
* named ports over. `terminate` is a no-op — the lifetime belongs to
|
|
1119
|
-
* whoever created the endpoint, and a handle that could kill a worker
|
|
1120
|
-
* it did not spawn would be a surprising thing to hand out.
|
|
1121
|
-
*/
|
|
1122
|
-
declare function portHandle(endpoint: TransferTarget): WorkerHandle;
|
|
1123
|
-
/**
|
|
1124
|
-
* Routes handshakes arriving on a transferred port through the same
|
|
1125
|
-
* handlers as the worker's own global channel.
|
|
1126
|
-
*
|
|
1127
|
-
* The shell owns the application worker and gives the render worker a
|
|
1128
|
-
* port to it, so handshakes reach this worker two ways: on its global
|
|
1129
|
-
* channel (whoever spawned it) and on that port (whoever was given
|
|
1130
|
-
* it). Both should be served by the same handlers, and neither end
|
|
1131
|
-
* should have to know which route a channel came in on.
|
|
1132
|
-
*/
|
|
1133
|
-
interface HubMessage {
|
|
1134
|
-
type: 'gesso:hub';
|
|
1135
|
-
}
|
|
1136
|
-
declare function isHubMessage(value: unknown): value is HubMessage;
|
|
1137
|
-
/**
|
|
1138
|
-
* Wraps a worker factory so the worker is created once and shared.
|
|
1139
|
-
*
|
|
1140
|
-
* A factory rather than a URL for the same reason the render worker
|
|
1141
|
-
* takes one: a bundler only emits a chunk for a worker it can see
|
|
1142
|
-
* constructed literally in the calling module.
|
|
1143
|
-
*
|
|
1144
|
-
* const data = workerHandle(
|
|
1145
|
-
* () => new Worker(new URL('./data.worker.ts', import.meta.url), { type: 'module' })
|
|
1146
|
-
* );
|
|
1147
|
-
*/
|
|
1148
|
-
declare function workerHandle(factory: () => Worker): WorkerHandle;
|
|
1149
|
-
/**
|
|
1150
|
-
* Minimal view of a worker's global scope, so this module type-checks
|
|
1151
|
-
* against the DOM lib without pulling in the WebWorker lib.
|
|
1152
|
-
*/
|
|
1153
|
-
interface PortHost {
|
|
1154
|
-
onmessage: ((event: {
|
|
1155
|
-
data: unknown;
|
|
1156
|
-
ports?: readonly MessagePort[];
|
|
1157
|
-
}) => void) | null;
|
|
1158
|
-
}
|
|
1159
|
-
/**
|
|
1160
|
-
* What a port is answered with when no handler claimed its name.
|
|
1161
|
-
*
|
|
1162
|
-
* Its own message type rather than a store's or a channel's, because
|
|
1163
|
-
* the transport does not know which of them the client is: both
|
|
1164
|
-
* recognise it, so a mismatched name is loud either way.
|
|
1165
|
-
*/
|
|
1166
|
-
interface PortErrorMessage {
|
|
1167
|
-
type: 'port:error';
|
|
1168
|
-
message: string;
|
|
1169
|
-
}
|
|
1170
|
-
declare function isPortErrorMessage(value: unknown): value is PortErrorMessage;
|
|
1171
|
-
/**
|
|
1172
|
-
* Serves named ports inside a worker.
|
|
1173
|
-
*
|
|
1174
|
-
* Call it synchronously at the top level of the worker module, before
|
|
1175
|
-
* any await, so no handshake is missed.
|
|
1176
|
-
*
|
|
1177
|
-
* `onPort` returns whether it took the port. Returning false passes
|
|
1178
|
-
* the handshake to whatever was serving before, which is what lets two
|
|
1179
|
-
* kinds of thing — stores and channels, during the migration — share
|
|
1180
|
-
* one worker: each answers for its own names and declines the rest.
|
|
1181
|
-
* When nobody accepts, the port is answered with an error naming
|
|
1182
|
-
* everything the worker does serve, because a handshake that silently
|
|
1183
|
-
* matched nothing leaves the client waiting forever with nothing said.
|
|
1184
|
-
*
|
|
1185
|
-
* `names` is only read to build that message.
|
|
1186
|
-
*
|
|
1187
|
-
* Returns a function that stops serving.
|
|
1188
|
-
*/
|
|
1189
|
-
declare function servePorts(onPort: (key: string, port: MessagePort) => boolean, names: () => readonly string[], host?: PortHost): () => void;
|
|
1190
|
-
//#endregion
|
|
1191
1002
|
//#region src/channel/createChannelRegistry.d.ts
|
|
1192
1003
|
/**
|
|
1193
1004
|
* A registration with its types erased.
|
|
@@ -1227,6 +1038,12 @@ interface ChannelRegistration {
|
|
|
1227
1038
|
}
|
|
1228
1039
|
interface ChannelRegistryHandle {
|
|
1229
1040
|
registry: ChannelRegistry;
|
|
1041
|
+
/**
|
|
1042
|
+
* The workers serving this registry's channels, so a thread can reach
|
|
1043
|
+
* them for something other than a channel: an agent asking what each
|
|
1044
|
+
* one serves.
|
|
1045
|
+
*/
|
|
1046
|
+
readonly workers: ReadonlySet<WorkerHandle>;
|
|
1230
1047
|
dispose(): void;
|
|
1231
1048
|
}
|
|
1232
1049
|
/**
|
|
@@ -1234,64 +1051,6 @@ interface ChannelRegistryHandle {
|
|
|
1234
1051
|
*/
|
|
1235
1052
|
declare function createChannelRegistry(registrations: readonly ChannelRegistration[], onError?: (channelName: string, message: string, stack?: string) => void): ChannelRegistryHandle;
|
|
1236
1053
|
//#endregion
|
|
1237
|
-
//#region src/channel/serveChannels.d.ts
|
|
1238
|
-
/**
|
|
1239
|
-
* One channel a worker offers: its token and what feeds it.
|
|
1240
|
-
*
|
|
1241
|
-
* Types erased structurally, for the same reason `ChannelRegistration`
|
|
1242
|
-
* erases them — a list of channels has no single generic
|
|
1243
|
-
* instantiation, and making every caller cast to reach one is worse
|
|
1244
|
-
* than describing what is actually needed.
|
|
1245
|
-
*/
|
|
1246
|
-
interface ServedChannel {
|
|
1247
|
-
token: {
|
|
1248
|
-
name: string;
|
|
1249
|
-
initial: object;
|
|
1250
|
-
};
|
|
1251
|
-
source: {
|
|
1252
|
-
view: Record<string, Observable<unknown>>;
|
|
1253
|
-
commands?: Record<string, Command>;
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* One served channel, with its source checked against its token.
|
|
1258
|
-
*
|
|
1259
|
-
* `ServedChannel` is erased on purpose, so one list can hold channels
|
|
1260
|
-
* of every shape; the cost is that a view key the token declares and
|
|
1261
|
-
* the source forgets is found at startup, by the error `provide`
|
|
1262
|
-
* reports, rather than by the compiler. This is the typed seam: the
|
|
1263
|
-
* source must hold an Observable for every key of the token's view and
|
|
1264
|
-
* a handler for every command, and each handler takes the arguments
|
|
1265
|
-
* the token declares, so none of them needs an annotation.
|
|
1266
|
-
*
|
|
1267
|
-
* serveChannels([
|
|
1268
|
-
* serve(Catalog, { view: catalog, commands: { add: name => catalog.add(name) } })
|
|
1269
|
-
* ]);
|
|
1270
|
-
*
|
|
1271
|
-
* The view may be any object with the right observables on it, which
|
|
1272
|
-
* is often the domain object itself when its properties are named
|
|
1273
|
-
* after the keys. Only the declared keys are read from it.
|
|
1274
|
-
*/
|
|
1275
|
-
declare function serve<View extends object, Commands extends object>(token: ChannelToken<View, Commands>, source: ChannelSource<View, Commands>): ServedChannel;
|
|
1276
|
-
/**
|
|
1277
|
-
* Publishes channels from an application worker.
|
|
1278
|
-
*
|
|
1279
|
-
* Call it synchronously at the top level of the worker module, before
|
|
1280
|
-
* any await, so no handshake is missed:
|
|
1281
|
-
*
|
|
1282
|
-
* const catalog = new CatalogViewModel(new CatalogDomain(new OpfsStore()));
|
|
1283
|
-
* serveChannels([
|
|
1284
|
-
* serve(Catalog, { view: { products: catalog.products$ }, commands: { … } })
|
|
1285
|
-
* ]);
|
|
1286
|
-
*
|
|
1287
|
-
* Everything above this call is the application's own — plain classes,
|
|
1288
|
-
* plain observables, no framework import. This function is the entire
|
|
1289
|
-
* seam between it and the view.
|
|
1290
|
-
*
|
|
1291
|
-
* Returns a function that stops serving and disposes what it provided.
|
|
1292
|
-
*/
|
|
1293
|
-
declare function serveChannels(channels: readonly ServedChannel[], host?: PortHost): () => void;
|
|
1294
|
-
//#endregion
|
|
1295
1054
|
//#region src/channel/pick.d.ts
|
|
1296
1055
|
/**
|
|
1297
1056
|
* One key of a view model, as its own Observable, emitting only when
|
|
@@ -1861,6 +1620,7 @@ declare function observeColorScheme(onChange: (scheme: ColorScheme) => void): ()
|
|
|
1861
1620
|
*/
|
|
1862
1621
|
type ShellRequest = {
|
|
1863
1622
|
type: 'clipboard';
|
|
1623
|
+
id: number;
|
|
1864
1624
|
text: string;
|
|
1865
1625
|
} | {
|
|
1866
1626
|
type: 'openUrl';
|
|
@@ -2027,6 +1787,7 @@ interface ShellStorageResult {
|
|
|
2027
1787
|
declare class ShellService {
|
|
2028
1788
|
private handler;
|
|
2029
1789
|
private readonly scheme;
|
|
1790
|
+
private readonly contrastState;
|
|
2030
1791
|
private readonly insets;
|
|
2031
1792
|
private readonly isFullscreen;
|
|
2032
1793
|
/** Popups asked for and not yet answered, by the id sent with each. */
|
|
@@ -2035,6 +1796,9 @@ declare class ShellService {
|
|
|
2035
1796
|
/** Storage requests asked for and not yet answered, by the id sent with each. */
|
|
2036
1797
|
private readonly stores;
|
|
2037
1798
|
private nextStorageId;
|
|
1799
|
+
/** Clipboard writes asked for and not yet answered, by the id sent with each. */
|
|
1800
|
+
private readonly copies;
|
|
1801
|
+
private nextCopyId;
|
|
2038
1802
|
/** File requests asked for and not yet answered, by the id sent with each. */
|
|
2039
1803
|
private readonly files;
|
|
2040
1804
|
private nextFileId;
|
|
@@ -2067,6 +1831,18 @@ declare class ShellService {
|
|
|
2067
1831
|
* read it beside a channel's view; its setter stays private here.
|
|
2068
1832
|
*/
|
|
2069
1833
|
readonly colorScheme: ReadableCell<ColorScheme>;
|
|
1834
|
+
/**
|
|
1835
|
+
* The contrast the platform is asking for: `high` when the person has
|
|
1836
|
+
* turned up contrast or turned on a contrast theme, `standard`
|
|
1837
|
+
* otherwise. Reported by the shell like `colorScheme`, and as with it,
|
|
1838
|
+
* what it means is the application's: `withContrast(theme, contrast)`
|
|
1839
|
+
* is the theme that answers it.
|
|
1840
|
+
*
|
|
1841
|
+
* const theme = combineLatest([shell.colorScheme, shell.contrast]).pipe(
|
|
1842
|
+
* map(([scheme, contrast]) => withContrast(scheme === 'dark' ? darkTheme : lightTheme, contrast))
|
|
1843
|
+
* );
|
|
1844
|
+
*/
|
|
1845
|
+
readonly contrast: ReadableCell<UiContrast>;
|
|
2070
1846
|
/** The current appearance, for code that needs it without subscribing. */
|
|
2071
1847
|
get currentColorScheme(): ColorScheme;
|
|
2072
1848
|
/**
|
|
@@ -2098,6 +1874,8 @@ declare class ShellService {
|
|
|
2098
1874
|
* answer, and `colorScheme` is how an application hears about it.
|
|
2099
1875
|
*/
|
|
2100
1876
|
applyColorScheme(scheme: ColorScheme): void;
|
|
1877
|
+
/** Called by the runtime when the shell reports the contrast; not for applications. */
|
|
1878
|
+
applyContrast(contrast: UiContrast): void;
|
|
2101
1879
|
/**
|
|
2102
1880
|
* Called by the runtime when the shell reports the platform's insets.
|
|
2103
1881
|
*
|
|
@@ -2106,8 +1884,27 @@ declare class ShellService {
|
|
|
2106
1884
|
* scroll event that moved no edge does not wake every subscriber.
|
|
2107
1885
|
*/
|
|
2108
1886
|
applyViewportInsets(insets: UiInsets): void;
|
|
2109
|
-
/**
|
|
2110
|
-
|
|
1887
|
+
/**
|
|
1888
|
+
* Puts text on the system clipboard, and answers whether it got there.
|
|
1889
|
+
*
|
|
1890
|
+
* Most callers ignore the answer, and may: the text is on its way the
|
|
1891
|
+
* moment this returns. It is for an application that tells the person
|
|
1892
|
+
* what happened, a "Copied" toast after a menu command, say, which
|
|
1893
|
+
* would be a lie on the occasions the browser refused. It does refuse:
|
|
1894
|
+
* the clipboard wants a focused document, and some browsers a fresh
|
|
1895
|
+
* gesture, and a key pressed in a render worker reaches the window's
|
|
1896
|
+
* clipboard a message later than it reached the canvas.
|
|
1897
|
+
*
|
|
1898
|
+
* With no shell installed the answer is false, as `openPopup`'s is,
|
|
1899
|
+
* rather than a promise that never settles.
|
|
1900
|
+
*/
|
|
1901
|
+
copyText(text: string): Promise<boolean>;
|
|
1902
|
+
/**
|
|
1903
|
+
* Called by the runtime when the shell reports whether a clipboard
|
|
1904
|
+
* write landed. Not for applications. An unknown id is ignored, on
|
|
1905
|
+
* `settlePopup`'s terms.
|
|
1906
|
+
*/
|
|
1907
|
+
settleClipboard(id: number, copied: boolean): void;
|
|
2111
1908
|
/** Opens a URL in the user's browser, in a new tab or window. */
|
|
2112
1909
|
openUrl(url: string): void;
|
|
2113
1910
|
/**
|
|
@@ -3481,7 +3278,20 @@ declare class GessoRuntime {
|
|
|
3481
3278
|
private readonly sharedElements;
|
|
3482
3279
|
private readonly focusNotifier;
|
|
3483
3280
|
private readonly environmentNotifier;
|
|
3281
|
+
/**
|
|
3282
|
+
* The semantics tree: every record by id, and each record's children
|
|
3283
|
+
* in order.
|
|
3284
|
+
*
|
|
3285
|
+
* A record's own `index` is only kept current for the records that
|
|
3286
|
+
* are sent; the order is `semanticsChildren`. Renumbering every
|
|
3287
|
+
* record after an insertion cost a pass over the whole tree on every
|
|
3288
|
+
* structural change, for indices nothing would read until a record
|
|
3289
|
+
* was next sent or the tree was asked for (`semanticsTree`).
|
|
3290
|
+
*/
|
|
3484
3291
|
private semantics;
|
|
3292
|
+
private semanticsChildren;
|
|
3293
|
+
/** The tree in document order with every index current, built when asked for. */
|
|
3294
|
+
private semanticsOrdered;
|
|
3485
3295
|
private semanticsListener;
|
|
3486
3296
|
/**
|
|
3487
3297
|
* The box last reported for each mirrored node, so a frame that
|
|
@@ -3489,6 +3299,8 @@ declare class GessoRuntime {
|
|
|
3489
3299
|
* them. Only populated while a listener is attached.
|
|
3490
3300
|
*/
|
|
3491
3301
|
private semanticsBoxes;
|
|
3302
|
+
/** What each semantics walk leaves for the next; see `SemanticsMemory`. */
|
|
3303
|
+
private readonly semanticsMemory;
|
|
3492
3304
|
private lastFocusedId;
|
|
3493
3305
|
/**
|
|
3494
3306
|
* Where the caret was when `reload` replaced the tree, put back on
|
|
@@ -3502,6 +3314,14 @@ declare class GessoRuntime {
|
|
|
3502
3314
|
private focusAfterReload;
|
|
3503
3315
|
/** Whether `focusAfterReload` is waiting to be applied. */
|
|
3504
3316
|
private restoringFocus;
|
|
3317
|
+
/**
|
|
3318
|
+
* Reveals asked for while the layout listeners run, kept until the
|
|
3319
|
+
* frame's boxes have settled; null outside `settleLayout`, where a
|
|
3320
|
+
* reveal is applied at once.
|
|
3321
|
+
*/
|
|
3322
|
+
private deferredReveals;
|
|
3323
|
+
/** Whether a frame has run out of layout passes and been warned about; see `MAX_LAYOUT_PASSES`. */
|
|
3324
|
+
private warnedLayoutPasses;
|
|
3505
3325
|
/** A frame changed semantics while nothing was listening; see `semanticsTree`. */
|
|
3506
3326
|
private semanticsStale;
|
|
3507
3327
|
private lastEditingState;
|
|
@@ -3800,6 +3620,8 @@ declare class GessoRuntime {
|
|
|
3800
3620
|
* dark should look like.
|
|
3801
3621
|
*/
|
|
3802
3622
|
setColorScheme(scheme: ColorScheme): void;
|
|
3623
|
+
/** The contrast the platform asks for, passed straight to `ShellService`; see `ShellService.contrast`. */
|
|
3624
|
+
setContrast(contrast: UiContrast): void;
|
|
3803
3625
|
/**
|
|
3804
3626
|
* The platform's own insets, as the shell reports them: the safe area
|
|
3805
3627
|
* under a notch or a home indicator and the strip a soft keyboard
|
|
@@ -3844,6 +3666,11 @@ declare class GessoRuntime {
|
|
|
3844
3666
|
* preference setters beside it this carries the id it is replying to.
|
|
3845
3667
|
*/
|
|
3846
3668
|
settlePopup(id: number, opened: boolean): void;
|
|
3669
|
+
/**
|
|
3670
|
+
* Reports whether a clipboard write landed, settling the promise
|
|
3671
|
+
* `ShellService.copyText` returned.
|
|
3672
|
+
*/
|
|
3673
|
+
settleClipboard(id: number, copied: boolean): void;
|
|
3847
3674
|
/**
|
|
3848
3675
|
* Reports what the shell found in `localStorage`, settling the
|
|
3849
3676
|
* promise `ShellService.requestStorage` returned.
|
|
@@ -3939,6 +3766,11 @@ declare class GessoRuntime {
|
|
|
3939
3766
|
* Scrolls every scroll container above `node` just enough that the
|
|
3940
3767
|
* node is inside its viewport, `padding` pixels from the nearest edge.
|
|
3941
3768
|
* Nothing moves when it is already visible.
|
|
3769
|
+
*
|
|
3770
|
+
* Asked for from a layout listener — `autoFocus` taking focus is the
|
|
3771
|
+
* usual one — it waits until the frame's layout has settled, so it
|
|
3772
|
+
* reveals where the node ends up rather than where the first pass
|
|
3773
|
+
* put it (see `settleLayout`).
|
|
3942
3774
|
*/
|
|
3943
3775
|
scrollIntoView(node: UiNode, padding?: number): void;
|
|
3944
3776
|
/**
|
|
@@ -4028,6 +3860,12 @@ declare class GessoRuntime {
|
|
|
4028
3860
|
* boxes at all.
|
|
4029
3861
|
*/
|
|
4030
3862
|
onSemantics(listener: ((update: UiSemanticsUpdate) => void) | null): void;
|
|
3863
|
+
/**
|
|
3864
|
+
* The id of the node that holds focus, or null. The same id the
|
|
3865
|
+
* semantics tree keys its records by, so a reader of the tree can
|
|
3866
|
+
* say which control a key press would reach.
|
|
3867
|
+
*/
|
|
3868
|
+
focusedNodeId(): string | null;
|
|
4031
3869
|
/**
|
|
4032
3870
|
* The semantics tree as of the last frame that changed it.
|
|
4033
3871
|
*
|
|
@@ -4036,6 +3874,17 @@ declare class GessoRuntime {
|
|
|
4036
3874
|
* every frame having paid to keep one nothing was reading.
|
|
4037
3875
|
*/
|
|
4038
3876
|
semanticsTree(): UiSemanticsMap;
|
|
3877
|
+
/** Replaces the tree with one built in full, which is in document order. */
|
|
3878
|
+
private storeSemantics;
|
|
3879
|
+
/**
|
|
3880
|
+
* The tree in document order, every index current: a walk down
|
|
3881
|
+
* `semanticsChildren`, done when someone asks rather than per frame.
|
|
3882
|
+
* Records whose index had gone out of date are brought up to date in
|
|
3883
|
+
* the store as well.
|
|
3884
|
+
*/
|
|
3885
|
+
private orderedSemantics;
|
|
3886
|
+
/** A record's index among its siblings now, which its own `index` may not say. */
|
|
3887
|
+
private semanticsIndexOf;
|
|
4039
3888
|
/**
|
|
4040
3889
|
* Something an assistive technology did to a mirrored element,
|
|
4041
3890
|
* turned back into ordinary input.
|
|
@@ -4125,6 +3974,28 @@ declare class GessoRuntime {
|
|
|
4125
3974
|
* decides how much of the tree has to be asked.
|
|
4126
3975
|
*/
|
|
4127
3976
|
private rescopeSemantics;
|
|
3977
|
+
/**
|
|
3978
|
+
* The patches for a frame that changed the shape of the tree, without
|
|
3979
|
+
* walking all of it, or null when the whole tree has to be rebuilt.
|
|
3980
|
+
*
|
|
3981
|
+
* Any frame that added or removed a child used to rebuild the tree
|
|
3982
|
+
* from the root, describing every node again. In a 5,000-line editor
|
|
3983
|
+
* that was 11 ms of every Enter, for one new paragraph. Now the walk
|
|
3984
|
+
* starts at the nearest record above each change, as
|
|
3985
|
+
* `rescopeSemantics` does for a change of meaning, and inside it a
|
|
3986
|
+
* subtree nothing touched keeps its records: renumbered if its
|
|
3987
|
+
* siblings moved, never described again (see
|
|
3988
|
+
* `rebuildSemanticsSubtree`). What is described is the path down to
|
|
3989
|
+
* each change, whatever is new, and everything under a node whose
|
|
3990
|
+
* own meaning changed.
|
|
3991
|
+
*
|
|
3992
|
+
* The result is spliced into `this.semantics` in place, since the map
|
|
3993
|
+
* is in document order and a record's subtree is a contiguous run of
|
|
3994
|
+
* it, so adds still arrive in document order. Removals come first.
|
|
3995
|
+
*/
|
|
3996
|
+
private restructureSemantics;
|
|
3997
|
+
/** Whether a node is still in the tree being laid out. */
|
|
3998
|
+
private attached;
|
|
4128
3999
|
/**
|
|
4129
4000
|
* The nearest node at or above `node` that holds a semantics record,
|
|
4130
4001
|
* or null when nothing above it does.
|
|
@@ -4167,6 +4038,15 @@ declare class GessoRuntime {
|
|
|
4167
4038
|
*
|
|
4168
4039
|
* Ids that have left the tree are dropped here rather than tracked,
|
|
4169
4040
|
* since a removal patch has already told the mirror about them.
|
|
4041
|
+
*
|
|
4042
|
+
* **Found by walking what is on screen, not by checking everything.**
|
|
4043
|
+
* Bounding what was sent still computed every node's box to find out
|
|
4044
|
+
* whether it was on screen: a 5,000-line document has three thousand
|
|
4045
|
+
* fields, and the sweep cost 4 to 24 ms of every keystroke. The walk
|
|
4046
|
+
* goes down from the root carrying the scroll and sticky offsets that
|
|
4047
|
+
* `visibleBox` adds up per node, and passes over any subtree whose
|
|
4048
|
+
* bounds (the hit tester's, see `subtreeBoundsFor`) are off screen.
|
|
4049
|
+
* A node it passes over is one this skipped before anyway.
|
|
4170
4050
|
*/
|
|
4171
4051
|
private collectSemanticsBoxes;
|
|
4172
4052
|
/**
|
|
@@ -4240,6 +4120,58 @@ declare class GessoRuntime {
|
|
|
4240
4120
|
private collectVirtualMeasures;
|
|
4241
4121
|
/** A node's outer extent along the list's axis. */
|
|
4242
4122
|
private extentOf;
|
|
4123
|
+
/**
|
|
4124
|
+
* Tells the layout listeners what moved, and lays out again for as
|
|
4125
|
+
* long as what they do in answer needs it, so the frame paints the
|
|
4126
|
+
* layout they settle on rather than the one they were told about.
|
|
4127
|
+
*
|
|
4128
|
+
* The browser's answer to the same problem. A `ResizeObserver`
|
|
4129
|
+
* callback runs after layout and before paint, and when it changes
|
|
4130
|
+
* layout the browser lays out again before it paints rather than
|
|
4131
|
+
* showing the stale boxes for a frame. The listeners here are
|
|
4132
|
+
* `breakpoint`, `sizeContainer` (and so `Responsive`),
|
|
4133
|
+
* `scrollPosition`, `autoFocus` and anything else on `host.onLayout`.
|
|
4134
|
+
* Before this a page whose breakpoint gave it wide padding was
|
|
4135
|
+
* painted with its narrow padding on the frame it appeared, and
|
|
4136
|
+
* jumped 16 px on the next.
|
|
4137
|
+
*
|
|
4138
|
+
* A pass after the first lays out only what the listeners dirtied,
|
|
4139
|
+
* the same incremental pass any frame runs, and then tells only the
|
|
4140
|
+
* listeners whose boxes it changed. A frame whose listeners wrote
|
|
4141
|
+
* nothing that lays out, which is almost every frame, runs no second
|
|
4142
|
+
* pass: it pays one look at the dirty set.
|
|
4143
|
+
*
|
|
4144
|
+
* **Bounded.** Listeners that keep moving each other's boxes would
|
|
4145
|
+
* otherwise never let the frame paint. ResizeObserver bounds its loop
|
|
4146
|
+
* by tree depth; this one is bounded by count, `MAX_LAYOUT_PASSES` in
|
|
4147
|
+
* all, which is easier to reason about and more than a real chain
|
|
4148
|
+
* needs (a breakpoint inside a `Responsive` inside a `Responsive` is
|
|
4149
|
+
* four passes). Past it the frame paints what it has, the rest waits
|
|
4150
|
+
* for the next frame as it always used to, and a warning says so
|
|
4151
|
+
* once, as the browser's "ResizeObserver loop completed with
|
|
4152
|
+
* undelivered notifications" does.
|
|
4153
|
+
*
|
|
4154
|
+
* **Reveals wait for the end.** `autoFocus` takes focus from a layout
|
|
4155
|
+
* listener, on its node's first layout, and focus reveals the node:
|
|
4156
|
+
* revealed from the first pass's boxes, it scrolled to where the node
|
|
4157
|
+
* was before a breakpoint moved it. A reveal asked for while the
|
|
4158
|
+
* listeners run is applied once they are quiet, from final boxes, and
|
|
4159
|
+
* its scroll laid out like any other write. So is the focus a hot
|
|
4160
|
+
* reload restores, after the listeners rather than before because
|
|
4161
|
+
* `autoFocus` is one of them and the restore has to be the last word:
|
|
4162
|
+
* every node in a subtree a reload replaced has its first layout on
|
|
4163
|
+
* this frame.
|
|
4164
|
+
*/
|
|
4165
|
+
private settleLayout;
|
|
4166
|
+
/**
|
|
4167
|
+
* Whether something written since the frame was collected has to be
|
|
4168
|
+
* laid out before the frame paints: the same flags that make a frame
|
|
4169
|
+
* lay out, or an inherited value still to be handed down.
|
|
4170
|
+
*/
|
|
4171
|
+
private layoutPending;
|
|
4172
|
+
/** Applies what waits for settled boxes: a reload's focus, then the reveals asked for. */
|
|
4173
|
+
private finishSettling;
|
|
4174
|
+
private warnLayoutPasses;
|
|
4243
4175
|
private handleFrame;
|
|
4244
4176
|
/**
|
|
4245
4177
|
* Keeps frames coming while something is animating.
|
|
@@ -4348,6 +4280,14 @@ interface FrameMetrics {
|
|
|
4348
4280
|
measured: number;
|
|
4349
4281
|
/** Relayout boundaries the layout phase started from; 0 when it ran from the root or not at all. */
|
|
4350
4282
|
relayoutRoots: number;
|
|
4283
|
+
/**
|
|
4284
|
+
* Times the frame laid out: 0 when it laid nothing out, 1 usually,
|
|
4285
|
+
* more when a layout listener (a `breakpoint`, a `sizeContainer`, an
|
|
4286
|
+
* `autoFocus`'s reveal) changed what the first pass laid out and the
|
|
4287
|
+
* frame laid it out again before painting. `measured` and
|
|
4288
|
+
* `relayoutRoots` count every pass.
|
|
4289
|
+
*/
|
|
4290
|
+
layoutPasses: number;
|
|
4351
4291
|
/** Milliseconds per phase. A phase with no work reports 0. */
|
|
4352
4292
|
phases: FramePhaseTimings;
|
|
4353
4293
|
/** The backend that drew this frame, or `pending` while WebGPU initialises. */
|
|
@@ -4538,9 +4478,12 @@ type ShellToRuntimeMessage = {
|
|
|
4538
4478
|
type: 'compositionEnd';
|
|
4539
4479
|
text: string;
|
|
4540
4480
|
at?: number;
|
|
4541
|
-
} |
|
|
4481
|
+
} |
|
|
4482
|
+
/** `html` is the clipboard's HTML, when it held some. */
|
|
4483
|
+
{
|
|
4542
4484
|
type: 'paste';
|
|
4543
4485
|
text: string;
|
|
4486
|
+
html?: string;
|
|
4544
4487
|
at?: number;
|
|
4545
4488
|
} |
|
|
4546
4489
|
/** The editing proxy lost focus to something outside the app. */
|
|
@@ -4589,6 +4532,9 @@ type ShellToRuntimeMessage = {
|
|
|
4589
4532
|
{
|
|
4590
4533
|
type: 'colorScheme';
|
|
4591
4534
|
scheme: ColorScheme;
|
|
4535
|
+
} | {
|
|
4536
|
+
type: 'contrast';
|
|
4537
|
+
contrast: UiContrast;
|
|
4592
4538
|
} |
|
|
4593
4539
|
/**
|
|
4594
4540
|
* What the window's own chrome is covering on each edge: the safe
|
|
@@ -4639,6 +4585,16 @@ type ShellToRuntimeMessage = {
|
|
|
4639
4585
|
id: number;
|
|
4640
4586
|
opened: boolean;
|
|
4641
4587
|
} |
|
|
4588
|
+
/**
|
|
4589
|
+
* Whether a `clipboard` request's text reached the clipboard, under
|
|
4590
|
+
* the request's `id`. False when the browser refused both ways of
|
|
4591
|
+
* writing it.
|
|
4592
|
+
*/
|
|
4593
|
+
{
|
|
4594
|
+
type: 'clipboardResult';
|
|
4595
|
+
id: number;
|
|
4596
|
+
copied: boolean;
|
|
4597
|
+
} |
|
|
4642
4598
|
/**
|
|
4643
4599
|
* What the shell found in `localStorage` for a `storage` request
|
|
4644
4600
|
* (ShellStorage). The second reply on this protocol, and it carries
|
|
@@ -4775,6 +4731,7 @@ type RuntimeToShellMessage = {
|
|
|
4775
4731
|
nodes: number;
|
|
4776
4732
|
measured: number;
|
|
4777
4733
|
relayoutRoots: number;
|
|
4734
|
+
layoutPasses: number;
|
|
4778
4735
|
at: number;
|
|
4779
4736
|
inputLatencyMs: number | null;
|
|
4780
4737
|
phases: FramePhaseTimings;
|
|
@@ -4828,9 +4785,13 @@ type RuntimeToShellMessage = {
|
|
|
4828
4785
|
type: 'editing';
|
|
4829
4786
|
state: EditingState | null;
|
|
4830
4787
|
} |
|
|
4831
|
-
/**
|
|
4788
|
+
/**
|
|
4789
|
+
* Put text on the clipboard (ShellService.copyText). `id` pairs it
|
|
4790
|
+
* with the `clipboardResult` that comes back, once.
|
|
4791
|
+
*/
|
|
4832
4792
|
{
|
|
4833
4793
|
type: 'clipboard';
|
|
4794
|
+
id: number;
|
|
4834
4795
|
text: string;
|
|
4835
4796
|
} |
|
|
4836
4797
|
/** Open a URL in a new tab (ShellService.openUrl). */
|
|
@@ -5388,6 +5349,30 @@ interface WorkerAppOptions {
|
|
|
5388
5349
|
* reach. `gesso-electrobun`'s bridge is what goes here.
|
|
5389
5350
|
*/
|
|
5390
5351
|
onOpenUrl?: (url: string) => void;
|
|
5352
|
+
/**
|
|
5353
|
+
* Offer the application's channels to an AI agent in the browser,
|
|
5354
|
+
* through WebMCP (default false). Each channel's view and commands
|
|
5355
|
+
* become tools registered with `document.modelContext` once the app
|
|
5356
|
+
* mounts, removed when it is disposed. A browser without WebMCP
|
|
5357
|
+
* registers nothing. Pass `{ confirm }` to ask the person about a
|
|
5358
|
+
* `@confirm` command with the application's own dialog instead of
|
|
5359
|
+
* the browser's. `gesso-framework/agent` has the rest.
|
|
5360
|
+
*/
|
|
5361
|
+
webmcp?: boolean | {
|
|
5362
|
+
confirm?: (request: AgentConfirmation) => boolean | Promise<boolean>;
|
|
5363
|
+
};
|
|
5364
|
+
/**
|
|
5365
|
+
* The app is the page (default false): a key pressed while nothing
|
|
5366
|
+
* on the page has focus goes to the app, and the canvas takes focus.
|
|
5367
|
+
*
|
|
5368
|
+
* Keys reach the app through the canvas, which has focus only once
|
|
5369
|
+
* something put it there. A page that is all app loads with focus on
|
|
5370
|
+
* the body, so its shortcuts did nothing until the first click, and a
|
|
5371
|
+
* person who pressed `c` or Mod+K straight away got nothing. An app
|
|
5372
|
+
* embedded in a page with other things on it leaves this off: a key
|
|
5373
|
+
* pressed on that page isn't its.
|
|
5374
|
+
*/
|
|
5375
|
+
pageKeys?: boolean;
|
|
5391
5376
|
/**
|
|
5392
5377
|
* Receives errors thrown inside the render worker: while handling a
|
|
5393
5378
|
* message, uncaught during a frame, from the renderer, or from a
|
|
@@ -5554,7 +5539,16 @@ declare class WorkerApp {
|
|
|
5554
5539
|
* uses this; its own view of the application is nothing at all.
|
|
5555
5540
|
*/
|
|
5556
5541
|
get appLogic(): WorkerHandle | undefined;
|
|
5542
|
+
/**
|
|
5543
|
+
* Opens a port to whatever the render worker serves under `key`, or
|
|
5544
|
+
* returns undefined before `mount` has started it. The development
|
|
5545
|
+
* agent bridge asks for `gesso:agent` this way; nothing else in the
|
|
5546
|
+
* shell talks to the render worker except through its protocol.
|
|
5547
|
+
*/
|
|
5548
|
+
openRenderPort(key: string): MessagePort | undefined;
|
|
5557
5549
|
mount(host: HTMLElement | string): () => void;
|
|
5550
|
+
/** Removes the WebMCP tools `webmcp` registered, if it did. */
|
|
5551
|
+
private disconnectWebMcp;
|
|
5558
5552
|
/**
|
|
5559
5553
|
* An error the browser raised *at the worker object*, which is not
|
|
5560
5554
|
* the same thing as the worker reporting one.
|
|
@@ -5828,6 +5822,10 @@ interface CreateAppOptions extends Omit<WorkerAppOptions, 'renderWorker'> {
|
|
|
5828
5822
|
declare function createApp(options?: CreateAppOptions): WorkerApp;
|
|
5829
5823
|
//#endregion
|
|
5830
5824
|
//#region src/app/GessoAppBuilder.d.ts
|
|
5825
|
+
/** What `useWebMcp` takes besides a boolean: the app's own way to ask the person. */
|
|
5826
|
+
interface WebMcpChoice {
|
|
5827
|
+
confirm?: (request: AgentConfirmation) => boolean | Promise<boolean>;
|
|
5828
|
+
}
|
|
5831
5829
|
/**
|
|
5832
5830
|
* Fluent builder for the single-thread configuration.
|
|
5833
5831
|
*/
|
|
@@ -5845,6 +5843,10 @@ declare class GessoAppBuilder {
|
|
|
5845
5843
|
private mediaOptions;
|
|
5846
5844
|
private fontDeclarations;
|
|
5847
5845
|
private app;
|
|
5846
|
+
/** The mounted app's channel registry, for the workers an agent port asks. */
|
|
5847
|
+
private channelHandle;
|
|
5848
|
+
private webmcpChoice;
|
|
5849
|
+
private disconnectWebMcp;
|
|
5848
5850
|
private colorSchemePreference;
|
|
5849
5851
|
constructor(root: FrameworkChild | ComponentType);
|
|
5850
5852
|
/**
|
|
@@ -5964,6 +5966,25 @@ declare class GessoAppBuilder {
|
|
|
5964
5966
|
* Returns a dispose function that tears the app down.
|
|
5965
5967
|
*/
|
|
5966
5968
|
mountSync(host: HTMLElement | string): () => void;
|
|
5969
|
+
/**
|
|
5970
|
+
* Offer the app's channels and screen to an AI agent in the browser,
|
|
5971
|
+
* through WebMCP (default false). The single-thread form of
|
|
5972
|
+
* `createApp({ webmcp })`: registered once `mountSync` has run,
|
|
5973
|
+
* removed when the app is unmounted. Call before `mountSync`.
|
|
5974
|
+
*/
|
|
5975
|
+
useWebMcp(choice?: boolean | WebMcpChoice): this;
|
|
5976
|
+
/**
|
|
5977
|
+
* Opens a port to what this app serves under `key`, or returns
|
|
5978
|
+
* undefined before `mountSync`.
|
|
5979
|
+
*
|
|
5980
|
+
* The same question `WorkerApp.openRenderPort` answers, asked of the
|
|
5981
|
+
* page instead of a render worker, because in this configuration the
|
|
5982
|
+
* page is the thread that draws. It serves one thing, `gesso:agent`:
|
|
5983
|
+
* the channels fed here, the workers behind them, and the screen.
|
|
5984
|
+
* The agent code is loaded the first time one is opened.
|
|
5985
|
+
*/
|
|
5986
|
+
openRenderPort(key: string): MessagePort | undefined;
|
|
5987
|
+
private connectWebMcp;
|
|
5967
5988
|
}
|
|
5968
5989
|
//#endregion
|
|
5969
5990
|
//#region src/app/createSyncApp.d.ts
|
|
@@ -6065,6 +6086,14 @@ interface GessoAppOptions {
|
|
|
6065
6086
|
*/
|
|
6066
6087
|
declare class GessoApp {
|
|
6067
6088
|
private readonly runtime;
|
|
6089
|
+
/**
|
|
6090
|
+
* The clock the runtime was given, its callback, and whether a frame
|
|
6091
|
+
* is waiting on it: what `uiHost().flush` needs to run that frame now,
|
|
6092
|
+
* since a background tab gets no animation frames to run it.
|
|
6093
|
+
*/
|
|
6094
|
+
private clock;
|
|
6095
|
+
private frameCallback;
|
|
6096
|
+
private framePending;
|
|
6068
6097
|
private readonly canvas;
|
|
6069
6098
|
private readonly host;
|
|
6070
6099
|
private readonly inputEnabled;
|
|
@@ -6085,6 +6114,7 @@ declare class GessoApp {
|
|
|
6085
6114
|
private detachFullscreen;
|
|
6086
6115
|
private fullscreen;
|
|
6087
6116
|
private detachReducedMotion;
|
|
6117
|
+
private detachContrast;
|
|
6088
6118
|
/** Stops watching `prefers-color-scheme`; null while overridden. */
|
|
6089
6119
|
private detachColorScheme;
|
|
6090
6120
|
/** Stops watching `visualViewport` for the safe area and the keyboard. */
|
|
@@ -6092,6 +6122,12 @@ declare class GessoApp {
|
|
|
6092
6122
|
/** The appearance this shell reports; watched or overridden. */
|
|
6093
6123
|
private colorSchemePreference;
|
|
6094
6124
|
constructor(options: GessoAppOptions);
|
|
6125
|
+
/**
|
|
6126
|
+
* The running app, as the agent's screen tools need it: its semantics
|
|
6127
|
+
* tree and focus, the mirror's actions, keys, and a way to run a
|
|
6128
|
+
* pending frame now. See `uiSurface` in `gesso-framework/agent`.
|
|
6129
|
+
*/
|
|
6130
|
+
uiHost(): UiHost;
|
|
6095
6131
|
/** The runtime services a component in this app can inject. */
|
|
6096
6132
|
get services(): ServiceRegistry;
|
|
6097
6133
|
/**
|
|
@@ -7498,6 +7534,42 @@ declare class EditingService {
|
|
|
7498
7534
|
* all three of which happen during the frame a field first appears.
|
|
7499
7535
|
*/
|
|
7500
7536
|
caretRectOf(node: UiNode | null): CaretRect | null;
|
|
7537
|
+
/**
|
|
7538
|
+
* Selects from `anchor` to `focus` and focuses the field the focus is
|
|
7539
|
+
* in: within one field, or across the fields of an editing group (see
|
|
7540
|
+
* `UiEditingGroup`). What an editor does after a command over a
|
|
7541
|
+
* selection (making it bold, say) to leave it selected, since its
|
|
7542
|
+
* fields can only select their own text.
|
|
7543
|
+
*
|
|
7544
|
+
* False when the two ends aren't editables of one group, or before
|
|
7545
|
+
* the runtime has wired the controller.
|
|
7546
|
+
*/
|
|
7547
|
+
select(anchor: UiTextPosition, focus: UiTextPosition): boolean;
|
|
7548
|
+
}
|
|
7549
|
+
//#endregion
|
|
7550
|
+
//#region src/app/ScrollService.d.ts
|
|
7551
|
+
/**
|
|
7552
|
+
* Scrolling a node into view, for a component that moves a highlight
|
|
7553
|
+
* rather than focus.
|
|
7554
|
+
*
|
|
7555
|
+
* Focus moved from the keyboard already brings its node into view. A
|
|
7556
|
+
* highlight doesn't move focus: a combobox's arrows walk its list while
|
|
7557
|
+
* the caret stays in the field, and a grid's cursor can do the same.
|
|
7558
|
+
* The list has to follow the highlight all the same, and only the
|
|
7559
|
+
* runtime knows where the scroll containers above a node are and how
|
|
7560
|
+
* far each has to move. This is the asking.
|
|
7561
|
+
*/
|
|
7562
|
+
declare class ScrollService {
|
|
7563
|
+
private scroller;
|
|
7564
|
+
/** Installed by the runtime; without one nothing scrolls. */
|
|
7565
|
+
setScroller(scroller: ((node: UiNode, padding: number) => void) | null): void;
|
|
7566
|
+
/**
|
|
7567
|
+
* Scrolls every container above `node` just enough that it's inside
|
|
7568
|
+
* the container's viewport, `padding` pixels from the nearest edge.
|
|
7569
|
+
* Nothing moves when it's visible already. Before the node has been
|
|
7570
|
+
* laid out there is nowhere to scroll it to, and nothing happens.
|
|
7571
|
+
*/
|
|
7572
|
+
scrollIntoView(node: UiNode, padding?: number): void;
|
|
7501
7573
|
}
|
|
7502
7574
|
//#endregion
|
|
7503
7575
|
//#region src/app/FocusService.d.ts
|
|
@@ -7525,14 +7597,28 @@ declare class FocusService {
|
|
|
7525
7597
|
readonly focused: InternalState<UiNode | null>;
|
|
7526
7598
|
/** Whether focus is confined to a subtree by an open trap. */
|
|
7527
7599
|
readonly trapped: InternalState<boolean>;
|
|
7600
|
+
/**
|
|
7601
|
+
* Whether the focus held is focus the keyboard can see: reached by Tab
|
|
7602
|
+
* or an arrow key, or by code with no pointer since, rather than by a
|
|
7603
|
+
* press. CSS's `:focus-visible`, for something other than a ring that
|
|
7604
|
+
* should answer the keyboard and not the click that happened to focus
|
|
7605
|
+
* the same control: a tooltip, say.
|
|
7606
|
+
*/
|
|
7607
|
+
readonly focusVisible: InternalState<boolean>;
|
|
7528
7608
|
private manager;
|
|
7529
7609
|
private detach;
|
|
7530
7610
|
/** Actions taken before the runtime installed a manager, in order. */
|
|
7531
7611
|
private queued;
|
|
7532
7612
|
/** Installed by the runtime; without one every action is queued. */
|
|
7533
7613
|
setManager(manager: UiFocusManager | null): void;
|
|
7534
|
-
/**
|
|
7535
|
-
|
|
7614
|
+
/**
|
|
7615
|
+
* Gives the node keyboard focus. Non-focusable nodes are ignored.
|
|
7616
|
+
*
|
|
7617
|
+
* The node is scrolled into view, unless `options.preventScroll` asks
|
|
7618
|
+
* for the page to stay where it is, as `element.focus({ preventScroll:
|
|
7619
|
+
* true })` does in a browser.
|
|
7620
|
+
*/
|
|
7621
|
+
focus(node: UiNode, options?: FocusOptions): void;
|
|
7536
7622
|
/** Drops focus without moving it anywhere. */
|
|
7537
7623
|
blur(): void;
|
|
7538
7624
|
/** Moves focus to the next focusable node, wrapping around. */
|
|
@@ -7565,7 +7651,8 @@ interface EditingProxySink {
|
|
|
7565
7651
|
compositionStart(): void;
|
|
7566
7652
|
compositionUpdate(text: string, caret: number): void;
|
|
7567
7653
|
compositionEnd(text: string): void;
|
|
7568
|
-
|
|
7654
|
+
/** Pasted text, and the clipboard's HTML when it held some. */
|
|
7655
|
+
paste(text: string, html: string | null): void;
|
|
7569
7656
|
/** The proxy lost focus to something outside the app. */
|
|
7570
7657
|
blur(): void;
|
|
7571
7658
|
/**
|
|
@@ -7677,7 +7764,7 @@ declare class EditingProxy {
|
|
|
7677
7764
|
* the reason the field's semantics live here rather than on a second
|
|
7678
7765
|
* element beside it.
|
|
7679
7766
|
*/
|
|
7680
|
-
describe(record: UiSemanticsRecord | null): void;
|
|
7767
|
+
describe(record: UiSemanticsRecord | null, activeDescendant?: string): void;
|
|
7681
7768
|
dispose(): void;
|
|
7682
7769
|
/** Puts the element where the caret is, so the IME window opens there. */
|
|
7683
7770
|
private position;
|
|
@@ -7686,11 +7773,12 @@ declare class EditingProxy {
|
|
|
7686
7773
|
private listen;
|
|
7687
7774
|
}
|
|
7688
7775
|
/**
|
|
7689
|
-
* Writes text to the system clipboard from the main thread
|
|
7690
|
-
* API needs a secure context and, in
|
|
7691
|
-
* gesture; the `execCommand` fallback
|
|
7776
|
+
* Writes text to the system clipboard from the main thread, and answers
|
|
7777
|
+
* whether it got there. The async API needs a secure context and, in
|
|
7778
|
+
* some browsers, a recent user gesture; the `execCommand` fallback
|
|
7779
|
+
* covers the rest. False means both refused. It never rejects.
|
|
7692
7780
|
*/
|
|
7693
|
-
declare function writeClipboard(text: string, doc?: Document):
|
|
7781
|
+
declare function writeClipboard(text: string, doc?: Document): Promise<boolean>;
|
|
7694
7782
|
//#endregion
|
|
7695
7783
|
//#region src/app/SemanticsMirror.d.ts
|
|
7696
7784
|
/**
|
|
@@ -7722,7 +7810,7 @@ interface SemanticsMirrorSink {
|
|
|
7722
7810
|
* nothing at all and the text is dropped before the application
|
|
7723
7811
|
* sees it.
|
|
7724
7812
|
*/
|
|
7725
|
-
paste?(text: string): void;
|
|
7813
|
+
paste?(text: string, html: string | null): void;
|
|
7726
7814
|
}
|
|
7727
7815
|
/**
|
|
7728
7816
|
* The editing proxy, as the mirror needs it.
|
|
@@ -7736,8 +7824,12 @@ interface SemanticsMirrorSink {
|
|
|
7736
7824
|
interface EditingMirrorTarget {
|
|
7737
7825
|
/** True while the proxy holds DOM focus for a focused editable. */
|
|
7738
7826
|
readonly active: boolean;
|
|
7739
|
-
/**
|
|
7740
|
-
|
|
7827
|
+
/**
|
|
7828
|
+
* Describes the focused editable on the proxy's element, or clears it.
|
|
7829
|
+
* `activeDescendant` is the DOM id of the element its record's
|
|
7830
|
+
* `activeDescendant` names, for `aria-activedescendant`.
|
|
7831
|
+
*/
|
|
7832
|
+
describe(record: UiSemanticsRecord | null, activeDescendant?: string): void;
|
|
7741
7833
|
/** Takes DOM focus back for the focused editable. */
|
|
7742
7834
|
focus(): void;
|
|
7743
7835
|
}
|
|
@@ -7786,6 +7878,12 @@ declare class SemanticsMirror {
|
|
|
7786
7878
|
private applying;
|
|
7787
7879
|
private focusedId;
|
|
7788
7880
|
private disposed;
|
|
7881
|
+
/**
|
|
7882
|
+
* Prefixes every element's DOM id, which `aria-activedescendant`
|
|
7883
|
+
* refers to. Per mirror, because two apps on one page have nodes with
|
|
7884
|
+
* the same ids.
|
|
7885
|
+
*/
|
|
7886
|
+
private readonly idPrefix;
|
|
7789
7887
|
constructor(canvas: HTMLCanvasElement, sink: SemanticsMirrorSink, editing?: EditingMirrorTarget | null);
|
|
7790
7888
|
/** The container, for tests and for a shell that wants to inspect it. */
|
|
7791
7889
|
get element(): HTMLElement;
|
|
@@ -7799,6 +7897,8 @@ declare class SemanticsMirror {
|
|
|
7799
7897
|
apply(update: UiSemanticsUpdate): void;
|
|
7800
7898
|
dispose(): void;
|
|
7801
7899
|
private upsert;
|
|
7900
|
+
/** Hands the proxy the focused editable's record, with its active descendant's DOM id. */
|
|
7901
|
+
private describeEditing;
|
|
7802
7902
|
private createElement;
|
|
7803
7903
|
/** Writes a record onto its element as ARIA, clearing what it no longer says. */
|
|
7804
7904
|
private describe;
|
|
@@ -8067,6 +8167,15 @@ declare class RenderWorkerApp {
|
|
|
8067
8167
|
* console is the worker global's, and this class is what owns the
|
|
8068
8168
|
* global.
|
|
8069
8169
|
*/
|
|
8170
|
+
/**
|
|
8171
|
+
* Answers an agent port with every channel this application can
|
|
8172
|
+
* reach: the ones fed from this thread, and whatever each worker
|
|
8173
|
+
* behind them serves, asked over a port of its own. Imported rather
|
|
8174
|
+
* than loaded on demand: a worker built as an IIFE, which is Vite's
|
|
8175
|
+
* default, cannot split off a chunk, and a dynamic import here failed
|
|
8176
|
+
* every such build. Nothing runs until an agent asks.
|
|
8177
|
+
*/
|
|
8178
|
+
private serveAgent;
|
|
8070
8179
|
private setConsoleForwarding;
|
|
8071
8180
|
private dispatch;
|
|
8072
8181
|
/**
|
|
@@ -8080,5 +8189,5 @@ declare class RenderWorkerApp {
|
|
|
8080
8189
|
private initialize;
|
|
8081
8190
|
}
|
|
8082
8191
|
//#endregion
|
|
8083
|
-
export {
|
|
8084
|
-
//# sourceMappingURL=index-
|
|
8192
|
+
export { StorageAdapter as $, UiOwnerReport as $n, ResourceOptions as $r, FontFaceDeclaration as $t, Presence as A, AudioState as An, Define as Ar, ActionCause as At, PersistedOptions as B, ShellFileType as Bn, Show as Br, UiTreeSnapshot as Bt, FocusService as C, formatUrl as Cn, ChannelRegistration as Cr, AppLogicEndpoint as Ct, FindService as D, AudioRequest as Dn, requirePlainData as Dr, ShellHistoryMode as Dt, TextService as E, AudioMetadata as En, findUnplainPath as Er, ShellHistory as Et, AudioSinkOptions as F, UiDuration as Fn, ControlledValue as Fr, DevtoolsEvent as Ft, IndexedDbStorage as G, ShellStorageResult as Gn, EachProps as Gr, FrameMetrics as Gt, persisted as H, ShellRequest as Hn, show as Hr, RuntimeErrorSource as Ht, AudioSinkOutput as I, UiEasingChoice as In, controlled as Ir, DevtoolsRequest as It, OpfsFileHandle as J, observeColorScheme as Jn, throttled as Jr, GessoRuntimeOptions as Jt, IndexedDbStorageOptions as K, ColorScheme as Kn, each as Kr, FramePhaseTimings as Kt, MediaSessionLike as L, ShellFile as Ln, ThemeTokenCell as Lr, FrameEntry as Lt, RouterOutlet as M, AnimateOptions as Mn, Input as Mr, ChannelErrorEntry as Mt, AudioElementLike as N, AnimationService as Nn, Output as Nr, CommandEntry as Nt, observeMediaQuery as O, AudioSample as On, ChannelRegistry as Or, ShellHistoryOptions as Ot, AudioSink as P, SpringOptions as Pn, ControlledOptions as Pr, ConsoleEntry as Pt, MemoryStorage as Q, UiNodeReport as Qn, Resource as Qr, UiFramePhase as Qt, audioClock as R, ShellFileRequest as Rn, themeTokenCell as Rr, PatchEntry as Rt, writeClipboard as S, buildPath as Sn, pickKeys as Sr, createApp as St, EditingService as T, AudioAction as Tn, createChannelRegistry as Tr, WorkerAppOptions as Tt, ShellStorage as U, ShellService as Un, Each as Ur, RuntimeToShellMessage as Ut, PersistedState as V, ShellRecentFile as Vn, ShowProps as Vr, treeText as Vt, ShellStorageOptions as W, ShellStorageOp as Wn, EachKey as Wr, ShellToRuntimeMessage as Wt, OpfsStorageOptions as X, NodePathTarget as Xn, Mutation as Xr, RuntimeInput as Xt, OpfsStorage as Y, BoundStream as Yn, MutateOptions as Yr, RendererChoice as Yt, OpfsWritable as Z, UiEnvironmentReport as Zn, mutate as Zr, UI_FRAME_PHASES as Zt, EditingMirrorTarget as _, ServiceRegistry as _i, RouteOptions as _n, ComponentElement as _r, GessoAppOptions as _t, UiRole as a, FanCell as ai, MediaOptions as an, formatAge as ar, storageReadValue as at, EditingProxy as b, to as bn, structurallyEqual as br, WebMcpChoice as bt, UiSemanticsPatch as c, FanOutOptions as ci, RouteMatch as cn, formatStream as cr, UndoableOptions as ct, markNow as d, ComputedOptions as di, RouterService as dn, ComponentHost as dr, UndoStackOptions as dt, ResourceState as ei, FontFaceLike as en, UiPropOrigin as er, StorageOutcome as et, measureSpan as f, ReadSource as fi, RouteState as fn, OverlayLayer as fr, UndoTransaction as ft, renderRoot as g, derive as gi, RouteGuard as gn, createComponent as gr, GessoApp as gt, RenderWorkerApp as h, Equality as hi, RouteDefinition as hn, OverlayService as hr, shellStorageDenied as ht, UI_SEMANTIC_STATES as i, select as ii, FontService as in, describeStream as ir, storageReadFailure as it, PresenceProps as j, AudioStatus as jn, Inject as jr, ActionEntry as jt, observeReducedMotion as k, AudioService as kn, Channel as kr, createShellHistory as kt, UiSemanticsRecord$1 as l, fanOut as li, RouterHistorySink as ln, printPropValue as lr, undoable as lt, setPerformanceMarks$1 as m, DeriveOptions as mi, RouteContext as mn, OverlayPlacement as mr, performShellStorage as mt, MARK_PREFIX as n, resource as ni, FontFamilyStatus as nn, UiSemanticsReport as nr, classifyStorageError as nt, UiSemanticState as o, FanKey as oi, MediaService as on, formatNodePath as or, UndoShortcutOptions as ot, performanceMarksEnabled as p, computed as pi, OutletProps as pn, OverlayEntry as pr, ShellLocalStore as pt, OpfsDirectory as q, ColorSchemePreference as qn, debounced as qr, GessoRuntime as qt, UI_ROLES as r, SelectOptions as ri, FontHost as rn, UiStreamReport as rr, storageErrorMessage as rt, UiSemanticsMap$1 as s, FanOut as si, RouteAnswer as sn, formatNodeReport as sr, registerUndoShortcuts as st, EditingState$1 as t, ResourceStatus as ti, FontFamilyDeclaration as tn, UiPropReport as tr, StorageRead as tt, markInstant as u, ComputedCell as ui, RouterRoutes as un, ComponentHostResolver as ur, UndoStack as ut, SemanticsMirror as v, RouteTarget as vn, FrameworkChild as vr, createSyncApp as vt, ScrollService as w, parseUrl as wn, ChannelRegistryHandle as wr, WorkerApp as wt, EditingProxySink as x, RouteParams as xn, pick as xr, CreateAppOptions as xt, SemanticsMirrorSink as y, route as yn, isComponentElement as yr, GessoAppBuilder as yt, FrameService as z, ShellFileResult as zn, bind as zr, UiTreeNode as zt };
|
|
8193
|
+
//# sourceMappingURL=index-BDM_gzzZ.d.ts.map
|