craft-native 0.0.395 → 0.0.408

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 (37) hide show
  1. package/README.md +7 -0
  2. package/dist/android/templates/CraftBridge.kt.template +2 -0
  3. package/dist/android/templates/CraftNative.kt.template +7 -0
  4. package/dist/android/templates/CraftNativeFlatList.kt.template +7 -0
  5. package/dist/android/templates/CraftNativeMapGoogle.kt.template +3 -0
  6. package/dist/android/templates/CraftNativeMapLibre.kt.template +3 -0
  7. package/dist/android/templates/CraftNativeRefreshableFlatList.kt.template +9 -0
  8. package/dist/android/templates/CraftNativeServices.kt.template +2 -1
  9. package/dist/android/templates/CraftNativeShell.kt.template +12 -2
  10. package/dist/android/templates/LocationRecordingService.kt.template +125 -6
  11. package/dist/android/templates/MainActivityNative.kt.template +338 -21
  12. package/dist/api/mobile.d.ts +59 -2
  13. package/dist/cli.js +1 -1
  14. package/dist/components/index.d.ts +16 -0
  15. package/dist/index.cjs +54 -7
  16. package/dist/index.d.cts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +54 -7
  19. package/dist/ios/src/index.d.ts +7 -0
  20. package/dist/ios/templates/CraftApp.swift +268 -12
  21. package/dist/ios/templates/CraftHybrid.swift +1 -0
  22. package/dist/ios/templates/CraftNativeActions.swift +3 -1
  23. package/dist/ios/templates/CraftNativeFlatList.swift +4 -0
  24. package/dist/ios/templates/CraftNativeMutation.swift +27 -2
  25. package/dist/ios/templates/CraftNativeScreen.swift +293 -44
  26. package/dist/ios/templates/CraftNativeUI.swift +89 -0
  27. package/dist/ios/templates/testing/DriverTests.swift.template +17 -1
  28. package/dist/macos/src/index.d.ts +14 -3
  29. package/dist/macos/src/index.js +124 -27
  30. package/dist/macos/src/toolchain.d.ts +56 -0
  31. package/dist/macos/templates/CraftMacApplication.swift +54 -9
  32. package/dist/macos/templates/CraftMacRenderer.swift +376 -18
  33. package/dist/macos/templates/CraftMacRuntime.swift +114 -1
  34. package/dist/macos/templates/CraftMacWebView.swift +416 -0
  35. package/dist/macos/templates/CraftNativeMutation.swift +27 -2
  36. package/dist/mobile.js +53 -6
  37. package/package.json +1 -1
@@ -558,10 +558,42 @@ export interface LocationOptions {
558
558
  export interface RecordingStartOptions {
559
559
  recordingId?: string;
560
560
  }
561
+ /**
562
+ * How hard a route recording works the GPS. `'saver'` is for a long effort (an
563
+ * ultra): fixes come at least 5 m apart rather than every second, and while
564
+ * the pace holds steady iOS asks for ten-metre accuracy instead of the best it
565
+ * can do, going back to the best at once when the pace or the signal changes.
566
+ * Fixes stay under 30 s apart at any speed that counts as moving, so distance
567
+ * and moving time come out as they would at full rate. Android asks for the
568
+ * same spacing and batches delivery.
569
+ *
570
+ * `'auto'` saves power only while the device wants it: iOS Low Power Mode or
571
+ * Android Battery Saver is on, or the battery is under 20% and not charging.
572
+ * The host re-checks whenever the platform reports a change, so a recording
573
+ * moves between `'saver'` and `'default'` by itself. Read which one it is using
574
+ * from `effectivePowerMode` on the recording's state.
575
+ */
576
+ export type LocationRecordingPowerMode = 'default' | 'saver' | 'auto';
577
+ /** What a recording is actually using right now: `'auto'` resolves to one of these. */
578
+ export type LocationRecordingEffectivePowerMode = 'default' | 'saver';
579
+ export interface LocationRecordingPowerOptions {
580
+ powerMode?: LocationRecordingPowerMode;
581
+ }
582
+ /**
583
+ * Change the power mode of the recording that is running, fenced to its ID
584
+ * like pause, resume and stop.
585
+ */
586
+ export interface LocationRecordingPowerModeOptions extends RecordingOwnershipOptions {
587
+ powerMode: LocationRecordingPowerMode;
588
+ }
561
589
  /** Fence a recording operation to the ID returned by start or explicit recovery. */
562
590
  export interface RecordingOwnershipOptions {
563
591
  expectedId: string;
564
592
  }
593
+ /** Reading a route back: `since` (epoch ms) asks only for the fixes recorded after it. */
594
+ export interface LocationRecordingReadOptions extends RecordingOwnershipOptions {
595
+ since?: number;
596
+ }
565
597
  /** Secure IDs supplied by the platform, including WebView-free mobile hosts. */
566
598
  export declare const crypto: {
567
599
  randomUUID(): Promise<string>;
@@ -584,6 +616,10 @@ export interface LocationRecordingState {
584
616
  paused: boolean;
585
617
  startedAt: number | null;
586
618
  sampleCount?: number;
619
+ /** The mode asked for (`'default'` on a host that predates power modes). */
620
+ powerMode?: LocationRecordingPowerMode;
621
+ /** The mode in use now. `'default'` once the recording has stopped. */
622
+ effectivePowerMode?: LocationRecordingEffectivePowerMode;
587
623
  }
588
624
  export interface LocationRecordingResult extends LocationRecordingState {
589
625
  locations: Location[];
@@ -609,6 +645,8 @@ export interface LocationRecordingResult extends LocationRecordingState {
609
645
  export declare const location: {
610
646
  supportsRecordingOwnership: () => boolean;
611
647
  supportsRecordingIntentIdentity: () => boolean;
648
+ /** `setRecordingPowerMode()` and `powerMode: 'auto'` work on this host. */
649
+ supportsRecordingPowerMode: () => boolean;
612
650
  /**
613
651
  * Get current position.
614
652
  *
@@ -630,13 +668,32 @@ export declare const location: {
630
668
  * @param watchId - Watch ID returned from watchPosition
631
669
  */
632
670
  clearWatch(watchId: number): void;
633
- startRecording(options?: LocationOptions & RecordingStartOptions): Promise<LocationRecordingState>;
671
+ startRecording(options?: LocationOptions & RecordingStartOptions & LocationRecordingPowerOptions): Promise<LocationRecordingState>;
672
+ /**
673
+ * Change how hard the running recording works the GPS, for example to
674
+ * `'saver'` while the screen shows nothing but a countdown and back to
675
+ * `'default'` afterwards, or to `'auto'` to follow the device's own power
676
+ * saving. Resolves with the recording's state, which reports the mode asked
677
+ * for (`powerMode`) and the one in use (`effectivePowerMode`).
678
+ *
679
+ * Rejects with `NO_ACTIVE_RECORDING` when nothing is recording,
680
+ * `RECORDING_CONFLICT` when `expectedId` is not the recording that is
681
+ * running, `INVALID_ARGUMENT` for an unknown mode, and
682
+ * `RECORDING_POWER_MODE_UNSUPPORTED` on a host built before this existed
683
+ * (check `supportsRecordingPowerMode()`).
684
+ */
685
+ setRecordingPowerMode(options: LocationRecordingPowerModeOptions): Promise<LocationRecordingState>;
634
686
  pauseRecording(options?: RecordingOwnershipOptions): Promise<LocationRecordingState>;
635
687
  resumeRecording(options?: RecordingOwnershipOptions): Promise<LocationRecordingState>;
636
688
  stopRecording(options?: RecordingOwnershipOptions): Promise<LocationRecordingResult>;
637
689
  getRecordingState(options?: RecordingOwnershipOptions): Promise<LocationRecordingState>;
638
690
  acknowledgeRecording(options: RecordingOwnershipOptions): Promise<boolean>;
639
- readRecording(options?: RecordingOwnershipOptions): Promise<Location[]>;
691
+ /**
692
+ * The recording's fixes. With `since`, iOS reads only the fixes after it
693
+ * from the end of the track; a host that does not know `since` answers with
694
+ * every fix, so a caller skips those it already has.
695
+ */
696
+ readRecording(options?: LocationRecordingReadOptions): Promise<Location[]>;
640
697
  };
641
698
  /**
642
699
  * Share options.
package/dist/cli.js CHANGED
@@ -3047,7 +3047,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3047
3047
  `);
3048
3048
  }
3049
3049
  // package.json
3050
- var version = "0.0.395";
3050
+ var version = "0.0.408";
3051
3051
 
3052
3052
  // bin/cli.ts
3053
3053
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
@@ -55,10 +55,14 @@ export interface FlexStyle {
55
55
  /** Column gap */
56
56
  columnGap?: number;
57
57
  }
58
+ /** Hit targeting at an authored native component boundary. */
59
+ export type PointerEvents = 'auto' | 'none' | 'box-none' | 'box-only';
58
60
  /**
59
61
  * Layout style properties.
60
62
  */
61
63
  export interface LayoutStyle {
64
+ /** Native pointer policy; a non-null prop overrides this style value. */
65
+ pointerEvents?: PointerEvents | null;
62
66
  /** Width */
63
67
  width?: number | string;
64
68
  /** Height */
@@ -281,7 +285,13 @@ export type TextStyle = ViewStyle & TextStyleProps;
281
285
  /**
282
286
  * Image-specific style properties.
283
287
  */
288
+ /** Explicit CSS-facing native image sizing. Legacy resizeMode remains unchanged. */
289
+ export type ImageObjectFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
284
290
  export interface ImageStyleProps {
291
+ /** Explicit fit; null clears the style value. */
292
+ objectFit?: ImageObjectFit | null;
293
+ /** One/two alignment keywords or percentages; defaults to center. */
294
+ objectPosition?: string | null;
285
295
  /** Resize mode */
286
296
  resizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
287
297
  /** Tint color */
@@ -297,6 +307,8 @@ export type StyleValue<T> = T | StyleValue<T>[] | null | false | undefined;
297
307
  * Base props for all components.
298
308
  */
299
309
  export interface BaseProps {
310
+ /** Native hit targeting. Null clears the override and falls back to style. */
311
+ pointerEvents?: PointerEvents | null;
300
312
  /** Unique identifier */
301
313
  id?: string;
302
314
  /** Test ID for testing */
@@ -422,6 +434,10 @@ export interface ImageErrorEvent {
422
434
  * Image component props.
423
435
  */
424
436
  export interface ImageProps extends BaseProps {
437
+ /** Non-null props override style; removing both restores legacy resizeMode. */
438
+ objectFit?: ImageObjectFit | null;
439
+ /** One/two alignment keywords or percentages, e.g. "right top" or "25% 75%". */
440
+ objectPosition?: string | null;
425
441
  /** Image source */
426
442
  source: ImageSource;
427
443
  /** Style object or array */
package/dist/index.cjs CHANGED
@@ -375,7 +375,7 @@ function craftBinaryNotFoundMessage(triedPath) {
375
375
  `);
376
376
  }
377
377
  // package.json
378
- var version = "0.0.395";
378
+ var version = "0.0.408";
379
379
 
380
380
  // src/sdk-version.ts
381
381
  var SDK_VERSION = version;
@@ -5491,6 +5491,7 @@ var secureStorage = {
5491
5491
  Object.keys(localStorage).filter((k) => k.startsWith("secure_")).forEach((k) => localStorage.removeItem(k));
5492
5492
  }
5493
5493
  };
5494
+ var RECORDING_POWER_MODES = ["default", "saver", "auto"];
5494
5495
  function storageHost(method) {
5495
5496
  const host = getCraftRoot()?.storage;
5496
5497
  if (typeof host?.[method] !== "function")
@@ -5554,6 +5555,23 @@ function recordingIntentSupported(namespace) {
5554
5555
  const advertised = Array.isArray(caps) ? caps.includes(flag) : caps?.[flag] === true;
5555
5556
  return advertised && recordingOwnershipSupported(namespace) && typeof root?.[namespace]?.startRecording === "function";
5556
5557
  }
5558
+ function recordingPowerModeSupported() {
5559
+ const root = getCraftRoot();
5560
+ const caps = root?.capabilities;
5561
+ const advertised = Array.isArray(caps) ? caps.includes("locationRecordingPowerMode") : caps?.locationRecordingPowerMode === true;
5562
+ return advertised && recordingOwnershipSupported("location") && typeof root?.location?.setRecordingPowerMode === "function";
5563
+ }
5564
+ function validatePowerMode(value) {
5565
+ if (typeof value !== "string" || !RECORDING_POWER_MODES.includes(value))
5566
+ throw Object.assign(new Error("powerMode must be 'default', 'saver' or 'auto'"), { code: "INVALID_ARGUMENT" });
5567
+ return value;
5568
+ }
5569
+ function validateRecordingPowerStart(options) {
5570
+ if (!Object.prototype.hasOwnProperty.call(options, "powerMode") || options.powerMode === undefined)
5571
+ return;
5572
+ if (validatePowerMode(options.powerMode) === "auto" && getCraftRoot() && !recordingPowerModeSupported())
5573
+ throw Object.assign(new Error("This app build cannot start a recording in powerMode 'auto'"), { code: "RECORDING_POWER_MODE_UNSUPPORTED" });
5574
+ }
5557
5575
  function validateRecordingStart(namespace, options) {
5558
5576
  if (!Object.prototype.hasOwnProperty.call(options, "recordingId"))
5559
5577
  return;
@@ -5584,10 +5602,20 @@ var webLocationRecording = {
5584
5602
  startedAt: null,
5585
5603
  locations: []
5586
5604
  };
5605
+ var webLocationPowerMode = "default";
5606
+ function webLocationRecordingState() {
5607
+ return {
5608
+ ...webLocationRecording,
5609
+ sampleCount: webLocationRecording.locations.length,
5610
+ powerMode: webLocationPowerMode,
5611
+ effectivePowerMode: webLocationRecording.active && webLocationPowerMode === "saver" ? "saver" : "default"
5612
+ };
5613
+ }
5587
5614
  var webLocationRecordingWatchId = null;
5588
5615
  var location = {
5589
5616
  supportsRecordingOwnership: () => recordingOwnershipSupported("location"),
5590
5617
  supportsRecordingIntentIdentity: () => recordingIntentSupported("location"),
5618
+ supportsRecordingPowerMode: () => recordingPowerModeSupported(),
5591
5619
  async getCurrentPosition(options = {}) {
5592
5620
  const craft = getCraftMobile();
5593
5621
  if (typeof window !== "undefined" && craft?.location) {
@@ -5637,6 +5665,7 @@ var location = {
5637
5665
  },
5638
5666
  async startRecording(options = {}) {
5639
5667
  validateRecordingStart("location", options);
5668
+ validateRecordingPowerStart(options);
5640
5669
  const craft = getCraftMobile();
5641
5670
  if (typeof window !== "undefined" && craft?.location?.startRecording)
5642
5671
  return verifyRecordingStart(options, await craft.location.startRecording(options));
@@ -5651,11 +5680,27 @@ var location = {
5651
5680
  startedAt: Date.now(),
5652
5681
  locations: []
5653
5682
  };
5683
+ webLocationPowerMode = options.powerMode ?? "default";
5654
5684
  webLocationRecordingWatchId = location.watchPosition((position) => {
5655
5685
  if (!webLocationRecording.paused)
5656
5686
  webLocationRecording.locations.push(position);
5657
5687
  }, options);
5658
- return { ...webLocationRecording, sampleCount: 0 };
5688
+ return webLocationRecordingState();
5689
+ },
5690
+ async setRecordingPowerMode(options) {
5691
+ if (!options || !Object.prototype.hasOwnProperty.call(options, "expectedId"))
5692
+ throw Object.assign(new Error("setRecordingPowerMode needs expectedId"), { code: "INVALID_ARGUMENT" });
5693
+ validateRecordingOwnership("location", options);
5694
+ const powerMode = validatePowerMode(options.powerMode);
5695
+ if (getCraftRoot() && !recordingPowerModeSupported())
5696
+ throw Object.assign(new Error("This app build cannot change the recording power mode"), { code: "RECORDING_POWER_MODE_UNSUPPORTED" });
5697
+ const craft = getCraftMobile();
5698
+ if (typeof window !== "undefined" && craft?.location?.setRecordingPowerMode)
5699
+ return craft.location.setRecordingPowerMode({ expectedId: options.expectedId, powerMode });
5700
+ if (!webLocationRecording.active)
5701
+ throw Object.assign(new Error("No active location recording"), { code: "NO_ACTIVE_RECORDING" });
5702
+ webLocationPowerMode = powerMode;
5703
+ return webLocationRecordingState();
5659
5704
  },
5660
5705
  async pauseRecording(options) {
5661
5706
  validateRecordingOwnership("location", options);
@@ -5663,7 +5708,7 @@ var location = {
5663
5708
  if (typeof window !== "undefined" && craft?.location?.pauseRecording)
5664
5709
  return craft.location.pauseRecording(options);
5665
5710
  webLocationRecording.paused = true;
5666
- return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
5711
+ return webLocationRecordingState();
5667
5712
  },
5668
5713
  async resumeRecording(options) {
5669
5714
  validateRecordingOwnership("location", options);
@@ -5671,7 +5716,7 @@ var location = {
5671
5716
  if (typeof window !== "undefined" && craft?.location?.resumeRecording)
5672
5717
  return craft.location.resumeRecording(options);
5673
5718
  webLocationRecording.paused = false;
5674
- return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
5719
+ return webLocationRecordingState();
5675
5720
  },
5676
5721
  async stopRecording(options) {
5677
5722
  validateRecordingOwnership("location", options);
@@ -5684,14 +5729,14 @@ var location = {
5684
5729
  }
5685
5730
  webLocationRecording.active = false;
5686
5731
  webLocationRecording.paused = false;
5687
- return { ...webLocationRecording, locations: [...webLocationRecording.locations] };
5732
+ return { ...webLocationRecordingState(), locations: [...webLocationRecording.locations] };
5688
5733
  },
5689
5734
  async getRecordingState(options) {
5690
5735
  validateRecordingOwnership("location", options);
5691
5736
  const craft = getCraftMobile();
5692
5737
  if (typeof window !== "undefined" && craft?.location?.getRecordingState)
5693
5738
  return craft.location.getRecordingState(options);
5694
- return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
5739
+ return webLocationRecordingState();
5695
5740
  },
5696
5741
  async acknowledgeRecording(options) {
5697
5742
  if (!options || !Object.prototype.hasOwnProperty.call(options, "expectedId"))
@@ -5703,6 +5748,7 @@ var location = {
5703
5748
  if (webLocationRecording.active)
5704
5749
  throw Object.assign(new Error("The recording is still active"), { code: "RECORDING_ALREADY_ACTIVE" });
5705
5750
  webLocationRecording = { id: null, active: false, paused: false, startedAt: null, locations: [] };
5751
+ webLocationPowerMode = "default";
5706
5752
  return true;
5707
5753
  },
5708
5754
  async readRecording(options) {
@@ -5710,7 +5756,8 @@ var location = {
5710
5756
  const craft = getCraftMobile();
5711
5757
  if (typeof window !== "undefined" && craft?.location?.readRecording)
5712
5758
  return craft.location.readRecording(options);
5713
- return [...webLocationRecording.locations];
5759
+ const since = options?.since;
5760
+ return typeof since === "number" && Number.isFinite(since) ? webLocationRecording.locations.filter((location) => location.timestamp > since) : [...webLocationRecording.locations];
5714
5761
  }
5715
5762
  };
5716
5763
  var share = {
package/dist/index.d.cts CHANGED
@@ -30,7 +30,7 @@ export * from './utils/index.js';
30
30
  export * from './api/index.js';
31
31
  export * as components from './components/index.js';
32
32
  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';
33
- 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, SafeAreaViewProps, KeyboardAvoidingViewProps, StatusBarProps, RefreshControlProps, TextProps, ButtonProps, LinkProps, TouchableOpacityProps, TouchableHighlightProps, ImageSource, ImageProps, ImageBackgroundProps, SvgPaintProps, SvgProps, GProps, SvgShapeProps, PathProps, LineProps, RectProps, CircleProps, EllipseProps, PolylineProps, PolygonProps, SvgTextProps, IconProps, VideoProps, MapRegion, MapProps, MapPolylineOverlay, MapMarkerOverlay, MapPolylineProps, MapPolygonProps, MapMarkerProps, ScrollViewProps, PressableProps, TextInputProps, KeyboardType, ReturnKeyType, SwitchProps, CheckboxProps, SliderProps, PickerOption, PickerProps, DatePickerChange, DatePickerProps, ActivityIndicatorProps, FlatListProps, SectionListSection, SectionListProps, ModalProps, LayoutEvent, ScrollEvent, } from './components/index.js';
33
+ 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, ImageObjectFit, ImageStyleProps, ImageStyle, BaseProps, ViewProps, SafeAreaViewProps, KeyboardAvoidingViewProps, StatusBarProps, RefreshControlProps, TextProps, ButtonProps, LinkProps, TouchableOpacityProps, TouchableHighlightProps, ImageSource, ImageProps, ImageBackgroundProps, SvgPaintProps, SvgProps, GProps, SvgShapeProps, PathProps, LineProps, RectProps, CircleProps, EllipseProps, PolylineProps, PolygonProps, SvgTextProps, IconProps, VideoProps, MapRegion, MapProps, MapPolylineOverlay, MapMarkerOverlay, MapPolylineProps, MapPolygonProps, MapMarkerProps, ScrollViewProps, PressableProps, TextInputProps, KeyboardType, ReturnKeyType, SwitchProps, CheckboxProps, SliderProps, PickerOption, PickerProps, DatePickerChange, DatePickerProps, ActivityIndicatorProps, FlatListProps, SectionListSection, SectionListProps, ModalProps, LayoutEvent, ScrollEvent, } from './components/index.js';
34
34
  export * from './styles/headwind.js';
35
35
  export * from './styles/index.js';
36
36
  export * from './optimizations/index.js';
package/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@ export * from './utils/index.js';
30
30
  export * from './api/index.js';
31
31
  export * as components from './components/index.js';
32
32
  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';
33
- 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, SafeAreaViewProps, KeyboardAvoidingViewProps, StatusBarProps, RefreshControlProps, TextProps, ButtonProps, LinkProps, TouchableOpacityProps, TouchableHighlightProps, ImageSource, ImageProps, ImageBackgroundProps, SvgPaintProps, SvgProps, GProps, SvgShapeProps, PathProps, LineProps, RectProps, CircleProps, EllipseProps, PolylineProps, PolygonProps, SvgTextProps, IconProps, VideoProps, MapRegion, MapProps, MapPolylineOverlay, MapMarkerOverlay, MapPolylineProps, MapPolygonProps, MapMarkerProps, ScrollViewProps, PressableProps, TextInputProps, KeyboardType, ReturnKeyType, SwitchProps, CheckboxProps, SliderProps, PickerOption, PickerProps, DatePickerChange, DatePickerProps, ActivityIndicatorProps, FlatListProps, SectionListSection, SectionListProps, ModalProps, LayoutEvent, ScrollEvent, } from './components/index.js';
33
+ 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, ImageObjectFit, ImageStyleProps, ImageStyle, BaseProps, ViewProps, SafeAreaViewProps, KeyboardAvoidingViewProps, StatusBarProps, RefreshControlProps, TextProps, ButtonProps, LinkProps, TouchableOpacityProps, TouchableHighlightProps, ImageSource, ImageProps, ImageBackgroundProps, SvgPaintProps, SvgProps, GProps, SvgShapeProps, PathProps, LineProps, RectProps, CircleProps, EllipseProps, PolylineProps, PolygonProps, SvgTextProps, IconProps, VideoProps, MapRegion, MapProps, MapPolylineOverlay, MapMarkerOverlay, MapPolylineProps, MapPolygonProps, MapMarkerProps, ScrollViewProps, PressableProps, TextInputProps, KeyboardType, ReturnKeyType, SwitchProps, CheckboxProps, SliderProps, PickerOption, PickerProps, DatePickerChange, DatePickerProps, ActivityIndicatorProps, FlatListProps, SectionListSection, SectionListProps, ModalProps, LayoutEvent, ScrollEvent, } from './components/index.js';
34
34
  export * from './styles/headwind.js';
35
35
  export * from './styles/index.js';
36
36
  export * from './optimizations/index.js';
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function craftBinaryNotFoundMessage(triedPath) {
117
117
  `);
118
118
  }
119
119
  // package.json
120
- var version = "0.0.395";
120
+ var version = "0.0.408";
121
121
 
122
122
  // src/sdk-version.ts
123
123
  var SDK_VERSION = version;
@@ -5247,6 +5247,7 @@ var secureStorage = {
5247
5247
  Object.keys(localStorage).filter((k) => k.startsWith("secure_")).forEach((k) => localStorage.removeItem(k));
5248
5248
  }
5249
5249
  };
5250
+ var RECORDING_POWER_MODES = ["default", "saver", "auto"];
5250
5251
  function storageHost(method) {
5251
5252
  const host = getCraftRoot()?.storage;
5252
5253
  if (typeof host?.[method] !== "function")
@@ -5310,6 +5311,23 @@ function recordingIntentSupported(namespace) {
5310
5311
  const advertised = Array.isArray(caps) ? caps.includes(flag) : caps?.[flag] === true;
5311
5312
  return advertised && recordingOwnershipSupported(namespace) && typeof root?.[namespace]?.startRecording === "function";
5312
5313
  }
5314
+ function recordingPowerModeSupported() {
5315
+ const root = getCraftRoot();
5316
+ const caps = root?.capabilities;
5317
+ const advertised = Array.isArray(caps) ? caps.includes("locationRecordingPowerMode") : caps?.locationRecordingPowerMode === true;
5318
+ return advertised && recordingOwnershipSupported("location") && typeof root?.location?.setRecordingPowerMode === "function";
5319
+ }
5320
+ function validatePowerMode(value) {
5321
+ if (typeof value !== "string" || !RECORDING_POWER_MODES.includes(value))
5322
+ throw Object.assign(new Error("powerMode must be 'default', 'saver' or 'auto'"), { code: "INVALID_ARGUMENT" });
5323
+ return value;
5324
+ }
5325
+ function validateRecordingPowerStart(options) {
5326
+ if (!Object.prototype.hasOwnProperty.call(options, "powerMode") || options.powerMode === undefined)
5327
+ return;
5328
+ if (validatePowerMode(options.powerMode) === "auto" && getCraftRoot() && !recordingPowerModeSupported())
5329
+ throw Object.assign(new Error("This app build cannot start a recording in powerMode 'auto'"), { code: "RECORDING_POWER_MODE_UNSUPPORTED" });
5330
+ }
5313
5331
  function validateRecordingStart(namespace, options) {
5314
5332
  if (!Object.prototype.hasOwnProperty.call(options, "recordingId"))
5315
5333
  return;
@@ -5340,10 +5358,20 @@ var webLocationRecording = {
5340
5358
  startedAt: null,
5341
5359
  locations: []
5342
5360
  };
5361
+ var webLocationPowerMode = "default";
5362
+ function webLocationRecordingState() {
5363
+ return {
5364
+ ...webLocationRecording,
5365
+ sampleCount: webLocationRecording.locations.length,
5366
+ powerMode: webLocationPowerMode,
5367
+ effectivePowerMode: webLocationRecording.active && webLocationPowerMode === "saver" ? "saver" : "default"
5368
+ };
5369
+ }
5343
5370
  var webLocationRecordingWatchId = null;
5344
5371
  var location = {
5345
5372
  supportsRecordingOwnership: () => recordingOwnershipSupported("location"),
5346
5373
  supportsRecordingIntentIdentity: () => recordingIntentSupported("location"),
5374
+ supportsRecordingPowerMode: () => recordingPowerModeSupported(),
5347
5375
  async getCurrentPosition(options = {}) {
5348
5376
  const craft = getCraftMobile();
5349
5377
  if (typeof window !== "undefined" && craft?.location) {
@@ -5393,6 +5421,7 @@ var location = {
5393
5421
  },
5394
5422
  async startRecording(options = {}) {
5395
5423
  validateRecordingStart("location", options);
5424
+ validateRecordingPowerStart(options);
5396
5425
  const craft = getCraftMobile();
5397
5426
  if (typeof window !== "undefined" && craft?.location?.startRecording)
5398
5427
  return verifyRecordingStart(options, await craft.location.startRecording(options));
@@ -5407,11 +5436,27 @@ var location = {
5407
5436
  startedAt: Date.now(),
5408
5437
  locations: []
5409
5438
  };
5439
+ webLocationPowerMode = options.powerMode ?? "default";
5410
5440
  webLocationRecordingWatchId = location.watchPosition((position) => {
5411
5441
  if (!webLocationRecording.paused)
5412
5442
  webLocationRecording.locations.push(position);
5413
5443
  }, options);
5414
- return { ...webLocationRecording, sampleCount: 0 };
5444
+ return webLocationRecordingState();
5445
+ },
5446
+ async setRecordingPowerMode(options) {
5447
+ if (!options || !Object.prototype.hasOwnProperty.call(options, "expectedId"))
5448
+ throw Object.assign(new Error("setRecordingPowerMode needs expectedId"), { code: "INVALID_ARGUMENT" });
5449
+ validateRecordingOwnership("location", options);
5450
+ const powerMode = validatePowerMode(options.powerMode);
5451
+ if (getCraftRoot() && !recordingPowerModeSupported())
5452
+ throw Object.assign(new Error("This app build cannot change the recording power mode"), { code: "RECORDING_POWER_MODE_UNSUPPORTED" });
5453
+ const craft = getCraftMobile();
5454
+ if (typeof window !== "undefined" && craft?.location?.setRecordingPowerMode)
5455
+ return craft.location.setRecordingPowerMode({ expectedId: options.expectedId, powerMode });
5456
+ if (!webLocationRecording.active)
5457
+ throw Object.assign(new Error("No active location recording"), { code: "NO_ACTIVE_RECORDING" });
5458
+ webLocationPowerMode = powerMode;
5459
+ return webLocationRecordingState();
5415
5460
  },
5416
5461
  async pauseRecording(options) {
5417
5462
  validateRecordingOwnership("location", options);
@@ -5419,7 +5464,7 @@ var location = {
5419
5464
  if (typeof window !== "undefined" && craft?.location?.pauseRecording)
5420
5465
  return craft.location.pauseRecording(options);
5421
5466
  webLocationRecording.paused = true;
5422
- return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
5467
+ return webLocationRecordingState();
5423
5468
  },
5424
5469
  async resumeRecording(options) {
5425
5470
  validateRecordingOwnership("location", options);
@@ -5427,7 +5472,7 @@ var location = {
5427
5472
  if (typeof window !== "undefined" && craft?.location?.resumeRecording)
5428
5473
  return craft.location.resumeRecording(options);
5429
5474
  webLocationRecording.paused = false;
5430
- return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
5475
+ return webLocationRecordingState();
5431
5476
  },
5432
5477
  async stopRecording(options) {
5433
5478
  validateRecordingOwnership("location", options);
@@ -5440,14 +5485,14 @@ var location = {
5440
5485
  }
5441
5486
  webLocationRecording.active = false;
5442
5487
  webLocationRecording.paused = false;
5443
- return { ...webLocationRecording, locations: [...webLocationRecording.locations] };
5488
+ return { ...webLocationRecordingState(), locations: [...webLocationRecording.locations] };
5444
5489
  },
5445
5490
  async getRecordingState(options) {
5446
5491
  validateRecordingOwnership("location", options);
5447
5492
  const craft = getCraftMobile();
5448
5493
  if (typeof window !== "undefined" && craft?.location?.getRecordingState)
5449
5494
  return craft.location.getRecordingState(options);
5450
- return { ...webLocationRecording, sampleCount: webLocationRecording.locations.length };
5495
+ return webLocationRecordingState();
5451
5496
  },
5452
5497
  async acknowledgeRecording(options) {
5453
5498
  if (!options || !Object.prototype.hasOwnProperty.call(options, "expectedId"))
@@ -5459,6 +5504,7 @@ var location = {
5459
5504
  if (webLocationRecording.active)
5460
5505
  throw Object.assign(new Error("The recording is still active"), { code: "RECORDING_ALREADY_ACTIVE" });
5461
5506
  webLocationRecording = { id: null, active: false, paused: false, startedAt: null, locations: [] };
5507
+ webLocationPowerMode = "default";
5462
5508
  return true;
5463
5509
  },
5464
5510
  async readRecording(options) {
@@ -5466,7 +5512,8 @@ var location = {
5466
5512
  const craft = getCraftMobile();
5467
5513
  if (typeof window !== "undefined" && craft?.location?.readRecording)
5468
5514
  return craft.location.readRecording(options);
5469
- return [...webLocationRecording.locations];
5515
+ const since = options?.since;
5516
+ return typeof since === "number" && Number.isFinite(since) ? webLocationRecording.locations.filter((location) => location.timestamp > since) : [...webLocationRecording.locations];
5470
5517
  }
5471
5518
  };
5472
5519
  var share = {
@@ -46,6 +46,13 @@ export interface CraftConfig {
46
46
  backgroundColor?: string;
47
47
  /** Default tint for native controls and selected tabs, as #RRGGBB. */
48
48
  tintColor?: string;
49
+ /**
50
+ * CSS font stack for the native chrome's labels (tab bar, bar buttons); the
51
+ * first family packaged in `nativeFonts` wins, a generic one keeps the system face.
52
+ */
53
+ fontFamily?: string;
54
+ /** CSS font stack for navigation titles; `fontFamily` when unset. */
55
+ headingFontFamily?: string;
49
56
  /** The launch and webview background while the phone is in Dark Mode. */
50
57
  backgroundColorDark?: string;
51
58
  /** Edge-swipe back and forward through the page's history, pushState entries included. */