@moku-labs/native 0.2.2 → 0.3.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/dist/index.d.cts CHANGED
@@ -67,7 +67,20 @@ type CapabilityConfigMap = {
67
67
  mode: "scheme";
68
68
  scheme: string;
69
69
  };
70
+ back: Record<string, never>;
71
+ haptics: Record<string, never>;
70
72
  };
73
+ /**
74
+ * Which way up a mobile app runs. Build time only: it picks the iOS `Info.plist`
75
+ * orientation keys and the Android main activity's `android:screenOrientation`, and
76
+ * nothing locks the screen at runtime. `"any"` keeps the Tauri template's default.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * createApp({ config: { app: { name: "Demo", identifier: "com.acme.demo", orientation: "portrait" } } });
81
+ * ```
82
+ */
83
+ type Orientation = "portrait" | "landscape" | "any";
71
84
  /** How `tauri ios build` exports the signed archive (`--export-method`). */
72
85
  type AppleExportMethod = "app-store-connect" | "release-testing" | "debugging";
73
86
  /**
@@ -105,10 +118,12 @@ type SigningConfig = {
105
118
  */
106
119
  type Config = {
107
120
  /**
108
- * App identity and store metadata — project.onInit validates name/identifier are
109
- * non-empty (reverse-DNS identifier). `icon` is a 1024x1024 PNG relative to cwd
110
- * (a placeholder is generated when unset); `category` maps to `bundle.category`;
111
- * `buildNumber` maps to the iOS/macOS `bundleVersion`.
121
+ * App identity, store metadata and presentation — project.onInit validates
122
+ * name/identifier are non-empty (reverse-DNS identifier). `icon` is a 1024x1024 PNG
123
+ * relative to cwd (a placeholder is generated when unset); `category` maps to
124
+ * `bundle.category`; `buildNumber` maps to the iOS/macOS `bundleVersion`;
125
+ * `orientation` locks the mobile screen at build time; `backgroundColor` paints the
126
+ * native window behind the page.
112
127
  */
113
128
  app: {
114
129
  name: string;
@@ -117,6 +132,19 @@ type Config = {
117
132
  icon?: string;
118
133
  category?: string;
119
134
  buildNumber?: string;
135
+ /**
136
+ * Build-time mobile orientation lock → the iOS `Info.plist` keys and the Android
137
+ * main activity's `android:screenOrientation`. There is no runtime lock. Unset
138
+ * behaves as `"any"`.
139
+ */
140
+ orientation?: Orientation;
141
+ /**
142
+ * Hex window colour (`"#10161d"`, or `"#10161dff"` with alpha) →
143
+ * `app.windows[0].backgroundColor`. Shows during launch and behind any gap the page
144
+ * does not cover. Android status bar icons follow it: light icons on a dark colour,
145
+ * dark icons on a light one. Unset leaves the platform default (white in light mode).
146
+ */
147
+ backgroundColor?: string;
120
148
  }; /** Web build/dev wiring codegenned into tauri.conf.json. cwd for monorepo layouts. */
121
149
  web: {
122
150
  build: string;
@@ -170,7 +198,7 @@ type BundleLayout = {
170
198
  readonly genDirectory: string | undefined;
171
199
  };
172
200
  declare namespace types_d_exports$3 {
173
- export { Api$4 as Api, CleanResult, CompletenessResult, DeepLinkConf, GenerateResult, ManifestEntry, PatchMobileOptions, PatchResult, PlistEntry, ProjectContext, RegistryRow, ResolvedCapability, TauriConfFragment };
201
+ export { Api$4 as Api, CleanResult, CompletenessResult, DeepLinkConf, GenerateResult, ManifestEntry, PatchMobileOptions, PatchResult, PlistEntry, PlistValue, ProjectContext, RegistryRow, ResolvedCapability, TauriConfFragment };
174
202
  }
175
203
  /** Result of a write-if-changed generation pass. */
176
204
  type GenerateResult = {
@@ -189,7 +217,11 @@ type CompletenessResult = {
189
217
  } | {
190
218
  status: "complete";
191
219
  };
192
- /** Result of the idempotent mobile patch pass (Android signing + the mobile runner command). */
220
+ /**
221
+ * Result of the idempotent mobile patch pass: Android release signing and the main
222
+ * activity's manifest attributes, the iOS Xcode build settings, and the runner command
223
+ * on both platforms. A file several patches touched is listed once.
224
+ */
193
225
  type PatchResult = {
194
226
  readonly patched: readonly string[];
195
227
  readonly unchanged: readonly string[];
@@ -205,9 +237,9 @@ type CleanResult = {
205
237
  };
206
238
  /**
207
239
  * One capability registry row — packaging metadata with per-row research confidence.
208
- * A row is backed EITHER by a real Tauri plugin (crate + npm package + Rust init) or by
209
- * a core Tauri cargo feature (tray), so every plugin-only field is optional and
210
- * `cargoFeatures` is always present.
240
+ * A row is backed by a real Tauri plugin (crate + npm package + Rust init), by a core
241
+ * Tauri cargo feature (tray), or by core permissions alone (back), so every plugin-only
242
+ * field is optional and `cargoFeatures` is always present.
211
243
  */
212
244
  type RegistryRow = {
213
245
  name: keyof CapabilityConfigMap;
@@ -238,15 +270,40 @@ type DeepLinkConf = {
238
270
  * the app at startup.
239
271
  */
240
272
  type TauriConfFragment = Record<string, never> | DeepLinkConf;
241
- /** An Info.ios.plist sidecar entry (src-tauri root, outside gen/) — empty for every v1 row. */
273
+ /**
274
+ * One Info.plist value: a `<string>`, a `<true/>`/`<false/>`, or an `<array>` of strings.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * const fullScreen: PlistValue = true; // <true/>
279
+ * const portrait: PlistValue = ["UIInterfaceOrientationPortrait"];
280
+ * // <array><string>UIInterfaceOrientationPortrait</string></array>
281
+ * ```
282
+ */
283
+ type PlistValue = string | boolean | readonly string[];
284
+ /**
285
+ * An Info.ios.plist sidecar entry (src-tauri root, outside gen/), which Tauri merges into
286
+ * the app's Info.plist on every iOS build. No registry row carries one today; the
287
+ * orientation lock does.
288
+ */
242
289
  type PlistEntry = {
243
290
  key: string;
244
- value: string;
291
+ value: PlistValue;
245
292
  };
246
- /** An AndroidManifest need — empty for every v1 row (official plugins self-merge via build.rs). */
293
+ /**
294
+ * An AndroidManifest need. `activity-attribute` sets one attribute on the main
295
+ * `<activity>`, or removes it when `value` is `undefined`; the orientation lock is one.
296
+ * `child` is the seam for a child element and the patch pass does not apply it. No
297
+ * registry row carries either kind: official plugins self-merge via build.rs.
298
+ */
247
299
  type ManifestEntry = {
300
+ kind: "child";
248
301
  parentTag: string;
249
302
  xml: string;
303
+ } | {
304
+ kind: "activity-attribute";
305
+ name: `android:${string}`;
306
+ value: string | undefined;
250
307
  };
251
308
  /** A capability resolved against consumer config. */
252
309
  type ResolvedCapability = RegistryRow & {
@@ -274,6 +331,29 @@ type Api$4 = {
274
331
  getCompleteness(opts: {
275
332
  target: Target;
276
333
  }): CompletenessResult;
334
+ /**
335
+ * Runs the idempotent mobile post-init patch pass. Android gets its release signing,
336
+ * the main activity's manifest attributes (the orientation lock among them) and the
337
+ * status bar style in MainActivity.kt (light icons on a dark `app.backgroundColor`,
338
+ * dark icons on a light one); iOS gets the Xcode entitlements-modification setting;
339
+ * both get the Xcode/Android-Studio runner-command rewrite when a `runner` is supplied.
340
+ * The build plugin calls it after the mobile init pass, with the runner from
341
+ * `tauri.getRunner()`.
342
+ *
343
+ * @param opts - The patch options.
344
+ * @param opts.target - The mobile platform to patch.
345
+ * @param opts.runner - The absolute Node/`tauri.js` pair from `tauri.getRunner()`.
346
+ * @returns The paths patched vs. left unchanged.
347
+ * @example
348
+ * ```ts
349
+ * // app.orientation is "portrait", app.backgroundColor is "#10161d", app.identifier is
350
+ * // "com.acme.demo", projectDir is the default, and neither is written yet
351
+ * await app.project.patchMobile({ target: "android" });
352
+ * // { patched: [".moku/tauri/src-tauri/gen/android/app/src/main/AndroidManifest.xml",
353
+ * // ".moku/tauri/src-tauri/gen/android/app/src/main/java/com/acme/demo/MainActivity.kt"],
354
+ * // unchanged: [".moku/tauri/src-tauri/gen/android/app/build.gradle.kts"] }
355
+ * ```
356
+ */
277
357
  patchMobile(opts: PatchMobileOptions): Promise<PatchResult>;
278
358
  clean(opts?: {
279
359
  target?: Target | undefined;
@@ -577,7 +657,9 @@ type Config$1 = {
577
657
  /**
578
658
  * Plugin state: the one branded console every verb and hook renders through (created
579
659
  * once in `createState`) plus the live-render bookkeeping for the current verb
580
- * invocation (`startedAt: undefined` = no phase running; unicorn/no-null).
660
+ * invocation (`startedAt: undefined` = no phase running; unicorn/no-null). `startedAt` is a
661
+ * `performance.now()` reading (monotonic, not epoch ms), so it only makes sense as the
662
+ * start of an elapsed-time difference.
581
663
  */
582
664
  type State = {
583
665
  readonly ui: BrandConsole;
@@ -678,8 +760,9 @@ declare const doctorPlugin: import("@moku-labs/core").PluginInstance<"doctor", C
678
760
  //#region src/plugins/project/index.d.ts
679
761
  /**
680
762
  * Complex tier — capability registry + generators/ + write-if-changed writer + the mobile/
681
- * sub-domain (completeness gate, Android signing block, runner-command rewrite) + the
682
- * guarded clean.
763
+ * sub-domain (completeness gate, Android signing block, Android manifest attributes,
764
+ * Xcode settings, runner-command rewrite) + the build-time orientation lock + the guarded
765
+ * clean.
683
766
  *
684
767
  * @see README.md
685
768
  * @example
@@ -736,4 +819,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
736
819
  */
737
820
  declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config, Events, import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", import("@moku-labs/common").LogConfig, import("@moku-labs/common").LogState, import("@moku-labs/common").LogApi>, import("@moku-labs/core").CorePluginInstance<"env", import("@moku-labs/common").EnvConfig, import("@moku-labs/common").EnvState, import("@moku-labs/common").EnvApi>]>>;
738
821
  //#endregion
739
- export { type AppleExportMethod, type AppleSigning, type types_d_exports as Build, type BuildFlavor, type CapabilityConfigMap, type types_d_exports$1 as Cli, type Config, type types_d_exports$2 as Doctor, type Events, type MobileTarget, type NativeCompleteEvent, type NativePhase, type NativePhaseEvent, PHASE_ORDER, type types_d_exports$3 as Project, type SigningConfig, TARGETS, type Target, type types_d_exports$4 as Tauri, TauriError, type TauriRunner, buildPlugin, cliPlugin, createApp, createPlugin, doctorPlugin, hostTargets, projectPlugin, tauriPlugin };
822
+ export { type AppleExportMethod, type AppleSigning, type types_d_exports as Build, type BuildFlavor, type CapabilityConfigMap, type types_d_exports$1 as Cli, type Config, type types_d_exports$2 as Doctor, type Events, type MobileTarget, type NativeCompleteEvent, type NativePhase, type NativePhaseEvent, type Orientation, PHASE_ORDER, type types_d_exports$3 as Project, type SigningConfig, TARGETS, type Target, type types_d_exports$4 as Tauri, TauriError, type TauriRunner, buildPlugin, cliPlugin, createApp, createPlugin, doctorPlugin, hostTargets, projectPlugin, tauriPlugin };
package/dist/index.d.mts CHANGED
@@ -68,7 +68,20 @@ type CapabilityConfigMap = {
68
68
  mode: "scheme";
69
69
  scheme: string;
70
70
  };
71
+ back: Record<string, never>;
72
+ haptics: Record<string, never>;
71
73
  };
74
+ /**
75
+ * Which way up a mobile app runs. Build time only: it picks the iOS `Info.plist`
76
+ * orientation keys and the Android main activity's `android:screenOrientation`, and
77
+ * nothing locks the screen at runtime. `"any"` keeps the Tauri template's default.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * createApp({ config: { app: { name: "Demo", identifier: "com.acme.demo", orientation: "portrait" } } });
82
+ * ```
83
+ */
84
+ type Orientation = "portrait" | "landscape" | "any";
72
85
  /** How `tauri ios build` exports the signed archive (`--export-method`). */
73
86
  type AppleExportMethod = "app-store-connect" | "release-testing" | "debugging";
74
87
  /**
@@ -106,10 +119,12 @@ type SigningConfig = {
106
119
  */
107
120
  type Config = {
108
121
  /**
109
- * App identity and store metadata — project.onInit validates name/identifier are
110
- * non-empty (reverse-DNS identifier). `icon` is a 1024x1024 PNG relative to cwd
111
- * (a placeholder is generated when unset); `category` maps to `bundle.category`;
112
- * `buildNumber` maps to the iOS/macOS `bundleVersion`.
122
+ * App identity, store metadata and presentation — project.onInit validates
123
+ * name/identifier are non-empty (reverse-DNS identifier). `icon` is a 1024x1024 PNG
124
+ * relative to cwd (a placeholder is generated when unset); `category` maps to
125
+ * `bundle.category`; `buildNumber` maps to the iOS/macOS `bundleVersion`;
126
+ * `orientation` locks the mobile screen at build time; `backgroundColor` paints the
127
+ * native window behind the page.
113
128
  */
114
129
  app: {
115
130
  name: string;
@@ -118,6 +133,19 @@ type Config = {
118
133
  icon?: string;
119
134
  category?: string;
120
135
  buildNumber?: string;
136
+ /**
137
+ * Build-time mobile orientation lock → the iOS `Info.plist` keys and the Android
138
+ * main activity's `android:screenOrientation`. There is no runtime lock. Unset
139
+ * behaves as `"any"`.
140
+ */
141
+ orientation?: Orientation;
142
+ /**
143
+ * Hex window colour (`"#10161d"`, or `"#10161dff"` with alpha) →
144
+ * `app.windows[0].backgroundColor`. Shows during launch and behind any gap the page
145
+ * does not cover. Android status bar icons follow it: light icons on a dark colour,
146
+ * dark icons on a light one. Unset leaves the platform default (white in light mode).
147
+ */
148
+ backgroundColor?: string;
121
149
  }; /** Web build/dev wiring codegenned into tauri.conf.json. cwd for monorepo layouts. */
122
150
  web: {
123
151
  build: string;
@@ -171,7 +199,7 @@ type BundleLayout = {
171
199
  readonly genDirectory: string | undefined;
172
200
  };
173
201
  declare namespace types_d_exports$3 {
174
- export { Api$4 as Api, CleanResult, CompletenessResult, DeepLinkConf, GenerateResult, ManifestEntry, PatchMobileOptions, PatchResult, PlistEntry, ProjectContext, RegistryRow, ResolvedCapability, TauriConfFragment };
202
+ export { Api$4 as Api, CleanResult, CompletenessResult, DeepLinkConf, GenerateResult, ManifestEntry, PatchMobileOptions, PatchResult, PlistEntry, PlistValue, ProjectContext, RegistryRow, ResolvedCapability, TauriConfFragment };
175
203
  }
176
204
  /** Result of a write-if-changed generation pass. */
177
205
  type GenerateResult = {
@@ -190,7 +218,11 @@ type CompletenessResult = {
190
218
  } | {
191
219
  status: "complete";
192
220
  };
193
- /** Result of the idempotent mobile patch pass (Android signing + the mobile runner command). */
221
+ /**
222
+ * Result of the idempotent mobile patch pass: Android release signing and the main
223
+ * activity's manifest attributes, the iOS Xcode build settings, and the runner command
224
+ * on both platforms. A file several patches touched is listed once.
225
+ */
194
226
  type PatchResult = {
195
227
  readonly patched: readonly string[];
196
228
  readonly unchanged: readonly string[];
@@ -206,9 +238,9 @@ type CleanResult = {
206
238
  };
207
239
  /**
208
240
  * One capability registry row — packaging metadata with per-row research confidence.
209
- * A row is backed EITHER by a real Tauri plugin (crate + npm package + Rust init) or by
210
- * a core Tauri cargo feature (tray), so every plugin-only field is optional and
211
- * `cargoFeatures` is always present.
241
+ * A row is backed by a real Tauri plugin (crate + npm package + Rust init), by a core
242
+ * Tauri cargo feature (tray), or by core permissions alone (back), so every plugin-only
243
+ * field is optional and `cargoFeatures` is always present.
212
244
  */
213
245
  type RegistryRow = {
214
246
  name: keyof CapabilityConfigMap;
@@ -239,15 +271,40 @@ type DeepLinkConf = {
239
271
  * the app at startup.
240
272
  */
241
273
  type TauriConfFragment = Record<string, never> | DeepLinkConf;
242
- /** An Info.ios.plist sidecar entry (src-tauri root, outside gen/) — empty for every v1 row. */
274
+ /**
275
+ * One Info.plist value: a `<string>`, a `<true/>`/`<false/>`, or an `<array>` of strings.
276
+ *
277
+ * @example
278
+ * ```ts
279
+ * const fullScreen: PlistValue = true; // <true/>
280
+ * const portrait: PlistValue = ["UIInterfaceOrientationPortrait"];
281
+ * // <array><string>UIInterfaceOrientationPortrait</string></array>
282
+ * ```
283
+ */
284
+ type PlistValue = string | boolean | readonly string[];
285
+ /**
286
+ * An Info.ios.plist sidecar entry (src-tauri root, outside gen/), which Tauri merges into
287
+ * the app's Info.plist on every iOS build. No registry row carries one today; the
288
+ * orientation lock does.
289
+ */
243
290
  type PlistEntry = {
244
291
  key: string;
245
- value: string;
292
+ value: PlistValue;
246
293
  };
247
- /** An AndroidManifest need — empty for every v1 row (official plugins self-merge via build.rs). */
294
+ /**
295
+ * An AndroidManifest need. `activity-attribute` sets one attribute on the main
296
+ * `<activity>`, or removes it when `value` is `undefined`; the orientation lock is one.
297
+ * `child` is the seam for a child element and the patch pass does not apply it. No
298
+ * registry row carries either kind: official plugins self-merge via build.rs.
299
+ */
248
300
  type ManifestEntry = {
301
+ kind: "child";
249
302
  parentTag: string;
250
303
  xml: string;
304
+ } | {
305
+ kind: "activity-attribute";
306
+ name: `android:${string}`;
307
+ value: string | undefined;
251
308
  };
252
309
  /** A capability resolved against consumer config. */
253
310
  type ResolvedCapability = RegistryRow & {
@@ -275,6 +332,29 @@ type Api$4 = {
275
332
  getCompleteness(opts: {
276
333
  target: Target;
277
334
  }): CompletenessResult;
335
+ /**
336
+ * Runs the idempotent mobile post-init patch pass. Android gets its release signing,
337
+ * the main activity's manifest attributes (the orientation lock among them) and the
338
+ * status bar style in MainActivity.kt (light icons on a dark `app.backgroundColor`,
339
+ * dark icons on a light one); iOS gets the Xcode entitlements-modification setting;
340
+ * both get the Xcode/Android-Studio runner-command rewrite when a `runner` is supplied.
341
+ * The build plugin calls it after the mobile init pass, with the runner from
342
+ * `tauri.getRunner()`.
343
+ *
344
+ * @param opts - The patch options.
345
+ * @param opts.target - The mobile platform to patch.
346
+ * @param opts.runner - The absolute Node/`tauri.js` pair from `tauri.getRunner()`.
347
+ * @returns The paths patched vs. left unchanged.
348
+ * @example
349
+ * ```ts
350
+ * // app.orientation is "portrait", app.backgroundColor is "#10161d", app.identifier is
351
+ * // "com.acme.demo", projectDir is the default, and neither is written yet
352
+ * await app.project.patchMobile({ target: "android" });
353
+ * // { patched: [".moku/tauri/src-tauri/gen/android/app/src/main/AndroidManifest.xml",
354
+ * // ".moku/tauri/src-tauri/gen/android/app/src/main/java/com/acme/demo/MainActivity.kt"],
355
+ * // unchanged: [".moku/tauri/src-tauri/gen/android/app/build.gradle.kts"] }
356
+ * ```
357
+ */
278
358
  patchMobile(opts: PatchMobileOptions): Promise<PatchResult>;
279
359
  clean(opts?: {
280
360
  target?: Target | undefined;
@@ -578,7 +658,9 @@ type Config$1 = {
578
658
  /**
579
659
  * Plugin state: the one branded console every verb and hook renders through (created
580
660
  * once in `createState`) plus the live-render bookkeeping for the current verb
581
- * invocation (`startedAt: undefined` = no phase running; unicorn/no-null).
661
+ * invocation (`startedAt: undefined` = no phase running; unicorn/no-null). `startedAt` is a
662
+ * `performance.now()` reading (monotonic, not epoch ms), so it only makes sense as the
663
+ * start of an elapsed-time difference.
582
664
  */
583
665
  type State = {
584
666
  readonly ui: BrandConsole;
@@ -679,8 +761,9 @@ declare const doctorPlugin: import("@moku-labs/core").PluginInstance<"doctor", C
679
761
  //#region src/plugins/project/index.d.ts
680
762
  /**
681
763
  * Complex tier — capability registry + generators/ + write-if-changed writer + the mobile/
682
- * sub-domain (completeness gate, Android signing block, runner-command rewrite) + the
683
- * guarded clean.
764
+ * sub-domain (completeness gate, Android signing block, Android manifest attributes,
765
+ * Xcode settings, runner-command rewrite) + the build-time orientation lock + the guarded
766
+ * clean.
684
767
  *
685
768
  * @see README.md
686
769
  * @example
@@ -737,4 +820,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
737
820
  */
738
821
  declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config, Events, import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", import("@moku-labs/common").LogConfig, import("@moku-labs/common").LogState, import("@moku-labs/common").LogApi>, import("@moku-labs/core").CorePluginInstance<"env", import("@moku-labs/common").EnvConfig, import("@moku-labs/common").EnvState, import("@moku-labs/common").EnvApi>]>>;
739
822
  //#endregion
740
- export { type AppleExportMethod, type AppleSigning, type types_d_exports as Build, type BuildFlavor, type CapabilityConfigMap, type types_d_exports$1 as Cli, type Config, type types_d_exports$2 as Doctor, type Events, type MobileTarget, type NativeCompleteEvent, type NativePhase, type NativePhaseEvent, PHASE_ORDER, type types_d_exports$3 as Project, type SigningConfig, TARGETS, type Target, type types_d_exports$4 as Tauri, TauriError, type TauriRunner, buildPlugin, cliPlugin, createApp, createPlugin, doctorPlugin, hostTargets, projectPlugin, tauriPlugin };
823
+ export { type AppleExportMethod, type AppleSigning, type types_d_exports as Build, type BuildFlavor, type CapabilityConfigMap, type types_d_exports$1 as Cli, type Config, type types_d_exports$2 as Doctor, type Events, type MobileTarget, type NativeCompleteEvent, type NativePhase, type NativePhaseEvent, type Orientation, PHASE_ORDER, type types_d_exports$3 as Project, type SigningConfig, TARGETS, type Target, type types_d_exports$4 as Tauri, TauriError, type TauriRunner, buildPlugin, cliPlugin, createApp, createPlugin, doctorPlugin, hostTargets, projectPlugin, tauriPlugin };