@stacksjs/defaults 0.75.226 → 0.75.227

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.
@@ -49,10 +49,19 @@ platform-specific commands when iterating on only one native target. The same
49
49
  targets are available through `buddy build mobile`, `buddy build ios`, and
50
50
  `buddy build android`.
51
51
 
52
- The build validates `config/mobile.ts`, initializes a Craft iOS project,
53
- selects either a remote application URL or bundled web assets, generates the
54
- Xcode project with xcodegen, and records source, capability, and Craft builder
55
- revision provenance in `stacks-mobile.json`.
52
+ The build validates `config/mobile.ts`, compiles configured STX native screens,
53
+ initializes the Craft platform project and records source, capability and builder
54
+ revision provenance in `stacks-mobile.json`. With `renderer: 'native'`, Craft
55
+ draws platform controls from the compiled bundle without a WebView. The same STX
56
+ components and TypeScript behavior can also serve browser routes; keep browser
57
+ route adapters thin and share the component implementation. Native capabilities
58
+ still depend on the host, OS, hardware and permission.
59
+
60
+ With `renderer: 'web'`, Craft loads a remote page or bundled web assets. This is
61
+ a separate renderer configuration. A native renderer's `url` supplies its API
62
+ and fallback browser origin; it does not fetch the native UI from that URL at
63
+ launch. Changes to bundled screens, native code or capabilities require a new
64
+ app build. API data refreshes independently.
56
65
 
57
66
  xcodegen comes from Pantry, never from `PATH`: the version is
58
67
  `iosDependencies` in `config/deps.ts` (beside `androidDependencies`; the
@@ -93,10 +102,12 @@ import type { MobileConfig } from '@stacksjs/types'
93
102
 
94
103
  export default {
95
104
  ios: {
105
+ renderer: 'native',
106
+ nativeScreens: { '/m/': 'Home' },
107
+ nativeScreensDir: 'resources/components',
96
108
  appName: 'My App',
97
109
  bundleId: 'com.example.app',
98
110
  url: 'https://example.com',
99
- fallbackWebAssets: 'dist',
100
111
  deploymentTarget: '16.0',
101
112
  orientations: ['portrait'],
102
113
  urlSchemes: ['myapp'],
@@ -108,10 +119,12 @@ export default {
108
119
  },
109
120
  },
110
121
  android: {
122
+ renderer: 'native',
123
+ nativeScreens: { '/m/': 'Home' },
124
+ nativeScreensDir: 'resources/components',
111
125
  appName: 'My App',
112
126
  packageName: 'com.example.app',
113
127
  url: 'https://example.com',
114
- fallbackWebAssets: 'dist',
115
128
  capabilities: {
116
129
  haptics: true,
117
130
  share: true,
@@ -122,13 +135,21 @@ export default {
122
135
  } satisfies MobileConfig
123
136
  ```
124
137
 
125
- Choose exactly one primary content source:
138
+ For the native renderer, every app-owned route must map to an STX screen in
139
+ `nativeScreens` on both platforms. The example maps `/m/` to
140
+ `resources/components/Home.stx`; browser routes should render that same shared
141
+ component rather than duplicate it. Compile and test the actual screen bundle
142
+ for both targets. External authorization or checkout routes may use the system
143
+ browser with an explicit return path.
144
+
145
+ For the web renderer, choose a primary content source:
126
146
 
127
147
  - `url`: load the deployed Stacks application and keep server-rendered routes.
128
148
  - `webAssets`: bundle a static distribution containing `index.html` and every
129
149
  referenced asset.
130
- - `fallbackWebAssets`: with `url`, bundle a static distribution that Craft
131
- loads when the remote application is unreachable on cold start.
150
+ - `fallbackWebAssets`: optionally pair with `url` to load bundled web assets
151
+ when the remote page is unreachable on cold start. This does not supply an
152
+ offline native UI; native screens are already in their compiled bundle.
132
153
 
133
154
  Only enable capabilities the product uses. Craft turns enabled capabilities
134
155
  into native bridge availability and required iOS privacy descriptions.
@@ -145,7 +166,9 @@ the default `deploymentTarget` stays, older systems drawing classic bars.
145
166
 
146
167
  ## Native screen bindings
147
168
 
148
- Screens under `resources/native/` use the same STX client syntax as web views.
169
+ Screens in `nativeScreensDir` (default `resources/native/`) use the same STX
170
+ client syntax as web views. Point it at the shared component directory when
171
+ those components also serve browser routes.
149
172
  Declare reactive data in `<script client>` and bind text with `:text`, props
150
173
  with `:prop`, and native presses with `@click`. Pull-to-refresh uses `@refresh`
151
174
  and a boolean `:refreshing` signal. Bare signals auto-unwrap in bindings;
@@ -394,9 +417,14 @@ The runtime is browser-safe. Craft-backed operations use the native bridge;
394
417
  supported web APIs provide fallback behavior outside a native host. Inside a
395
418
  native host whose bridge is still loading (an older shell installs it after
396
419
  the page loads), a call waits for it briefly instead of taking the web path.
397
- Nothing throws for being unsupported: it resolves `null` or `false`.
420
+ Unsupported behavior belongs to each service's contract: some availability
421
+ queries return `false`, while permission requests, writes and operations that
422
+ must enforce identity may reject. Check the documented capability predicate
423
+ and handle typed errors; never treat a missing native method as success or
424
+ silently replace a guarded operation with an unguarded fallback.
398
425
 
399
- Beyond the services above, each with a web fallback:
426
+ Other services include the following; browser behavior and native support vary
427
+ by operation:
400
428
 
401
429
  ```ts
402
430
  import { browser, clipboard, confirmAction, contextMenu, db, dialog, files, haptics, orientation, shortcuts, storeKit, symbols, useActionSheet, widgets } from '@stacksjs/mobile'
@@ -421,12 +449,20 @@ settles.
421
449
 
422
450
  For a run or ride, `createRouteRecorder({ location, onUpdate })` starts, pauses,
423
451
  resumes and stops the native recording, re-attaches to one that outlived the
424
- app (`attach()`), and reports live distance and pace from `routeStats(fixes)`,
452
+ app (`attach({ expectedId })` with the ID saved in the account's draft), and reports live distance and pace from `routeStats(fixes)`,
425
453
  which ignores GPS drift, inaccurate fixes and the ground crossed during a pause.
426
454
  Recorder operations serialize; repeated `stop()` returns the same recording.
427
455
  Call `dispose()` when the owning page is destroyed to stop polling without
428
456
  stopping the native recording. Refreshes coalesce and cannot overwrite a final
429
- recording with a stale read.
457
+ recording with a stale read. Persist `recordingId` (and `heartRateRecordingId`
458
+ when bundled) under the account and workout that started it. Never adopt the
459
+ current native slot without its saved ID. Guarded metadata, reads and stop
460
+ recover that ID's completed archive even if another recording is now active.
461
+ Only after durably checkpointing its result, or committing its discard, call
462
+ `location.acknowledgeRecording({ expectedId })` and the matching heart-rate
463
+ acknowledgement. A storage failure must retain the native copy. Ownership
464
+ operations require support from both the SDK adapter and the native host;
465
+ unsupported hosts reject with `RECORDING_OWNERSHIP_UNSUPPORTED`.
430
466
 
431
467
  For timestamp-based timers use `startSessionClock(now)`,
432
468
  `pauseSessionClock(clock, now)`, `resumeSessionClock(clock, now)` and
@@ -60,7 +60,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
60
60
  | `@stacksjs/image` | [`stacks-image`](../stacks-image/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/image/src/index.ts) | 2 |
61
61
  | `@stacksjs/lint` | [`stacks-lint`](../stacks-lint/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/lint/src/index.ts) | 3 |
62
62
  | `@stacksjs/logging` | [`stacks-logging`](../stacks-logging/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/src/index.ts) | 14 |
63
- | `@stacksjs/mobile` | [`stacks-mobile`](../stacks-mobile/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/index.ts) | 18 |
63
+ | `@stacksjs/mobile` | [`stacks-mobile`](../stacks-mobile/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/index.ts) | 22 |
64
64
  | `@stacksjs/model-meta` | [`stacks-models`](../stacks-models/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/model-meta/src/index.ts) | 1 |
65
65
  | `@stacksjs/newsletter` | [`stacks-newsletter`](../stacks-newsletter/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/index.ts) | 7 |
66
66
  | `@stacksjs/notifications` | [`stacks-notifications`](../stacks-notifications/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/index.ts) | 15 |
@@ -583,9 +583,9 @@ Guidance: [`stacks-mobile`](../stacks-mobile/SKILL.md). Source: [storage/framewo
583
583
 
584
584
  Declared runtime exports: `appReview`, `biometrics`, `brightness`, `camera`, `deepLinks`, `device`, `getNativeMobileBridge`, `haptics`, `health`, `heartRate`, `isNativeMobile`, `keepAwake`, `lifecycle`, `liveActivities`, `location`, `mobile`, `music`, `network`, `normalizeDeepLinkURL`, `notifications`, `onMobileReady`, `permissions`, `pushNotifications`, `secureStorage`, `share`, `snapshots`, `speech`, `splash`, `watchConnectivity`, `whenNativeMobile`, `withNativeFeedback`.
585
585
 
586
- Local source modules: [src/bridge.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/bridge.ts), [src/controls.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/controls.ts), [src/crash-reporting.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/crash-reporting.ts), [src/events.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/events.ts), [src/gestures.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/gestures.ts), [src/indoor.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/indoor.ts), [src/native.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/native.ts), [src/navigation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/navigation.ts), [src/refresh-control.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/refresh-control.ts), [src/route.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/route.ts), [src/scheduled-workouts.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/scheduled-workouts.ts), [src/session-clock.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/session-clock.ts), [src/sheet-gesture.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/sheet-gesture.ts), [src/sheets.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/sheets.ts), [src/shell.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/shell.ts), [src/spotlight.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/spotlight.ts), [src/tab-bar.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/tab-bar.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/types.ts).
586
+ Local source modules: [src/bridge.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/bridge.ts), [src/controls.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/controls.ts), [src/crash-reporting.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/crash-reporting.ts), [src/crypto.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/crypto.ts), [src/events.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/events.ts), [src/gestures.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/gestures.ts), [src/indoor.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/indoor.ts), [src/native.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/native.ts), [src/navigation.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/navigation.ts), [src/refresh-control.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/refresh-control.ts), [src/route.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/route.ts), [src/scheduled-workouts.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/scheduled-workouts.ts), [src/session-clock.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/session-clock.ts), [src/sheet-gesture.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/sheet-gesture.ts), [src/sheets.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/sheets.ts), [src/shell.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/shell.ts), [src/spotlight.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/spotlight.ts), [src/storage.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/storage.ts), [src/tab-bar.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/tab-bar.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/types.ts).
587
587
 
588
- Evidence directory: [18 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
588
+ Evidence directory: [22 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
589
589
 
590
590
  ### @stacksjs/model-meta
591
591
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.226",
5
+ "version": "0.75.227",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.226",
5
+ "version": "0.75.227",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@iconify-json/f7": "^1.2.2",
46
46
  "@iconify-json/hugeicons": "^1.2.35",
47
- "@stacksjs/mobile": "0.75.226",
47
+ "@stacksjs/mobile": "0.75.227",
48
48
  "@stacksjs/sanitizer": "^0.2.534",
49
49
  "@xterm/addon-fit": "^0.11.0",
50
50
  "@xterm/xterm": "^6.0.0",