@bake-native/core 0.1.0-rc.0 → 0.1.0-rc.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.
@@ -1,4 +1,4 @@
1
- THIRD-PARTY NOTICES: @bake-native/core 0.1.0-rc.0
1
+ THIRD-PARTY NOTICES: @bake-native/core 0.1.0-rc.1
2
2
  Generated by tools/release/third-party.mjs (https://github.com/gronxb/bake-native). Do not edit.
3
3
 
4
4
  @bake-native/core is licensed under the MIT License (LICENSE). It also contains the third-party
@@ -0,0 +1,137 @@
1
+ // The HTML Standard's CloseWatcher on native targets ("close requests and close watchers", as
2
+ // Chromium implements it: Android's back is a close request). The core keeps the root's
3
+ // close-request stack (bake_core::close_watch): auto popovers, aria-modal dialogs of the page and
4
+ // these watchers, newest on top. `new CloseWatcher()` posts `closeWatcher {id, op: "add"}`; a
5
+ // close request for it comes back as `__bakeDispatch(-1, {type: "closerequest", id})`.
6
+ //
7
+ // Not as in Chromium: an app is not an untrusted page, so watchers created without a user
8
+ // activation are not grouped together, and `cancel` is always cancelable (an app may keep the
9
+ // screen on back, as React Native's BackHandler can).
10
+
11
+ /**
12
+ * Installs `CloseWatcher` on `global`. `post(channel, json)` reaches the core (null: no core,
13
+ * as while baking: watchers then do nothing). Returns the close request handler for watcher id.
14
+ */
15
+ export function installCloseWatcher(global, post) {
16
+ const watchers = new Map();
17
+ let nextId = 1;
18
+ const S = Symbol('closeWatcher');
19
+
20
+ function fire(watcher, type, cancelable) {
21
+ const s = watcher[S];
22
+ let prevented = false;
23
+ const event = {
24
+ type,
25
+ bubbles: false,
26
+ cancelable,
27
+ target: watcher,
28
+ currentTarget: watcher,
29
+ eventPhase: 2,
30
+ isTrusted: true,
31
+ get defaultPrevented() {
32
+ return prevented;
33
+ },
34
+ preventDefault() {
35
+ if (cancelable) prevented = true;
36
+ },
37
+ stopPropagation() {},
38
+ stopImmediatePropagation() {
39
+ event.__immediate = true;
40
+ },
41
+ };
42
+ const handler = s.handlers[type];
43
+ const listeners = [...s.listeners].filter((l) => l.type === type);
44
+ if (typeof handler === 'function') handler.call(watcher, event);
45
+ for (const l of listeners) {
46
+ if (event.__immediate) break;
47
+ if (!s.listeners.has(l)) continue;
48
+ if (l.once) s.listeners.delete(l);
49
+ l.fn.call(watcher, event);
50
+ }
51
+ return !prevented;
52
+ }
53
+
54
+ class CloseWatcher {
55
+ constructor(options) {
56
+ const signal = options?.signal;
57
+ this[S] = { id: 0, active: false, cancelling: false, handlers: { cancel: null, close: null }, listeners: new Set() };
58
+ if (signal?.aborted) return;
59
+ const s = this[S];
60
+ s.id = nextId++;
61
+ s.active = true;
62
+ watchers.set(s.id, this);
63
+ post?.('closeWatcher', JSON.stringify({ id: s.id, op: 'add' }));
64
+ if (signal) {
65
+ const abort = () => this.destroy();
66
+ if (typeof signal.addEventListener === 'function') signal.addEventListener('abort', abort, { once: true });
67
+ }
68
+ }
69
+
70
+ get oncancel() {
71
+ return this[S].handlers.cancel;
72
+ }
73
+ set oncancel(fn) {
74
+ this[S].handlers.cancel = typeof fn === 'function' ? fn : null;
75
+ }
76
+ get onclose() {
77
+ return this[S].handlers.close;
78
+ }
79
+ set onclose(fn) {
80
+ this[S].handlers.close = typeof fn === 'function' ? fn : null;
81
+ }
82
+
83
+ /** As a close request (Android's back) would: `cancel` (cancelable), then `close`. */
84
+ requestClose() {
85
+ const s = this[S];
86
+ if (!s.active || s.cancelling) return;
87
+ s.cancelling = true;
88
+ let go;
89
+ try {
90
+ go = fire(this, 'cancel', true);
91
+ } finally {
92
+ s.cancelling = false;
93
+ }
94
+ if (go) this.close();
95
+ }
96
+
97
+ /** Closes without `cancel`: destroys the watcher, then fires `close`. */
98
+ close() {
99
+ if (!this[S].active) return;
100
+ this.destroy();
101
+ fire(this, 'close', false);
102
+ }
103
+
104
+ /** Takes the watcher off the stack without events. */
105
+ destroy() {
106
+ const s = this[S];
107
+ if (!s.active) return;
108
+ s.active = false;
109
+ watchers.delete(s.id);
110
+ post?.('closeWatcher', JSON.stringify({ id: s.id, op: 'remove' }));
111
+ }
112
+
113
+ addEventListener(type, fn, options) {
114
+ if (typeof fn !== 'function' || (type !== 'cancel' && type !== 'close')) return;
115
+ const once = typeof options === 'object' && options !== null && !!options.once;
116
+ for (const l of this[S].listeners) if (l.type === type && l.fn === fn) return;
117
+ const l = { type, fn, once };
118
+ this[S].listeners.add(l);
119
+ const signal = typeof options === 'object' && options !== null ? options.signal : null;
120
+ if (signal?.aborted) this[S].listeners.delete(l);
121
+ else if (signal && typeof signal.addEventListener === 'function') signal.addEventListener('abort', () => this[S].listeners.delete(l), { once: true });
122
+ }
123
+
124
+ removeEventListener(type, fn) {
125
+ for (const l of this[S].listeners) if (l.type === type && l.fn === fn) this[S].listeners.delete(l);
126
+ }
127
+ }
128
+
129
+ Object.defineProperty(global, 'CloseWatcher', { value: CloseWatcher, writable: true, configurable: true, enumerable: false });
130
+
131
+ return (id) => {
132
+ const watcher = watchers.get(id);
133
+ // Destroyed in JS while the request was on its way: the core forgets it.
134
+ if (!watcher) post?.('closeWatcher', JSON.stringify({ id, op: 'remove' }));
135
+ else watcher.requestClose();
136
+ };
137
+ }
package/compat.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$comment": "The version table: which runtime, host protocol, Hermes bytecode, schemas and Octane this @bake-native/core release builds for, and the toolchain package each host installs (its bin/ tools, apps and libraries, and apple/: the prebuilt Apple runtime iOS and macOS apps link). bake build refuses any other combination (src/compat.ts); tools/check-versions.mjs keeps it equal to the Rust core, the Swift host, the Hermes pin and the toolchain packages. Change versions with tools/release/version.mjs.",
3
- "@bake-native/core": "0.1.0-rc.0",
3
+ "@bake-native/core": "0.1.0-rc.1",
4
4
  "runtime": {
5
- "version": "0.1.0-rc.0",
5
+ "version": "0.1.0-rc.1",
6
6
  "series": "0.1"
7
7
  },
8
8
  "hostProtocol": 4,
@@ -11,7 +11,7 @@
11
11
  "commit": "f7b0b8632a926720a777564d1264c027a95bb49f",
12
12
  "bytecode": 100
13
13
  },
14
- "schemaDigest": "0xa9dcbcdd1891d852",
14
+ "schemaDigest": "0x377ed5b41f9a99cc",
15
15
  "batchDigest": "0xd4c77b3d54621b67",
16
16
  "octane": "0.27.1",
17
17
  "toolchain": {
package/dist/bake.mjs CHANGED
@@ -3,12 +3,12 @@ import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.mjs";
3
3
  import { closeSync, copyFileSync, cpSync, existsSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
4
4
  import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
5
5
  import { C as flag, D as integer, E as float, F as optional, I as withDefault, M as or, N as map, O as string, P as multiple, S as constant, T as choice, _ as inspectRequest, b as argument, g as inspectParser, j as object, l as inspectParsed, w as option, wt as message, x as command } from "./client-Cm7o6dQd.mjs";
6
- import { c as TARGETS, d as targetList$1, f as writeMobileApp, l as loadBakeConfig, n as aarPackageManifest, r as checkAar, s as DEFAULT_CONFIG_TARGETS, t as run, u as resolveTargets } from "./run-D2aPm54a.mjs";
7
- import { A as writeRegistration, C as bundleAppModules, D as registrationFiles, E as checkoutRelative, G as toolchainFor, I as repo, J as execToolBuffer, L as toolProcessEnv, N as defaultHermesc, P as nativeTool, R as COMPAT, S as appViewUnit, T as bundleViews, W as toolchainDir, Z as NOTICES_JSON, a as androidIdentity, b as FAMILY, d as thirdPartyDeclarations, et as mergeComponents, k as targetNativeDeps, n as packageConfig, nt as readNoticesJson, q as execTool, rt as writeOutputNotices, s as integrateThirdParty, tt as placedAt, w as bundleModules, x as appModuleSources } from "./package-KkUSMoji.mjs";
6
+ import { c as TARGETS, d as targetList$1, f as writeMobileApp, l as loadBakeConfig, n as aarPackageManifest, r as checkAar, s as DEFAULT_CONFIG_TARGETS, t as run, u as resolveTargets } from "./run-BtyJGAQB.mjs";
7
+ import { A as writeRegistration, C as bundleAppModules, D as registrationFiles, E as checkoutRelative, G as toolchainFor, I as repo, J as execToolBuffer, L as toolProcessEnv, N as defaultHermesc, P as nativeTool, R as COMPAT, S as appViewUnit, T as bundleViews, W as toolchainDir, Z as NOTICES_JSON, a as androidIdentity, b as FAMILY, d as thirdPartyDeclarations, et as mergeComponents, k as targetNativeDeps, n as packageConfig, nt as readNoticesJson, q as execTool, rt as writeOutputNotices, s as integrateThirdParty, tt as placedAt, w as bundleModules, x as appModuleSources } from "./package-D2aYD6A4.mjs";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
9
9
  import { execFileSync } from "node:child_process";
10
10
  import { createHash } from "node:crypto";
11
- import { A as moduleDir, C as MODULES_DIR, D as compareVersions, E as buildRegistry, F as registryLocation, I as satisfies, J as unpinnedPackages, L as sha256$1, M as openRegistry, N as parseRequest, O as filesFor, P as readLock, S as LOCK_FILE, T as appModules, Ut as packageRoot$1, X as merge3, Y as diffStat, Z as unifiedDiff, _ as specsSchema, at as releaseCheck, f as generateSpecs, j as normalize$1, k as lockEntry, o as viewFiles, r as viewCatalog, s as viewIssues, t as readViewSpec, u as appModuleSpecs, x as ALL_TARGETS, z as writeLock } from "./native-views-BuzB9x5H.mjs";
11
+ import { A as moduleDir, C as MODULES_DIR, D as compareVersions, E as buildRegistry, F as registryLocation, I as satisfies, J as unpinnedPackages, L as sha256$1, M as openRegistry, N as parseRequest, O as filesFor, P as readLock, S as LOCK_FILE, T as appModules, Ut as packageRoot$1, X as merge3, Y as diffStat, Z as unifiedDiff, _ as specsSchema, at as releaseCheck, f as generateSpecs, j as normalize$1, k as lockEntry, o as viewFiles, r as viewCatalog, s as viewIssues, t as readViewSpec, u as appModuleSpecs, x as ALL_TARGETS, z as writeLock } from "./native-views-BQ8TtbQj.mjs";
12
12
  import { n as loadReactCompiler, r as selectRenderer } from "./build-tools-Dxyl6XAf.mjs";
13
13
  // src/apple-runtime.ts
14
14
  /** The runtime's files in the toolchain package's apple/ directory. */
@@ -2128,17 +2128,17 @@ async function main() {
2128
2128
  }
2129
2129
  });
2130
2130
  switch (input.command) {
2131
- case "build": return (await import("./build-CMsvCcZ0.mjs")).buildCommand(await resolveBuildOptions(input));
2131
+ case "build": return (await import("./build-BrSFpaK1.mjs")).buildCommand(await resolveBuildOptions(input));
2132
2132
  case "package": {
2133
2133
  const opts = await resolveBuildOptions(input);
2134
- const { buildCommand, packageCommand } = await import("./build-CMsvCcZ0.mjs");
2134
+ const { buildCommand, packageCommand } = await import("./build-BrSFpaK1.mjs");
2135
2135
  return input.standalone ? buildCommand(opts) : packageCommand(opts);
2136
2136
  }
2137
2137
  case "check": {
2138
2138
  const root = resolve(input.root);
2139
2139
  const config = await loadBakeConfig(root);
2140
2140
  const targets = resolveTargets(input.targets, config, [...platforms]);
2141
- return (await import("./build-CMsvCcZ0.mjs")).checkCommand({
2141
+ return (await import("./build-BrSFpaK1.mjs")).checkCommand({
2142
2142
  root,
2143
2143
  targets,
2144
2144
  json: input.json,
@@ -2156,7 +2156,7 @@ async function main() {
2156
2156
  case "aot": {
2157
2157
  const root = resolve(input.root);
2158
2158
  const config = await loadBakeConfig(root);
2159
- return (await import("./build-CMsvCcZ0.mjs")).aotCommand({
2159
+ return (await import("./build-BrSFpaK1.mjs")).aotCommand({
2160
2160
  root,
2161
2161
  renderer: config?.config.renderer,
2162
2162
  json: input.json,
@@ -2165,7 +2165,7 @@ async function main() {
2165
2165
  });
2166
2166
  }
2167
2167
  case "create": return createCommand(input);
2168
- case "dev": return (await import("./dev-Cskd8Hl4.mjs")).devCommand(await resolveDevOptions(input));
2168
+ case "dev": return (await import("./dev-xZblYmDc.mjs")).devCommand(await resolveDevOptions(input));
2169
2169
  case "add":
2170
2170
  case "diff":
2171
2171
  case "upgrade":
@@ -2191,7 +2191,7 @@ async function main() {
2191
2191
  const args = [bundle];
2192
2192
  for (const [key, value] of Object.entries(options)) if (value !== void 0) args.push("--" + key, String(value));
2193
2193
  const hermesc = defaultHermesc();
2194
- const prelude = hermesc ? { BAKE_FRAME_PRELUDE: (await import("./build-CMsvCcZ0.mjs")).bakePrelude(hermesc) } : {};
2194
+ const prelude = hermesc ? { BAKE_FRAME_PRELUDE: (await import("./build-BrSFpaK1.mjs")).bakePrelude(hermesc) } : {};
2195
2195
  process.stdout.write(execToolBuffer(nativeTool("bake-snap"), args, {
2196
2196
  env: {
2197
2197
  ...toolProcessEnv(),
@@ -1 +1 @@
1
- export { n as aotCommand, i as bakePrelude, a as buildCommand, o as buildTargets, c as checkCommand, l as packageCommand } from "./build-CkLSZw06.mjs";
1
+ export { n as aotCommand, i as bakePrelude, a as buildCommand, o as buildTargets, c as checkCommand, l as packageCommand } from "./build-vAPG2xQv.mjs";
@@ -8,10 +8,10 @@ import { tmpdir } from "node:os";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
9
9
  import { createContext, runInContext } from "node:vm";
10
10
  import { performance } from "node:perf_hooks";
11
- import { $ as bundleComponents, A as writeRegistration, D as registrationFiles, E as checkoutRelative, F as nativeTools, G as toolchainFor, H as hermescPackage, I as repo, L as toolProcessEnv, M as NATIVE_RENDERER, O as targetFiles, P as nativeTool, R as COMPAT, S as appViewUnit, V as hermescBytecode, X as NOTICES, Y as toolTimeout, Z as NOTICES_JSON, _ as run, b as FAMILY, et as mergeComponents, f as TARGET_SLICES, g as productName, h as packageSwift, j as implementationIssues, k as targetNativeDeps, m as buildPackageXCFramework, n as packageConfig, nt as readNoticesJson, p as buildAppXCFramework, q as execTool, r as packageManifest, rt as writeOutputNotices, t as RUNTIME_VERSION, tt as placedAt, u as rangeAccepts, v as runtimeNoticeFiles, x as appModuleSources, y as zipForSwiftPM, z as assertCompatible } from "./package-KkUSMoji.mjs";
11
+ import { $ as bundleComponents, A as writeRegistration, D as registrationFiles, E as checkoutRelative, F as nativeTools, G as toolchainFor, H as hermescPackage, I as repo, L as toolProcessEnv, M as NATIVE_RENDERER, O as targetFiles, P as nativeTool, R as COMPAT, S as appViewUnit, V as hermescBytecode, X as NOTICES, Y as toolTimeout, Z as NOTICES_JSON, _ as run, b as FAMILY, et as mergeComponents, f as TARGET_SLICES, g as productName, h as packageSwift, j as implementationIssues, k as targetNativeDeps, m as buildPackageXCFramework, n as packageConfig, nt as readNoticesJson, p as buildAppXCFramework, q as execTool, r as packageManifest, rt as writeOutputNotices, t as RUNTIME_VERSION, tt as placedAt, u as rangeAccepts, v as runtimeNoticeFiles, x as appModuleSources, y as zipForSwiftPM, z as assertCompatible } from "./package-D2aYD6A4.mjs";
12
12
  import { createRequire } from "node:module";
13
13
  import { r as selectRenderer, t as loadBuildTools } from "./build-tools-Dxyl6XAf.mjs";
14
- import { B as DEPS_RULE, Bt as usesVisibility, Ct as lineStartsOf, Et as originalPosition, Ft as usesDialogs, G as packageDepIssues, Ht as usesWebFetch, It as usesElementApi, J as unpinnedPackages, Lt as usesPageElements, Mt as swiftUiTargetMessage, Nt as uiIssues, Ot as refineLine, P as readLock, Pt as usesCustomProperties, Q as FIRST_PARTY_MODULES, R as verifyModules, Rt as usesPopover, S as LOCK_FILE, St as importLine, T as appModules, Tt as markupIssues, U as nativeDepComponents, Ut as packageRoot, V as NativeDepsError, Vt as usesWebCrypto, _t as dialogWarnings, b as webSpec, bt as headerIconIssues, c as viewRequires, d as calledSpecs, et as bundleRequires, gt as decodeMappings, ht as deadBranches, jt as swiftUiIssues, kt as rootPropParams, m as parseModuleSpec, n as usedViews, nt as cssProperties, pt as componentDeclarations, r as viewCatalog, s as viewIssues, tt as checkUses, u as appModuleSpecs, ut as allowed, vt as freeReferences, wt as liveReferences, xt as hostEmitIssues, yt as globalIssues, zt as usesViewRef } from "./native-views-BuzB9x5H.mjs";
14
+ import { B as DEPS_RULE, Bt as usesVisibility, Ct as lineStartsOf, Et as originalPosition, Ft as usesDialogs, G as packageDepIssues, Ht as usesWebFetch, It as usesElementApi, J as unpinnedPackages, Lt as usesPageElements, Mt as swiftUiTargetMessage, Nt as uiIssues, Ot as refineLine, P as readLock, Pt as usesCustomProperties, Q as FIRST_PARTY_MODULES, R as verifyModules, Rt as usesPopover, S as LOCK_FILE, St as importLine, T as appModules, Tt as markupIssues, U as nativeDepComponents, Ut as packageRoot, V as NativeDepsError, Vt as usesWebCrypto, _t as dialogWarnings, b as webSpec, bt as headerIconIssues, c as viewRequires, d as calledSpecs, et as bundleRequires, gt as decodeMappings, ht as deadBranches, jt as swiftUiIssues, kt as rootPropParams, m as parseModuleSpec, n as usedViews, nt as cssProperties, pt as componentDeclarations, r as viewCatalog, s as viewIssues, tt as checkUses, u as appModuleSpecs, ut as allowed, vt as freeReferences, wt as liveReferences, xt as hostEmitIssues, yt as globalIssues, zt as usesViewRef } from "./native-views-BQ8TtbQj.mjs";
15
15
  import { r as scope_exports } from "./scope-8W2aIuQ9.mjs";
16
16
  import { i as intlUses, n as HERMES_TARGETS, r as intlMessage } from "./intl-ROnAp2qO.mjs";
17
17
  // lower-views.mjs
@@ -3827,6 +3827,7 @@ function styleTagLines(text) {
3827
3827
  * dependencies). */
3828
3828
  function intlLint(root, target) {
3829
3829
  const errors = [];
3830
+ const realRoot = realpathOr(root);
3830
3831
  return {
3831
3832
  errors,
3832
3833
  plugin: {
@@ -3846,6 +3847,7 @@ function intlLint(root, target) {
3846
3847
  try {
3847
3848
  text = readFileSync(file, "utf8");
3848
3849
  } catch {}
3850
+ const source = relative(realRoot, realpathOr(file)).replaceAll("\\", "/");
3849
3851
  const seen = {};
3850
3852
  for (const u of uses) {
3851
3853
  const needle = new RegExp(`\\bIntl\\s*(?:\\.\\s*|\\[\\s*['"\`])${u.name}\\b|\\b${u.name}\\b(?=[^=]*\\}\\s*=\\s*Intl\\b)`, "g");
@@ -3854,7 +3856,7 @@ function intlLint(root, target) {
3854
3856
  const at = hits.length ? hits[Math.min(k, hits.length - 1)] : -1;
3855
3857
  const before = at >= 0 ? text.slice(0, at) : "";
3856
3858
  errors.push({
3857
- file: relative(root, file).replaceAll("\\", "/"),
3859
+ file: source,
3858
3860
  line: at >= 0 ? before.split("\n").length : 1,
3859
3861
  column: at >= 0 ? at - before.lastIndexOf("\n") : 1,
3860
3862
  id: "intl-unsupported",
package/dist/compiler.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { parseSync } from "@tsrx/oxc/parser";
2
- import { At as styleCss, Ct as lineStartsOf, Dt as patternNames, Gt as checkElement, a as viewDeclarations, dt as checkImageSourceSyntax, ft as checkSafeAreaEdgesSyntax, gt as decodeMappings, i as viewClientParts, lt as VIEW_ELEMENTS, mt as constNumber, st as SUPPORT } from "./native-views-BuzB9x5H.mjs";
2
+ import { At as styleCss, Ct as lineStartsOf, Dt as patternNames, Gt as checkElement, a as viewDeclarations, dt as checkImageSourceSyntax, ft as checkSafeAreaEdgesSyntax, gt as decodeMappings, i as viewClientParts, lt as VIEW_ELEMENTS, mt as constNumber, st as SUPPORT } from "./native-views-BQ8TtbQj.mjs";
3
3
  import { n as UI_SWIFT_STYLE_KEYS, t as UI_COMPONENTS } from "./scope-8W2aIuQ9.mjs";
4
4
  export { SUPPORT, UI_COMPONENTS, UI_SWIFT_STYLE_KEYS, VIEW_ELEMENTS, checkElement, checkImageSourceSyntax, checkSafeAreaEdgesSyntax, constNumber, decodeMappings, lineStartsOf, parseSync, patternNames, styleCss, viewClientParts, viewDeclarations };
@@ -4,8 +4,8 @@ import { createServer } from "node:http";
4
4
  import { basename, extname, join, resolve, sep } from "node:path";
5
5
  import { performance } from "node:perf_hooks";
6
6
  import { promisify } from "node:util";
7
- import { o as buildTargets } from "./build-CkLSZw06.mjs";
8
- import { I as repo, U as packagedTool } from "./package-KkUSMoji.mjs";
7
+ import { o as buildTargets } from "./build-vAPG2xQv.mjs";
8
+ import { I as repo, U as packagedTool } from "./package-D2aYD6A4.mjs";
9
9
  // src/devices.mjs
10
10
  /** The booted simulator bake dev uses: `udid` when given (it must be booted), else the only booted one. */
11
11
  function pickSimulator(devices, udid) {
@@ -235,13 +235,17 @@ async function devCommand(opts) {
235
235
  for (const f of files) if (!pending.files.includes(f)) pending.files.push(f);
236
236
  schedule();
237
237
  }
238
- const watcher = opts.once ? null : watch(opts.root, { recursive: true }, (_type, filename) => {
238
+ const watchStartedAt = process.platform === "darwin" ? performance.timeOrigin + performance.now() : 0;
239
+ const watcher = opts.once ? null : watch(opts.root, { recursive: true }, (type, filename) => {
239
240
  const rel = filename ? String(filename) : "";
240
241
  if (!watchedChange(rel)) return;
241
242
  const file = rel.replaceAll("\\", "/");
242
243
  try {
243
- if (statSync(join(opts.root, rel)).isDirectory()) return;
244
- } catch {}
244
+ const stat = statSync(join(opts.root, rel));
245
+ if (stat.isDirectory() || watchStartedAt && stat.ctimeMs < watchStartedAt) return;
246
+ } catch (error) {
247
+ if (watchStartedAt && error.code === "ENOENT" && type === "change" && rel === basename(opts.root)) return;
248
+ }
245
249
  if (NATIVE_SOURCES.has(extname(file).toLowerCase())) {
246
250
  emit({
247
251
  event: "notice",
@@ -95,22 +95,102 @@ var elements = {
95
95
  "spellCheck",
96
96
  "suppressNativeChangeWarning"
97
97
  ],
98
- "values": { "type": [
99
- "text",
100
- "password",
101
- "email",
102
- "search",
103
- "tel",
104
- "url",
105
- "number",
106
- "checkbox",
107
- "radio",
108
- "range",
109
- "date",
110
- "time",
111
- "datetime-local",
112
- "color"
113
- ] }
98
+ "values": {
99
+ "type": [
100
+ "text",
101
+ "password",
102
+ "email",
103
+ "search",
104
+ "tel",
105
+ "url",
106
+ "number",
107
+ "checkbox",
108
+ "radio",
109
+ "range",
110
+ "date",
111
+ "time",
112
+ "datetime-local",
113
+ "color"
114
+ ],
115
+ "inputmode": [
116
+ "none",
117
+ "text",
118
+ "decimal",
119
+ "numeric",
120
+ "tel",
121
+ "search",
122
+ "email",
123
+ "url"
124
+ ],
125
+ "inputMode": [
126
+ "none",
127
+ "text",
128
+ "decimal",
129
+ "numeric",
130
+ "tel",
131
+ "search",
132
+ "email",
133
+ "url"
134
+ ],
135
+ "enterkeyhint": [
136
+ "enter",
137
+ "done",
138
+ "go",
139
+ "next",
140
+ "previous",
141
+ "search",
142
+ "send"
143
+ ],
144
+ "enterKeyHint": [
145
+ "enter",
146
+ "done",
147
+ "go",
148
+ "next",
149
+ "previous",
150
+ "search",
151
+ "send"
152
+ ],
153
+ "autocapitalize": [
154
+ "none",
155
+ "off",
156
+ "sentences",
157
+ "on",
158
+ "words",
159
+ "characters"
160
+ ],
161
+ "autoCapitalize": [
162
+ "none",
163
+ "off",
164
+ "sentences",
165
+ "on",
166
+ "words",
167
+ "characters"
168
+ ],
169
+ "autocorrect": [
170
+ "",
171
+ "on",
172
+ "off",
173
+ "true",
174
+ "false"
175
+ ],
176
+ "autoCorrect": [
177
+ "",
178
+ "on",
179
+ "off",
180
+ "true",
181
+ "false"
182
+ ],
183
+ "spellcheck": [
184
+ "",
185
+ "true",
186
+ "false"
187
+ ],
188
+ "spellCheck": [
189
+ "",
190
+ "true",
191
+ "false"
192
+ ]
193
+ }
114
194
  },
115
195
  "kbd": {},
116
196
  "label": { "attributes": ["for", "htmlFor"] },
@@ -148,29 +228,111 @@ var elements = {
148
228
  "span": {},
149
229
  "strong": {},
150
230
  "summary": {},
151
- "textarea": { "attributes": [
152
- "value",
153
- "defaultValue",
154
- "disabled",
155
- "placeholder",
156
- "name",
157
- "rows",
158
- "maxlength",
159
- "maxLength",
160
- "inputmode",
161
- "inputMode",
162
- "enterkeyhint",
163
- "enterKeyHint",
164
- "autocomplete",
165
- "autoComplete",
166
- "autocorrect",
167
- "autoCorrect",
168
- "autocapitalize",
169
- "autoCapitalize",
170
- "spellcheck",
171
- "spellCheck",
172
- "suppressNativeChangeWarning"
173
- ] },
231
+ "textarea": {
232
+ "attributes": [
233
+ "value",
234
+ "defaultValue",
235
+ "disabled",
236
+ "placeholder",
237
+ "name",
238
+ "rows",
239
+ "maxlength",
240
+ "maxLength",
241
+ "inputmode",
242
+ "inputMode",
243
+ "enterkeyhint",
244
+ "enterKeyHint",
245
+ "autocomplete",
246
+ "autoComplete",
247
+ "autocorrect",
248
+ "autoCorrect",
249
+ "autocapitalize",
250
+ "autoCapitalize",
251
+ "spellcheck",
252
+ "spellCheck",
253
+ "suppressNativeChangeWarning"
254
+ ],
255
+ "values": {
256
+ "inputmode": [
257
+ "none",
258
+ "text",
259
+ "decimal",
260
+ "numeric",
261
+ "tel",
262
+ "search",
263
+ "email",
264
+ "url"
265
+ ],
266
+ "inputMode": [
267
+ "none",
268
+ "text",
269
+ "decimal",
270
+ "numeric",
271
+ "tel",
272
+ "search",
273
+ "email",
274
+ "url"
275
+ ],
276
+ "enterkeyhint": [
277
+ "enter",
278
+ "done",
279
+ "go",
280
+ "next",
281
+ "previous",
282
+ "search",
283
+ "send"
284
+ ],
285
+ "enterKeyHint": [
286
+ "enter",
287
+ "done",
288
+ "go",
289
+ "next",
290
+ "previous",
291
+ "search",
292
+ "send"
293
+ ],
294
+ "autocapitalize": [
295
+ "none",
296
+ "off",
297
+ "sentences",
298
+ "on",
299
+ "words",
300
+ "characters"
301
+ ],
302
+ "autoCapitalize": [
303
+ "none",
304
+ "off",
305
+ "sentences",
306
+ "on",
307
+ "words",
308
+ "characters"
309
+ ],
310
+ "autocorrect": [
311
+ "",
312
+ "on",
313
+ "off",
314
+ "true",
315
+ "false"
316
+ ],
317
+ "autoCorrect": [
318
+ "",
319
+ "on",
320
+ "off",
321
+ "true",
322
+ "false"
323
+ ],
324
+ "spellcheck": [
325
+ "",
326
+ "true",
327
+ "false"
328
+ ],
329
+ "spellCheck": [
330
+ "",
331
+ "true",
332
+ "false"
333
+ ]
334
+ }
335
+ },
174
336
  "time": {},
175
337
  "u": {},
176
338
  "ul": {},
@@ -299,6 +461,9 @@ var elements = {
299
461
  "glasseffectcontainer",
300
462
  "text",
301
463
  "label",
464
+ "contentunavailableview",
465
+ "labeledcontent",
466
+ "link",
302
467
  "image",
303
468
  "progressview",
304
469
  "button",
@@ -311,6 +476,8 @@ var elements = {
311
476
  "form",
312
477
  "list",
313
478
  "section",
479
+ "swipeactions",
480
+ "swipeactiongroup",
314
481
  "navigationstack",
315
482
  "toolbaritem",
316
483
  "bakeview",
@@ -758,6 +925,8 @@ var attributes = {
758
925
  "main",
759
926
  "menu",
760
927
  "menuitem",
928
+ "menuitemcheckbox",
929
+ "menuitemradio",
761
930
  "meter",
762
931
  "navigation",
763
932
  "none",
@@ -802,15 +971,35 @@ var attributes = {
802
971
  "undefined"
803
972
  ]
804
973
  },
805
- "valueTargets": { "dir": { "rtl": {
806
- "targets": [
807
- "ios",
808
- "mac",
809
- "android"
810
- ],
811
- "why": "the text backend of this target shapes paragraphs left to right (the same as `direction: rtl`, css-direction)",
812
- "instead": "leave the default (ltr) on this target"
813
- } } },
974
+ "valueTargets": {
975
+ "enterkeyhint": { "previous": {
976
+ "targets": [
977
+ "android",
978
+ "mac",
979
+ "windows"
980
+ ],
981
+ "why": "UIKit has no Previous return key",
982
+ "instead": "choose another enterkeyhint for iOS"
983
+ } },
984
+ "enterKeyHint": { "previous": {
985
+ "targets": [
986
+ "android",
987
+ "mac",
988
+ "windows"
989
+ ],
990
+ "why": "UIKit has no Previous return key",
991
+ "instead": "choose another enterKeyHint for iOS"
992
+ } },
993
+ "dir": { "rtl": {
994
+ "targets": [
995
+ "ios",
996
+ "mac",
997
+ "android"
998
+ ],
999
+ "why": "the text backend of this target shapes paragraphs left to right (the same as `direction: rtl`, css-direction)",
1000
+ "instead": "leave the default (ltr) on this target"
1001
+ } }
1002
+ },
814
1003
  "unsupported": {
815
1004
  "controls": {
816
1005
  "why": "native targets draw no media controls yet: each platform player has its own (AVKit, Media Foundation, Android) and none matches Chromium's, so the same markup would look different on every target",
@@ -981,6 +1170,11 @@ var events = {
981
1170
  "event": "click",
982
1171
  "note": "alias of onClick"
983
1172
  },
1173
+ "onBeforeInput": {
1174
+ "event": "beforeinput",
1175
+ "capture": true,
1176
+ "targets": ["ios", "android"]
1177
+ },
984
1178
  "onInput": {
985
1179
  "event": "input",
986
1180
  "elements": [
@@ -1314,8 +1508,8 @@ var events = {
1314
1508
  "instead": "nothing yet"
1315
1509
  },
1316
1510
  "onBefore": {
1317
- "why": "beforeinput / beforetoggle are not delivered",
1318
- "instead": "onInput / onToggle"
1511
+ "why": "beforetoggle is not delivered",
1512
+ "instead": "onToggle"
1319
1513
  },
1320
1514
  "onGot": {
1321
1515
  "why": "pointer capture is not implemented",
@@ -7118,7 +7312,9 @@ function swift(v, source) {
7118
7312
  L.push(`//`);
7119
7313
  L.push(`// Threads: the class is @MainActor (makeView, the setters, propsUpdated and the command bodies run`);
7120
7314
  L.push(`// on main); the emit and call methods are nonisolated (any thread).`);
7315
+ if (!v.commands.length) L.push("#if canImport(BakeNativeNativeViews)");
7121
7316
  L.push(`import BakeNativeNativeViews`);
7317
+ if (!v.commands.length) L.push("#endif");
7122
7318
  L.push(swiftBakeNativeImports(["BakeNativeKit", "BakeNativeAppKit"]).trimEnd());
7123
7319
  L.push("");
7124
7320
  L.push(doc("", v.doc) + `open class ${v.name}ViewSpec<V: AnyObject>: BakeNativeNativeView<V> {`);
@@ -7179,6 +7375,7 @@ function swift(v, source) {
7179
7375
  L.push(` setState(view, next)`);
7180
7376
  L.push(` propsUpdated(view)`);
7181
7377
  L.push(` }`);
7378
+ if (!v.commands.length) return [...L, "}"].join("\n") + "\n";
7182
7379
  L.push("");
7183
7380
  L.push(` // MARK: generated (JSI host functions -> commands; ${v.name}ViewJSI.h calls these through C++ interop)`);
7184
7381
  for (const c of v.commands) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@bake-native/octane",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.1.0-rc.1",
4
4
  "peerDependencies": {}
5
5
  }
@@ -1,4 +1,4 @@
1
- import { $ as RUNTIME_PROVIDES, H as mergeNativeDeps, K as readNativeDeps, P as readLock, Ut as packageRoot$1, W as nativeDepLibraries, Wt as readPackageJson, _ as specsSchema, ct as SYSTEM_MODULES, d as calledSpecs, g as snake, h as rustSpec, it as memberSignatures, l as appModuleFiles, o as viewFiles, ot as satisfies, p as kotlinSpec, q as unitPath, rt as defaultRuntimeRange, t as readViewSpec, u as appModuleSpecs, v as swiftBakeNativeImports, y as swiftSpec } from "./native-views-BuzB9x5H.mjs";
1
+ import { $ as RUNTIME_PROVIDES, H as mergeNativeDeps, K as readNativeDeps, P as readLock, Ut as packageRoot$1, W as nativeDepLibraries, Wt as readPackageJson, _ as specsSchema, ct as SYSTEM_MODULES, d as calledSpecs, g as snake, h as rustSpec, it as memberSignatures, l as appModuleFiles, o as viewFiles, ot as satisfies, p as kotlinSpec, q as unitPath, rt as defaultRuntimeRange, t as readViewSpec, u as appModuleSpecs, v as swiftBakeNativeImports, y as swiftSpec } from "./native-views-BQ8TtbQj.mjs";
2
2
  import { chmodSync, closeSync, copyFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
@@ -865,7 +865,7 @@ const header = (c, target, units) => `${c} Generated by \`bake native link\` fro
865
865
  * `prebuilt` (ios, mac): `bakenative` is the prebuilt runtime an npm install brings
866
866
  * (src/apple-runtime.ts), a Swift package with the host products only (BakeNativeKit, BakeNativeAppKit).
867
867
  * A bundle that needs more of the BakeNative package (a first-party module the app has no copy of,
868
- * a native view) is refused with what to do.
868
+ * a built-in view or a view with commands) is refused with what to do.
869
869
  * `out`: the directory the files go to; the native dependencies' local paths (binary targets,
870
870
  * jniLibs, source folders, path crates) are written relative to it.
871
871
  * @param {string} target @param {string[]} names @param {{ bakenative?: string, prebuilt?: boolean, views?: { name: string, unit: any, signature?: string }[], minSdk?: number, app?: { name: string, module: string, locked?: boolean, files: { path: string, text: string }[], deps?: any }[], appModules?: { required: string[], optional: string[] }, specs?: Map<string, any>, out?: string }} [opts]
@@ -880,7 +880,8 @@ function registrationFiles(target, names, { bakenative, prebuilt = false, views
880
880
  if (family === "apple" && prebuilt) {
881
881
  const problems = [];
882
882
  if (units.length) problems.push(`the bundle uses ${list(units)} without a copy in the app: add ${units.length === 1 ? "it" : "them"} with \`bake add ${units.map((u) => u.name.toLowerCase()).join(" ")}\``);
883
- if (v.length) problems.push(`the bundle renders the native view${v.length === 1 ? "" : "s"} ${v.map((x) => x.name).join(", ")}, whose glue compiles against the core's headers`);
883
+ const sourceViews = v.filter(({ unit }) => !unit.app || unit.spec.commands.length);
884
+ if (sourceViews.length) problems.push(`the bundle renders the native view${sourceViews.length === 1 ? "" : "s"} ${sourceViews.map((x) => x.name).join(", ")}, which needs the source checkout`);
884
885
  if (problems.length) throw new Error(`the prebuilt Apple runtime has the ${target} host only (${target === "ios" ? "BakeNativeKit" : "BakeNativeAppKit"}): ${problems.join("; ")}. Or build against an BakeNative source checkout: bake native link --target ${target} --bakenative <checkout>`);
885
886
  }
886
887
  const called = calledSpecs(specs, appModules);
@@ -896,7 +897,7 @@ function registrationFiles(target, names, { bakenative, prebuilt = false, views
896
897
  if (!out) throw new Error(`registration for ${target}: native dependencies with local paths need the output directory (out)`);
897
898
  return unitPath(out, abs);
898
899
  };
899
- if (family === "apple") return [...appleFiles(target, units, bakenative, v, mods, auto, deps, where), ...ownFiles];
900
+ if (family === "apple") return [...appleFiles(target, units, bakenative, v, mods, auto, deps, where, prebuilt), ...ownFiles];
900
901
  if (family === "android") return [...androidFiles(target, units, v, minSdk, mods, auto, deps, where), ...ownFiles];
901
902
  return [...windowsFiles(target, units, bakenative, v, mods, auto, contracts, deps, where), ...ownFiles];
902
903
  }
@@ -930,8 +931,8 @@ const TEST = /(Tests?\.swift|Test\.kt|_test\.rs)$/;
930
931
  /**
931
932
  * The build unit of a view the app declares itself (`native/views/<Name>.native.ts`, its
932
933
  * implementation at package.json "bakenative".views.<Name>.<family>), for `target`: on Apple the
933
- * generated registration compiles it as three targets of its own package (the JSI glue, the
934
- * generated base, the app's implementation). Android copies commandless Kotlin views and their
934
+ * generated registration compiles the generated base, the app's implementation, and the JSI
935
+ * glue if the view has commands. Android copies commandless Kotlin views and their
935
936
  * contracts into its registration module. Windows registers built-in views only.
936
937
  */
937
938
  function appViewUnit(root, entry, target) {
@@ -1033,14 +1034,16 @@ function appleTargetDeps(d) {
1033
1034
  settings: d.apple.frameworks.length ? `, linkerSettings: [${d.apple.frameworks.map((f) => `.linkedFramework(${q(f)})`).join(", ")}]` : ""
1034
1035
  };
1035
1036
  }
1036
- function appleFiles(target, units, bakenative, views, mods, auto = [], deps = null, where = null) {
1037
+ function appleFiles(target, units, bakenative, views, mods, auto, deps, where, prebuilt) {
1037
1038
  const host = target === "ios" ? "BakeNativeKit" : "BakeNativeAppKit";
1038
1039
  const own = views.filter((v) => v.unit.app);
1040
+ const viewRuntime = prebuilt ? host : "BakeNativeNativeViews";
1041
+ const hasCommands = own.some(({ unit }) => unit.spec.commands.length);
1039
1042
  const products = [
1040
1043
  host,
1041
1044
  ...units.map((u) => u.unit.product),
1042
1045
  ...views.filter((v) => !v.unit.app).map((v) => v.unit.product),
1043
- ...own.length ? ["BakeNativeNativeViews"] : []
1046
+ ...own.length && !prebuilt ? [viewRuntime] : []
1044
1047
  ];
1045
1048
  const all = deps?.all.apple ?? {
1046
1049
  packages: [],
@@ -1053,7 +1056,7 @@ function appleFiles(target, units, bakenative, views, mods, auto = [], deps = nu
1053
1056
  ${header("//", target, units)}// The app target depends on the product BakeNativeAppModules and registers BakeNativeBundleModules.entries
1054
1057
  // in its app-layer module registry. A module the bundles do not use is not linked.
1055
1058
  import PackageDescription
1056
- ${own.length ? `import Foundation\n\nlet bakeNativePath = ${JSON.stringify(bakenative)}\n${appViewIncludes}` : ""}
1059
+ ${hasCommands ? `import Foundation\n\nlet bakeNativePath = ${JSON.stringify(bakenative)}\n${appViewIncludes}` : ""}
1057
1060
  let package = Package(
1058
1061
  name: "BakeNativeAppModules",
1059
1062
  platforms: [.macOS("14.0"), .iOS("16.0")],
@@ -1062,8 +1065,8 @@ let package = Package(
1062
1065
  targets: [
1063
1066
  .target(name: "BakeNativeAppModules", dependencies: [
1064
1067
  ${products.map((p) => ` .product(name: "${p}", package: "BakeNative"),`).join("\n")}${own.map((v) => `\n "${v.unit.product}",`).join("")}${mine.entries.map((e) => `\n ${e},`).join("")}
1065
- ]${mine.settings}),${own.map((v) => appViewTargets(v.unit)).join("")}${binaries}
1066
- ]${own.length ? ",\n cxxLanguageStandard: .cxx17" : ""}
1068
+ ]${mine.settings}),${own.map((v) => appViewTargets(v.unit, viewRuntime)).join("")}${binaries}
1069
+ ]${hasCommands ? ",\n cxxLanguageStandard: .cxx17" : ""}
1067
1070
  )
1068
1071
  `;
1069
1072
  const swift = `${header("//", target, units)}${swiftBakeNativeImports([host])}
@@ -1105,18 +1108,18 @@ let bakeNativeDir = URL(fileURLWithPath: bakeNativePath, relativeTo: URL(fileURL
1105
1108
  let viewHeaders: [String] = ["native/hermes/artifacts/include", "native/hermes/BakeNativeJSI/include", "native/rust/apple/Sources/CBakeNativeRust/include"]
1106
1109
  .flatMap { ["-I", bakeNativeDir + "/" + $0] }
1107
1110
  `;
1108
- /** One app view as three targets: `<Name>ViewJSI` (C++, the module the interop imports), the
1109
- * generated base `BakeNativeAppView<Name>Spec` (Swift with C++ interop) and the app's
1110
- * implementation `BakeNativeAppView<Name>`. */
1111
- function appViewTargets(u) {
1111
+ /** The generated Swift base and the app implementation, plus C++ interop for commands. */
1112
+ function appViewTargets(u, runtime) {
1112
1113
  const n = u.spec.name;
1113
1114
  const at = `Sources/AppViews/${n}`;
1114
1115
  const d = appleTargetDeps(u.deps);
1115
- return `
1116
- .target(name: "${n}ViewJSI", path: "${at}/JSI", cxxSettings: [.unsafeFlags(viewHeaders)]),
1117
- .target(name: "${u.specModule}", dependencies: [.product(name: "BakeNativeNativeViews", package: "BakeNative"), "${n}ViewJSI"], path: "${at}/Spec",
1118
- swiftSettings: [.interoperabilityMode(.Cxx), .unsafeFlags(["-Xfrontend", "-disable-cxx-interop-requirement-at-import"])]),
1119
- .target(name: "${u.product}", dependencies: [.product(name: "BakeNativeNativeViews", package: "BakeNative"), "${u.specModule}"${d.entries.map((e) => `, ${e}`).join("")}], path: "${at}/View"${d.settings}),`;
1116
+ const host = `.product(name: "${runtime}", package: "BakeNative")`;
1117
+ const commands = u.spec.commands.length > 0;
1118
+ const jsi = commands ? `\n .target(name: "${n}ViewJSI", path: "${at}/JSI", cxxSettings: [.unsafeFlags(viewHeaders)]),` : "";
1119
+ const interop = commands ? `,\n swiftSettings: [.interoperabilityMode(.Cxx), .unsafeFlags(["-Xfrontend", "-disable-cxx-interop-requirement-at-import"])]` : "";
1120
+ return `${jsi}
1121
+ .target(name: "${u.specModule}", dependencies: [${host}${commands ? `, "${n}ViewJSI"` : ""}], path: "${at}/Spec"${interop}),
1122
+ .target(name: "${u.product}", dependencies: [${host}, "${u.specModule}"${d.entries.map((e) => `, ${e}`).join("")}], path: "${at}/View"${d.settings}),`;
1120
1123
  }
1121
1124
  /** An app view's files in the package: the generated Apple glue and the implementation. */
1122
1125
  function appViewSources(u) {
@@ -1125,26 +1128,28 @@ function appViewSources(u) {
1125
1128
  const gen = viewFiles(u.spec);
1126
1129
  const pick = (p) => gen.find((f) => f.path === p)?.text ?? "";
1127
1130
  return [
1128
- {
1129
- path: `Sources/AppViews/${n}ViewJSI.h`,
1130
- text: pick(`${n}ViewJSI.h`)
1131
- },
1132
- {
1133
- path: `${at}/JSI/${n}ViewJSIApple.cpp`,
1134
- text: pick(`apple/${n}ViewJSI/${n}ViewJSIApple.cpp`)
1135
- },
1136
- {
1137
- path: `${at}/JSI/include/${n}ViewJSIApple.h`,
1138
- text: pick(`apple/${n}ViewJSI/include/${n}ViewJSIApple.h`)
1139
- },
1140
1131
  {
1141
1132
  path: `${at}/Spec/${n}ViewSpec.swift`,
1142
1133
  text: pick(`apple/${n}ViewSpec/${n}ViewSpec.swift`)
1143
1134
  },
1144
- {
1145
- path: `${at}/Spec/${n}ViewInterop.swift`,
1146
- text: pick(`apple/${n}ViewSpec/${n}ViewInterop.swift`)
1147
- },
1135
+ ...u.spec.commands.length ? [
1136
+ {
1137
+ path: `Sources/AppViews/${n}ViewJSI.h`,
1138
+ text: pick(`${n}ViewJSI.h`)
1139
+ },
1140
+ {
1141
+ path: `${at}/JSI/${n}ViewJSIApple.cpp`,
1142
+ text: pick(`apple/${n}ViewJSI/${n}ViewJSIApple.cpp`)
1143
+ },
1144
+ {
1145
+ path: `${at}/JSI/include/${n}ViewJSIApple.h`,
1146
+ text: pick(`apple/${n}ViewJSI/include/${n}ViewJSIApple.h`)
1147
+ },
1148
+ {
1149
+ path: `${at}/Spec/${n}ViewInterop.swift`,
1150
+ text: pick(`apple/${n}ViewSpec/${n}ViewInterop.swift`)
1151
+ }
1152
+ ] : [],
1148
1153
  ...u.files.map((f) => ({
1149
1154
  path: `${at}/View/${f.path}`,
1150
1155
  text: f.text.replace(/\r\n/g, "\n")
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bake-native/react",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.1.0-rc.1",
4
4
  "peerDependencies": {
5
5
  "react": "^19.3.0",
6
6
  "react-dom": "^19.3.0"
@@ -1,6 +1,6 @@
1
1
  import { t as bundledFonts } from "./config-B1W8gfZY.mjs";
2
2
  import { $ as createInputTrace, A as longestMatch, B as hiddenCommandAliasesKey, C as flag, Ct as lineBreak, Dt as value, Et as text, F as optional, G as collectExplicitSourceValuesAsync, H as collectRootOptionNames, I as withDefault, J as attemptParseSync, K as createDependencyRuntimeContext, L as getJoinedFileSuggestion, O as string, Ot as cacheTerminalTheme, P as multiple, Q as getDocPageForConsumedPrefix, R as completeOrExtractPhase2Seed, S as constant, St as formatMessage, Tt as optionName, U as projectCommandUsage, V as collectActiveOptionNames, W as collectExplicitSourceValues, X as createParserContext, Y as createEffectfulCompletionSession, Z as getDocPage, _t as validateMetaNameCollisions, at as minimumUsageWidth, b as argument, bt as injectAnnotations, ct as spaceAfterLabel, dt as formatUsageTerm, et as dispatchByMode, ft as isSuggestionHidden, gt as validateLabel, ht as validateContextIds, it as hasAutomaticWidth, j as object, k as group$2, kt as renderTerminalTerm, lt as cloneUsage, mt as validateCommandNames, nt as isDocEntryHidden, ot as withAutomaticWidth, pt as normalizeUsage, q as attemptParseAsync, rt as renderErrorMessage, st as measureText, tt as formatDocPage, ut as formatUsage, vt as validateOptionNames, w as option, wt as message, x as command, xt as commandLine, yt as validateProgramName$1, z as allowDuplicateLeadingCommandNamesKey } from "./client-Cm7o6dQd.mjs";
3
- import { Q as appEntries, i as ANDROID_RUNTIME, l as parseRange, o as formatRange, u as rangeAccepts } from "./package-KkUSMoji.mjs";
3
+ import { Q as appEntries, i as ANDROID_RUNTIME, l as parseRange, o as formatRange, u as rangeAccepts } from "./package-D2aYD6A4.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import fs, { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
6
6
  import path, { basename, dirname, extname, isAbsolute, join, parse as parse$1, relative, resolve, sep } from "node:path";
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@bake-native/screens",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.0.1",
4
4
  "peerDependencies": {}
5
5
  }
package/host-runtime.js CHANGED
@@ -16,6 +16,7 @@ import { installVisibility } from './visibility.js';
16
16
  import { installElementApi } from './element-api.js';
17
17
  import { installMediaElement } from './media-element.js';
18
18
  import { installPageElements } from './page-elements.js';
19
+ import { installCloseWatcher } from './close-watcher.js';
19
20
  import { nativeViewRefs } from './view-ref-writer.js';
20
21
  import { bakeProps, installBakeTraps, takePropReads, throwIfRead } from './first-screen.js';
21
22
 
@@ -95,6 +96,9 @@ if (sendBinary) {
95
96
  // fetch rejects there.
96
97
  // Bundled only when the app names one of these globals (bake build, __BAKE_WEB_FETCH__).
97
98
  if (__BAKE_WEB_FETCH__) installWebFetch(globalThis, sendBinary ? post : null);
99
+ // CloseWatcher: Android's back, Escape and other close requests (close-watcher.js); the core keeps
100
+ // the stack and asks a watcher through __bakeDispatch(-1, {type: 'closerequest', id}).
101
+ const closeRequest = installCloseWatcher(globalThis, sendBinary ? post : null);
98
102
  // crypto.getRandomValues / randomUUID from the OS CSPRNG (web-crypto.js, the core's
99
103
  // __bakeRandomWords). Installed before the app module runs, so the bake's traps (installed at
100
104
  // mount) see it. Bundled only when the app names `crypto` (bake build, __BAKE_WEB_CRYPTO__).
@@ -346,9 +350,11 @@ function dispatchDomEvent(root, message, isInactiveListenerError) {
346
350
  let stopped = false;
347
351
  let immediate = false;
348
352
  let prevented = false;
353
+ const eventTarget = element(target);
354
+ if (eventTarget && typeof payload.target?.value === 'string') eventTarget.value = payload.target.value;
349
355
  const event = Object.assign({}, payload, {
350
356
  type,
351
- target: element(target),
357
+ target: eventTarget,
352
358
  currentTarget: null,
353
359
  relatedTarget: element(related),
354
360
  eventPhase: 0,
@@ -432,6 +438,13 @@ export function mountNative(App, adapter) {
432
438
  // the element it happened on, so that element is the currentTarget while the listener runs, as
433
439
  // in the DOM, and null once dispatch is over. The core sends the element's fields as `target`.
434
440
  globalThis.__bakeDispatch = (listener, payload) => {
441
+ // A close request for a CloseWatcher (bake_core::close_watch::CLOSE_WATCHER_LISTENER): a
442
+ // discrete user event, as a click.
443
+ if (listener === -1) {
444
+ if (root.eventScope) root.eventScope('discrete', () => closeRequest(payload.id));
445
+ else closeRequest(payload.id);
446
+ return true;
447
+ }
435
448
  payload = (mediaApi ? mediaApi.event(payload, element) : payload) ?? {};
436
449
  const at = payload.currentTarget ?? payload.target;
437
450
  const own = at != null && typeof at === 'object';
@@ -76,6 +76,16 @@ interface AbortSignal {
76
76
  declare var AbortSignal: { prototype: AbortSignal; abort(reason?: any): AbortSignal; timeout(ms: number): AbortSignal; any(signals: Iterable<AbortSignal>): AbortSignal };
77
77
  interface AbortController { readonly signal: AbortSignal; abort(reason?: any): void }
78
78
  declare var AbortController: { new (): AbortController; prototype: AbortController };
79
+ // CloseWatcher (close-watcher.js): Android's back, Escape and other close requests. Unlike
80
+ // Chromium, cancel is always cancelable and watchers are never grouped.
81
+ interface CloseWatcherEvent { readonly type: 'cancel' | 'close'; readonly cancelable: boolean; readonly defaultPrevented: boolean; readonly target: CloseWatcher; preventDefault(): void }
82
+ interface CloseWatcher {
83
+ oncancel: ((event: CloseWatcherEvent) => void) | null; onclose: ((event: CloseWatcherEvent) => void) | null;
84
+ requestClose(): void; close(): void; destroy(): void;
85
+ addEventListener(type: 'cancel' | 'close', listener: (event: CloseWatcherEvent) => void, options?: { once?: boolean; signal?: AbortSignal }): void;
86
+ removeEventListener(type: 'cancel' | 'close', listener: (event: CloseWatcherEvent) => void): void;
87
+ }
88
+ declare var CloseWatcher: { new (options?: { signal?: AbortSignal }): CloseWatcher; prototype: CloseWatcher };
79
89
  interface DOMException extends Error { readonly name: string; readonly code: number }
80
90
  declare var DOMException: { new (message?: string, name?: string): DOMException; prototype: DOMException; readonly ABORT_ERR: 20; readonly TIMEOUT_ERR: 23 };
81
91
  interface URLSearchParams {
@@ -17,7 +17,14 @@
17
17
  "attributes": ["type", "value", "defaultValue", "checked", "defaultChecked", "disabled", "placeholder", "name", "min", "max", "step",
18
18
  "maxlength", "maxLength", "switch", "inputmode", "inputMode", "enterkeyhint", "enterKeyHint", "autocomplete", "autoComplete",
19
19
  "autocorrect", "autoCorrect", "autocapitalize", "autoCapitalize", "spellcheck", "spellCheck", "suppressNativeChangeWarning"],
20
- "values": { "type": ["text", "password", "email", "search", "tel", "url", "number", "checkbox", "radio", "range", "date", "time", "datetime-local", "color"] }
20
+ "values": {
21
+ "type": ["text", "password", "email", "search", "tel", "url", "number", "checkbox", "radio", "range", "date", "time", "datetime-local", "color"],
22
+ "inputmode": ["none", "text", "decimal", "numeric", "tel", "search", "email", "url"], "inputMode": ["none", "text", "decimal", "numeric", "tel", "search", "email", "url"],
23
+ "enterkeyhint": ["enter", "done", "go", "next", "previous", "search", "send"], "enterKeyHint": ["enter", "done", "go", "next", "previous", "search", "send"],
24
+ "autocapitalize": ["none", "off", "sentences", "on", "words", "characters"], "autoCapitalize": ["none", "off", "sentences", "on", "words", "characters"],
25
+ "autocorrect": ["", "on", "off", "true", "false"], "autoCorrect": ["", "on", "off", "true", "false"],
26
+ "spellcheck": ["", "true", "false"], "spellCheck": ["", "true", "false"]
27
+ }
21
28
  },
22
29
  "kbd": {}, "label": { "attributes": ["for", "htmlFor"] }, "li": {}, "main": {}, "mark": {}, "menu": {},
23
30
  "meter": { "attributes": ["value", "min", "max"] },
@@ -32,7 +39,14 @@
32
39
  "textarea": {
33
40
  "attributes": ["value", "defaultValue", "disabled", "placeholder", "name", "rows", "maxlength", "maxLength", "inputmode", "inputMode",
34
41
  "enterkeyhint", "enterKeyHint", "autocomplete", "autoComplete", "autocorrect", "autoCorrect", "autocapitalize",
35
- "autoCapitalize", "spellcheck", "spellCheck", "suppressNativeChangeWarning"]
42
+ "autoCapitalize", "spellcheck", "spellCheck", "suppressNativeChangeWarning"],
43
+ "values": {
44
+ "inputmode": ["none", "text", "decimal", "numeric", "tel", "search", "email", "url"], "inputMode": ["none", "text", "decimal", "numeric", "tel", "search", "email", "url"],
45
+ "enterkeyhint": ["enter", "done", "go", "next", "previous", "search", "send"], "enterKeyHint": ["enter", "done", "go", "next", "previous", "search", "send"],
46
+ "autocapitalize": ["none", "off", "sentences", "on", "words", "characters"], "autoCapitalize": ["none", "off", "sentences", "on", "words", "characters"],
47
+ "autocorrect": ["", "on", "off", "true", "false"], "autoCorrect": ["", "on", "off", "true", "false"],
48
+ "spellcheck": ["", "true", "false"], "spellCheck": ["", "true", "false"]
49
+ }
36
50
  },
37
51
  "time": {}, "u": {}, "ul": {}, "var": {},
38
52
  "svg": { "svg": true }, "g": { "svg": true }, "path": { "svg": true }, "rect": { "svg": true }, "circle": { "svg": true },
@@ -54,8 +68,8 @@
54
68
  "bake-tabbar": { "attributes": "*", "internal": "Universal UI", "targets": ["ios", "mac", "android"] },
55
69
  "swiftui-*": { "attributes": "*", "internal": "the SwiftUI adapters", "targets": ["ios", "mac"],
56
70
  "kinds": ["host", "vstack", "hstack", "zstack", "group", "spacer", "divider", "scrollview", "glasseffectcontainer",
57
- "text", "label", "image", "progressview", "button", "toggle", "slider", "picker", "textfield",
58
- "securefield", "menu", "form", "list", "section", "navigationstack", "toolbaritem", "bakeview",
71
+ "text", "label", "contentunavailableview", "labeledcontent", "link", "image", "progressview", "button", "toggle", "slider", "picker", "textfield",
72
+ "securefield", "menu", "form", "list", "section", "swipeactions", "swipeactiongroup", "navigationstack", "toolbaritem", "bakeview",
59
73
  "bottomsheet", "tabview", "tab"],
60
74
  "unknown": { "why": "the SwiftUI host draws no such component (its registry is the kinds list in native-support.json)",
61
75
  "instead": "a component exported by your adapter's ui/swift-ui entry" } }
@@ -134,7 +148,7 @@
134
148
  "font-style": ["normal", "italic", "oblique"], "fontStyle": ["normal", "italic", "oblique"],
135
149
  "role": ["alert", "alertdialog", "article", "banner", "button", "cell", "checkbox", "columnheader", "combobox", "complementary", "contentinfo",
136
150
  "dialog", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "image", "link", "list", "listbox", "listitem", "log",
137
- "main", "menu", "menuitem", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio",
151
+ "main", "menu", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio",
138
152
  "radiogroup", "region", "row", "search", "searchbox", "separator", "slider", "spinbutton", "status", "switch", "tab", "table", "tablist",
139
153
  "tabpanel", "text", "textbox", "toolbar", "tooltip"],
140
154
  "aria-haspopup": ["false", "true", "menu", "listbox", "tree", "grid", "dialog"],
@@ -142,6 +156,8 @@
142
156
  "aria-orientation": ["horizontal", "vertical", "undefined"]
143
157
  },
144
158
  "valueTargets": {
159
+ "enterkeyhint": { "previous": { "targets": ["android", "mac", "windows"], "why": "UIKit has no Previous return key", "instead": "choose another enterkeyhint for iOS" } },
160
+ "enterKeyHint": { "previous": { "targets": ["android", "mac", "windows"], "why": "UIKit has no Previous return key", "instead": "choose another enterKeyHint for iOS" } },
145
161
  "dir": { "rtl": { "targets": ["ios", "mac", "android"], "why": "the text backend of this target shapes paragraphs left to right (the same as `direction: rtl`, css-direction)", "instead": "leave the default (ltr) on this target" } }
146
162
  },
147
163
  "unsupported": {
@@ -198,6 +214,7 @@
198
214
  "supported": {
199
215
  "onClick": { "event": "click" },
200
216
  "onPress": { "event": "click", "note": "alias of onClick" },
217
+ "onBeforeInput": { "event": "beforeinput", "capture": true, "targets": ["ios", "android"] },
201
218
  "onInput": { "event": "input", "elements": ["input", "textarea", "select"] },
202
219
  "onChange": { "event": "change", "elements": ["input", "textarea", "select"], "note": "a text field commits (Return or blur); in React, onChange of a text input, textarea or range, date, time or color input is the input event, as React DOM" },
203
220
  "onSubmit": { "event": "submit", "elements": ["input", "textarea"], "note": "a text field's commit (Return) when it has no change listener (an Octane onChange; a React text field's onChange is on input)" },
@@ -260,7 +277,7 @@
260
277
  "onCut": { "why": "clipboard events are not delivered", "instead": "a native module" },
261
278
  "onPaste": { "why": "clipboard events are not delivered", "instead": "a native module" },
262
279
  "onSelect": { "why": "text selection events are not delivered", "instead": "nothing yet" },
263
- "onBefore": { "why": "beforeinput / beforetoggle are not delivered", "instead": "onInput / onToggle" },
280
+ "onBefore": { "why": "beforetoggle is not delivered", "instead": "onToggle" },
264
281
  "onGot": { "why": "pointer capture is not implemented", "instead": "onClick" },
265
282
  "onLost": { "why": "pointer capture is not implemented", "instead": "onClick" }
266
283
  }
@@ -268,7 +285,7 @@
268
285
  "element": {
269
286
  "$comment": "Element handles (refs, event targets) on native targets: getComputedStyle answers `computedStyle` (bake_core::element::COMPUTED_STYLE_PROPERTIES; the last eight are properties the CSS lint rejects, so always their initial value) and custom properties through getPropertyValue('--name') (env() replaced; requires.globals `custom-properties`) and addEventListener takes `events` (REF_EVENT_TYPES); anything else throws E_UNSUPPORTED. The core's tests check both lists against these.",
270
287
  "computedStyle": ["display", "position", "visibility", "opacity", "overflow", "overflowX", "overflowY", "pointerEvents", "zIndex", "transform", "animationName", "animationDuration", "animationDelay", "animationIterationCount", "animationFillMode", "animationDirection", "transitionProperty", "transitionDuration", "transitionDelay", "width", "height", "boxSizing", "direction", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "translate", "scale", "rotate", "perspective", "containerType", "backdropFilter", "willChange", "contain"],
271
- "events": ["click", "change", "pointerdown", "pointerup", "pointermove", "pointercancel", "pointerover", "pointerout", "pointerenter", "pointerleave", "gotpointercapture", "lostpointercapture", "mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave", "keydown", "keyup", "focus", "blur", "focusin", "focusout", "wheel", "animationstart", "animationiteration", "animationend", "animationcancel", "transitionrun", "transitionstart", "transitionend", "transitioncancel"]
288
+ "events": ["click", "change", "pointerdown", "pointerup", "pointermove", "pointercancel", "pointerover", "pointerout", "pointerenter", "pointerleave", "gotpointercapture", "lostpointercapture", "mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave", "keydown", "keyup", "beforeinput", "focus", "blur", "focusin", "focusout", "wheel", "animationstart", "animationiteration", "animationend", "animationcancel", "transitionrun", "transitionstart", "transitionend", "transitioncancel"]
272
289
  },
273
290
  "globals": {
274
291
  "$comment": "Free identifiers a native bundle may read. `hermes`: what Hermes itself defines (checked against the real VM by tests/fail-closed/hermes-globals). `runtime`: what BakeNative installs (host-runtime.js, the native bridge). `crypto`: the members of `crypto` (web-crypto.js); any other is an error (`crypto.subtle`: global-crypto-subtle). `alert` and `confirm` (dialogs.js) return a Promise: a confirm() result must be awaited or returned (global-confirm-sync), and .then on either throws on the web (global-dialog-then). `typeof X` reads and `globalThis.X` feature tests are always allowed.",
@@ -283,7 +300,7 @@
283
300
  "console": ["log", "debug", "info", "warn", "error"],
284
301
  "runtime": ["setTimeout", "setInterval", "clearTimeout", "clearInterval", "requestAnimationFrame", "cancelAnimationFrame", "performance", "native", "getComputedStyle",
285
302
  "fetch", "Request", "Response", "Headers", "AbortController", "AbortSignal", "DOMException", "URL", "URLSearchParams", "Blob", "crypto",
286
- "alert", "confirm"],
303
+ "alert", "confirm", "CloseWatcher"],
287
304
  "crypto": ["getRandomValues", "randomUUID"],
288
305
  "runtimePrefixes": ["__bake", "__BAKE", "__host"],
289
306
  "intl": { "targets": ["ios", "mac", "android", "windows"], "note": "Intl.Collator, Intl.DateTimeFormat, Intl.NumberFormat and Intl.getCanonicalLocales, over the platform's ICU (Foundation on iOS and macOS). Hermes has no Intl.PluralRules, RelativeTimeFormat, ListFormat, DisplayNames, Segmenter, Locale, DurationFormat or supportedValuesOf, and the Intl lint names what to use instead" },
@@ -293,7 +310,7 @@
293
310
  "self": { "why": "there is no DOM window on native targets", "instead": "globalThis" },
294
311
  "navigator": { "why": "there is no navigator on native targets", "instead": "import.meta.env.BAKE_TARGET, or a native module" },
295
312
  "location": { "why": "there is no page URL on native targets", "instead": "read the initial URL from host.props and subscribe to incoming URLs with host.on" },
296
- "history": { "why": "there is no session history on native targets", "instead": "keep the current screen in component state and handle incoming URLs with host.props and host.on" },
313
+ "history": { "why": "there is no session history on native targets", "instead": "keep the current screen in component state, close it on Android's back with a CloseWatcher, and handle incoming URLs with host.props and host.on" },
297
314
  "localStorage": { "why": "there is no web storage on native targets", "instead": "a native module" },
298
315
  "sessionStorage": { "why": "there is no web storage on native targets", "instead": "a native module" },
299
316
  "indexedDB": { "why": "there is no web storage on native targets", "instead": "a native module" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bake-native/core",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.1.0-rc.1",
4
4
  "description": "Build and run baked first frames on web, iOS, Android, macOS and Windows with the bake CLI.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -50,6 +50,7 @@
50
50
  "batch-wire.js",
51
51
  "determinism.js",
52
52
  "web-fetch.js",
53
+ "close-watcher.js",
53
54
  "web-crypto.js",
54
55
  "dom-exception.js",
55
56
  "dialogs.js",
@@ -134,10 +135,10 @@
134
135
  },
135
136
  "types": "./index.d.ts",
136
137
  "optionalDependencies": {
137
- "@bake-native/toolchain-darwin-arm64": "0.1.0-rc.0",
138
- "@bake-native/toolchain-darwin-x64": "0.1.0-rc.0",
139
- "@bake-native/toolchain-linux-x64": "0.1.0-rc.0",
140
- "@bake-native/toolchain-win32-x64": "0.1.0-rc.0"
138
+ "@bake-native/toolchain-darwin-arm64": "0.1.0-rc.1",
139
+ "@bake-native/toolchain-darwin-x64": "0.1.0-rc.1",
140
+ "@bake-native/toolchain-linux-x64": "0.1.0-rc.1",
141
+ "@bake-native/toolchain-win32-x64": "0.1.0-rc.1"
141
142
  },
142
143
  "publishConfig": {
143
144
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "runtime": "0.1.0-rc.0",
3
+ "runtime": "0.1.0-rc.1",
4
4
  "hostProtocol": 4,
5
5
  "minHostProtocol": 4,
6
6
  "batch": {
@@ -11,18 +11,24 @@ export const padding = (args) => m('padding', args);
11
11
  export const frame = (args) => m('frame', args);
12
12
  /** `.background(color)`, optionally clipped to `shape` ('capsule' | 'circle' | { roundedRectangle: r }). */
13
13
  export const background = (color, shape) => m('background', { color, shape });
14
- /** `.foregroundStyle(color)`. */
14
+ /** `.foregroundStyle(...)`: a color or the system secondary foreground style. */
15
15
  export const foregroundStyle = (color) => m('foregroundStyle', { color });
16
+ /** `.listRowBackground(color)` on a Form or List row. */
17
+ export const listRowBackground = (color) => m('listRowBackground', { color });
16
18
  /** `.font(.system(size:weight:design:))` or a text style: `font({ textStyle: 'headline' })`. */
17
19
  export const font = (args) => m('font', args);
18
20
  /** `.bold()`. */
19
21
  export const bold = () => m('bold');
20
22
  /** `.italic()`. */
21
23
  export const italic = () => m('italic');
24
+ /** `.monospacedDigit()`: digits in the current font keep the same width. */
25
+ export const monospacedDigit = () => m('monospacedDigit');
22
26
  /** `.tint(color)`. */
23
27
  export const tint = (color) => m('tint', { color });
24
28
  /** `.buttonStyle(...)`: 'automatic' | 'bordered' | 'borderedProminent' | 'borderless' | 'plain' | 'glass' | 'glassProminent'. */
25
29
  export const buttonStyle = (style) => m('buttonStyle', { style });
30
+ /** `.buttonBorderShape(...)`: changes the bordered or glass style's shape. */
31
+ export const buttonBorderShape = (shape) => m('buttonBorderShape', { shape });
26
32
  /** `.controlSize(...)`: 'mini' | 'small' | 'regular' | 'large' | 'extraLarge'. */
27
33
  export const controlSize = (size) => m('controlSize', { size });
28
34
  /** `.glassEffect(_:in:)` (iOS 26 / macOS 26 Liquid Glass): `{ glass: { variant: 'regular' | 'clear', interactive, tint }, shape }`. */
@@ -31,6 +37,8 @@ export const glassEffect = (args) => m('glassEffect', args);
31
37
  export const cornerRadius = (radius) => m('cornerRadius', { radius });
32
38
  /** `.clipShape(...)`: 'capsule' | 'circle' | 'rectangle' | { roundedRectangle: r }. */
33
39
  export const clipShape = (shape) => m('clipShape', { shape });
40
+ /** `.contentShape(.rect)`: the whole rectangle answers a press, even with transparent content. */
41
+ export const contentShape = (shape) => m('contentShape', { shape });
34
42
  /** `.opacity(v)`. */
35
43
  export const opacity = (value) => m('opacity', { value });
36
44
  /** `.shadow(color:radius:x:y:)`. */
@@ -43,6 +51,8 @@ export const pickerStyle = (style) => m('pickerStyle', { style });
43
51
  export const toggleStyle = (style) => m('toggleStyle', { style });
44
52
  /** `.labelsHidden()`. */
45
53
  export const labelsHidden = () => m('labelsHidden');
54
+ /** `.labelStyle(.iconOnly)`: show the symbol while keeping the accessible label. */
55
+ export const labelStyle = (style) => m('labelStyle', { style });
46
56
  /** `.accessibilityLabel(value)`: the accessible name of an unlabeled view. */
47
57
  export const accessibilityLabel = (value) => m('accessibilityLabel', { value });
48
58
  /** `.multilineTextAlignment(...)`: 'leading' | 'center' | 'trailing'. */
@@ -115,7 +125,8 @@ export function webStyle(mods) {
115
125
  s.background = x.color;
116
126
  if (shapeRadius(x.shape)) s.borderRadius = shapeRadius(x.shape);
117
127
  break;
118
- case 'foregroundStyle': s.color = x.color; break;
128
+ case 'foregroundStyle': s.color = x.color === 'secondary' ? 'GrayText' : x.color; break;
129
+ case 'listRowBackground': s.backgroundColor = x.color; break;
119
130
  case 'tint': s.accentColor = x.color; break;
120
131
  case 'font':
121
132
  if (x.size != null) s.fontSize = px(x.size);
@@ -127,6 +138,7 @@ export function webStyle(mods) {
127
138
  break;
128
139
  case 'bold': s.fontWeight = 700; break;
129
140
  case 'italic': s.fontStyle = 'italic'; break;
141
+ case 'monospacedDigit': s.fontVariantNumeric = 'tabular-nums'; break;
130
142
  case 'cornerRadius': s.borderRadius = px(x.radius); s.overflow = 'hidden'; break;
131
143
  case 'clipShape': s.borderRadius = shapeRadius(x.shape) ?? '0px'; s.overflow = 'hidden'; break;
132
144
  case 'opacity': s.opacity = x.value; break;