@absolutejs/absolute 0.20.0-beta.2 → 0.20.0-beta.21

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 (75) hide show
  1. package/README.md +135 -0
  2. package/dist/angular/browser.js +15 -1
  3. package/dist/angular/browser.js.map +3 -3
  4. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  5. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  6. package/dist/angular/index.js +341 -22
  7. package/dist/angular/index.js.map +8 -5
  8. package/dist/angular/server.js +341 -22
  9. package/dist/angular/server.js.map +8 -5
  10. package/dist/build.js +1268 -598
  11. package/dist/build.js.map +17 -14
  12. package/dist/cli/index.js +5005 -1614
  13. package/dist/dev/client/cssUtils.ts +16 -2
  14. package/dist/dev/client/handlers/rebuild.ts +11 -1
  15. package/dist/dev/client/hmrClient.ts +9 -3
  16. package/dist/dev/client/hmrTiming.ts +14 -7
  17. package/dist/dev/client/syncDevtools.ts +237 -0
  18. package/dist/index.js +1644 -863
  19. package/dist/index.js.map +26 -23
  20. package/dist/mobile/browser.js +123 -1
  21. package/dist/mobile/browser.js.map +6 -4
  22. package/dist/mobile/index.js +3369 -298
  23. package/dist/mobile/index.js.map +27 -13
  24. package/dist/mobile/remoteMacAgentEntry.js +29 -0
  25. package/dist/mobile/shellAuth.js +35 -0
  26. package/dist/mobile/shellBootstrap.js +585 -0
  27. package/dist/mobile/shellSync.js +123 -0
  28. package/dist/src/angular/pageHandler.d.ts +3 -0
  29. package/dist/src/build/pwa.d.ts +16 -0
  30. package/dist/src/cli/config/server.d.ts +1 -1
  31. package/dist/src/core/pageHandlers.d.ts +11 -2
  32. package/dist/src/core/prepare.d.ts +6 -0
  33. package/dist/src/dev/clientManager.d.ts +2 -0
  34. package/dist/src/mobile/androidEmulatorController.d.ts +6 -1
  35. package/dist/src/mobile/browser.d.ts +1 -0
  36. package/dist/src/mobile/buildPipeline.d.ts +1 -0
  37. package/dist/src/mobile/capacitorBundle.d.ts +22 -1
  38. package/dist/src/mobile/client.d.ts +4 -0
  39. package/dist/src/mobile/deviceCapabilities.d.ts +33 -0
  40. package/dist/src/mobile/index.d.ts +9 -0
  41. package/dist/src/mobile/iosConformance.d.ts +15 -0
  42. package/dist/src/mobile/iosNativeWatcher.d.ts +19 -0
  43. package/dist/src/mobile/iosRelease.d.ts +2 -2
  44. package/dist/src/mobile/iosSimulatorController.d.ts +89 -0
  45. package/dist/src/mobile/nativeAuth.d.ts +17 -0
  46. package/dist/src/mobile/nativeBackgroundSync.d.ts +4 -0
  47. package/dist/src/mobile/nativeDeviceCapabilities.d.ts +6 -0
  48. package/dist/src/mobile/releaseArtifact.d.ts +2 -0
  49. package/dist/src/mobile/remoteMacAgent.d.ts +2 -0
  50. package/dist/src/mobile/remoteMacAgentEntry.d.ts +1 -0
  51. package/dist/src/mobile/remoteMacProtocol.d.ts +114 -0
  52. package/dist/src/mobile/remoteMacWire.d.ts +2 -0
  53. package/dist/src/mobile/shellAuth.d.ts +13 -0
  54. package/dist/src/mobile/shellBootstrap.d.ts +18 -1
  55. package/dist/src/mobile/shellSync.d.ts +19 -0
  56. package/dist/src/mobile/staticDocument.d.ts +5 -0
  57. package/dist/src/mobile/syncRemediation.d.ts +10 -0
  58. package/dist/src/mobile/syncSchema.d.ts +9 -0
  59. package/dist/src/mobile/transport.d.ts +16 -1
  60. package/dist/src/plugins/hmr.d.ts +3 -0
  61. package/dist/src/plugins/imageOptimizer.d.ts +1 -1
  62. package/dist/src/svelte/pageHandler.d.ts +3 -0
  63. package/dist/src/utils/imageProcessing.d.ts +3 -0
  64. package/dist/src/utils/loadConfig.d.ts +1 -0
  65. package/dist/src/vue/pageHandler.d.ts +3 -0
  66. package/dist/svelte/index.js +312 -23
  67. package/dist/svelte/index.js.map +7 -4
  68. package/dist/svelte/server.js +307 -18
  69. package/dist/svelte/server.js.map +7 -4
  70. package/dist/types/build.d.ts +14 -0
  71. package/dist/vue/index.js +312 -23
  72. package/dist/vue/index.js.map +7 -4
  73. package/dist/vue/server.js +307 -18
  74. package/dist/vue/server.js.map +7 -4
  75. package/package.json +30 -9
package/README.md CHANGED
@@ -105,6 +105,141 @@ export const server = new Elysia()
105
105
  2. Route handlers (`handleReactPageRequest`, `handleSveltePageRequest`, …) stream HTML and inject scripts/assets based on that manifest.
106
106
  3. The static plugin serves all compiled files from `/build`.
107
107
 
108
+ ### Installable PWA and offline Sync
109
+
110
+ Enable the web-app shell once in `absolutejs.config.ts`. AbsoluteJS generates a
111
+ single shared browser bootstrap, service worker, and optional manifest, then
112
+ wires them into React, Vue, Svelte, Angular, HTML, HTMX, and island client
113
+ entries. Route and page code does not change.
114
+
115
+ ```ts
116
+ import { defineConfig } from '@absolutejs/absolute';
117
+
118
+ export default defineConfig({
119
+ // Existing framework directories and build settings...
120
+ pwa: {
121
+ manifest: {
122
+ name: 'Acme',
123
+ shortName: 'Acme',
124
+ themeColor: '#111827',
125
+ icons: [
126
+ {
127
+ src: '/icons/app-512.png',
128
+ sizes: '512x512',
129
+ type: 'image/png'
130
+ }
131
+ ]
132
+ },
133
+ serviceWorker: {
134
+ offline: {
135
+ fallback: '/offline.html',
136
+ assetPrefix: '/assets/'
137
+ }
138
+ },
139
+ // With @absolutejs/auth + syncSocket(), this provisions the existing
140
+ // HTTP-only web session and durable IndexedDB transport automatically.
141
+ sync: true
142
+ }
143
+ });
144
+ ```
145
+
146
+ The default outputs are `/sw.js`, `/manifest.webmanifest`, and the internal
147
+ shared bootstrap at `/__absolute/pwa/bootstrap.js`. Put referenced icons and the
148
+ offline fallback in `publicDirectory`. The worker uses Background Sync when the
149
+ browser offers it, while online/focus/visibility resume remains the correctness
150
+ path. Native Capacitor clients continue to use their Bearer and SQLite
151
+ transport; no web cookie or token is copied into the worker.
152
+
153
+ `@absolutejs/pwa/client` also exposes `onPwaSyncResult()` and
154
+ `getLastPwaSyncResult()` (plus the `absolute:pwa-sync-result` DOM event) for
155
+ application-owned diagnostics. Results contain only success, duration, trigger,
156
+ and aggregate counts—never credentials, namespaces, endpoints, arguments, or
157
+ rows. Account changes are re-resolved before focus/online/visible Sync and the
158
+ old worker run is aborted and cleared before the new namespace can run.
159
+
160
+ AbsoluteJS also generates one local-storage migration bundle for web and native
161
+ from the app plus installed Sync packs. Routes stay unchanged. A package that
162
+ owns persisted data declares its JSON-safe evolution in `package.json`:
163
+
164
+ ```json
165
+ {
166
+ "absolutejs": {
167
+ "sync": {
168
+ "localSchema": {
169
+ "version": 2,
170
+ "migrations": [
171
+ {
172
+ "toVersion": 2,
173
+ "operations": [
174
+ {
175
+ "type": "set-default",
176
+ "collection": "tasks",
177
+ "field": "completed",
178
+ "value": false
179
+ }
180
+ ]
181
+ }
182
+ ]
183
+ }
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ Absolute derives stable component IDs from package names, keeps independent
190
+ version ledgers, validates migration gaps during build/doctor, and applies the
191
+ same transaction atomically in IndexedDB or Capacitor SQLite before Sync starts.
192
+ The same `localSchema` object can declare `localData` rules for sensitivity,
193
+ encryption, memory-only fallback, whole-cache retention, eviction priority, and
194
+ per-principal quota. Absolute mobile stores record payloads as AES-256-GCM
195
+ ciphertext using a random key held by Keychain/Keystore; native background Sync
196
+ uses the identical authenticated format. Browsers without an audited key
197
+ provider either keep a declared fallback in memory only or fail closed. Pending
198
+ mutations are never evicted to satisfy quota.
199
+
200
+ App updates are consent-driven: `onUpdateAvailable()` latches a waiting worker
201
+ for late UI subscribers, `checkForUpdate()` performs a passive check, and
202
+ `applyUpdate()` activates and reloads only after the user accepts. AbsoluteJS
203
+ does not silently replace a running application session.
204
+
205
+ ### Native device capabilities
206
+
207
+ Application code uses one provider-neutral API in web pages and Capacitor apps:
208
+
209
+ ```ts
210
+ import { camera, clipboard, haptics, photos, share } from '@absolutejs/devices';
211
+
212
+ await clipboard.writeText('Copied everywhere');
213
+ await share.share({ text: 'Shared everywhere', url: 'https://absolutejs.com' });
214
+ await haptics.impact('light');
215
+ const permission = await camera.requestPermission();
216
+ if (permission.state === 'granted') {
217
+ const capture = await camera.takePhoto();
218
+ image.src = capture.webPath;
219
+ }
220
+ const chosen = await photos.pick({ limit: 1 });
221
+ ```
222
+
223
+ `absolute mobile init` and `absolute mobile sync` discover these named value
224
+ imports, read the tested mappings published by `@absolutejs/devices-capacitor`,
225
+ and offer to install only the exact Capacitor plugins in use. The generated
226
+ shell wires them into the shared device facade; users do not import Capacitor,
227
+ edit Swift/Kotlin, or maintain native bootstrap code. Type-only imports and test
228
+ sources do not provision plugins. `absolute mobile doctor release` rejects a
229
+ missing or mismatched plugin before release.
230
+
231
+ Camera capture requires an explicit `camera.requestPermission()` call from an
232
+ intentional user action. `photos.pick()` uses the item-scoped system picker
233
+ without requesting broad library access. AbsoluteJS generates the required iOS
234
+ usage descriptions from the same audited capability metadata; this first slice
235
+ does not expose EXIF metadata or save captures into the gallery, and Android does
236
+ not receive unnecessary camera/storage permissions.
237
+
238
+ Clipboard and Share use browser standards on the web and fail with normalized
239
+ errors when unavailable. Haptics uses vibration where supported and otherwise
240
+ safely becomes a no-op, because tactile feedback must never be required to
241
+ complete an action.
242
+
108
243
  ### Immutable production images
109
244
 
110
245
  Build production assets and the server bundle while constructing the image,
@@ -9191,6 +9191,20 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
9191
9191
  return "webp";
9192
9192
  }
9193
9193
  return "jpeg";
9194
+ }, sniffImageMime = (buffer) => {
9195
+ if (buffer.length < 12)
9196
+ return null;
9197
+ if (buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78)
9198
+ return "image/png";
9199
+ if (buffer[0] === 255 && buffer[1] === 216)
9200
+ return "image/jpeg";
9201
+ if (buffer[0] === 71 && buffer[1] === 73 && buffer[2] === 70)
9202
+ return "image/gif";
9203
+ if (buffer.toString("ascii", 0, 4) === "RIFF" && buffer.toString("ascii", 8, 12) === "WEBP")
9204
+ return "image/webp";
9205
+ if (buffer.toString("ascii", 4, 12) === "ftypavif")
9206
+ return "image/avif";
9207
+ return null;
9194
9208
  }, AVIF_QUALITY_OFFSET = 20, AVIF_EFFORT = 3, PNG_COMPRESSION_LEVEL = 9, optimizeWithBunImage = async (buffer, width, quality, format) => {
9195
9209
  const pipeline = new Bun.Image(buffer).resize(width, undefined, {
9196
9210
  withoutEnlargement: true
@@ -10361,5 +10375,5 @@ export {
10361
10375
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
10362
10376
  };
10363
10377
 
10364
- //# debugId=7F459B45B76DA26564756E2164756E21
10378
+ //# debugId=0318D343B2F494ED64756E2164756E21
10365
10379
  //# sourceMappingURL=browser.js.map