@moku-labs/native 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,18 @@ 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. Unset leaves the platform default (white in light mode).
145
+ */
146
+ backgroundColor?: string;
120
147
  }; /** Web build/dev wiring codegenned into tauri.conf.json. cwd for monorepo layouts. */
121
148
  web: {
122
149
  build: string;
@@ -170,7 +197,7 @@ type BundleLayout = {
170
197
  readonly genDirectory: string | undefined;
171
198
  };
172
199
  declare namespace types_d_exports$3 {
173
- export { Api$4 as Api, CleanResult, CompletenessResult, DeepLinkConf, GenerateResult, ManifestEntry, PatchMobileOptions, PatchResult, PlistEntry, ProjectContext, RegistryRow, ResolvedCapability, TauriConfFragment };
200
+ export { Api$4 as Api, CleanResult, CompletenessResult, DeepLinkConf, GenerateResult, ManifestEntry, PatchMobileOptions, PatchResult, PlistEntry, PlistValue, ProjectContext, RegistryRow, ResolvedCapability, TauriConfFragment };
174
201
  }
175
202
  /** Result of a write-if-changed generation pass. */
176
203
  type GenerateResult = {
@@ -189,7 +216,11 @@ type CompletenessResult = {
189
216
  } | {
190
217
  status: "complete";
191
218
  };
192
- /** Result of the idempotent mobile patch pass (Android signing + the mobile runner command). */
219
+ /**
220
+ * Result of the idempotent mobile patch pass: Android release signing and the main
221
+ * activity's manifest attributes, the iOS Xcode build settings, and the runner command
222
+ * on both platforms. A file several patches touched is listed once.
223
+ */
193
224
  type PatchResult = {
194
225
  readonly patched: readonly string[];
195
226
  readonly unchanged: readonly string[];
@@ -205,9 +236,9 @@ type CleanResult = {
205
236
  };
206
237
  /**
207
238
  * 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.
239
+ * A row is backed by a real Tauri plugin (crate + npm package + Rust init), by a core
240
+ * Tauri cargo feature (tray), or by core permissions alone (back), so every plugin-only
241
+ * field is optional and `cargoFeatures` is always present.
211
242
  */
212
243
  type RegistryRow = {
213
244
  name: keyof CapabilityConfigMap;
@@ -238,15 +269,40 @@ type DeepLinkConf = {
238
269
  * the app at startup.
239
270
  */
240
271
  type TauriConfFragment = Record<string, never> | DeepLinkConf;
241
- /** An Info.ios.plist sidecar entry (src-tauri root, outside gen/) — empty for every v1 row. */
272
+ /**
273
+ * One Info.plist value: a `<string>`, a `<true/>`/`<false/>`, or an `<array>` of strings.
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * const fullScreen: PlistValue = true; // <true/>
278
+ * const portrait: PlistValue = ["UIInterfaceOrientationPortrait"];
279
+ * // <array><string>UIInterfaceOrientationPortrait</string></array>
280
+ * ```
281
+ */
282
+ type PlistValue = string | boolean | readonly string[];
283
+ /**
284
+ * An Info.ios.plist sidecar entry (src-tauri root, outside gen/), which Tauri merges into
285
+ * the app's Info.plist on every iOS build. No registry row carries one today; the
286
+ * orientation lock does.
287
+ */
242
288
  type PlistEntry = {
243
289
  key: string;
244
- value: string;
290
+ value: PlistValue;
245
291
  };
246
- /** An AndroidManifest need — empty for every v1 row (official plugins self-merge via build.rs). */
292
+ /**
293
+ * An AndroidManifest need. `activity-attribute` sets one attribute on the main
294
+ * `<activity>`, or removes it when `value` is `undefined`; the orientation lock is one.
295
+ * `child` is the seam for a child element and the patch pass does not apply it. No
296
+ * registry row carries either kind: official plugins self-merge via build.rs.
297
+ */
247
298
  type ManifestEntry = {
299
+ kind: "child";
248
300
  parentTag: string;
249
301
  xml: string;
302
+ } | {
303
+ kind: "activity-attribute";
304
+ name: `android:${string}`;
305
+ value: string | undefined;
250
306
  };
251
307
  /** A capability resolved against consumer config. */
252
308
  type ResolvedCapability = RegistryRow & {
@@ -274,6 +330,25 @@ type Api$4 = {
274
330
  getCompleteness(opts: {
275
331
  target: Target;
276
332
  }): CompletenessResult;
333
+ /**
334
+ * Runs the idempotent mobile post-init patch pass. Android gets its release signing and
335
+ * the main activity's manifest attributes (the orientation lock among them); iOS gets
336
+ * the Xcode entitlements-modification setting; both get the Xcode/Android-Studio
337
+ * runner-command rewrite when a `runner` is supplied. The build plugin calls it after
338
+ * the mobile init pass, with the runner from `tauri.getRunner()`.
339
+ *
340
+ * @param opts - The patch options.
341
+ * @param opts.target - The mobile platform to patch.
342
+ * @param opts.runner - The absolute Node/`tauri.js` pair from `tauri.getRunner()`.
343
+ * @returns The paths patched vs. left unchanged.
344
+ * @example
345
+ * ```ts
346
+ * // app.orientation is "portrait", projectDir is the default, the lock is not written yet
347
+ * await app.project.patchMobile({ target: "android" });
348
+ * // { patched: [".moku/tauri/src-tauri/gen/android/app/src/main/AndroidManifest.xml"],
349
+ * // unchanged: [".moku/tauri/src-tauri/gen/android/app/build.gradle.kts"] }
350
+ * ```
351
+ */
277
352
  patchMobile(opts: PatchMobileOptions): Promise<PatchResult>;
278
353
  clean(opts?: {
279
354
  target?: Target | undefined;
@@ -577,7 +652,9 @@ type Config$1 = {
577
652
  /**
578
653
  * Plugin state: the one branded console every verb and hook renders through (created
579
654
  * once in `createState`) plus the live-render bookkeeping for the current verb
580
- * invocation (`startedAt: undefined` = no phase running; unicorn/no-null).
655
+ * invocation (`startedAt: undefined` = no phase running; unicorn/no-null). `startedAt` is a
656
+ * `performance.now()` reading (monotonic, not epoch ms), so it only makes sense as the
657
+ * start of an elapsed-time difference.
581
658
  */
582
659
  type State = {
583
660
  readonly ui: BrandConsole;
@@ -678,8 +755,9 @@ declare const doctorPlugin: import("@moku-labs/core").PluginInstance<"doctor", C
678
755
  //#region src/plugins/project/index.d.ts
679
756
  /**
680
757
  * 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.
758
+ * sub-domain (completeness gate, Android signing block, Android manifest attributes,
759
+ * Xcode settings, runner-command rewrite) + the build-time orientation lock + the guarded
760
+ * clean.
683
761
  *
684
762
  * @see README.md
685
763
  * @example
@@ -736,4 +814,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
736
814
  */
737
815
  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
816
  //#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 };
817
+ 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,18 @@ 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. Unset leaves the platform default (white in light mode).
146
+ */
147
+ backgroundColor?: string;
121
148
  }; /** Web build/dev wiring codegenned into tauri.conf.json. cwd for monorepo layouts. */
122
149
  web: {
123
150
  build: string;
@@ -171,7 +198,7 @@ type BundleLayout = {
171
198
  readonly genDirectory: string | undefined;
172
199
  };
173
200
  declare namespace types_d_exports$3 {
174
- 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 };
175
202
  }
176
203
  /** Result of a write-if-changed generation pass. */
177
204
  type GenerateResult = {
@@ -190,7 +217,11 @@ type CompletenessResult = {
190
217
  } | {
191
218
  status: "complete";
192
219
  };
193
- /** 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
+ */
194
225
  type PatchResult = {
195
226
  readonly patched: readonly string[];
196
227
  readonly unchanged: readonly string[];
@@ -206,9 +237,9 @@ type CleanResult = {
206
237
  };
207
238
  /**
208
239
  * 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.
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.
212
243
  */
213
244
  type RegistryRow = {
214
245
  name: keyof CapabilityConfigMap;
@@ -239,15 +270,40 @@ type DeepLinkConf = {
239
270
  * the app at startup.
240
271
  */
241
272
  type TauriConfFragment = Record<string, never> | DeepLinkConf;
242
- /** 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
+ */
243
289
  type PlistEntry = {
244
290
  key: string;
245
- value: string;
291
+ value: PlistValue;
246
292
  };
247
- /** 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
+ */
248
299
  type ManifestEntry = {
300
+ kind: "child";
249
301
  parentTag: string;
250
302
  xml: string;
303
+ } | {
304
+ kind: "activity-attribute";
305
+ name: `android:${string}`;
306
+ value: string | undefined;
251
307
  };
252
308
  /** A capability resolved against consumer config. */
253
309
  type ResolvedCapability = RegistryRow & {
@@ -275,6 +331,25 @@ type Api$4 = {
275
331
  getCompleteness(opts: {
276
332
  target: Target;
277
333
  }): CompletenessResult;
334
+ /**
335
+ * Runs the idempotent mobile post-init patch pass. Android gets its release signing and
336
+ * the main activity's manifest attributes (the orientation lock among them); iOS gets
337
+ * the Xcode entitlements-modification setting; both get the Xcode/Android-Studio
338
+ * runner-command rewrite when a `runner` is supplied. The build plugin calls it after
339
+ * the mobile init pass, with the runner from `tauri.getRunner()`.
340
+ *
341
+ * @param opts - The patch options.
342
+ * @param opts.target - The mobile platform to patch.
343
+ * @param opts.runner - The absolute Node/`tauri.js` pair from `tauri.getRunner()`.
344
+ * @returns The paths patched vs. left unchanged.
345
+ * @example
346
+ * ```ts
347
+ * // app.orientation is "portrait", projectDir is the default, the lock is not written yet
348
+ * await app.project.patchMobile({ target: "android" });
349
+ * // { patched: [".moku/tauri/src-tauri/gen/android/app/src/main/AndroidManifest.xml"],
350
+ * // unchanged: [".moku/tauri/src-tauri/gen/android/app/build.gradle.kts"] }
351
+ * ```
352
+ */
278
353
  patchMobile(opts: PatchMobileOptions): Promise<PatchResult>;
279
354
  clean(opts?: {
280
355
  target?: Target | undefined;
@@ -578,7 +653,9 @@ type Config$1 = {
578
653
  /**
579
654
  * Plugin state: the one branded console every verb and hook renders through (created
580
655
  * once in `createState`) plus the live-render bookkeeping for the current verb
581
- * invocation (`startedAt: undefined` = no phase running; unicorn/no-null).
656
+ * invocation (`startedAt: undefined` = no phase running; unicorn/no-null). `startedAt` is a
657
+ * `performance.now()` reading (monotonic, not epoch ms), so it only makes sense as the
658
+ * start of an elapsed-time difference.
582
659
  */
583
660
  type State = {
584
661
  readonly ui: BrandConsole;
@@ -679,8 +756,9 @@ declare const doctorPlugin: import("@moku-labs/core").PluginInstance<"doctor", C
679
756
  //#region src/plugins/project/index.d.ts
680
757
  /**
681
758
  * 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.
759
+ * sub-domain (completeness gate, Android signing block, Android manifest attributes,
760
+ * Xcode settings, runner-command rewrite) + the build-time orientation lock + the guarded
761
+ * clean.
684
762
  *
685
763
  * @see README.md
686
764
  * @example
@@ -737,4 +815,4 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
737
815
  */
738
816
  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
817
  //#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 };
818
+ 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 };