craft-native 0.0.247 → 0.0.248
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/android/src/index.d.ts +2 -0
- package/dist/android/src/index.js +22 -18
- package/dist/android/templates/CraftNative.kt.template +17 -0
- package/dist/android/templates/CraftNativeFlatList.kt.template +115 -40
- package/dist/android/templates/CraftNativeMapGoogle.kt.template +92 -5
- package/dist/android/templates/CraftNativeMapLibre.kt.template +90 -3
- package/dist/android/templates/CraftNativeMutation.kt.template +32 -0
- package/dist/android/templates/CraftNativeRefreshableFlatList.kt.template +7 -2
- package/dist/android/templates/CraftNativeServices.kt.template +25 -0
- package/dist/android/templates/CraftNativeShell.kt.template +34 -8
- package/dist/android/templates/MainActivityNative.kt.template +369 -69
- package/dist/android/templates/build.gradle.kts.project.template +1 -1
- package/dist/api/mobile.d.ts +37 -1
- package/dist/browser.js +9 -9
- package/dist/cli.js +90 -673
- package/dist/components/index.d.ts +50 -9
- package/dist/index.cjs +394 -438
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +446 -493
- package/dist/ios/src/index.d.ts +2 -0
- package/dist/ios/src/index.js +54 -53
- package/dist/ios/templates/CraftApp.swift +37 -2
- package/dist/ios/templates/CraftHealth.swift +217 -0
- package/dist/ios/templates/CraftHeartRate.swift +6 -3
- package/dist/ios/templates/CraftHybrid.swift +18 -19
- package/dist/ios/templates/CraftLiveActivities.swift +1 -1
- package/dist/ios/templates/CraftNativeActions.swift +87 -8
- package/dist/ios/templates/CraftNativeFiles.swift +15 -3
- package/dist/ios/templates/CraftNativeFlatList.swift +18 -1
- package/dist/ios/templates/CraftNativeMutation.swift +36 -0
- package/dist/ios/templates/CraftNativeScreen.swift +813 -65
- package/dist/ios/templates/CraftNativeServices.swift +4 -2
- package/dist/ios/templates/CraftNativeUI.swift +10 -2
- package/dist/ios/templates/testing/DriverTests.swift.template +1 -0
- package/dist/ios/templates/testing/HostApp.swift +9 -2
- package/dist/macos/templates/CraftNativeMutation.swift +36 -0
- package/dist/macos/templates/native_layout.zig +226 -2
- package/dist/mobile-testing.js +2 -2
- package/dist/mobile.js +101 -63
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
2
2
|
plugins {
|
|
3
|
-
id("com.android.application") version "8.
|
|
3
|
+
id("com.android.application") version "8.10.1" apply false
|
|
4
4
|
id("org.jetbrains.kotlin.android") version "2.2.10" apply false
|
|
5
5
|
{{GOOGLE_SERVICES_PLUGIN}}
|
|
6
6
|
}
|
package/dist/api/mobile.d.ts
CHANGED
|
@@ -1678,8 +1678,34 @@ export interface HealthHeartRateUpdatesOptions {
|
|
|
1678
1678
|
/** Epoch milliseconds: samples that start at or after this. Defaults to two minutes ago. */
|
|
1679
1679
|
since?: number;
|
|
1680
1680
|
}
|
|
1681
|
+
export type HealthLiveWorkoutType = 'running' | 'walking' | 'hiking' | 'cycling' | 'swimming' | 'rowing' | 'elliptical' | 'strength' | 'hiit';
|
|
1682
|
+
export interface HealthLiveWorkoutOptions {
|
|
1683
|
+
type: HealthLiveWorkoutType;
|
|
1684
|
+
location?: 'indoor' | 'outdoor' | 'unknown';
|
|
1685
|
+
}
|
|
1686
|
+
export interface HealthLiveWorkoutStarted {
|
|
1687
|
+
id: string;
|
|
1688
|
+
type: HealthLiveWorkoutType;
|
|
1689
|
+
/** Epoch milliseconds. */
|
|
1690
|
+
startDate: number;
|
|
1691
|
+
}
|
|
1692
|
+
export interface HealthLiveWorkoutResult {
|
|
1693
|
+
id: string;
|
|
1694
|
+
workoutId: string;
|
|
1695
|
+
/** Epoch milliseconds. */
|
|
1696
|
+
endDate: number;
|
|
1697
|
+
durationSeconds: number;
|
|
1698
|
+
}
|
|
1699
|
+
export interface HealthLiveWorkoutEvent {
|
|
1700
|
+
id: string;
|
|
1701
|
+
event: 'state' | 'error';
|
|
1702
|
+
state?: 'notStarted' | 'prepared' | 'running' | 'paused' | 'stopped' | 'ended' | 'unknown';
|
|
1703
|
+
/** Epoch milliseconds for a state transition. */
|
|
1704
|
+
date?: number;
|
|
1705
|
+
message?: string;
|
|
1706
|
+
}
|
|
1681
1707
|
/** The health reads and writes a host may or may not have, depending on the app build it runs in. */
|
|
1682
|
-
export type HealthReadMethod = 'getWorkouts' | 'getDailyStatistics' | 'getHeartRateSamples' | 'getSleepIntervals' | 'saveData' | 'saveMindfulSession' | 'getMindfulSessions' | 'startHeartRateUpdates' | 'stopHeartRateUpdates';
|
|
1708
|
+
export type HealthReadMethod = 'getWorkouts' | 'getDailyStatistics' | 'getHeartRateSamples' | 'getSleepIntervals' | 'saveData' | 'saveMindfulSession' | 'getMindfulSessions' | 'startHeartRateUpdates' | 'stopHeartRateUpdates' | 'startWorkout' | 'pauseWorkout' | 'resumeWorkout' | 'endWorkout';
|
|
1683
1709
|
export declare const health: {
|
|
1684
1710
|
/**
|
|
1685
1711
|
* Whether this app build answers `method`. An app installed before a read
|
|
@@ -1724,6 +1750,16 @@ export declare const health: {
|
|
|
1724
1750
|
startHeartRateUpdates(options?: HealthHeartRateUpdatesOptions): Promise<boolean>;
|
|
1725
1751
|
/** Stops the stream `startHeartRateUpdates` started; true also when none ran. */
|
|
1726
1752
|
stopHeartRateUpdates(): Promise<boolean>;
|
|
1753
|
+
/** Starts an OS-owned live workout session (iOS 26+ for now). */
|
|
1754
|
+
startWorkout(options: HealthLiveWorkoutOptions): Promise<HealthLiveWorkoutStarted>;
|
|
1755
|
+
/** Pauses the current live workout. */
|
|
1756
|
+
pauseWorkout(): Promise<boolean>;
|
|
1757
|
+
/** Resumes the current live workout. */
|
|
1758
|
+
resumeWorkout(): Promise<boolean>;
|
|
1759
|
+
/** Ends and saves the current live workout. */
|
|
1760
|
+
endWorkout(): Promise<HealthLiveWorkoutResult>;
|
|
1761
|
+
/** Receives OS workout state transitions; returns the unsubscribe. */
|
|
1762
|
+
onWorkout(callback: (event: HealthLiveWorkoutEvent) => void): () => void;
|
|
1727
1763
|
/**
|
|
1728
1764
|
* Each batch of new heart-rate samples while `startHeartRateUpdates` runs,
|
|
1729
1765
|
* oldest first, every sample once. Returns the unsubscribe; off a phone, or
|
package/dist/browser.js
CHANGED
|
@@ -379,11 +379,11 @@ async function createBrowserPlatform(options = {}) {
|
|
|
379
379
|
const sounds = new Map;
|
|
380
380
|
const fades = new Map;
|
|
381
381
|
const cancelFade = (sound) => {
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
cancelAnimationFrame(
|
|
382
|
+
const fade = fades.get(sound);
|
|
383
|
+
if (fade) {
|
|
384
|
+
cancelAnimationFrame(fade.frame);
|
|
385
385
|
fades.delete(sound);
|
|
386
|
-
|
|
386
|
+
fade.done();
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
389
|
const fade = (sound, volume, milliseconds) => {
|
|
@@ -805,10 +805,10 @@ async function createBrowserPlatform(options = {}) {
|
|
|
805
805
|
mediaTransfers = new AbortController;
|
|
806
806
|
const name = cacheName();
|
|
807
807
|
return writeMedia(async () => {
|
|
808
|
-
const
|
|
808
|
+
const cache = await caches.open(name);
|
|
809
809
|
let removed = 0;
|
|
810
|
-
for (const entry of await
|
|
811
|
-
if (await
|
|
810
|
+
for (const entry of await cache.keys()) {
|
|
811
|
+
if (await cache.delete(entry))
|
|
812
812
|
removed++;
|
|
813
813
|
const local = mediaURLs.get(entry.url);
|
|
814
814
|
if (local)
|
|
@@ -896,6 +896,6 @@ async function createBrowserPlatform(options = {}) {
|
|
|
896
896
|
return platform;
|
|
897
897
|
}
|
|
898
898
|
export {
|
|
899
|
-
|
|
900
|
-
|
|
899
|
+
browserHapticPattern,
|
|
900
|
+
createBrowserPlatform
|
|
901
901
|
};
|