@native-sdk/cli 0.9.0 → 0.9.1
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/build/app.zig +331 -24
- package/build.zig +179 -11
- package/native-sdk.d.ts +8 -0
- package/package.json +10 -10
- package/packages/core/compile-surface/core.ts +70 -1
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/merge_static_archives.mjs +78 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
- package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
- package/packages/core/scripts/stage_external_services.mjs +1 -1
- package/packages/core/sdk/core.d.ts +75 -0
- package/packages/core/sdk/core.ts +167 -12
- package/packages/core/sdk/events.d.ts +53 -0
- package/packages/core/sdk/events.ts +78 -7
- package/packages/core/src/checker.ts +470 -2
- package/packages/core/src/cli.ts +13 -0
- package/packages/core/src/contract.ts +3 -1
- package/packages/core/src/devhost.ts +30 -1
- package/packages/core/src/devhost_journal.mjs +10 -8
- package/packages/core/src/diagnostics.ts +99 -8
- package/packages/core/src/frontend.ts +6 -0
- package/packages/core/src/infer.ts +24 -0
- package/skill-data/automation/SKILL.md +1 -1
- package/skill-data/native-ui/SKILL.md +11 -5
- package/skill-data/ts-core/SKILL.md +53 -20
- package/skill-data/ts-services/SKILL.md +4 -4
- package/skill-data/ts-services/references/service-surface.md +2 -1
- package/skill-data/zig/SKILL.md +1 -1
- package/src/app_runner/root.zig +29 -0
- package/src/app_runner/ts_core_main.zig +5 -0
- package/src/app_runner/ts_core_mobile.zig +241 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +8 -6
- package/src/embed/app_exports.zig +1 -0
- package/src/embed/root.zig +1 -0
- package/src/embed/tests.zig +28 -0
- package/src/embed/ui_host.zig +68 -2
- package/src/platform/linux/cef_host.cpp +7 -1
- package/src/platform/linux/gtk_host.c +200 -5
- package/src/platform/linux/gtk_host.h +2 -1
- package/src/platform/linux/root.zig +69 -4
- package/src/platform/macos/appkit_host.h +11 -7
- package/src/platform/macos/appkit_host.m +210 -88
- package/src/platform/macos/cef_host.mm +210 -88
- package/src/platform/macos/root.zig +77 -30
- package/src/platform/null_platform.zig +234 -51
- package/src/platform/null_platform_tests.zig +39 -0
- package/src/platform/root.zig +10 -0
- package/src/platform/types.zig +105 -16
- package/src/platform/windows/root.zig +20 -6
- package/src/platform/windows/webview2_host.cpp +41 -5
- package/src/root.zig +7 -0
- package/src/runtime/api.zig +8 -0
- package/src/runtime/automation_commands.zig +35 -2
- package/src/runtime/automation_snapshot.zig +32 -24
- package/src/runtime/bridge_permission_tests.zig +35 -1
- package/src/runtime/bridge_responses.zig +1 -1
- package/src/runtime/builtin_bridge.zig +11 -1
- package/src/runtime/core.zig +12 -6
- package/src/runtime/effects.zig +1323 -35
- package/src/runtime/effects_file_tests.zig +587 -0
- package/src/runtime/effects_notification_tests.zig +11 -0
- package/src/runtime/file_access.zig +400 -0
- package/src/runtime/file_effect_crash_helper.zig +28 -0
- package/src/runtime/file_effect_crash_tests.zig +37 -0
- package/src/runtime/flow.zig +21 -9
- package/src/runtime/native_command_event_tests.zig +44 -2
- package/src/runtime/pty.zig +5 -2
- package/src/runtime/root.zig +5 -0
- package/src/runtime/session_blobs.zig +4 -1
- package/src/runtime/session_journal.zig +56 -5
- package/src/runtime/session_record.zig +38 -0
- package/src/runtime/session_replay.zig +97 -7
- package/src/runtime/session_tests.zig +81 -0
- package/src/runtime/state.zig +10 -0
- package/src/runtime/system_services.zig +129 -36
- package/src/runtime/ts_core_host.zig +281 -11
- package/src/runtime/ts_core_host_tests.zig +95 -1
- package/src/runtime/ts_ui_app.zig +461 -8
- package/src/runtime/ui_app.zig +321 -109
- package/src/runtime/ui_app_tests.zig +132 -6
- package/src/runtime/ui_app_window_tests.zig +61 -7
- package/src/runtime/validation.zig +20 -0
- package/src/tooling/templates.zig +28 -0
- package/src/tooling/ts_core.zig +83 -0
- package/tools/corewire/emit.zig +3 -3
- package/tools/corewire/emit_facade.zig +65 -5
- package/tools/corewire/emit_profile.zig +2 -2
- package/tools/corewire/emit_service.zig +2 -2
- package/tools/corewire/service_contract.zig +4 -4
- package/tools/corewire/sidecar.zig +4 -4
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// return path (NS1017) — they never live in the Model, in a Msg, in a local,
|
|
11
11
|
// or in a helper.
|
|
12
12
|
//
|
|
13
|
-
// The
|
|
13
|
+
// The v5 command set:
|
|
14
14
|
//
|
|
15
15
|
// Cmd.none no effects (what a bare `return model` means)
|
|
16
16
|
// Cmd.persist() ask the host to persist the committed model
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
// re-issuing a live key replaces it, and
|
|
33
33
|
// Cmd.cancel(key) drops it.
|
|
34
34
|
// Cmd.cancel(key) drop the in-flight keyed effect — request,
|
|
35
|
-
// readFile/writeFile/fetch/
|
|
35
|
+
// readFile/writeFile/readFileStream/fetch/
|
|
36
|
+
// clipboardRead, or
|
|
36
37
|
// delay — SILENTLY (no terminal arm dispatch).
|
|
37
38
|
// Aimed at a live spawn, streaming fetch, or
|
|
38
|
-
// streaming service it
|
|
39
|
+
// streaming service or write-file sink it
|
|
39
40
|
// stays LOUD: the err arm runs with
|
|
40
41
|
// "cancelled" — ending a stream is observable
|
|
41
42
|
// Cmd.batch([a, b, ...]) several commands from one dispatch
|
|
@@ -53,6 +54,12 @@
|
|
|
53
54
|
// whole-file write (parents created, replaced
|
|
54
55
|
// whole); ok arm carries NOTHING (an arm with
|
|
55
56
|
// no payload fields), err arm the reason bytes
|
|
57
|
+
// Cmd.appendFile / statFile / deleteFile
|
|
58
|
+
// bounded append, metadata probe, and deletion
|
|
59
|
+
// Cmd.readFileStream 256-KiB chunks, then done(total) or err
|
|
60
|
+
// Cmd.writeFileStream / writeFileChunk / writeFileClose
|
|
61
|
+
// atomic streamed sink; chunks are acknowledged
|
|
62
|
+
// in order and close installs the destination
|
|
56
63
|
// Cmd.fetch({ url, method?, headers?, body?, timeoutMs? }, { key?, ok, err })
|
|
57
64
|
// buffered HTTP(S) exchange; ok arm carries a
|
|
58
65
|
// two-field record — one number field (the real
|
|
@@ -73,7 +80,7 @@
|
|
|
73
80
|
// clipboard read; ok arm carries the text bytes,
|
|
74
81
|
// err arm the reason bytes ("failed",
|
|
75
82
|
// "rejected")
|
|
76
|
-
// Cmd.showNotification({ title, subtitle?, body? })
|
|
83
|
+
// Cmd.showNotification({ id?, title, subtitle?, body?, actionLabel?, actionCommand? })
|
|
77
84
|
// fire-and-forget desktop notification; the OS
|
|
78
85
|
// remains authoritative over final delivery
|
|
79
86
|
// Cmd.openExternalUrl(url) open an allowed HTTP(S) URL in the system
|
|
@@ -255,10 +262,12 @@
|
|
|
255
262
|
// The keyed-effect discipline is ONE rule: a keyed effect REPLACES its live
|
|
256
263
|
// predecessor (the superseded effect's result is dropped — no message), and
|
|
257
264
|
// Cmd.cancel drops it silently. That holds for request, readFile, writeFile,
|
|
258
|
-
// buffered fetch, clipboardRead, and delay alike.
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
//
|
|
265
|
+
// readFileStream, buffered fetch, clipboardRead, and delay alike. A reissued
|
|
266
|
+
// readFileStream key retires the old read silently and starts the replacement.
|
|
267
|
+
// Live spawn, streaming-fetch, streaming-service, and write-file SINK keys are
|
|
268
|
+
// the exceptions: a duplicate REJECTS the new stream/sink so two producers are
|
|
269
|
+
// never spliced. Cancelling a sink is loud (`err: cancelled`) because a
|
|
270
|
+
// half-written export is observable; cancelling a read stream is silent.
|
|
262
271
|
//
|
|
263
272
|
// `Sub` is the recurring-effects surface: an app may export
|
|
264
273
|
// `subscriptions(model): Sub<Msg>` returning declarative descriptors the
|
|
@@ -366,6 +375,32 @@ export function utf8Bytes(s: string): Uint8Array {
|
|
|
366
375
|
/// Every app Msg is a discriminated union on a string `kind` tag.
|
|
367
376
|
export type Msgish = { readonly kind: string };
|
|
368
377
|
|
|
378
|
+
import { type WindowDescriptor, type WindowDescriptorSpec } from "./events.ts";
|
|
379
|
+
|
|
380
|
+
/// Fill the canonical defaults for a model-declared secondary window.
|
|
381
|
+
export function windowDescriptor(spec: WindowDescriptorSpec): WindowDescriptor {
|
|
382
|
+
return {
|
|
383
|
+
label: spec.label,
|
|
384
|
+
canvasLabel: spec.canvasLabel,
|
|
385
|
+
title: spec.title ?? new Uint8Array(0),
|
|
386
|
+
width: spec.width ?? 480,
|
|
387
|
+
height: spec.height ?? 360,
|
|
388
|
+
x: spec.x ?? null,
|
|
389
|
+
y: spec.y ?? null,
|
|
390
|
+
resizable: spec.resizable ?? true,
|
|
391
|
+
minWidth: spec.minWidth ?? 0,
|
|
392
|
+
minHeight: spec.minHeight ?? 0,
|
|
393
|
+
titlebar: spec.titlebar ?? "standard",
|
|
394
|
+
transparent: spec.transparent ?? false,
|
|
395
|
+
alwaysOnTop: spec.alwaysOnTop ?? false,
|
|
396
|
+
clickThrough: spec.clickThrough ?? false,
|
|
397
|
+
activateOnShow: spec.activateOnShow ?? true,
|
|
398
|
+
allowsFullscreen: spec.allowsFullscreen ?? true,
|
|
399
|
+
closePolicy: spec.closePolicy ?? "quit",
|
|
400
|
+
onCloseCommand: spec.onCloseCommand ?? new Uint8Array(0),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
369
404
|
/** Cooperative cancellation capability supplied by generated service hosts. */
|
|
370
405
|
export interface ServiceCancellation {
|
|
371
406
|
/** True after Cmd.cancel or the operation deadline requests cancellation. */
|
|
@@ -850,6 +885,36 @@ export interface WriteRoute<M extends Msgish> {
|
|
|
850
885
|
readonly err: BytesKind<M>;
|
|
851
886
|
}
|
|
852
887
|
|
|
888
|
+
/// Streaming read routing: zero or more 256-KiB `chunk` messages, then one
|
|
889
|
+
/// `done` carrying the total byte count, or one `err` carrying a closed file
|
|
890
|
+
/// outcome.
|
|
891
|
+
export interface FileReadStreamRoute<M extends Msgish> {
|
|
892
|
+
readonly key?: string;
|
|
893
|
+
readonly chunk: BytesKind<M>;
|
|
894
|
+
readonly done: TimestampKind<M>;
|
|
895
|
+
readonly err: BytesKind<M>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export interface FileStatArm {
|
|
899
|
+
readonly exists: boolean;
|
|
900
|
+
readonly size: number;
|
|
901
|
+
readonly mtimeMs: number;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
export type FileStatKind<M extends Msgish> = M extends Msgish
|
|
905
|
+
? [Exclude<keyof M, "kind">] extends [keyof FileStatArm]
|
|
906
|
+
? [keyof FileStatArm] extends [Exclude<keyof M, "kind">]
|
|
907
|
+
? M extends Msgish & FileStatArm ? M["kind"] : never
|
|
908
|
+
: never
|
|
909
|
+
: never
|
|
910
|
+
: never;
|
|
911
|
+
|
|
912
|
+
export interface FileStatRoute<M extends Msgish> {
|
|
913
|
+
readonly key?: string;
|
|
914
|
+
readonly ok: FileStatKind<M>;
|
|
915
|
+
readonly err: BytesKind<M>;
|
|
916
|
+
}
|
|
917
|
+
|
|
853
918
|
/// Pagination controls for `Cmd.store.scan`. `limit` defaults to 100 and is
|
|
854
919
|
/// bounded at 256. `after` is the opaque key cursor returned by the previous
|
|
855
920
|
/// page; omit it for the first page.
|
|
@@ -1042,9 +1107,12 @@ export interface FetchStreamSpec extends FetchSpec {
|
|
|
1042
1107
|
/// fire-and-forget because the OS may suppress an accepted request through
|
|
1043
1108
|
/// Focus / Do Not Disturb or the user's notification settings.
|
|
1044
1109
|
export interface NotificationSpec {
|
|
1110
|
+
readonly id?: Uint8Array;
|
|
1045
1111
|
readonly title: Uint8Array;
|
|
1046
1112
|
readonly subtitle?: Uint8Array;
|
|
1047
1113
|
readonly body?: Uint8Array;
|
|
1114
|
+
readonly actionLabel?: Uint8Array;
|
|
1115
|
+
readonly actionCommand?: Uint8Array;
|
|
1048
1116
|
}
|
|
1049
1117
|
|
|
1050
1118
|
/// The three bounded host-local timestamp presentations. Unlike the markup
|
|
@@ -1099,6 +1167,56 @@ export type Cmd<M extends Msgish> =
|
|
|
1099
1167
|
readonly path: Uint8Array;
|
|
1100
1168
|
readonly bytes: Uint8Array;
|
|
1101
1169
|
}
|
|
1170
|
+
| {
|
|
1171
|
+
readonly op: "append_file";
|
|
1172
|
+
readonly key: string;
|
|
1173
|
+
readonly okKind: string;
|
|
1174
|
+
readonly errKind: string;
|
|
1175
|
+
readonly path: Uint8Array;
|
|
1176
|
+
readonly bytes: Uint8Array;
|
|
1177
|
+
}
|
|
1178
|
+
| {
|
|
1179
|
+
readonly op: "stat_file";
|
|
1180
|
+
readonly key: string;
|
|
1181
|
+
readonly okKind: string;
|
|
1182
|
+
readonly errKind: string;
|
|
1183
|
+
readonly path: Uint8Array;
|
|
1184
|
+
}
|
|
1185
|
+
| {
|
|
1186
|
+
readonly op: "delete_file";
|
|
1187
|
+
readonly key: string;
|
|
1188
|
+
readonly okKind: string;
|
|
1189
|
+
readonly errKind: string;
|
|
1190
|
+
readonly path: Uint8Array;
|
|
1191
|
+
}
|
|
1192
|
+
| {
|
|
1193
|
+
readonly op: "read_file_stream";
|
|
1194
|
+
readonly key: string;
|
|
1195
|
+
readonly chunkKind: string;
|
|
1196
|
+
readonly doneKind: string;
|
|
1197
|
+
readonly errKind: string;
|
|
1198
|
+
readonly path: Uint8Array;
|
|
1199
|
+
}
|
|
1200
|
+
| {
|
|
1201
|
+
readonly op: "write_file_stream";
|
|
1202
|
+
readonly key: string;
|
|
1203
|
+
readonly okKind: string;
|
|
1204
|
+
readonly errKind: string;
|
|
1205
|
+
readonly path: Uint8Array;
|
|
1206
|
+
}
|
|
1207
|
+
| {
|
|
1208
|
+
readonly op: "write_file_chunk";
|
|
1209
|
+
readonly key: string;
|
|
1210
|
+
readonly okKind: string;
|
|
1211
|
+
readonly errKind: string;
|
|
1212
|
+
readonly bytes: Uint8Array;
|
|
1213
|
+
}
|
|
1214
|
+
| {
|
|
1215
|
+
readonly op: "write_file_close";
|
|
1216
|
+
readonly key: string;
|
|
1217
|
+
readonly okKind: string;
|
|
1218
|
+
readonly errKind: string;
|
|
1219
|
+
}
|
|
1102
1220
|
| {
|
|
1103
1221
|
readonly op: "store_set";
|
|
1104
1222
|
readonly key: string;
|
|
@@ -1176,7 +1294,7 @@ export type Cmd<M extends Msgish> =
|
|
|
1176
1294
|
}
|
|
1177
1295
|
| { readonly op: "clip_write"; readonly bytes: Uint8Array }
|
|
1178
1296
|
| { readonly op: "clip_read"; readonly key: string; readonly okKind: string; readonly errKind: string }
|
|
1179
|
-
| { readonly op: "show_notification"; readonly title: Uint8Array; readonly subtitle: Uint8Array; readonly body: Uint8Array }
|
|
1297
|
+
| { readonly op: "show_notification"; readonly id: Uint8Array; readonly title: Uint8Array; readonly subtitle: Uint8Array; readonly body: Uint8Array; readonly actionLabel: Uint8Array; readonly actionCommand: Uint8Array }
|
|
1180
1298
|
| { readonly op: "delay"; readonly key: string; readonly afterMs: number; readonly msgKind: string }
|
|
1181
1299
|
| {
|
|
1182
1300
|
readonly op: "spawn";
|
|
@@ -1511,7 +1629,7 @@ export const Cmd = {
|
|
|
1511
1629
|
|
|
1512
1630
|
/// Drop the in-flight keyed effect — request, named engine op, or delay —
|
|
1513
1631
|
/// with this key, if any, SILENTLY (neither routing arm is dispatched for
|
|
1514
|
-
/// it). Live spawn, streaming-fetch,
|
|
1632
|
+
/// it). Live spawn, streaming-fetch, streaming-service, and write-file-sink operations are the exceptions:
|
|
1515
1633
|
/// cancel ends the stream and its err arm runs with "cancelled".
|
|
1516
1634
|
cancel(key: string): Cmd<never> {
|
|
1517
1635
|
return { op: "cancel", key };
|
|
@@ -1531,6 +1649,37 @@ export const Cmd = {
|
|
|
1531
1649
|
return { op: "write_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path, bytes };
|
|
1532
1650
|
},
|
|
1533
1651
|
|
|
1652
|
+
appendFile<M extends Msgish>(path: Uint8Array, bytes: Uint8Array, route: WriteRoute<M>): Cmd<M> {
|
|
1653
|
+
return { op: "append_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path, bytes };
|
|
1654
|
+
},
|
|
1655
|
+
|
|
1656
|
+
statFile<M extends Msgish>(path: Uint8Array, route: FileStatRoute<M>): Cmd<M> {
|
|
1657
|
+
return { op: "stat_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path };
|
|
1658
|
+
},
|
|
1659
|
+
|
|
1660
|
+
/// Delete one file. The ok arm carries no payload. A final symlink is
|
|
1661
|
+
/// unlinked without deleting its target. A missing file routes the err arm
|
|
1662
|
+
/// with "not_found"; directories and other OS refusals route "io_failed".
|
|
1663
|
+
deleteFile<M extends Msgish>(path: Uint8Array, route: WriteRoute<M>): Cmd<M> {
|
|
1664
|
+
return { op: "delete_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path };
|
|
1665
|
+
},
|
|
1666
|
+
|
|
1667
|
+
readFileStream<M extends Msgish>(path: Uint8Array, route: FileReadStreamRoute<M>): Cmd<M> {
|
|
1668
|
+
return { op: "read_file_stream", key: route.key ?? "", chunkKind: route.chunk, doneKind: route.done, errKind: route.err, path };
|
|
1669
|
+
},
|
|
1670
|
+
|
|
1671
|
+
writeFileStream<M extends Msgish>(key: string, path: Uint8Array, route: WriteRoute<M>): Cmd<M> {
|
|
1672
|
+
return { op: "write_file_stream", key, okKind: route.ok, errKind: route.err, path };
|
|
1673
|
+
},
|
|
1674
|
+
|
|
1675
|
+
writeFileChunk<M extends Msgish>(key: string, bytes: Uint8Array, route: WriteRoute<M>): Cmd<M> {
|
|
1676
|
+
return { op: "write_file_chunk", key, okKind: route.ok, errKind: route.err, bytes };
|
|
1677
|
+
},
|
|
1678
|
+
|
|
1679
|
+
writeFileClose<M extends Msgish>(key: string, route: WriteRoute<M>): Cmd<M> {
|
|
1680
|
+
return { op: "write_file_close", key, okKind: route.ok, errKind: route.err };
|
|
1681
|
+
},
|
|
1682
|
+
|
|
1534
1683
|
/// Capability-gated, engine-owned per-record storage. Keys are UTF-8 text
|
|
1535
1684
|
/// up to 512 bytes; values are bytes up to 1 MiB. Results remain effects:
|
|
1536
1685
|
/// they arrive through the supplied Msg routes after update commits.
|
|
@@ -1645,14 +1794,20 @@ export const Cmd = {
|
|
|
1645
1794
|
|
|
1646
1795
|
/// Ask the desktop host to show a system notification. Fire-and-forget:
|
|
1647
1796
|
/// platform acceptance cannot promise display while OS focus modes and user
|
|
1648
|
-
/// notification settings remain authoritative.
|
|
1649
|
-
///
|
|
1797
|
+
/// notification settings remain authoritative. A stable id replaces the
|
|
1798
|
+
/// earlier notification with that id; paired actionLabel/actionCommand bytes
|
|
1799
|
+
/// dispatch through the normal app-command path while the process is live.
|
|
1800
|
+
/// Empty or over-bound titles, over-bound optional fields, unpaired actions,
|
|
1801
|
+
/// invalid command names, and unavailable services fail closed.
|
|
1650
1802
|
showNotification(spec: NotificationSpec): Cmd<never> {
|
|
1651
1803
|
return {
|
|
1652
1804
|
op: "show_notification",
|
|
1805
|
+
id: spec.id ?? new Uint8Array(0),
|
|
1653
1806
|
title: spec.title,
|
|
1654
1807
|
subtitle: spec.subtitle ?? new Uint8Array(0),
|
|
1655
1808
|
body: spec.body ?? new Uint8Array(0),
|
|
1809
|
+
actionLabel: spec.actionLabel ?? new Uint8Array(0),
|
|
1810
|
+
actionCommand: spec.actionCommand ?? new Uint8Array(0),
|
|
1656
1811
|
};
|
|
1657
1812
|
},
|
|
1658
1813
|
|
|
@@ -35,6 +35,59 @@ export interface StatusItemState {
|
|
|
35
35
|
readonly presentation: StatusItemPresentation;
|
|
36
36
|
readonly items: readonly StatusItemMenuItem[];
|
|
37
37
|
}
|
|
38
|
+
export interface StatusItemDescriptor {
|
|
39
|
+
readonly id: number;
|
|
40
|
+
readonly visible: boolean;
|
|
41
|
+
readonly iconPath: Uint8Array;
|
|
42
|
+
readonly tooltip: Uint8Array;
|
|
43
|
+
readonly activationCommand: Uint8Array;
|
|
44
|
+
readonly alternateActivationCommand: Uint8Array;
|
|
45
|
+
readonly openCommand: Uint8Array;
|
|
46
|
+
readonly presentation: StatusItemPresentation;
|
|
47
|
+
readonly items: readonly StatusItemMenuItem[];
|
|
48
|
+
}
|
|
49
|
+
export type WindowClosePolicy = "quit" | "hide";
|
|
50
|
+
export type WindowTitlebarStyle = "standard" | "hidden_inset" | "hidden_inset_tall" | "chromeless";
|
|
51
|
+
export interface WindowDescriptorSpec {
|
|
52
|
+
readonly label: Uint8Array;
|
|
53
|
+
readonly canvasLabel: Uint8Array;
|
|
54
|
+
readonly title?: Uint8Array;
|
|
55
|
+
readonly width?: number;
|
|
56
|
+
readonly height?: number;
|
|
57
|
+
readonly x?: number | null;
|
|
58
|
+
readonly y?: number | null;
|
|
59
|
+
readonly resizable?: boolean;
|
|
60
|
+
readonly minWidth?: number;
|
|
61
|
+
readonly minHeight?: number;
|
|
62
|
+
readonly titlebar?: WindowTitlebarStyle;
|
|
63
|
+
readonly transparent?: boolean;
|
|
64
|
+
readonly alwaysOnTop?: boolean;
|
|
65
|
+
readonly clickThrough?: boolean;
|
|
66
|
+
readonly activateOnShow?: boolean;
|
|
67
|
+
readonly allowsFullscreen?: boolean;
|
|
68
|
+
readonly closePolicy?: WindowClosePolicy;
|
|
69
|
+
readonly onCloseCommand?: Uint8Array;
|
|
70
|
+
}
|
|
71
|
+
export interface WindowDescriptor {
|
|
72
|
+
readonly label: Uint8Array;
|
|
73
|
+
readonly canvasLabel: Uint8Array;
|
|
74
|
+
readonly title: Uint8Array;
|
|
75
|
+
readonly width: number;
|
|
76
|
+
readonly height: number;
|
|
77
|
+
readonly x: number | null;
|
|
78
|
+
readonly y: number | null;
|
|
79
|
+
readonly resizable: boolean;
|
|
80
|
+
readonly minWidth: number;
|
|
81
|
+
readonly minHeight: number;
|
|
82
|
+
readonly titlebar: WindowTitlebarStyle;
|
|
83
|
+
readonly transparent: boolean;
|
|
84
|
+
readonly alwaysOnTop: boolean;
|
|
85
|
+
readonly clickThrough: boolean;
|
|
86
|
+
readonly activateOnShow: boolean;
|
|
87
|
+
readonly allowsFullscreen: boolean;
|
|
88
|
+
readonly closePolicy: WindowClosePolicy;
|
|
89
|
+
readonly onCloseCommand: Uint8Array;
|
|
90
|
+
}
|
|
38
91
|
export interface ScrollState {
|
|
39
92
|
readonly offsetX: number;
|
|
40
93
|
readonly offsetY: number;
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
// - `AppearanceEvent`, `ChromeEvent`, `AudioEvent`: the full arm
|
|
38
38
|
// payload shapes, canonical and importable for helper signatures
|
|
39
39
|
// (an arm value is structurally assignable to its event record).
|
|
40
|
-
// - `StatusItemState` and
|
|
41
|
-
// returned by `statusItem(model)
|
|
42
|
-
//
|
|
40
|
+
// - `StatusItemState`, `StatusItemDescriptor`, and their nested records:
|
|
41
|
+
// the model-derived shell returned by `statusItem(model)` or keyed
|
|
42
|
+
// `statusItems(model)`; the generated launcher refreshes shell,
|
|
43
|
+
// presentation, visibility, and menu after committed model changes.
|
|
43
44
|
|
|
44
45
|
export type { TextCaretDirection, TextCaretMove, TextSelection, TextInputEvent } from "./text.ts";
|
|
45
46
|
|
|
@@ -83,10 +84,9 @@ export interface StatusItemMenuItem {
|
|
|
83
84
|
|
|
84
85
|
/// The generated launcher's model-derived menu-bar status item. Export
|
|
85
86
|
/// `statusItem(model: Model): StatusItemState` from `src/core.ts`; its
|
|
86
|
-
///
|
|
87
|
-
///
|
|
88
|
-
///
|
|
89
|
-
/// so returning literals or freshly built arrays is safe.
|
|
87
|
+
/// shell, presentation, and rows are re-derived after every committed model
|
|
88
|
+
/// update. Byte slices are borrowed only for that apply, so returning literals
|
|
89
|
+
/// or freshly built arrays is safe.
|
|
90
90
|
export interface StatusItemState {
|
|
91
91
|
readonly iconPath: Uint8Array;
|
|
92
92
|
readonly tooltip: Uint8Array;
|
|
@@ -97,6 +97,77 @@ export interface StatusItemState {
|
|
|
97
97
|
readonly items: readonly StatusItemMenuItem[];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/// One independently reconciled menu-bar status item. Export
|
|
101
|
+
/// `statusItems(model: Model): readonly StatusItemDescriptor[]`; `id`
|
|
102
|
+
/// preserves the native item while all remaining fields update live.
|
|
103
|
+
export interface StatusItemDescriptor {
|
|
104
|
+
readonly id: number;
|
|
105
|
+
readonly visible: boolean;
|
|
106
|
+
readonly iconPath: Uint8Array;
|
|
107
|
+
readonly tooltip: Uint8Array;
|
|
108
|
+
readonly activationCommand: Uint8Array;
|
|
109
|
+
readonly alternateActivationCommand: Uint8Array;
|
|
110
|
+
readonly openCommand: Uint8Array;
|
|
111
|
+
readonly presentation: StatusItemPresentation;
|
|
112
|
+
readonly items: readonly StatusItemMenuItem[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/// What the user's close affordance does for a model-declared secondary
|
|
116
|
+
/// window. `quit` really closes it and routes `onCloseCommand`; `hide` keeps
|
|
117
|
+
/// the native window and view tree alive for `Cmd.showWindow(label)`.
|
|
118
|
+
export type WindowClosePolicy = "quit" | "hide";
|
|
119
|
+
|
|
120
|
+
export type WindowTitlebarStyle = "standard" | "hidden_inset" | "hidden_inset_tall" | "chromeless";
|
|
121
|
+
|
|
122
|
+
/// Author-facing input to `windowDescriptor`; omitted fields receive the
|
|
123
|
+
/// same defaults as UiApp.WindowDescriptor.
|
|
124
|
+
export interface WindowDescriptorSpec {
|
|
125
|
+
readonly label: Uint8Array;
|
|
126
|
+
readonly canvasLabel: Uint8Array;
|
|
127
|
+
readonly title?: Uint8Array;
|
|
128
|
+
readonly width?: number;
|
|
129
|
+
readonly height?: number;
|
|
130
|
+
readonly x?: number | null;
|
|
131
|
+
readonly y?: number | null;
|
|
132
|
+
readonly resizable?: boolean;
|
|
133
|
+
readonly minWidth?: number;
|
|
134
|
+
readonly minHeight?: number;
|
|
135
|
+
readonly titlebar?: WindowTitlebarStyle;
|
|
136
|
+
readonly transparent?: boolean;
|
|
137
|
+
readonly alwaysOnTop?: boolean;
|
|
138
|
+
readonly clickThrough?: boolean;
|
|
139
|
+
readonly activateOnShow?: boolean;
|
|
140
|
+
readonly allowsFullscreen?: boolean;
|
|
141
|
+
readonly closePolicy?: WindowClosePolicy;
|
|
142
|
+
readonly onCloseCommand?: Uint8Array;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/// One independently reconciled secondary window returned by
|
|
146
|
+
/// `windows(model)`. The generated launcher compiles
|
|
147
|
+
/// `src/windows/<label>.native` as its view; presence is liveness. Construct
|
|
148
|
+
/// entries with `windowDescriptor` and spell `label` as a literal
|
|
149
|
+
/// `asciiBytes("<label>")` so check/build can prove that root exists.
|
|
150
|
+
export interface WindowDescriptor {
|
|
151
|
+
readonly label: Uint8Array;
|
|
152
|
+
readonly canvasLabel: Uint8Array;
|
|
153
|
+
readonly title: Uint8Array;
|
|
154
|
+
readonly width: number;
|
|
155
|
+
readonly height: number;
|
|
156
|
+
readonly x: number | null;
|
|
157
|
+
readonly y: number | null;
|
|
158
|
+
readonly resizable: boolean;
|
|
159
|
+
readonly minWidth: number;
|
|
160
|
+
readonly minHeight: number;
|
|
161
|
+
readonly titlebar: WindowTitlebarStyle;
|
|
162
|
+
readonly transparent: boolean;
|
|
163
|
+
readonly alwaysOnTop: boolean;
|
|
164
|
+
readonly clickThrough: boolean;
|
|
165
|
+
readonly activateOnShow: boolean;
|
|
166
|
+
readonly allowsFullscreen: boolean;
|
|
167
|
+
readonly closePolicy: WindowClosePolicy;
|
|
168
|
+
readonly onCloseCommand: Uint8Array;
|
|
169
|
+
}
|
|
170
|
+
|
|
100
171
|
/// The scroll-state mirror markup's `on-scroll` matches structurally: a
|
|
101
172
|
/// record of exactly these eight numeric fields — the TWO-AXIS shape, one
|
|
102
173
|
/// offset/velocity/viewport/content quartet per axis. Offsets and extents
|