craft-native 0.0.55 → 0.0.72

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.
Files changed (146) hide show
  1. package/dist/android/src/index.d.ts +73 -0
  2. package/dist/android/src/index.js +177 -37
  3. package/dist/android/templates/AndroidManifest.xml.template +10 -36
  4. package/dist/android/templates/CraftBridge.kt.template +192 -60
  5. package/dist/android/templates/CraftHealthConnect.kt.template +200 -0
  6. package/dist/android/templates/CraftHealthConnectStub.kt.template +28 -0
  7. package/dist/android/templates/LocationRecordingService.kt.template +160 -0
  8. package/dist/android/templates/MainActivity.kt.template +140 -19
  9. package/dist/android/templates/build.gradle.kts.app.template +23 -1
  10. package/dist/android/templates/build.gradle.kts.project.template +3 -2
  11. package/dist/android/templates/proguard-rules.pro.template +9 -0
  12. package/dist/api/android-advanced.d.ts +5 -6
  13. package/dist/api/app.d.ts +0 -1
  14. package/dist/api/clipboard.d.ts +0 -1
  15. package/dist/api/crypto.d.ts +1 -2
  16. package/dist/api/db.d.ts +1 -2
  17. package/dist/api/dialog.d.ts +0 -1
  18. package/dist/api/fs.d.ts +1 -2
  19. package/dist/api/gestures.d.ts +66 -0
  20. package/dist/api/http.d.ts +1 -2
  21. package/dist/api/index.d.ts +37 -34
  22. package/dist/api/ios-advanced.d.ts +6 -7
  23. package/dist/api/macos-advanced.d.ts +2 -3
  24. package/dist/api/media.d.ts +0 -1
  25. package/dist/api/mobile.d.ts +109 -1
  26. package/dist/api/process.d.ts +0 -1
  27. package/dist/api/sidebar.d.ts +3 -20
  28. package/dist/api/spaces.d.ts +83 -0
  29. package/dist/api/tray.d.ts +2 -3
  30. package/dist/api/window.d.ts +1 -2
  31. package/dist/api/windows-advanced.d.ts +6 -7
  32. package/dist/assets/index.d.ts +0 -1
  33. package/dist/binary-resolver.d.ts +23 -1
  34. package/dist/bridge/android.d.ts +0 -1
  35. package/dist/bridge/core.d.ts +0 -38
  36. package/dist/bridge/ids.d.ts +0 -1
  37. package/dist/bridge/ios.d.ts +0 -1
  38. package/dist/bridge/webkit-pending.d.ts +0 -1
  39. package/dist/build/bundle-optimizer.d.ts +0 -1
  40. package/dist/cli.js +666 -90
  41. package/dist/components/index.d.ts +6 -7
  42. package/dist/components/native.d.ts +0 -1
  43. package/dist/components/sidebar.d.ts +2 -81
  44. package/dist/dev/devtools.d.ts +0 -1
  45. package/dist/dev/error-overlay.d.ts +0 -1
  46. package/dist/dev/hot-reload.d.ts +0 -1
  47. package/dist/index.cjs +113 -3
  48. package/dist/index.d.cts +16 -16
  49. package/dist/index.d.ts +16 -16
  50. package/dist/index.js +112 -4
  51. package/dist/ios/src/index.d.ts +172 -0
  52. package/dist/ios/src/index.js +440 -42
  53. package/dist/ios/templates/CraftActivityAttributes.swift +14 -0
  54. package/dist/ios/templates/CraftApp.swift +1001 -73
  55. package/dist/ios/templates/CraftLiveActivityWidget.swift.template +62 -0
  56. package/dist/ios/templates/CraftWatchApp.swift.template +155 -0
  57. package/dist/ios/templates/Info.plist.template +10 -9
  58. package/dist/ios/templates/WatchApp.Info.plist.template +26 -0
  59. package/dist/ios/templates/WidgetExtension.Info.plist +31 -0
  60. package/dist/ios/templates/project.yml.template +12 -1
  61. package/dist/logging/index.d.ts +0 -1
  62. package/dist/mobile.d.ts +8 -0
  63. package/dist/mobile.js +755 -0
  64. package/dist/optimizations/index.d.ts +3 -4
  65. package/dist/package.d.ts +11 -1
  66. package/dist/performance/runtime.d.ts +0 -1
  67. package/dist/performance/startup.d.ts +0 -1
  68. package/dist/plugins/index.d.ts +0 -1
  69. package/dist/security/index.d.ts +0 -1
  70. package/dist/sidebar-types.d.ts +102 -0
  71. package/dist/signing/index.d.ts +0 -1
  72. package/dist/styles/headwind.d.ts +0 -1
  73. package/dist/styles/index.d.ts +9 -10
  74. package/dist/styles/sidebar-templates.d.ts +0 -1
  75. package/dist/styles/sidebars.d.ts +0 -1
  76. package/dist/types.d.ts +131 -1
  77. package/dist/updater/index.d.ts +0 -1
  78. package/dist/utils/audio.d.ts +0 -1
  79. package/dist/utils/index.d.ts +4 -5
  80. package/dist/utils/native.d.ts +1 -2
  81. package/dist/utils/react.d.ts +0 -1
  82. package/dist/utils/storage.d.ts +0 -1
  83. package/dist/utils/svelte.d.ts +0 -1
  84. package/dist/utils/timer.d.ts +0 -1
  85. package/dist/utils/vue.d.ts +0 -1
  86. package/package.json +32 -4
  87. package/dist/android/src/index.js.map +0 -10
  88. package/dist/api/android-advanced.d.ts.map +0 -1
  89. package/dist/api/app.d.ts.map +0 -1
  90. package/dist/api/clipboard.d.ts.map +0 -1
  91. package/dist/api/crypto.d.ts.map +0 -1
  92. package/dist/api/db.d.ts.map +0 -1
  93. package/dist/api/dialog.d.ts.map +0 -1
  94. package/dist/api/fs.d.ts.map +0 -1
  95. package/dist/api/http.d.ts.map +0 -1
  96. package/dist/api/index.d.ts.map +0 -1
  97. package/dist/api/ios-advanced.d.ts.map +0 -1
  98. package/dist/api/macos-advanced.d.ts.map +0 -1
  99. package/dist/api/media.d.ts.map +0 -1
  100. package/dist/api/mobile.d.ts.map +0 -1
  101. package/dist/api/process.d.ts.map +0 -1
  102. package/dist/api/sidebar.d.ts.map +0 -1
  103. package/dist/api/tray.d.ts.map +0 -1
  104. package/dist/api/window.d.ts.map +0 -1
  105. package/dist/api/windows-advanced.d.ts.map +0 -1
  106. package/dist/assets/index.d.ts.map +0 -1
  107. package/dist/binary-resolver.d.ts.map +0 -1
  108. package/dist/bridge/android.d.ts.map +0 -1
  109. package/dist/bridge/core.d.ts.map +0 -1
  110. package/dist/bridge/ids.d.ts.map +0 -1
  111. package/dist/bridge/ios.d.ts.map +0 -1
  112. package/dist/bridge/webkit-pending.d.ts.map +0 -1
  113. package/dist/build/bundle-optimizer.d.ts.map +0 -1
  114. package/dist/components/index.d.ts.map +0 -1
  115. package/dist/components/native.d.ts.map +0 -1
  116. package/dist/components/sidebar.d.ts.map +0 -1
  117. package/dist/dev/devtools.d.ts.map +0 -1
  118. package/dist/dev/error-overlay.d.ts.map +0 -1
  119. package/dist/dev/hot-reload.d.ts.map +0 -1
  120. package/dist/index.d.ts.map +0 -1
  121. package/dist/index.js.map +0 -45
  122. package/dist/ios/src/index.js.map +0 -10
  123. package/dist/logging/index.d.ts.map +0 -1
  124. package/dist/optimizations/index.d.ts.map +0 -1
  125. package/dist/package.d.ts.map +0 -1
  126. package/dist/package.test.d.ts +0 -2
  127. package/dist/package.test.d.ts.map +0 -1
  128. package/dist/performance/runtime.d.ts.map +0 -1
  129. package/dist/performance/startup.d.ts.map +0 -1
  130. package/dist/plugins/index.d.ts.map +0 -1
  131. package/dist/security/index.d.ts.map +0 -1
  132. package/dist/signing/index.d.ts.map +0 -1
  133. package/dist/styles/headwind.d.ts.map +0 -1
  134. package/dist/styles/index.d.ts.map +0 -1
  135. package/dist/styles/sidebar-templates.d.ts.map +0 -1
  136. package/dist/styles/sidebars.d.ts.map +0 -1
  137. package/dist/types.d.ts.map +0 -1
  138. package/dist/updater/index.d.ts.map +0 -1
  139. package/dist/utils/audio.d.ts.map +0 -1
  140. package/dist/utils/index.d.ts.map +0 -1
  141. package/dist/utils/native.d.ts.map +0 -1
  142. package/dist/utils/react.d.ts.map +0 -1
  143. package/dist/utils/storage.d.ts.map +0 -1
  144. package/dist/utils/svelte.d.ts.map +0 -1
  145. package/dist/utils/timer.d.ts.map +0 -1
  146. package/dist/utils/vue.d.ts.map +0 -1
@@ -18,10 +18,10 @@
18
18
  * }
19
19
  * ```
20
20
  */
21
- export { Sidebar, createSidebar, createTahoeSidebar, createArcSidebar, createOrbStackSidebar, sidebarItem, sidebarSection, sidebarSeparator, tahoeStyle, arcStyle, orbstackStyle } from './sidebar';
22
- export type { SidebarItem, SidebarSection, ContextMenuItem, SidebarStyle, SidebarPosition, SidebarConfig, SidebarHeaderConfig, SidebarFooterConfig, SidebarEventType, SidebarEventMap, SidebarEventHandler } from './sidebar';
23
- export { createSplitView, SplitViewInstance, createFileBrowser, FileBrowserInstance, createOutlineView, OutlineViewInstance, createTableView, TableViewInstance, showQuickLook, hideQuickLook, canQuickLook, showColorPicker, showFontPicker, showDatePicker, createProgress, ProgressInstance, setToolbar, updateToolbarItem, setToolbarVisible, setTouchBar, updateTouchBarItem } from './native';
24
- export type { ComponentProps, ComponentInstance, SplitViewOrientation, SplitViewDividerStyle, SplitViewConfig, FileBrowserConfig, FileBrowserSelection, OutlineItem, OutlineViewConfig, TableColumn, TableRow, TableViewConfig, QuickLookConfig, ColorPickerConfig, FontPickerConfig, FontResult, DatePickerConfig, ProgressConfig, ToolbarItem, ToolbarConfig, TouchBarItem, TouchBarConfig } from './native';
21
+ export { Sidebar, createSidebar, createTahoeSidebar, createArcSidebar, createOrbStackSidebar, sidebarItem, sidebarSection, sidebarSeparator, tahoeStyle, arcStyle, orbstackStyle } from './sidebar.js';
22
+ export type { SidebarItem, SidebarSection, ContextMenuItem, SidebarStyle, SidebarPosition, SidebarConfig, SidebarHeaderConfig, SidebarFooterConfig, SidebarEventType, SidebarEventMap, SidebarEventHandler } from './sidebar.js';
23
+ export { createSplitView, SplitViewInstance, createFileBrowser, FileBrowserInstance, createOutlineView, OutlineViewInstance, createTableView, TableViewInstance, showQuickLook, hideQuickLook, canQuickLook, showColorPicker, showFontPicker, showDatePicker, createProgress, ProgressInstance, setToolbar, updateToolbarItem, setToolbarVisible, setTouchBar, updateTouchBarItem } from './native.js';
24
+ export type { ComponentProps, ComponentInstance, SplitViewOrientation, SplitViewDividerStyle, SplitViewConfig, FileBrowserConfig, FileBrowserSelection, OutlineItem, OutlineViewConfig, TableColumn, TableRow, TableViewConfig, QuickLookConfig, ColorPickerConfig, FontPickerConfig, FontResult, DatePickerConfig, ProgressConfig, ToolbarItem, ToolbarConfig, TouchBarItem, TouchBarConfig } from './native.js';
25
25
  /**
26
26
  * Flexbox style properties.
27
27
  */
@@ -573,7 +573,7 @@ export interface ScrollEvent {
573
573
  */
574
574
  export declare const Platform: {
575
575
  /** Current platform */
576
- OS: "ios" | "android" | "web";
576
+ OS: 'ios' | 'android' | 'web';
577
577
  /** Platform version */
578
578
  Version: string;
579
579
  /**
@@ -632,7 +632,7 @@ export declare const StyleSheet: {
632
632
  * Get the absolute fill style (full parent).
633
633
  */
634
634
  absoluteFill: {
635
- position: "absolute";
635
+ position: 'absolute';
636
636
  top: number;
637
637
  left: number;
638
638
  right: number;
@@ -716,4 +716,3 @@ declare const components: {
716
716
  Animated: typeof Animated;
717
717
  };
718
718
  export default components;
719
- //# sourceMappingURL=index.d.ts.map
@@ -725,4 +725,3 @@ declare const nativeComponents: {
725
725
  updateTouchBarItem: typeof updateTouchBarItem;
726
726
  };
727
727
  export default nativeComponents;
728
- //# sourceMappingURL=native.d.ts.map
@@ -10,86 +10,8 @@
10
10
  * `webSidebarMaterial` window — that component is the canonical macOS look.
11
11
  * @module @craft-native/components/sidebar
12
12
  */
13
- /**
14
- * Sidebar item components-flavored.
15
- *
16
- * NOTE: there is a separate `SidebarItem` type in `api/sidebar` with a
17
- * narrower shape (only `tintColor` / `enabled` / no `contextMenu`). The
18
- * top-level package exports the api version; if you reach into
19
- * `craft-native/components` directly you will get *this* one.
20
- * Don't rely on cross-mixing the two.
21
- */
22
- export interface SidebarItem {
23
- /** Unique identifier */
24
- id: string;
25
- /** Display label */
26
- label: string;
27
- /** Icon (SF Symbol name, path, or emoji) */
28
- icon?: string;
29
- /** Badge text/number */
30
- badge?: string | number;
31
- /** Badge color */
32
- badgeColor?: string;
33
- /** Whether item is selected */
34
- selected?: boolean;
35
- /** Whether item is disabled */
36
- disabled?: boolean;
37
- /** Whether item is expandable/collapsible */
38
- expandable?: boolean;
39
- /** Whether item is expanded (if expandable) */
40
- expanded?: boolean;
41
- /** Child items */
42
- children?: SidebarItem[];
43
- /** Custom data */
44
- data?: Record<string, any>;
45
- /** Tooltip */
46
- tooltip?: string;
47
- /** Context menu items */
48
- contextMenu?: ContextMenuItem[];
49
- /** Whether item is draggable */
50
- draggable?: boolean;
51
- /** Drop target types accepted */
52
- dropTypes?: string[];
53
- }
54
- /**
55
- * Sidebar section (group of items)
56
- */
57
- export interface SidebarSection {
58
- /** Section ID */
59
- id: string;
60
- /** Section title (can be empty for untitled section) */
61
- title?: string;
62
- /** Items in this section */
63
- items: SidebarItem[];
64
- /** Whether section is collapsible */
65
- collapsible?: boolean;
66
- /** Whether section is collapsed */
67
- collapsed?: boolean;
68
- }
69
- /**
70
- * Context menu item
71
- */
72
- export interface ContextMenuItem {
73
- /** Item ID */
74
- id?: string;
75
- /** Label */
76
- label?: string;
77
- /** Item type */
78
- type?: 'normal' | 'separator' | 'checkbox';
79
- /** Icon */
80
- icon?: string;
81
- /** Keyboard shortcut */
82
- shortcut?: string;
83
- /** Checked state */
84
- checked?: boolean;
85
- /** Disabled state */
86
- disabled?: boolean;
87
- /** Submenu items */
88
- submenu?: ContextMenuItem[];
89
- }
90
- /**
91
- * Sidebar style presets
92
- */
13
+ export type { ContextMenuItem, SidebarItem, SidebarSection } from '../sidebar-types.js';
14
+ import type { SidebarItem, SidebarSection } from '../sidebar-types.js';
93
15
  export type SidebarStyle = 'tahoe' | 'arc' | 'orbstack' | 'custom';
94
16
  /**
95
17
  * Sidebar position
@@ -459,4 +381,3 @@ declare const sidebarModule: {
459
381
  orbstackStyle: typeof orbstackStyle;
460
382
  };
461
383
  export default sidebarModule;
462
- //# sourceMappingURL=sidebar.d.ts.map
@@ -115,4 +115,3 @@ export declare class DevToolsServer extends EventEmitter {
115
115
  }
116
116
  export declare function getDevTools(): DevToolsServer;
117
117
  export default DevToolsServer;
118
- //# sourceMappingURL=devtools.d.ts.map
@@ -70,4 +70,3 @@ export declare function getErrorOverlay(): ErrorOverlay;
70
70
  export declare function showError(error: Error | string): void;
71
71
  export declare function hideError(): void;
72
72
  export default ErrorOverlay;
73
- //# sourceMappingURL=error-overlay.d.ts.map
@@ -133,4 +133,3 @@ export declare class HotReloadServer extends EventEmitter {
133
133
  */
134
134
  export declare function createHmrClient(serverUrl: string): string;
135
135
  export default HotReloadServer;
136
- //# sourceMappingURL=hot-reload.d.ts.map
package/dist/index.cjs CHANGED
@@ -80,6 +80,7 @@ __export(exports_src, {
80
80
  stageManager: () => stageManager,
81
81
  spotlight: () => spotlight,
82
82
  spawn: () => spawn2,
83
+ spaces: () => spaces,
83
84
  sidecar: () => sidecar,
84
85
  sidebarUtils: () => sidebarUtils,
85
86
  sidebarSeparator: () => sidebarSeparator,
@@ -125,6 +126,7 @@ __export(exports_src, {
125
126
  playBilling: () => playBilling,
126
127
  photoPicker: () => photoPicker,
127
128
  permissions: () => permissions,
129
+ parseCraftVersionOutput: () => parseCraftVersionOutput,
128
130
  packageApp: () => packageApp,
129
131
  pack: () => pack,
130
132
  orbstackStyles: () => orbstackStyles,
@@ -134,6 +136,7 @@ __export(exports_src, {
134
136
  openFile: () => openFile,
135
137
  openDatabase: () => openDatabase,
136
138
  open: () => open,
139
+ onSwipe: () => onSwipe,
137
140
  notify: () => notify,
138
141
  notifications: () => notifications,
139
142
  notification: () => notifications,
@@ -159,6 +162,8 @@ __export(exports_src, {
159
162
  hideDockIcon: () => hideDockIcon,
160
163
  hide: () => hide,
161
164
  hashPassword: () => hashPassword,
165
+ hasNativeSpaces: () => hasNativeSpaces,
166
+ hasNativeGestures: () => hasNativeGestures,
162
167
  haptics: () => haptics,
163
168
  handoff: () => handoff,
164
169
  getVersion: () => getVersion,
@@ -172,6 +177,7 @@ __export(exports_src, {
172
177
  getInfo: () => getInfo,
173
178
  getFullPageHTML: () => getFullPageHTML,
174
179
  getCraft: () => getCraft,
180
+ gestures: () => gestures,
175
181
  generateUpdateManifest: () => generateUpdateManifest,
176
182
  generateConfig: () => generateConfig,
177
183
  fs: () => fs,
@@ -192,6 +198,7 @@ __export(exports_src, {
192
198
  createTahoeSidebar: () => createTahoeSidebar,
193
199
  createTableView: () => createTableView,
194
200
  createSplitView: () => createSplitView,
201
+ createSpacesSidebar: () => createSpacesSidebar,
195
202
  createSidebar: () => createSidebar,
196
203
  createSettingsSidebar: () => createSettingsSidebar,
197
204
  createProgress: () => createProgress,
@@ -882,6 +889,9 @@ function windowsExecutableName(name) {
882
889
  throw new Error(`Reserved Windows application name: ${JSON.stringify(name)}`);
883
890
  return `${name}.exe`;
884
891
  }
892
+ function candleArguments(architecture, wixobjPath, wxsPath) {
893
+ return ["-nologo", "-arch", architecture, "-out", wixobjPath, wxsPath];
894
+ }
885
895
  function runCommand(command, args, cwd) {
886
896
  return new Promise((resolve, reject) => {
887
897
  const child = import_child_process.spawn(command, args, { cwd, stdio: "inherit", windowsHide: true });
@@ -898,7 +908,7 @@ async function createMSI(opts) {
898
908
  const wixobjPath = import_path.join(tempDir, "installer.wixobj");
899
909
  import_fs.copyFileSync(opts.binaryPath, sourcePath);
900
910
  import_fs.writeFileSync(wxsPath, renderWixSource(opts, binaryName));
901
- await runCommand("candle.exe", ["-nologo", "-out", wixobjPath, wxsPath], tempDir);
911
+ await runCommand("candle.exe", candleArguments(opts.architecture, wixobjPath, wxsPath), tempDir);
902
912
  await runCommand("light.exe", ["-nologo", "-sval", "-out", opts.outputPath, wixobjPath], tempDir);
903
913
  if (opts.certificatePath) {
904
914
  const signArgs = ["sign", "/fd", "sha256", "/tr", "https://timestamp.digicert.com", "/td", "sha256", "/f", opts.certificatePath];
@@ -4787,6 +4797,8 @@ var secureStorage = {
4787
4797
  if (typeof window !== "undefined" && craft?.secureStorage) {
4788
4798
  return craft.secureStorage.set(key, value);
4789
4799
  }
4800
+ if (typeof window !== "undefined" && window.craft)
4801
+ throw new Error("Craft secure storage bridge is unavailable");
4790
4802
  localStorage.setItem(`secure_${key}`, value);
4791
4803
  },
4792
4804
  async get(key) {
@@ -4794,6 +4806,8 @@ var secureStorage = {
4794
4806
  if (typeof window !== "undefined" && craft?.secureStorage) {
4795
4807
  return craft.secureStorage.get(key);
4796
4808
  }
4809
+ if (typeof window !== "undefined" && window.craft)
4810
+ throw new Error("Craft secure storage bridge is unavailable");
4797
4811
  return localStorage.getItem(`secure_${key}`);
4798
4812
  },
4799
4813
  async delete(key) {
@@ -4801,6 +4815,8 @@ var secureStorage = {
4801
4815
  if (typeof window !== "undefined" && craft?.secureStorage) {
4802
4816
  return craft.secureStorage.delete(key);
4803
4817
  }
4818
+ if (typeof window !== "undefined" && window.craft)
4819
+ throw new Error("Craft secure storage bridge is unavailable");
4804
4820
  localStorage.removeItem(`secure_${key}`);
4805
4821
  },
4806
4822
  async clear() {
@@ -4808,9 +4824,19 @@ var secureStorage = {
4808
4824
  if (typeof window !== "undefined" && craft?.secureStorage) {
4809
4825
  return craft.secureStorage.clear();
4810
4826
  }
4827
+ if (typeof window !== "undefined" && window.craft)
4828
+ throw new Error("Craft secure storage bridge is unavailable");
4811
4829
  Object.keys(localStorage).filter((k) => k.startsWith("secure_")).forEach((k) => localStorage.removeItem(k));
4812
4830
  }
4813
4831
  };
4832
+ var webLocationRecording = {
4833
+ id: null,
4834
+ active: false,
4835
+ paused: false,
4836
+ startedAt: null,
4837
+ locations: []
4838
+ };
4839
+ var webLocationRecordingWatchId = null;
4814
4840
  var location = {
4815
4841
  async getCurrentPosition(options = {}) {
4816
4842
  const craft = getCraftMobile();
@@ -4858,6 +4884,63 @@ var location = {
4858
4884
  return craft.location.clearWatch(watchId);
4859
4885
  }
4860
4886
  navigator.geolocation.clearWatch(watchId);
4887
+ },
4888
+ async startRecording(options = {}) {
4889
+ const craft = getCraftMobile();
4890
+ if (typeof window !== "undefined" && craft?.location?.startRecording)
4891
+ return craft.location.startRecording(options);
4892
+ if (webLocationRecordingWatchId !== null)
4893
+ navigator.geolocation.clearWatch(webLocationRecordingWatchId);
4894
+ webLocationRecording = {
4895
+ id: secureUUID(),
4896
+ active: true,
4897
+ paused: false,
4898
+ startedAt: Date.now(),
4899
+ locations: []
4900
+ };
4901
+ webLocationRecordingWatchId = location.watchPosition((position) => {
4902
+ if (!webLocationRecording.paused)
4903
+ webLocationRecording.locations.push(position);
4904
+ }, options);
4905
+ return { ...webLocationRecording, sampleCount: 0 };
4906
+ },
4907
+ async pauseRecording() {
4908
+ const craft = getCraftMobile();
4909
+ if (typeof window !== "undefined" && craft?.location?.pauseRecording)
4910
+ return craft.location.pauseRecording();
4911
+ webLocationRecording.paused = true;
4912
+ return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
4913
+ },
4914
+ async resumeRecording() {
4915
+ const craft = getCraftMobile();
4916
+ if (typeof window !== "undefined" && craft?.location?.resumeRecording)
4917
+ return craft.location.resumeRecording();
4918
+ webLocationRecording.paused = false;
4919
+ return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
4920
+ },
4921
+ async stopRecording() {
4922
+ const craft = getCraftMobile();
4923
+ if (typeof window !== "undefined" && craft?.location?.stopRecording)
4924
+ return craft.location.stopRecording();
4925
+ if (webLocationRecordingWatchId !== null) {
4926
+ location.clearWatch(webLocationRecordingWatchId);
4927
+ webLocationRecordingWatchId = null;
4928
+ }
4929
+ webLocationRecording.active = false;
4930
+ webLocationRecording.paused = false;
4931
+ return { ...webLocationRecording, locations: [...webLocationRecording.locations] };
4932
+ },
4933
+ async getRecordingState() {
4934
+ const craft = getCraftMobile();
4935
+ if (typeof window !== "undefined" && craft?.location?.getRecordingState)
4936
+ return craft.location.getRecordingState();
4937
+ return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
4938
+ },
4939
+ async readRecording() {
4940
+ const craft = getCraftMobile();
4941
+ if (typeof window !== "undefined" && craft?.location?.readRecording)
4942
+ return craft.location.readRecording();
4943
+ return [...webLocationRecording.locations];
4861
4944
  }
4862
4945
  };
4863
4946
  var share = {
@@ -7248,6 +7331,29 @@ var sidebar = {
7248
7331
  settings: createSettingsSidebar,
7249
7332
  Sidebar
7250
7333
  };
7334
+ // src/api/spaces.ts
7335
+ function hasNativeSpaces() {
7336
+ const nativeUI = globalThis.window?.craft?.nativeUI;
7337
+ return typeof nativeUI?.createSpacesSidebar === "function";
7338
+ }
7339
+ function createSpacesSidebar(options = {}) {
7340
+ const nativeUI = globalThis.window?.craft?.nativeUI;
7341
+ if (typeof nativeUI?.createSpacesSidebar !== "function")
7342
+ return null;
7343
+ return nativeUI.createSpacesSidebar(options);
7344
+ }
7345
+ var spaces = { hasNativeSpaces, createSpacesSidebar };
7346
+ // src/api/gestures.ts
7347
+ function hasNativeGestures() {
7348
+ return typeof globalThis.window?.craft?.gestures?.onSwipe === "function";
7349
+ }
7350
+ function onSwipe(listener) {
7351
+ const gestures = globalThis.window?.craft?.gestures;
7352
+ if (typeof gestures?.onSwipe !== "function")
7353
+ return () => {};
7354
+ return gestures.onSwipe(listener);
7355
+ }
7356
+ var gestures = { hasNativeGestures, onSwipe };
7251
7357
  // src/components/index.ts
7252
7358
  var exports_components = {};
7253
7359
  __export(exports_components, {
@@ -10385,7 +10491,7 @@ var execFileAsync = import_node_util.promisify(import_node_child_process.execFil
10385
10491
  var versionMismatchWarned = false;
10386
10492
  function getSdkVersion() {
10387
10493
  try {
10388
- const pkgPath = import_node_path.join("/Users/chris/Code/Tools/craft/packages/typescript/src", "..", "package.json");
10494
+ const pkgPath = import_node_path.join("/home/runner/work/craft/craft/packages/typescript/src", "..", "package.json");
10389
10495
  return JSON.parse(import_node_fs2.readFileSync(pkgPath, "utf-8")).version ?? "unknown";
10390
10496
  } catch {
10391
10497
  return "unknown";
@@ -10396,7 +10502,7 @@ async function probeBinaryVersion(craftPath) {
10396
10502
  return;
10397
10503
  try {
10398
10504
  const { stdout } = await execFileAsync(craftPath, ["--version"], { timeout: 2000 });
10399
- const nativeVersion = stdout.trim().replace(/^v/, "");
10505
+ const nativeVersion = parseCraftVersionOutput(stdout);
10400
10506
  const sdkVersion = getSdkVersion();
10401
10507
  if (sdkVersion !== "unknown" && nativeVersion && nativeVersion !== sdkVersion) {
10402
10508
  versionMismatchWarned = true;
@@ -10405,6 +10511,10 @@ async function probeBinaryVersion(craftPath) {
10405
10511
  }
10406
10512
  } catch {}
10407
10513
  }
10514
+ function parseCraftVersionOutput(output) {
10515
+ const firstLine = output.trim().split(/\r?\n/, 1)[0] ?? "";
10516
+ return firstLine.replace(/^craft version\s+/i, "").replace(/^v/, "").trim();
10517
+ }
10408
10518
  function detectDevMode() {
10409
10519
  if (typeof process === "undefined")
10410
10520
  return false;
package/dist/index.d.cts CHANGED
@@ -2,20 +2,21 @@
2
2
  * Craft - Build desktop apps with web languages
3
3
  * TypeScript SDK powered by Bun
4
4
  */
5
- import type { AppConfig, WindowOptions } from './types';
6
- export { packageApp, pack, type PackageConfig, type PackageResult } from './package';
7
- export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver';
8
- export * from './utils';
9
- export * from './api';
10
- export * as components from './components';
11
- export { createTahoeSidebar, createArcSidebar, createOrbStackSidebar, sidebarItem, sidebarSection, sidebarSeparator, tahoeStyle, arcStyle, orbstackStyle, createSplitView, SplitViewInstance, createFileBrowser, FileBrowserInstance, createOutlineView, OutlineViewInstance, createTableView, TableViewInstance, showQuickLook, hideQuickLook, canQuickLook, showColorPicker, showFontPicker, showDatePicker, createProgress, ProgressInstance, setToolbar, updateToolbarItem, setToolbarVisible, setTouchBar, updateTouchBarItem, StyleSheet, Animated, } from './components';
12
- export type { ContextMenuItem, SidebarStyle, SidebarPosition, SidebarHeaderConfig, SidebarFooterConfig, SidebarEventType, SidebarEventMap, SidebarEventHandler, ComponentProps, ComponentInstance, SplitViewOrientation, SplitViewDividerStyle, SplitViewConfig, FileBrowserConfig, FileBrowserSelection, OutlineItem, OutlineViewConfig, TableRow, TableViewConfig, QuickLookConfig, ColorPickerConfig, FontPickerConfig, FontResult, DatePickerConfig, ProgressConfig, ToolbarItem, ToolbarConfig, TouchBarConfig, FlexStyle, LayoutStyle, SpacingStyle, BorderStyle, ColorStyle, ShadowStyle, TransformStyle, ViewStyle, TextStyleProps, TextStyle, ImageStyleProps, ImageStyle, BaseProps, ViewProps, TextProps, ImageSource, ImageProps, ScrollViewProps, PressableProps, TextInputProps, FlatListProps, LayoutEvent, ScrollEvent, } from './components';
13
- export * from './styles/headwind';
14
- export * from './styles';
15
- export * from './optimizations';
16
- export * as updater from './updater';
17
- export { AutoUpdater, generateUpdateManifest } from './updater';
18
- export type { UpdateInfo as UpdateManifest, UpdateProgress, UpdaterConfig, UpdaterEvent, PlatformUpdate, } from './updater';
5
+ import type { AppConfig, WindowOptions } from './types.js';
6
+ export declare function parseCraftVersionOutput(output: string): string;
7
+ export { packageApp, pack, type PackageConfig, type PackageResult } from './package.js';
8
+ export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver.js';
9
+ export * from './utils/index.js';
10
+ export * from './api/index.js';
11
+ export * as components from './components/index.js';
12
+ export { createTahoeSidebar, createArcSidebar, createOrbStackSidebar, sidebarItem, sidebarSection, sidebarSeparator, tahoeStyle, arcStyle, orbstackStyle, createSplitView, SplitViewInstance, createFileBrowser, FileBrowserInstance, createOutlineView, OutlineViewInstance, createTableView, TableViewInstance, showQuickLook, hideQuickLook, canQuickLook, showColorPicker, showFontPicker, showDatePicker, createProgress, ProgressInstance, setToolbar, updateToolbarItem, setToolbarVisible, setTouchBar, updateTouchBarItem, StyleSheet, Animated, } from './components/index.js';
13
+ export type { ContextMenuItem, SidebarStyle, SidebarPosition, SidebarHeaderConfig, SidebarFooterConfig, SidebarEventType, SidebarEventMap, SidebarEventHandler, ComponentProps, ComponentInstance, SplitViewOrientation, SplitViewDividerStyle, SplitViewConfig, FileBrowserConfig, FileBrowserSelection, OutlineItem, OutlineViewConfig, TableRow, TableViewConfig, QuickLookConfig, ColorPickerConfig, FontPickerConfig, FontResult, DatePickerConfig, ProgressConfig, ToolbarItem, ToolbarConfig, TouchBarConfig, FlexStyle, LayoutStyle, SpacingStyle, BorderStyle, ColorStyle, ShadowStyle, TransformStyle, ViewStyle, TextStyleProps, TextStyle, ImageStyleProps, ImageStyle, BaseProps, ViewProps, TextProps, ImageSource, ImageProps, ScrollViewProps, PressableProps, TextInputProps, FlatListProps, LayoutEvent, ScrollEvent, } from './components/index.js';
14
+ export * from './styles/headwind.js';
15
+ export * from './styles/index.js';
16
+ export * from './optimizations/index.js';
17
+ export * as updater from './updater/index.js';
18
+ export { AutoUpdater, generateUpdateManifest } from './updater/index.js';
19
+ export type { UpdateInfo as UpdateManifest, UpdateProgress, UpdaterConfig, UpdaterEvent, PlatformUpdate, } from './updater/index.js';
19
20
  export declare class CraftApp {
20
21
  private process?;
21
22
  private config;
@@ -58,5 +59,4 @@ export declare function show(html: string, options?: WindowOptions): Promise<voi
58
59
  * Quick helper to load a URL
59
60
  */
60
61
  export declare function loadURL(url: string, options?: WindowOptions): Promise<void>;
61
- export type { WindowOptions, CraftSidebarAPI, AppConfig, CraftTrayAPI, CraftWindowAPI, CraftAppAPI, CraftBridgeAPI, Permission, HapticType, CameraOptions, PhotoPickerOptions, CraftMobileAPI, CraftFileSystemAPI, CraftDatabaseAPI, CraftHttpAPI, CraftCryptoAPI, CraftEventType, CraftEventMap, CraftEventHandler, CraftEventEmitter, IOSConfig, AndroidConfig, MacOSConfig, WindowsConfig, LinuxConfig, CraftAppConfig, } from './types';
62
- //# sourceMappingURL=index.d.ts.map
62
+ export type { WindowOptions, CraftSidebarAPI, AppConfig, CraftTrayAPI, CraftWindowAPI, CraftAppAPI, CraftBridgeAPI, Permission, HapticType, CameraOptions, PhotoPickerOptions, CraftMobileAPI, CraftFileSystemAPI, CraftDatabaseAPI, CraftHttpAPI, CraftCryptoAPI, CraftEventType, CraftEventMap, CraftEventHandler, CraftEventEmitter, IOSConfig, AndroidConfig, MacOSConfig, WindowsConfig, LinuxConfig, CraftAppConfig, } from './types.js';
package/dist/index.d.ts CHANGED
@@ -2,20 +2,21 @@
2
2
  * Craft - Build desktop apps with web languages
3
3
  * TypeScript SDK powered by Bun
4
4
  */
5
- import type { AppConfig, WindowOptions } from './types';
6
- export { packageApp, pack, type PackageConfig, type PackageResult } from './package';
7
- export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver';
8
- export * from './utils';
9
- export * from './api';
10
- export * as components from './components';
11
- export { createTahoeSidebar, createArcSidebar, createOrbStackSidebar, sidebarItem, sidebarSection, sidebarSeparator, tahoeStyle, arcStyle, orbstackStyle, createSplitView, SplitViewInstance, createFileBrowser, FileBrowserInstance, createOutlineView, OutlineViewInstance, createTableView, TableViewInstance, showQuickLook, hideQuickLook, canQuickLook, showColorPicker, showFontPicker, showDatePicker, createProgress, ProgressInstance, setToolbar, updateToolbarItem, setToolbarVisible, setTouchBar, updateTouchBarItem, StyleSheet, Animated, } from './components';
12
- export type { ContextMenuItem, SidebarStyle, SidebarPosition, SidebarHeaderConfig, SidebarFooterConfig, SidebarEventType, SidebarEventMap, SidebarEventHandler, ComponentProps, ComponentInstance, SplitViewOrientation, SplitViewDividerStyle, SplitViewConfig, FileBrowserConfig, FileBrowserSelection, OutlineItem, OutlineViewConfig, TableRow, TableViewConfig, QuickLookConfig, ColorPickerConfig, FontPickerConfig, FontResult, DatePickerConfig, ProgressConfig, ToolbarItem, ToolbarConfig, TouchBarConfig, FlexStyle, LayoutStyle, SpacingStyle, BorderStyle, ColorStyle, ShadowStyle, TransformStyle, ViewStyle, TextStyleProps, TextStyle, ImageStyleProps, ImageStyle, BaseProps, ViewProps, TextProps, ImageSource, ImageProps, ScrollViewProps, PressableProps, TextInputProps, FlatListProps, LayoutEvent, ScrollEvent, } from './components';
13
- export * from './styles/headwind';
14
- export * from './styles';
15
- export * from './optimizations';
16
- export * as updater from './updater';
17
- export { AutoUpdater, generateUpdateManifest } from './updater';
18
- export type { UpdateInfo as UpdateManifest, UpdateProgress, UpdaterConfig, UpdaterEvent, PlatformUpdate, } from './updater';
5
+ import type { AppConfig, WindowOptions } from './types.js';
6
+ export declare function parseCraftVersionOutput(output: string): string;
7
+ export { packageApp, pack, type PackageConfig, type PackageResult } from './package.js';
8
+ export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver.js';
9
+ export * from './utils/index.js';
10
+ export * from './api/index.js';
11
+ export * as components from './components/index.js';
12
+ export { createTahoeSidebar, createArcSidebar, createOrbStackSidebar, sidebarItem, sidebarSection, sidebarSeparator, tahoeStyle, arcStyle, orbstackStyle, createSplitView, SplitViewInstance, createFileBrowser, FileBrowserInstance, createOutlineView, OutlineViewInstance, createTableView, TableViewInstance, showQuickLook, hideQuickLook, canQuickLook, showColorPicker, showFontPicker, showDatePicker, createProgress, ProgressInstance, setToolbar, updateToolbarItem, setToolbarVisible, setTouchBar, updateTouchBarItem, StyleSheet, Animated, } from './components/index.js';
13
+ export type { ContextMenuItem, SidebarStyle, SidebarPosition, SidebarHeaderConfig, SidebarFooterConfig, SidebarEventType, SidebarEventMap, SidebarEventHandler, ComponentProps, ComponentInstance, SplitViewOrientation, SplitViewDividerStyle, SplitViewConfig, FileBrowserConfig, FileBrowserSelection, OutlineItem, OutlineViewConfig, TableRow, TableViewConfig, QuickLookConfig, ColorPickerConfig, FontPickerConfig, FontResult, DatePickerConfig, ProgressConfig, ToolbarItem, ToolbarConfig, TouchBarConfig, FlexStyle, LayoutStyle, SpacingStyle, BorderStyle, ColorStyle, ShadowStyle, TransformStyle, ViewStyle, TextStyleProps, TextStyle, ImageStyleProps, ImageStyle, BaseProps, ViewProps, TextProps, ImageSource, ImageProps, ScrollViewProps, PressableProps, TextInputProps, FlatListProps, LayoutEvent, ScrollEvent, } from './components/index.js';
14
+ export * from './styles/headwind.js';
15
+ export * from './styles/index.js';
16
+ export * from './optimizations/index.js';
17
+ export * as updater from './updater/index.js';
18
+ export { AutoUpdater, generateUpdateManifest } from './updater/index.js';
19
+ export type { UpdateInfo as UpdateManifest, UpdateProgress, UpdaterConfig, UpdaterEvent, PlatformUpdate, } from './updater/index.js';
19
20
  export declare class CraftApp {
20
21
  private process?;
21
22
  private config;
@@ -58,5 +59,4 @@ export declare function show(html: string, options?: WindowOptions): Promise<voi
58
59
  * Quick helper to load a URL
59
60
  */
60
61
  export declare function loadURL(url: string, options?: WindowOptions): Promise<void>;
61
- export type { WindowOptions, CraftSidebarAPI, AppConfig, CraftTrayAPI, CraftWindowAPI, CraftAppAPI, CraftBridgeAPI, Permission, HapticType, CameraOptions, PhotoPickerOptions, CraftMobileAPI, CraftFileSystemAPI, CraftDatabaseAPI, CraftHttpAPI, CraftCryptoAPI, CraftEventType, CraftEventMap, CraftEventHandler, CraftEventEmitter, IOSConfig, AndroidConfig, MacOSConfig, WindowsConfig, LinuxConfig, CraftAppConfig, } from './types';
62
- //# sourceMappingURL=index.d.ts.map
62
+ export type { WindowOptions, CraftSidebarAPI, AppConfig, CraftTrayAPI, CraftWindowAPI, CraftAppAPI, CraftBridgeAPI, Permission, HapticType, CameraOptions, PhotoPickerOptions, CraftMobileAPI, CraftFileSystemAPI, CraftDatabaseAPI, CraftHttpAPI, CraftCryptoAPI, CraftEventType, CraftEventMap, CraftEventHandler, CraftEventEmitter, IOSConfig, AndroidConfig, MacOSConfig, WindowsConfig, LinuxConfig, CraftAppConfig, } from './types.js';