craft-native 0.0.110 → 0.0.112

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.
@@ -25,6 +25,8 @@ export interface CraftAndroidConfig {
25
25
  enableHealthConnect?: boolean;
26
26
  enableKeepAwake?: boolean;
27
27
  enableDeepLinks?: boolean;
28
+ /** Reach the person's own devices on the local network over plain HTTP (a Mac companion). */
29
+ enableLocalNetwork?: boolean;
28
30
  urlSchemes?: string[];
29
31
  trustedOrigins?: string[];
30
32
  appIconPath?: string;
@@ -445,7 +445,7 @@ async function init(options) {
445
445
  const healthTemplate = readFileSync(join(TEMPLATES_DIR, config.enableHealthConnect ? "CraftHealthConnect.kt.template" : "CraftHealthConnectStub.kt.template"), "utf-8");
446
446
  writeFileSync(join(output, "app/src/main/java", packagePath, "CraftHealthConnect.kt"), healthTemplate.replace(/\{\{PACKAGE_NAME\}\}/g, finalPackageName));
447
447
  const manifestTemplate = readFileSync(join(TEMPLATES_DIR, "AndroidManifest.xml.template"), "utf-8");
448
- const manifest = manifestTemplate.replace(/\{\{PACKAGE_NAME\}\}/g, finalPackageName).replace(/\{\{APP_NAME\}\}/g, name).replace(/\{\{PERMISSIONS\}\}/g, renderAndroidPermissions(config)).replace(/\{\{USES_CLEARTEXT\}\}/g, config.devServerURL?.startsWith("http://") ? "true" : "false").replace(/\{\{DEEP_LINK_INTENT_FILTERS\}\}/g, renderAndroidDeepLinks(config)).replace(/\{\{BACKGROUND_SERVICE\}\}/g, config.enableBackgroundLocation ? ' <service android:name="com.craft.runtime.LocationRecordingService" android:exported="false" android:foregroundServiceType="location" android:stopWithTask="false" />' : "").replace(/\{\{HEALTH_CONNECT_QUERIES\}\}/g, config.enableHealthConnect ? ` <queries>
448
+ const manifest = manifestTemplate.replace(/\{\{PACKAGE_NAME\}\}/g, finalPackageName).replace(/\{\{APP_NAME\}\}/g, name).replace(/\{\{PERMISSIONS\}\}/g, renderAndroidPermissions(config)).replace(/\{\{USES_CLEARTEXT\}\}/g, config.devServerURL?.startsWith("http://") || config.enableLocalNetwork ? "true" : "false").replace(/\{\{DEEP_LINK_INTENT_FILTERS\}\}/g, renderAndroidDeepLinks(config)).replace(/\{\{BACKGROUND_SERVICE\}\}/g, config.enableBackgroundLocation ? ' <service android:name="com.craft.runtime.LocationRecordingService" android:exported="false" android:foregroundServiceType="location" android:stopWithTask="false" />' : "").replace(/\{\{HEALTH_CONNECT_QUERIES\}\}/g, config.enableHealthConnect ? ` <queries>
449
449
  <package android:name="com.google.android.apps.healthdata" />
450
450
  </queries>` : "").replace(/\{\{HEALTH_CONNECT_RATIONALE\}\}/g, config.enableHealthConnect ? ` <intent-filter>
451
451
  <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
package/dist/cli.js CHANGED
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3303
3303
  `);
3304
3304
  }
3305
3305
  // package.json
3306
- var version = "0.0.110";
3306
+ var version = "0.0.112";
3307
3307
 
3308
3308
  // bin/cli.ts
3309
3309
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -310,7 +310,7 @@ function craftBinaryNotFoundMessage(triedPath) {
310
310
  `);
311
311
  }
312
312
  // package.json
313
- var version = "0.0.110";
313
+ var version = "0.0.112";
314
314
 
315
315
  // src/sdk-version.ts
316
316
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ function craftBinaryNotFoundMessage(triedPath) {
58
58
  `);
59
59
  }
60
60
  // package.json
61
- var version = "0.0.110";
61
+ var version = "0.0.112";
62
62
 
63
63
  // src/sdk-version.ts
64
64
  var SDK_VERSION = version;
@@ -40,6 +40,8 @@ export interface CraftConfig {
40
40
  enableOrientationLock?: boolean;
41
41
  enableDeepLinks?: boolean;
42
42
  enableQRScanner?: boolean;
43
+ /** Reach devices on the local network (a Mac on the same Wi-Fi); iOS asks first. */
44
+ enableLocalNetwork?: boolean;
43
45
  enableFilePicker?: boolean;
44
46
  enableFileDownload?: boolean;
45
47
  enableSocialAuth?: boolean;
@@ -27,6 +27,7 @@ var DEFAULT_CONFIG = {
27
27
  enableOrientationLock: false,
28
28
  enableDeepLinks: false,
29
29
  enableQRScanner: false,
30
+ enableLocalNetwork: false,
30
31
  enableFilePicker: false,
31
32
  enableFileDownload: false,
32
33
  enableSocialAuth: false,
@@ -91,6 +92,7 @@ function renderUsageDescriptions(config) {
91
92
  [config.enableBluetooth, "NSBluetoothAlwaysUsageDescription", `${config.appName} uses Bluetooth to connect to nearby devices.`],
92
93
  [config.enableMotionSensors, "NSMotionUsageDescription", `${config.appName} uses motion data for activity features.`],
93
94
  [config.enableNFC, "NFCReaderUsageDescription", `${config.appName} reads NFC tags when you start a scan.`],
95
+ [config.enableLocalNetwork, "NSLocalNetworkUsageDescription", `${config.appName} connects to your own devices on this network.`],
94
96
  [config.enableHealthKit, "NSHealthShareUsageDescription", `${config.appName} reads health data you choose to share.`],
95
97
  [config.enableHealthKit, "NSHealthUpdateUsageDescription", `${config.appName} writes health data only with your permission.`],
96
98
  [config.enableBiometric, "NSFaceIDUsageDescription", `${config.appName} uses Face ID to protect your account.`]
package/dist/types.d.ts CHANGED
@@ -1077,6 +1077,8 @@ export interface CraftContextMenuItem {
1077
1077
  */
1078
1078
  shortcut?: string;
1079
1079
  enabled?: boolean;
1080
+ /** Shows a checkmark: the choice in effect. */
1081
+ checked?: boolean;
1080
1082
  submenu?: CraftContextMenuItem[];
1081
1083
  }
1082
1084
  /** How a context menu closed. `id` is null when it was dismissed. */
@@ -1099,6 +1101,42 @@ export interface CraftNativeUIAPI {
1099
1101
  }) => Promise<CraftContextMenuResult>;
1100
1102
  /** Every context menu's outcome. Returns an unsubscribe function. */
1101
1103
  onContextMenuAction: (callback: (result: CraftContextMenuResult) => void) => () => void;
1104
+ /**
1105
+ * A native source-list sidebar (macOS): the window's content becomes a
1106
+ * split view with the sidebar on the left and the page on the right. One
1107
+ * per window.
1108
+ */
1109
+ createSidebar: (options: {
1110
+ id?: string;
1111
+ sections?: CraftSidebarSection[];
1112
+ selected?: string;
1113
+ }) => CraftSidebar;
1114
+ }
1115
+ export interface CraftSidebarItem {
1116
+ id: string;
1117
+ label: string;
1118
+ /** SF Symbol name, e.g. `'tray'`. */
1119
+ icon?: string;
1120
+ /** A count or short text drawn right-aligned, like Mail's unread counts. */
1121
+ badge?: string;
1122
+ }
1123
+ export interface CraftSidebarSection {
1124
+ id: string;
1125
+ /** The section's heading; omit for none. */
1126
+ header?: string;
1127
+ items: CraftSidebarItem[];
1128
+ }
1129
+ export interface CraftSidebar {
1130
+ readonly id: string;
1131
+ /** Replace every section, keeping the selection by id when it still exists. */
1132
+ setSections: (sections: CraftSidebarSection[]) => CraftSidebar;
1133
+ /** Change one row's label, icon or badge in place; `badge: ''` clears it. */
1134
+ updateItem: (itemId: string, changes: Partial<Omit<CraftSidebarItem, 'id'>>) => CraftSidebar;
1135
+ /** Select a row without reporting it as a pick. */
1136
+ setSelectedItem: (itemId: string) => CraftSidebar;
1137
+ /** The person picked a row. */
1138
+ onSelect: (callback: (itemId: string) => void) => CraftSidebar;
1139
+ destroy: () => void;
1102
1140
  }
1103
1141
  export interface CraftBridgeAPI {
1104
1142
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.110",
3
+ "version": "0.0.112",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",